content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Python - 3.6.0 def tickets(people): moneys = {k: 0 for k in [25, 50, 100]} for cost in people: if cost == 50: if moneys[25] < 1: return 'NO' moneys[25] -= 1 elif cost == 100: if moneys[50] >= 1: if moneys[25] < 1: ...
def tickets(people): moneys = {k: 0 for k in [25, 50, 100]} for cost in people: if cost == 50: if moneys[25] < 1: return 'NO' moneys[25] -= 1 elif cost == 100: if moneys[50] >= 1: if moneys[25] < 1: return 'N...
LANGS = ["hi,my,fa,tk,vi,zh,ka,zh_yue,hy,ru", "hi,my,fa,vi,zh,tk,zh_yue,ru,bxr,cdo", "hi,my,fa,vi,tk,jv,zh_yue,id,zh,am", "is,en,se,et,fi,fr,kv,cs,de,eu", "et,lv,fi,en,se,cs,de,fr,is,hu", "cs,en,de,fr,lv,et,hu,fi,la,eu", "lv,et,cs,hu,de,el,fi,myv,mhr,tr", "hu,el,cs,de,lv,tr,la,et,xmf,myv", "el,hu,tr,la,cs,de,xmf,lv,hy,...
langs = ['hi,my,fa,tk,vi,zh,ka,zh_yue,hy,ru', 'hi,my,fa,vi,zh,tk,zh_yue,ru,bxr,cdo', 'hi,my,fa,vi,tk,jv,zh_yue,id,zh,am', 'is,en,se,et,fi,fr,kv,cs,de,eu', 'et,lv,fi,en,se,cs,de,fr,is,hu', 'cs,en,de,fr,lv,et,hu,fi,la,eu', 'lv,et,cs,hu,de,el,fi,myv,mhr,tr', 'hu,el,cs,de,lv,tr,la,et,xmf,myv', 'el,hu,tr,la,cs,de,xmf,lv,hy,...
a = [-11, -2, -4, -10, -9, 4, -5, -18, -16, 5, -6, -19, 0, -7, 11, -17, 11, 9, -7, -11, 19, -16, -11, -4, 19, -6, -6, -15, 1, 11, -1, -16, 12, 0, -15, -13, 11, -19, -15, -18, -20, 7, -8, 17, -4, 16, 6, -5, -3, -8, 17, -2, 2, 1, -2, 19, -6, 13, -7, -8, 9, -13, 4, -19, -4, 20, 20, -10, 9, 13, 18, 15, -15, -16, 20, 15, 1...
a = [-11, -2, -4, -10, -9, 4, -5, -18, -16, 5, -6, -19, 0, -7, 11, -17, 11, 9, -7, -11, 19, -16, -11, -4, 19, -6, -6, -15, 1, 11, -1, -16, 12, 0, -15, -13, 11, -19, -15, -18, -20, 7, -8, 17, -4, 16, 6, -5, -3, -8, 17, -2, 2, 1, -2, 19, -6, 13, -7, -8, 9, -13, 4, -19, -4, 20, 20, -10, 9, 13, 18, 15, -15, -16, 20, 15, 19...
BASE_STATS = { 1: { "Monster": {"HP": 7, "Attack": 5, "Defence": 5, "Scaling": 0.05}, "Player": {"HP": 5, "Attack": 2, "Defence": 2}, }, 30: { "Monster": {"HP": 15, "Attack": 10, "Defence": 10, "Scaling": 0.1}, "Player": {"HP": 9, "Attack": 6, "Defence": 5}, }, 60: { ...
base_stats = {1: {'Monster': {'HP': 7, 'Attack': 5, 'Defence': 5, 'Scaling': 0.05}, 'Player': {'HP': 5, 'Attack': 2, 'Defence': 2}}, 30: {'Monster': {'HP': 15, 'Attack': 10, 'Defence': 10, 'Scaling': 0.1}, 'Player': {'HP': 9, 'Attack': 6, 'Defence': 5}}, 60: {'Monster': {'HP': 37, 'Attack': 20, 'Defence': 20, 'Scaling'...
# Sum vs XOR # https://www.hackerrank.com/challenges/sum-vs-xor/problem def sumXor(n): if n == 0: return 1 return 1 << f'{n:b}'.count('0') n = int(input().strip()) result = sumXor(n) print (result)
def sum_xor(n): if n == 0: return 1 return 1 << f'{n:b}'.count('0') n = int(input().strip()) result = sum_xor(n) print(result)
################################################################## # Mocked returns for patched functions that access web resources # ################################################################## GET_POLICE_STATION_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID",...
get_police_station_api_mock = {'displayFieldName': 'NAME', 'fieldAliases': {'OBJECTID': 'OBJECTID', 'FACILITYID': 'Facility Identifier', 'NAME': 'Name of Facility', 'OWNER': 'Owner Name', 'OWNTYPE': 'Owner Type', 'SUBTYPEFIELD': 'Subtype Field', 'FEATURECODE': 'Feature Code', 'FULLADDR': 'Full Address', 'AGENCYURL': 'W...
#https://www.hackerrank.com/contests/w35/challenges/lucky-purchase/problem books= {} ; n= int(input()) ; for a0 in range(n): string = input().split() ; books[string[0]] = string[1] ; books = list(books.items()) ; mini = books[0] ; for pair in books: if pair[1].count('7')+pair[1].count('4')!=len(pair[1]):...
books = {} n = int(input()) for a0 in range(n): string = input().split() books[string[0]] = string[1] books = list(books.items()) mini = books[0] for pair in books: if pair[1].count('7') + pair[1].count('4') != len(pair[1]): continue if pair[1].count('7') == pair[1].count('4'): if int(pa...
n = int(input("_gram? - ")) s = input("words: ") grams = [] for i in range(len(s)): op = "" for x in range(i, i + n): if x >= len(s): op = "" break op += s[x] if op != "": grams.append(op) print(op) grams.sort() print(grams)
n = int(input('_gram? - ')) s = input('words: ') grams = [] for i in range(len(s)): op = '' for x in range(i, i + n): if x >= len(s): op = '' break op += s[x] if op != '': grams.append(op) print(op) grams.sort() print(grams)
VERSION = '0.1.6b0' ENV_LIST = ['clustering-v0', 'clustering-v1', 'clustering-v2', 'clustering-v3', 'classification-v0']
version = '0.1.6b0' env_list = ['clustering-v0', 'clustering-v1', 'clustering-v2', 'clustering-v3', 'classification-v0']
# Solution A # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: ListNode) -> ListNode: prev = None cur = head while cur: tmp = cur.next ...
class Solution: def reverse_list(self, head: ListNode) -> ListNode: prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev class Solution: def reverse_list(self, head: ListNode) -> ListN...
a=[2, 3, 5, 7] print(a) a.reverse() print(a)
a = [2, 3, 5, 7] print(a) a.reverse() print(a)
def binarySearch(arr, x, left, right): if right <= left: if right + 1 <= len(arr): return right + 1 return -1 mid = (left + right) // 2 if x <= arr[mid]: return binarySearch(arr, x, left, mid) else: return binarySearch(arr, x, mid + 1, right) def read_input(...
def binary_search(arr, x, left, right): if right <= left: if right + 1 <= len(arr): return right + 1 return -1 mid = (left + right) // 2 if x <= arr[mid]: return binary_search(arr, x, left, mid) else: return binary_search(arr, x, mid + 1, right) def read_inpu...
river = { 'nile': 'egypt', 'huang': 'china', 'mississippi':'USA' } for key, value in river.items(): print("The " + key + "runs through " + value +".") for name in (river.keys()): print(name) for country in (river.values()): print(country)
river = {'nile': 'egypt', 'huang': 'china', 'mississippi': 'USA'} for (key, value) in river.items(): print('The ' + key + 'runs through ' + value + '.') for name in river.keys(): print(name) for country in river.values(): print(country)
# (C) Datadog, Inc. 2022-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) __version__ = '1.1.0'
__version__ = '1.1.0'
def printList(): li=list() for i in range(1,21): li.append(i**2) print(li) printList()
def print_list(): li = list() for i in range(1, 21): li.append(i ** 2) print(li) print_list()
def count_substring(string, sub_string): res = 0 len_sub = len(sub_string) for i in range(len(string) - len_sub + 1): if string[i:i + len_sub] == sub_string: res += 1 i += 1 return res
def count_substring(string, sub_string): res = 0 len_sub = len(sub_string) for i in range(len(string) - len_sub + 1): if string[i:i + len_sub] == sub_string: res += 1 i += 1 return res
_base_="../base-ucmerced-config-simpleaug.py" # this will merge with the parent model=dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth') # epoch related total_iters=5000 checkpoint_config = dict(interval=total_iters) model = dict( pretrained='data/basetrain_chkpts/moco_v2_800ep.pth', backbone=dict( n...
_base_ = '../base-ucmerced-config-simpleaug.py' model = dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth') total_iters = 5000 checkpoint_config = dict(interval=total_iters) model = dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth', backbone=dict(norm_train=True, frozen_stages=4)) optimizer = dict(type='...
def finferensi(berat, pinjam, harga): linguistik = [] derajat = [] for bk, bv in berat.items(): for pk, pv in pinjam.items(): for hk, hv in harga.items(): # rule 1 if bk == 'ringan' and pk == 'sebentar' and hk == 'rendah': lingui...
def finferensi(berat, pinjam, harga): linguistik = [] derajat = [] for (bk, bv) in berat.items(): for (pk, pv) in pinjam.items(): for (hk, hv) in harga.items(): if bk == 'ringan' and pk == 'sebentar' and (hk == 'rendah'): linguistik.append('kecil') ...
# Booknames.py class Booknames: def usfmBookId(self, bookName): books = { 'Genesis': 'GEN', 'Exodus': 'EXO', 'Leviticus': 'LEV', 'Numbers': 'NUM', 'Deuteronomy': 'DEU', 'Joshua': 'JOS', 'Judges': 'JDG', 'Ruth': 'RUT', '1Samuel': '1SA', '2Samuel': '2SA', '1...
class Booknames: def usfm_book_id(self, bookName): books = {'Genesis': 'GEN', 'Exodus': 'EXO', 'Leviticus': 'LEV', 'Numbers': 'NUM', 'Deuteronomy': 'DEU', 'Joshua': 'JOS', 'Judges': 'JDG', 'Ruth': 'RUT', '1Samuel': '1SA', '2Samuel': '2SA', '1Kings': '1KI', '2Kings': '2KI', '1Chronicles': '1CH', '2Chronicle...
# pylint: disable=missing-function-docstring, missing-module-docstring/ a = 4 a += 5.0
a = 4 a += 5.0
# encoding: utf-8 class FastCGIError(Exception): pass # Values for type component of FCGI_Header FCGI_BEGIN_REQUEST = 1 FCGI_ABORT_REQUEST = 2 FCGI_END_REQUEST = 3 FCGI_PARAMS = 4 FCGI_STDIN = 5 FCGI_STDOUT = 6 FCGI_STDERR = 7 FCGI_DATA = 8 FCGI_GET_VALUES = 9 F...
class Fastcgierror(Exception): pass fcgi_begin_request = 1 fcgi_abort_request = 2 fcgi_end_request = 3 fcgi_params = 4 fcgi_stdin = 5 fcgi_stdout = 6 fcgi_stderr = 7 fcgi_data = 8 fcgi_get_values = 9 fcgi_get_values_result = 10 fcgi_unknown_type = 11 type_names = {FCGI_BEGIN_REQUEST: 'fcgi_begin_request', FCGI_ABOR...
match x: case Class( ): pass case Class( foo=1 ): pass case Class( foo=1, bar=2 ): pass case Class( foo=1, bar=2, ): pass
match x: case Class(): pass case Class(foo=1): pass case Class(foo=1, bar=2): pass case Class(foo=1, bar=2): pass
def deep_flatten(in_list): out_list = [] for i in in_list: if type(i) == str: out_list.append(i) elif hasattr(i,'__iter__'): out_list.extend(deep_flatten(i)) else: out_list.append(i) return out_list a = [(1,2),3,4,5,[4,4,5,6]] a = [['cats', ['car...
def deep_flatten(in_list): out_list = [] for i in in_list: if type(i) == str: out_list.append(i) elif hasattr(i, '__iter__'): out_list.extend(deep_flatten(i)) else: out_list.append(i) return out_list a = [(1, 2), 3, 4, 5, [4, 4, 5, 6]] a = [['cats'...
# Default constants DF_ADSB = 17 LAT_REF = 44.807047 # TODO put reference values LONG_REF = -0.605526 NZ=15 # Default variables fe=20*10**6; Te=1/fe Ds=1*10**6; Ts=1/Ds Fse=int(round(Ts/Te)) Ns=112 # Number of points of the signal : 1000, 112 Nfft=512 # Number of points of FFT # Default TEB parameters SIG_NB_ERROR...
df_adsb = 17 lat_ref = 44.807047 long_ref = -0.605526 nz = 15 fe = 20 * 10 ** 6 te = 1 / fe ds = 1 * 10 ** 6 ts = 1 / Ds fse = int(round(Ts / Te)) ns = 112 nfft = 512 sig_nb_error = 100 max_count = 500 nteb = 11 tp = 8 * 10 ** (-6) fpe = int(round(Tp / Te)) def init_ref(lat_ref, long_ref): lat_ref = lat_ref lo...
# names of hurricanes names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', 'Gilbert', 'Hugo', 'Andrew', 'Mitch', 'Isabel', 'Ivan', 'Emily', 'Katrina', ...
names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', 'Gilbert', 'Hugo', 'Andrew', 'Mitch', 'Isabel', 'Ivan', 'Emily', 'Katrina', 'Rita', 'Wilma', 'Dean'...
alien_0 = {'color': 'green', 'points': 5} alien_1 = {'color': 'yellow', 'points': 10} alien_2 = {'color': 'red', 'points': 15} aliens = [alien_0, alien_1, alien_2] for alien in aliens: print(alien) print('...') aliens = [] for alien_number in range(30): new_alien = {'color': 'green', 'points': 5, 'speed': '...
alien_0 = {'color': 'green', 'points': 5} alien_1 = {'color': 'yellow', 'points': 10} alien_2 = {'color': 'red', 'points': 15} aliens = [alien_0, alien_1, alien_2] for alien in aliens: print(alien) print('...') aliens = [] for alien_number in range(30): new_alien = {'color': 'green', 'points': 5, 'speed': 'slow...
#!/usr/bin/env python3 with open("day-1/data") as f: expenses = f.readlines() founditems = [] def accounting(i): for j in expenses: j = int(j.strip('\n')) for x in expenses: x = int(x.strip('\n')) if i + j + x == 2020 and i * j * x not in founditems: pri...
with open('day-1/data') as f: expenses = f.readlines() founditems = [] def accounting(i): for j in expenses: j = int(j.strip('\n')) for x in expenses: x = int(x.strip('\n')) if i + j + x == 2020 and i * j * x not in founditems: print('3-sum: ' + str(i * j...
class Command(object): CONTINUE = 1 SKIP_REMAINING = 2 def __init__(self, args=None, explicit=False): self.explicit = explicit self._args = args or [] @property def args(self): return self._args def add_argument(self, arg): self._args.append(arg) def cmdli...
class Command(object): continue = 1 skip_remaining = 2 def __init__(self, args=None, explicit=False): self.explicit = explicit self._args = args or [] @property def args(self): return self._args def add_argument(self, arg): self._args.append(arg) def cmdli...
Desc = cellDescClass("DFFNSRX4") Desc.properties["cell_footprint"] = "dffnsr" Desc.properties["area"] = "116.424000" Desc.properties["cell_leakage_power"] = "3723.759540" Desc.pinOrder = ['CKN', 'D', 'IQ', 'IQN', 'Q', 'QN', 'RN', 'SN', 'next'] Desc.add_arc("CKN","D","setup_falling") Desc.add_arc("CKN","D","hold_falling...
desc = cell_desc_class('DFFNSRX4') Desc.properties['cell_footprint'] = 'dffnsr' Desc.properties['area'] = '116.424000' Desc.properties['cell_leakage_power'] = '3723.759540' Desc.pinOrder = ['CKN', 'D', 'IQ', 'IQN', 'Q', 'QN', 'RN', 'SN', 'next'] Desc.add_arc('CKN', 'D', 'setup_falling') Desc.add_arc('CKN', 'D', 'hold_f...
def _is_socket(path): # -S if not path: return False if hasattr(path, '_mode'): return stat.S_ISSOCK(path._mode) if hasattr(path, 'fileno') and os.stat in os.supports_fd: path = path.fileno() elif hasattr(path, 'name'): path = path.name return stat.S...
def _is_socket(path): if not path: return False if hasattr(path, '_mode'): return stat.S_ISSOCK(path._mode) if hasattr(path, 'fileno') and os.stat in os.supports_fd: path = path.fileno() elif hasattr(path, 'name'): path = path.name return stat.S_ISSOCK(os.stat(path).s...
num1 = 10 num2 = int(input()) def add_sum(): sum = num1+num2 print(sum) add_sum()
num1 = 10 num2 = int(input()) def add_sum(): sum = num1 + num2 print(sum) add_sum()
class ConsoleCommandFailed(Exception): pass class ConvergeFailed(Exception): pass
class Consolecommandfailed(Exception): pass class Convergefailed(Exception): pass
class Overflow( Enum, CascadeProperty, ): Visible = "visible" # initial Hidden = "hidden" Scroll = "scroll" Auto = "auto"
class Overflow(Enum, CascadeProperty): visible = 'visible' hidden = 'hidden' scroll = 'scroll' auto = 'auto'
def Y_S(a): if a == 0: return 0 else: ys = (a//30) * 10 + 10 return ys def M_S(b): if b == 0: return 0 else: ms = (b//60) * 15 + 15 return ms N=int(input()) ms_add = 0 ys_add = 0 arr = list(map(int,input().split())) for i in arr: Y = Y_S(i) M = M_S...
def y_s(a): if a == 0: return 0 else: ys = a // 30 * 10 + 10 return ys def m_s(b): if b == 0: return 0 else: ms = b // 60 * 15 + 15 return ms n = int(input()) ms_add = 0 ys_add = 0 arr = list(map(int, input().split())) for i in arr: y = y_s(i) m =...
animals = ['bear', 'python3.8', 'peacock', 'kangaroo', 'whale', 'platypus'] print("The animal at 1: ", animals[1]) # Python3.8 print("The third animal: ", animals[2]) # Peacock print("The first animal: ", animals[0]) # bear print("The animal at 3: ", animals[3]) # kangaroo print("The fifth (5th) animal: ", animals...
animals = ['bear', 'python3.8', 'peacock', 'kangaroo', 'whale', 'platypus'] print('The animal at 1: ', animals[1]) print('The third animal: ', animals[2]) print('The first animal: ', animals[0]) print('The animal at 3: ', animals[3]) print('The fifth (5th) animal: ', animals[4]) print('The animal at 2: ', animals[2]) p...
class User: def __init__(self, reddit_id, username, karma, relevant_comments, relevant_posts): self.reddit_id = reddit_id self.username = username self.karma = karma self.score = 0 self.relevant_comments = relevant_comments self.relevant_posts = relevant_posts
class User: def __init__(self, reddit_id, username, karma, relevant_comments, relevant_posts): self.reddit_id = reddit_id self.username = username self.karma = karma self.score = 0 self.relevant_comments = relevant_comments self.relevant_posts = relevant_posts
# Mathematics > Algebra > Little Gaurav and Sequence # Help Gaurav in calculating last digit of a sequence. # # https://www.hackerrank.com/challenges/little-gaurav-and-sequence/problem # def S_brutforce(n): s = 0 i = 0 while 2 ** i <= n: for j in range(0, n + 1): s += 2 ** (2 ** i + 2 ...
def s_brutforce(n): s = 0 i = 0 while 2 ** i <= n: for j in range(0, n + 1): s += 2 ** (2 ** i + 2 * j) i += 1 return s def s(n): i = n k = 0 while i != 0: i //= 2 k += 1 if k == 1: s1 = 2 else: s1 = [6, 2, 8, 4, 0][(k - 2)...
# Solution to Mega Contest 1 Problem: Maximum Sum for testcase in range(int(input())): n, k = map(int, input().split()) array_a = list(map(int, input().split())) array_b = list(map(int, input().split())) if k>0: array_a.sort() array_b.sort() # max_sum = sum(array_a[k:]+array_b[n...
for testcase in range(int(input())): (n, k) = map(int, input().split()) array_a = list(map(int, input().split())) array_b = list(map(int, input().split())) if k > 0: array_a.sort() array_b.sort() values = array_a[k:] for val in range(k): values.append(max(arra...
N = int(input()) V = list(map(int, input().split())) C = list(map(int, input().split())) result = 0 for i in range(N): if V[i] > C[i]: result += V[i] - C[i] print(result)
n = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) result = 0 for i in range(N): if V[i] > C[i]: result += V[i] - C[i] print(result)
class Hair(object): def __init__(self, radius): self.radius = radius self.phi = random(TAU) self.slow = random(1.15, 1.2) self.theta = asin(random(-self.radius, self.radius) / self.radius) self.z = self.radius * sin(self.theta) def render(self): oFF = (noise(mill...
class Hair(object): def __init__(self, radius): self.radius = radius self.phi = random(TAU) self.slow = random(1.15, 1.2) self.theta = asin(random(-self.radius, self.radius) / self.radius) self.z = self.radius * sin(self.theta) def render(self): o_ff = (noise(mi...
with open("input.txt") as f: numbers = list(map(int, f.readline().split())) def parse_tree_metadata(tree): num_nodes = tree[0] num_metadata = tree[1] leafs = tree[2:] total = 0 for i in range(num_nodes): leafs, sum_metadata = parse_tree_metadata(leafs) total += sum_metadata ...
with open('input.txt') as f: numbers = list(map(int, f.readline().split())) def parse_tree_metadata(tree): num_nodes = tree[0] num_metadata = tree[1] leafs = tree[2:] total = 0 for i in range(num_nodes): (leafs, sum_metadata) = parse_tree_metadata(leafs) total += sum_metadata ...
class Dough: def __init__(self, flour_type, baking_technique, weight): self.__flour_type = flour_type self.__baking_technique = baking_technique self.__weight = weight @property def flour_type(self): return self.__flour_type @flour_type.setter def flour_type(self, ...
class Dough: def __init__(self, flour_type, baking_technique, weight): self.__flour_type = flour_type self.__baking_technique = baking_technique self.__weight = weight @property def flour_type(self): return self.__flour_type @flour_type.setter def flour_type(self, ...
a, b = 10, 5 print("Add: a+b = ", a+b) print("Sub: a-b = ", a-b) print("Mul: a*b = ", a*b) print("Div: a/b = ", a/b) print("Mod: a%b = ", a%b) print("Exp: a**b = ", a**b) print("Floored Div: a//b = ", a//b)
(a, b) = (10, 5) print('Add: a+b = ', a + b) print('Sub: a-b = ', a - b) print('Mul: a*b = ', a * b) print('Div: a/b = ', a / b) print('Mod: a%b = ', a % b) print('Exp: a**b = ', a ** b) print('Floored Div: a//b = ', a // b)
''' 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,...
""" 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3...
# Definition for a undirected graph node # class UndirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] class Solution: # @param node, a undirected graph node # @return a undirected graph node def cloneGraph(self, node): graph = {} visited =...
class Solution: def clone_graph(self, node): graph = {} visited = set() def dfs(node, visited, graph): if not node or node.label in visited: return visited |= {node.label} if node.label not in graph: graph[node.label] = un...
#Assignment 1 print("welcome to the Controlroom of Hyderabad ATC") Altitude = 1500 if Altitude <= 1000: print('youre safe to land') elif Altitude <=5000: print('Please Bring Down Altitude to 1000') else : print('it is Danger now to land, please Turn around') #Assignment2 for num in range(0,200): if num > 1: ...
print('welcome to the Controlroom of Hyderabad ATC') altitude = 1500 if Altitude <= 1000: print('youre safe to land') elif Altitude <= 5000: print('Please Bring Down Altitude to 1000') else: print('it is Danger now to land, please Turn around') for num in range(0, 200): if num > 1: for i in rang...
s="2 3 4 5 66 74 33 2 3" s=s.split() s = [int(x) for x in s] s1=[] for i in s: if i not in s1: s1.append(i) s1 = sorted(s1) print(s1) for i in s1: print(i,s.count(i))
s = '2 3 4 5 66 74 33 2 3' s = s.split() s = [int(x) for x in s] s1 = [] for i in s: if i not in s1: s1.append(i) s1 = sorted(s1) print(s1) for i in s1: print(i, s.count(i))
print('This is the dummy Controller') def dummy_example(): print('This is a function in the dummy Controller') if __name__ == '__main__': print('This is printed only from __main__') dummy_example()
print('This is the dummy Controller') def dummy_example(): print('This is a function in the dummy Controller') if __name__ == '__main__': print('This is printed only from __main__') dummy_example()
# Linked list operations in Python # Create a node class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None # Insert at the beginning def insertAtBeginning(self, new_data): new_node =...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def insert_at_beginning(self, new_data): new_node = node(new_data) new_node.next = self.head self.head = new_node def insert...
# -*- coding: utf-8 -*- class BaseCompressor(object): def __init__(self, options): self._options = options def compress(self, value): raise NotImplementedError def decompress(self, value): raise NotImplementedError
class Basecompressor(object): def __init__(self, options): self._options = options def compress(self, value): raise NotImplementedError def decompress(self, value): raise NotImplementedError
n = 10 a = [] s = [[0] * n for i in range(n)] s2 = [[0] * n for i in range(n)] for i in range(n): a.append(list(map(int, input().split()))) s[0][0] = a[0][0] s2[0][0] = a[0][0] for j in range(1, n): s[0][j] = s[0][j - 1] + a[0][j] for i in range(1, n): s[i][0] = s[i - 1][0] + a[i][0] for i in range(n):...
n = 10 a = [] s = [[0] * n for i in range(n)] s2 = [[0] * n for i in range(n)] for i in range(n): a.append(list(map(int, input().split()))) s[0][0] = a[0][0] s2[0][0] = a[0][0] for j in range(1, n): s[0][j] = s[0][j - 1] + a[0][j] for i in range(1, n): s[i][0] = s[i - 1][0] + a[i][0] for i in range(n): ...
#FUNCTION TEXT def AddCharA(char,lista,z): x=0 for y in lista[0]: if y=="|": break else: x+=1 x+=1 if x==len(lista[0]): lista[0]=lista[0][:len(lista[0])-1]+char+"|" elif x==1: lista[0]=char+lista[0][:] else: lista[0]=lista[0][:x-1]+char+lista[0][x-1:] print(char) print(lista) z[0].configure(t...
def add_char_a(char, lista, z): x = 0 for y in lista[0]: if y == '|': break else: x += 1 x += 1 if x == len(lista[0]): lista[0] = lista[0][:len(lista[0]) - 1] + char + '|' elif x == 1: lista[0] = char + lista[0][:] else: lista[0] = ...
_base_ = [ '../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py', ] # load model pretrained on imagenet model = dict( backbone=dict( init_cfg=dict( type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassifi...
_base_ = ['../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py'] model = dict(backbone=dict(init_cfg=dict(type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth', prefix='backbone')), head=dict(n...
def quick_sort(arr,low,high): if len(arr) > 1: if low < high: position = partition(arr,low,high) quick_sort(arr,low,position -1) quick_sort(arr,position +1,high) return arr return arr def partition(arr,low,high): position = low for i in range(low,high...
def quick_sort(arr, low, high): if len(arr) > 1: if low < high: position = partition(arr, low, high) quick_sort(arr, low, position - 1) quick_sort(arr, position + 1, high) return arr return arr def partition(arr, low, high): position = low for i in ra...
name = 'snape' print(name+name+str(7)) age = 11 wizard_age_multiplier = 56 final_age = age * wizard_age_multiplier print(f'You are {age} which means you are {final_age} in wizard years') print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years')
name = 'snape' print(name + name + str(7)) age = 11 wizard_age_multiplier = 56 final_age = age * wizard_age_multiplier print(f'You are {age} which means you are {final_age} in wizard years') print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years')
# Python program to find the factorial of a number num = int(input("Enter a number: ")) factorial = 1 if num < 0: print("factorial does not exist for negative numbers") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1, num + 1): factorial = factorial*i print("The factor...
num = int(input('Enter a number: ')) factorial = 1 if num < 0: print('factorial does not exist for negative numbers') elif num == 0: print('The factorial of 0 is 1') else: for i in range(1, num + 1): factorial = factorial * i print('The factorial of', num, 'is', factorial)
class InstagramException(Exception): StatusCode = -1 def __init__(self, message="", code=500): super().__init__(f'{message}, Code:{code}') @staticmethod def default(response_text, status_code): StatusCode = status_code return InstagramException( 'Response code i...
class Instagramexception(Exception): status_code = -1 def __init__(self, message='', code=500): super().__init__(f'{message}, Code:{code}') @staticmethod def default(response_text, status_code): status_code = status_code return instagram_exception('Response code is {status_code...
class Spawn: def __init__ (self, width, height): self.width, self.height, self.spacing = self.fill = width, height, 100, d3.scale.category20 () self.svg = d3.select ('body' ) .append ('svg' ) .attr ('width', self.width ) .attr ('height', self.height ) .on ('mousemove', self.mousemove ) .on ('mo...
class Spawn: def __init__(self, width, height): (self.width, self.height, self.spacing) = self.fill = (width, height, 100, d3.scale.category20()) self.svg = d3.select('body').append('svg').attr('width', self.width).attr('height', self.height).on('mousemove', self.mousemove).on('mousedown', self.mou...
class Queue(object): def __init__(self): super(Queue, self).__init__() self.rear = -1 self.front = -1 self.MAX = 10 self.queue = [None]*self.MAX def enqueue(self,element): if(self.rear == self.MAX - 1): print("Error- queue full") else: self.rear += 1 self.queue[self.rear] = element if self.r...
class Queue(object): def __init__(self): super(Queue, self).__init__() self.rear = -1 self.front = -1 self.MAX = 10 self.queue = [None] * self.MAX def enqueue(self, element): if self.rear == self.MAX - 1: print('Error- queue full') else: ...
n=int(input()) arr=[[input(),float(input())] for _ in range(0,n)] arr.sort(key=lambda x: (x[1],x[0])) names = [i[0] for i in arr] marks = [i[1] for i in arr] min_val=min(marks) while marks[0]==min_val: marks.remove(marks[0]) names.remove(names[0]) for x in range(0,len(marks)): if marks[x]==min(marks): ...
n = int(input()) arr = [[input(), float(input())] for _ in range(0, n)] arr.sort(key=lambda x: (x[1], x[0])) names = [i[0] for i in arr] marks = [i[1] for i in arr] min_val = min(marks) while marks[0] == min_val: marks.remove(marks[0]) names.remove(names[0]) for x in range(0, len(marks)): if marks[x] == min...
sse3=1 debug=0 strict=1 osx_min_ver = '10.7' compiler = 'clang' osx_archs = 'x86_64' cxxstd = 'c++14' ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs' linkflags = '-stdlib=libc++' package_arch = 'x86_64' #disable_local = 'libevent re2' sign_disable = 1 sign_keychain = 'login.keychain' #sign_keychain = 'develope...
sse3 = 1 debug = 0 strict = 1 osx_min_ver = '10.7' compiler = 'clang' osx_archs = 'x86_64' cxxstd = 'c++14' ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs' linkflags = '-stdlib=libc++' package_arch = 'x86_64' sign_disable = 1 sign_keychain = 'login.keychain' sign_id_app = 'Developer ID Application: Jane Doe (C123...
#define the main() function def main(): i = 0 #declare interger i x = 119.0 #declare float x for i in range(120): #loop i from 0 to 119, inclusive if((i%2)==0): #if i is even x += 3. #add 3 to x else: #if not true x -= 5. #substract 5 from x s = "%3.2e" % x #make a string containing x with sci...
def main(): i = 0 x = 119.0 for i in range(120): if i % 2 == 0: x += 3.0 else: x -= 5.0 s = '%3.2e' % x print(s) if __name__ == '__main__': main()
# 7. Write a program that takes any two lists L and M of the same size and adds their elements # together to form a new list N whose elements are sums of the corresponding elements in L # and M. For instance, if L=[3,1,4] and M=[1,5,9], then N should equal [4,6,13]. L = input('Enter a list of numbers: ').split() M = i...
l = input('Enter a list of numbers: ').split() m = input('Enter another list of numbers: ').split() n = [] for i in range(len(L)): N.append(int(L[i]) + int(M[i])) print(N)
class Solution: def canConstruct(self, s: str, k: int) -> bool: if len(s) < k: return False if len(s) == k: return True letters = collections.Counter(s) mid = [] for key, val in letters.items(): if val % 2 == 1: mid.append...
class Solution: def can_construct(self, s: str, k: int) -> bool: if len(s) < k: return False if len(s) == k: return True letters = collections.Counter(s) mid = [] for (key, val) in letters.items(): if val % 2 == 1: mid.appe...
class NoChefException(Exception): pass class Chef(object): def make(self, **params): print("I am a chef") class Boost(Chef): def make(self, food=None, **keywords): print("I can cook %s for robots" % food) class Fry(Chef): def make(self, food=None): print("I can fry " + food...
class Nochefexception(Exception): pass class Chef(object): def make(self, **params): print('I am a chef') class Boost(Chef): def make(self, food=None, **keywords): print('I can cook %s for robots' % food) class Fry(Chef): def make(self, food=None): print('I can fry ' + food...
class Range: def __init__(self, left, right, left_inclusive=True, right_inclusive=False): self.left = left self.right = right self.left_inclusive = left_inclusive self.right_inclusive = right_inclusive def __contains__(self, item): if self.left_inclusive and self.left ...
class Range: def __init__(self, left, right, left_inclusive=True, right_inclusive=False): self.left = left self.right = right self.left_inclusive = left_inclusive self.right_inclusive = right_inclusive def __contains__(self, item): if self.left_inclusive and self.left =...
alphabet_dict = { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24,...
alphabet_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26, '1': 27, '2': 28, '3': 29, '4': 30, '5': 31, '6': 32, '7': 33, '8': 34, '9': 3...
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py' model = dict( pretrained='open-mmlab://resnext101_32x4d', backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style...
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py' model = dict(pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch')) optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)...
#!/usr/bin/env python # -*- coding: utf-8 -*- #Reference https://ebisuke33.hatenablog.com/entry/abc197c def main(): N = int(input()) array = list(map(int,input().split())) ans = 10**9+7 if N==1: print(array[0]) exit() for i in range(2**(N-1)): base = 0 or_value = ar...
def main(): n = int(input()) array = list(map(int, input().split())) ans = 10 ** 9 + 7 if N == 1: print(array[0]) exit() for i in range(2 ** (N - 1)): base = 0 or_value = array[0] for j in range(1, N): if i >> j - 1 & 1: base ^= or_...
print("(1, 2, 3) < (1, 2, 4) :", (1, 2, 3) < (1, 2, 4)) print("[1, 2, 3] < [1, 2, 4] :", [1, 2, 3] < [1, 2, 4]) print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python') print("(1, 2, 3, 4) < (1, 2, 4) :",...
print('(1, 2, 3) < (1, 2, 4) :', (1, 2, 3) < (1, 2, 4)) print('[1, 2, 3] < [1, 2, 4] :', [1, 2, 3] < [1, 2, 4]) print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python') print('(1, 2, 3, 4) < (1, 2, 4) :',...
#Spiral Traversal def spiralTraverse(array): # Write your code here. result=[] startRow=0 startCol=0 endRow=len(array)-1 endCol=len(array[0])-1 while startRow<=endRow and startCol<=endCol: for col in range(startCol, endCol+1): print(col) result.append(array[startRow][col]) for row in range(startRow...
def spiral_traverse(array): result = [] start_row = 0 start_col = 0 end_row = len(array) - 1 end_col = len(array[0]) - 1 while startRow <= endRow and startCol <= endCol: for col in range(startCol, endCol + 1): print(col) result.append(array[startRow][col]) ...
# TODO Find a way to actually configure these :D BASE_URL = 'http://localhost:8000/' MAILCATCHER_URL = 'http://localhost:1080/'
base_url = 'http://localhost:8000/' mailcatcher_url = 'http://localhost:1080/'
''' @Author: Yingshi Chen @Date: 2020-03-20 17:39:56 @ # Description: '''
""" @Author: Yingshi Chen @Date: 2020-03-20 17:39:56 @ # Description: """
#Ricky Deegan #check if one number divides another p = 8 m = 2 if (p % m) == 0: print (p, "divided by", m, "leaves a remainder of zero") print ("I'll be run too if the condition is true") else: print (p, "divided by", m, "does not leave leaves a remainder of zero") print ("I'll be run too if the condi...
p = 8 m = 2 if p % m == 0: print(p, 'divided by', m, 'leaves a remainder of zero') print("I'll be run too if the condition is true") else: print(p, 'divided by', m, 'does not leave leaves a remainder of zero') print("I'll be run too if the condition is false") print("I'll run no matter what")
stim_positions = { 'double' : [ [( .4584, .2575, .2038), # 3d location ( .4612, .2690,-.0283)], [( .4601, .1549, .1937), ( .4614, .1660,-.0358)] ], 'double_20070301' : [ [( .4538, .2740, .1994), # top highy ( .4565,...
stim_positions = {'double': [[(0.4584, 0.2575, 0.2038), (0.4612, 0.269, -0.0283)], [(0.4601, 0.1549, 0.1937), (0.4614, 0.166, -0.0358)]], 'double_20070301': [[(0.4538, 0.274, 0.1994), (0.4565, 0.2939, -0.0531)], [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)]], 'half': [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166,...
def test_NEQSys(): pass def test_SimpleNEQSys(): pass
def test_neq_sys(): pass def test__simple_neq_sys(): pass
def str_or_list_to_list(path_or_paths): if isinstance(path_or_paths, str): # parameter is a string, turn it into a list of strings paths = [path_or_paths] else: # parameter is a list paths = path_or_paths return paths
def str_or_list_to_list(path_or_paths): if isinstance(path_or_paths, str): paths = [path_or_paths] else: paths = path_or_paths return paths
def f(a, b): return a + b def g(): i = 0 while i < 10: a = 'foo' i += 1 def h(): [x for x in range(10)]
def f(a, b): return a + b def g(): i = 0 while i < 10: a = 'foo' i += 1 def h(): [x for x in range(10)]
if __name__ == "__main__": count = 0 resolution = 10000 iota = 1 / resolution a = 0 b = 0 while a <= 1: b = 0 while b <= 1: if (pow(a, 2) + pow(b, 2)) <= (2 * min(a, b)): count = count + 1 b += iota a += iota print(f"Count is: {...
if __name__ == '__main__': count = 0 resolution = 10000 iota = 1 / resolution a = 0 b = 0 while a <= 1: b = 0 while b <= 1: if pow(a, 2) + pow(b, 2) <= 2 * min(a, b): count = count + 1 b += iota a += iota print(f'Count is: {coun...
class GradScaler(object): def __init__( self, init_scale, growth_factor, backoff_factor, growth_interval, enabled ): self.scale_factor = init_scale self.growth_factor = growth_factor self.backoff_factor = backoff_factor self.growth_interval = growth_interval self....
class Gradscaler(object): def __init__(self, init_scale, growth_factor, backoff_factor, growth_interval, enabled): self.scale_factor = init_scale self.growth_factor = growth_factor self.backoff_factor = backoff_factor self.growth_interval = growth_interval self.enabled = ena...
# -*- coding: utf-8 -*- __all__ = [] __version__ = '0.0' FONTS = [ { "name": "Roboto", "fn_regular": fonts_path + 'Roboto-Regular.ttf', "fn_bold": fonts_path + 'Roboto-Medium.ttf', "fn_italic": fonts_path + 'Roboto-Italic.ttf', "fn_bolditalic": fonts_path + 'Roboto-MediumIt...
__all__ = [] __version__ = '0.0' fonts = [{'name': 'Roboto', 'fn_regular': fonts_path + 'Roboto-Regular.ttf', 'fn_bold': fonts_path + 'Roboto-Medium.ttf', 'fn_italic': fonts_path + 'Roboto-Italic.ttf', 'fn_bolditalic': fonts_path + 'Roboto-MediumItalic.ttf'}, {'name': 'RobotoLight', 'fn_regular': fonts_path + 'Roboto-T...
# TODO(dragondriver): add more default configs to here class DefaultConfigs: MaxSearchResultSize = 100 * 1024 * 1024 WaitTimeDurationWhenLoad = 0.5 # in seconds
class Defaultconfigs: max_search_result_size = 100 * 1024 * 1024 wait_time_duration_when_load = 0.5
def f(): n = 0 while True: n = yield n + 1 print(n) g = f() try: g.send(1) print("FAIL") raise SystemExit except TypeError: print("caught") print(g.send(None)) print(g.send(100)) print(g.send(200)) def f2(): print("entering") for i in range(3): print(i) ...
def f(): n = 0 while True: n = (yield (n + 1)) print(n) g = f() try: g.send(1) print('FAIL') raise SystemExit except TypeError: print('caught') print(g.send(None)) print(g.send(100)) print(g.send(200)) def f2(): print('entering') for i in range(3): print(i) ...
# What substring do hish and fish have in common ? # How about hish and vista ? # Thats what we'll calculate # grid cell = [] word_a = 'fosh' word_b = 'fort' l_c_s = 0 # initiating with 0 values for a in range(0, len(word_a)): cell.append(list(0 for b in word_b)) for i in range(0, len(word_a)): for j i...
cell = [] word_a = 'fosh' word_b = 'fort' l_c_s = 0 for a in range(0, len(word_a)): cell.append(list((0 for b in word_b))) for i in range(0, len(word_a)): for j in range(0, len(word_b)): if word_a[i] == word_b[j]: cell[i][j] = cell[i - 1][j - 1] + 1 l_c_s = max(l_c_s, cell[i][j])...
class Group(object): def __init__(self, id=None, name=None, members=None) -> None: self.id = id self.name = name self.members = [] def setId(self, id): self.id = id def getId(self): return self.id def setName(self, name): self.id = name ...
class Group(object): def __init__(self, id=None, name=None, members=None) -> None: self.id = id self.name = name self.members = [] def set_id(self, id): self.id = id def get_id(self): return self.id def set_name(self, name): self.id = name def get...
# CONFIGURATION # -------------------------------------------------------------------------------------------- y_min = 0 # minimum value displayed on y axis y_max = 100 # maximum value displayed on y axis (maximum must be greater (not greater or equal) than minimum) x_m...
y_min = 0 y_max = 100 x_min = 0 x_max = 100 inputs = ['input1', 'input2'] output = 'output' chart_color = '#2E86C1' chart_height = 500 chart_width = 500 num_y_labels = 4 num_x_labels = 4 label_decimals = 0 graph_name = 'User Segmentation' line_offset = 15 font_size = 12 background_color = '#212F3C' y_range = y_max - y_...
f=open('4.1.2_run_all_randomize_wholebrain.sh','w') for i in range(1000): cmd='python 4.1_randomize_wholebrain.py %d'%i f.write(cmd+'\n') f.close()
f = open('4.1.2_run_all_randomize_wholebrain.sh', 'w') for i in range(1000): cmd = 'python 4.1_randomize_wholebrain.py %d' % i f.write(cmd + '\n') f.close()
#Given an interval, the task is to count numbers which have same first and last digits. #For example, 1231 has same first and last digits def same_1andlast(s,e): out=[] for i in range(s,e+1): num=i nos=[] while(num!=0): nos.append(num%10) num /= 10 if(nos[0]==nos[len(nos)-1]): out....
def same_1andlast(s, e): out = [] for i in range(s, e + 1): num = i nos = [] while num != 0: nos.append(num % 10) num /= 10 if nos[0] == nos[len(nos) - 1]: out.append(i) return (out, len(out)) print(same_1andlast(7, 68))
# Problem: # Write a program for converting money from one currency to another. # The following currencies need to be maintained: BGN, USD, EUR, GBP. # Use the following fixed exchange rates: # BGN = 1.79549 USD / 1.95583 EUR / 2.53405 GBP # The input is a conversion amount + Input Currency + Output Currency. # The o...
amount = float(input()) first_currency = input() second_currency = input() result = 0 if first_currency == 'BGN': if second_currency == 'BGN': result = amount * 1 elif second_currency == 'USD': result = amount / 1.79549 elif second_currency == 'EUR': result = amount / 1.95583 eli...
''' Hyper Paramators ''' LENGTH = 9 WALLS = 10 BREAK = 96 INPUT_SHAPE = (LENGTH, LENGTH, 4 + WALLS * 2) OUTPUT_SHAPE = 8 + 2 * (LENGTH - 1) * (LENGTH - 1) # Train epoch for one cycle. EPOCHS = 200 # Training epoch number BATCH_SIZE = 256 FILTER = 256 KERNEL = 3 STRIDE = 1 INITIALIZER = 'he_normal' REGULARIZER = 0.0005 ...
""" Hyper Paramators """ length = 9 walls = 10 break = 96 input_shape = (LENGTH, LENGTH, 4 + WALLS * 2) output_shape = 8 + 2 * (LENGTH - 1) * (LENGTH - 1) epochs = 200 batch_size = 256 filter = 256 kernel = 3 stride = 1 initializer = 'he_normal' regularizer = 0.0005 res_num = 19 simulations = 300 gamma = 1.0 selfmatch ...
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py' model = dict( pretrained='open-mmlab://resnext101_64x4d', backbone=dict( type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, ...
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py' model = dict(pretrained='open-mmlab://resnext101_64x4d', backbone=dict(type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='p...
routers = dict( BASE = dict( routes_onerror = [ ('3muses/*', '3muses/default/handle_error') ] ))
routers = dict(BASE=dict(routes_onerror=[('3muses/*', '3muses/default/handle_error')]))
class Triangulo: def __init__(self): self.lado1 = int(input('Ingrese el primer lado: ')) self.lado2 = int(input('Ingrese el segundo lado: ')) self.lado3 = int(input('Ingrese el tercer lado: ')) def mayor(self): if self.lado1>self.lado2 and self.lado1>self.lado3 : pri...
class Triangulo: def __init__(self): self.lado1 = int(input('Ingrese el primer lado: ')) self.lado2 = int(input('Ingrese el segundo lado: ')) self.lado3 = int(input('Ingrese el tercer lado: ')) def mayor(self): if self.lado1 > self.lado2 and self.lado1 > self.lado3: ...
__all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__license__", "__copyright__", ] __title__ = "warzone_map_utils" __summary__ = "Map generation and validation repository" __uri__ = "https://github.com/rmudambi/warlight-maps" __version__ = "1.0.0" __author__ = "Beren Erchamion"...
__all__ = ['__title__', '__summary__', '__uri__', '__version__', '__author__', '__license__', '__copyright__'] __title__ = 'warzone_map_utils' __summary__ = 'Map generation and validation repository' __uri__ = 'https://github.com/rmudambi/warlight-maps' __version__ = '1.0.0' __author__ = 'Beren Erchamion' __license__ =...
def river_travelling(cost_matrix): N = len(cost_matrix) M = [[0 for x in range(N)] for x in range(N)] for steps in range(1, N): for i in range(N - steps): j = i + steps lowest = cost_matrix[i][j] for k in range(i + 1, j): lowest = min(lowest, M[k][...
def river_travelling(cost_matrix): n = len(cost_matrix) m = [[0 for x in range(N)] for x in range(N)] for steps in range(1, N): for i in range(N - steps): j = i + steps lowest = cost_matrix[i][j] for k in range(i + 1, j): lowest = min(lowest, M[k][...
# coding: utf-8 # # Functions (2) - Using Functions # In the last lesson we saw how to create a function using the <code>def</code> keyword. We found out how to pass arguments to a function and how to use these arguments within the function. Finally, we learnt how to return one or many objects from the function, and...
def string_multiply(stringIn, number): return stringIn * number test1 = string_multiply('hi', 5) test2 = string_multiply('one', 2) print(test1, test2) def string_compare(string1, string2): if len(string1) > len(string2): return string1 elif len(string2) > len(string1): return string2 el...
class config(): # env config render_train = True render_test = False env_name = "Pong-v0" overwrite_render = True record = True high = 255. # output config output_path = "results/test/" model_output = output_path + "model.weight...
class Config: render_train = True render_test = False env_name = 'Pong-v0' overwrite_render = True record = True high = 255.0 output_path = 'results/test/' model_output = output_path + 'model.weights/' log_path = output_path + 'log.txt' plot_output = output_path + 'scores.png' ...
with open("sleepy.in") as input_file: input_file.readline() cows = list(map(int, input_file.readline().split())) def is_list_sorted(lst): return all(elem >= lst[index] for index, elem in enumerate(lst[1:])) t = 0 sorted_cows = cows.copy() for cow in cows: if is_list_sorted(sorted_cows): break ...
with open('sleepy.in') as input_file: input_file.readline() cows = list(map(int, input_file.readline().split())) def is_list_sorted(lst): return all((elem >= lst[index] for (index, elem) in enumerate(lst[1:]))) t = 0 sorted_cows = cows.copy() for cow in cows: if is_list_sorted(sorted_cows): bre...
# Variable for registering new components # Add a new component here and define a file with the name <component_name>.py and override the main variables COMPONENTS = ["aggregations-spot", "gbdisagg-spot"]
components = ['aggregations-spot', 'gbdisagg-spot']
FEATURES = [ 'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3'...
features = ['Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', ...