content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def entityParser(self, text: str) -> str: text = text.replace("&quot;", '"') text = text.replace("&apos;", "'") text = text.replace("&gt;", ">") text = text.replace("&lt;", "<") text = text.replace("&frasl;", "/") text = text.replace("&amp;", "&") ...
class Solution: def entity_parser(self, text: str) -> str: text = text.replace('&quot;', '"') text = text.replace('&apos;', "'") text = text.replace('&gt;', '>') text = text.replace('&lt;', '<') text = text.replace('&frasl;', '/') text = text.replace('&amp;', '&') ...
f = open("config.txt", 'w') f.write("Random Seed <>\n\ Number of worlds <>\n\ Number of Days <>\n\ Agent Parameter Keys <>\n\ Agent list filename <>\n\ Interaction Info Keys <>\n\ Interaction Files list filename <>\n\ Location Parameter Keys <>\n\ Location list filename <>\n\ Event Parameter Keys <>\n\ Event Files list...
f = open('config.txt', 'w') f.write('Random Seed <>\nNumber of worlds <>\nNumber of Days <>\nAgent Parameter Keys <>\nAgent list filename <>\nInteraction Info Keys <>\nInteraction Files list filename <>\nLocation Parameter Keys <>\nLocation list filename <>\nEvent Parameter Keys <>\nEvent Files list filename <>\nOne Ti...
class Solution: # @param {string} s # @return {boolean} def isPalindrome(self, s): n = len(s) s = s.lower() if n < 2: return True i = 0 j = n-1 while(i<=j): while(not s[i].isalnum() and i<j): i+=1 while(not s...
class Solution: def is_palindrome(self, s): n = len(s) s = s.lower() if n < 2: return True i = 0 j = n - 1 while i <= j: while not s[i].isalnum() and i < j: i += 1 while not s[j].isalnum() and j > i: ...
################################### # File Name : dir_closure.py ################################### #!/usr/bin/python3 def closure(): def inner(): pass p = dir(inner()) print ("=== inner attribute ===") print (p) return inner if __name__ == "__main__": p = dir(closure()) prin...
def closure(): def inner(): pass p = dir(inner()) print('=== inner attribute ===') print(p) return inner if __name__ == '__main__': p = dir(closure()) print('=== attribute ===') print(p)
''' Description: In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N-1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend ...
""" Description: In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N-1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend ...
class Flight: def __init__(self, engine): self.engine = engine def startEngine(self): self.engine.start() class AirbusEngine: def start(self): print("Starting Airbus Engine.") class BoingEngine: def start(self): print("Starting Boing Engine.") ae = AirbusEngin...
class Flight: def __init__(self, engine): self.engine = engine def start_engine(self): self.engine.start() class Airbusengine: def start(self): print('Starting Airbus Engine.') class Boingengine: def start(self): print('Starting Boing Engine.') ae = airbus_engine() ...
def value_added_tax(amount): tax = amount * 0.25 total_amount = amount * 1.25 return f"{amount}, {tax}, {total_amount}" price = value_added_tax(100) print(price, type(price))
def value_added_tax(amount): tax = amount * 0.25 total_amount = amount * 1.25 return f'{amount}, {tax}, {total_amount}' price = value_added_tax(100) print(price, type(price))
class Solution: def calc(self, s): s = s.strip() s = s.replace(' ', '') s = s.replace('--', '+') try: int(s) return str(s) except: pass # print('') res = 0 queue = [] i = 0 while i < len(s): ...
class Solution: def calc(self, s): s = s.strip() s = s.replace(' ', '') s = s.replace('--', '+') try: int(s) return str(s) except: pass res = 0 queue = [] i = 0 while i < len(s): tmp = '' ...
def test_socfaker_logs_windows_eventlog(socfaker_fixture): assert socfaker_fixture.logs.windows.eventlog() def test_socfaker_logs_windows_sysmon_logs(socfaker_fixture): assert socfaker_fixture.logs.windows.sysmon()
def test_socfaker_logs_windows_eventlog(socfaker_fixture): assert socfaker_fixture.logs.windows.eventlog() def test_socfaker_logs_windows_sysmon_logs(socfaker_fixture): assert socfaker_fixture.logs.windows.sysmon()
# test round() with large integer values and second arg # rounding integers is an optional feature so test for it try: round(1, -1) except NotImplementedError: print('SKIP') raise SystemExit i = 2**70 tests = [ (i, 0), (i, -1), (i, -10), (i, 1), (-i, 0), (-i, -1), (-i, -10), (-i, 1), ] for t in t...
try: round(1, -1) except NotImplementedError: print('SKIP') raise SystemExit i = 2 ** 70 tests = [(i, 0), (i, -1), (i, -10), (i, 1), (-i, 0), (-i, -1), (-i, -10), (-i, 1)] for t in tests: print(round(*t)) print('PASS')
def is_user_has_access_to_view_submission(user, submission): has_access = False if not user.is_authenticated: pass elif user.is_apply_staff or submission.user == user or user.is_reviewer: has_access = True elif user.is_partner and submission.partners.filter(pk=user.pk).exists(): ...
def is_user_has_access_to_view_submission(user, submission): has_access = False if not user.is_authenticated: pass elif user.is_apply_staff or submission.user == user or user.is_reviewer: has_access = True elif user.is_partner and submission.partners.filter(pk=user.pk).exists(): ...
# https://adventofcode.com/2015/day/2 # part 1 def calculate_size(input): dims = list(map(int, input.split('x'))) dims.sort() return 3 * dims[0] * dims[1] + 2 * (dims[1] * dims[2] + dims[2] * dims[0]) assert calculate_size('2x3x4') == 58 assert calculate_size('1x1x10') == 43 total = 0 for line in open("20...
def calculate_size(input): dims = list(map(int, input.split('x'))) dims.sort() return 3 * dims[0] * dims[1] + 2 * (dims[1] * dims[2] + dims[2] * dims[0]) assert calculate_size('2x3x4') == 58 assert calculate_size('1x1x10') == 43 total = 0 for line in open('201502_input.txt'): total += calculate_size(lin...
# -*- coding: utf-8 -*- # Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com> # # Permission to use, copy, modify, and/or distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright notice # and this permission notice appear in all copies. # # THE SOFTWARE I...
def r(gn, fn): g = '' f = None fl = list() for c in fn: fl.append(c) if len(fn) <= 1: return fn + gn else: for c in reversed(gn): if c >= fn[0]: g += c else: f = fn[1] g += f if f: ...
class Solution: def isValidPalindrome(self, s: str, k: int) -> bool: dp = [[0] * len(s) for _ in range(len(s))] for j in range(len(dp)): dp[j][j] = 1 for i in range(j - 1, -1, -1): if s[i] == s[j]: dp[i][j] = 2 + dp[i + 1][j - 1] ...
class Solution: def is_valid_palindrome(self, s: str, k: int) -> bool: dp = [[0] * len(s) for _ in range(len(s))] for j in range(len(dp)): dp[j][j] = 1 for i in range(j - 1, -1, -1): if s[i] == s[j]: dp[i][j] = 2 + dp[i + 1][j - 1] ...
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt def get_data(): return { "fieldname": "release", "transactions": [{"label": "GitHub", "items": ["Pull Request"]},], }
def get_data(): return {'fieldname': 'release', 'transactions': [{'label': 'GitHub', 'items': ['Pull Request']}]}
def splitter(filename): with open(filename) as f: return f.read().splitlines() # in list.txt file seperate package name on next line to generate string and make sure that there is no adb command written in file. Also check for any additional quotes in the string. # Author : Manmeet Singh # url: https://www.g...
def splitter(filename): with open(filename) as f: return f.read().splitlines() filename = 'list.txt' usr_input = input('Enter 1 for install, 2 for Uninstall list and 3 for existing package install: ') if usrInput == '1': for ele in splitter(filename): print('adb install "apk/%s.apk" > CON' % ele...
__author__ = 'J. Michael Caine' __copyright__ = '2020' __version__ = '0.1' __license__ = 'MIT' re_alphanum = '^[\w\d- ]+$' re_username = '^[\w\d_]+$' #re_password = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)' re_email = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)' re_slug = '^[\w\d-_]+$'
__author__ = 'J. Michael Caine' __copyright__ = '2020' __version__ = '0.1' __license__ = 'MIT' re_alphanum = '^[\\w\\d- ]+$' re_username = '^[\\w\\d_]+$' re_email = '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)' re_slug = '^[\\w\\d-_]+$'
def calculate_I_pos(pos_a, pos_b, pos_c, pos_d): return ( (pos_a[0] + pos_b[0] + pos_c[0] + pos_d[0])/4, (pos_a[1] + pos_b[1] + pos_c[1] + pos_d[1])/4) def calculate_avg(pos_a, pos_b): return (pos_a[0] + pos_b[0]) / 2, (pos_a[1] + pos_b[1]) / 2
def calculate_i_pos(pos_a, pos_b, pos_c, pos_d): return ((pos_a[0] + pos_b[0] + pos_c[0] + pos_d[0]) / 4, (pos_a[1] + pos_b[1] + pos_c[1] + pos_d[1]) / 4) def calculate_avg(pos_a, pos_b): return ((pos_a[0] + pos_b[0]) / 2, (pos_a[1] + pos_b[1]) / 2)
def equizip(*xs): xs = list(map(list, xs)) assert all(len(x) == len(xs[0]) for x in xs) return zip(*xs) def argany(xs): for x in xs: if x: return x
def equizip(*xs): xs = list(map(list, xs)) assert all((len(x) == len(xs[0]) for x in xs)) return zip(*xs) def argany(xs): for x in xs: if x: return x
#Write a program that allow user to enter classmate (name, Birthday, Email), validate if enter values are valid format (limit length apply), else ask user to enter again per field def getinput(): while True: name = input("Please input student name\n") if len(name)<=12: break el...
def getinput(): while True: name = input('Please input student name\n') if len(name) <= 12: break else: print('Name can only contain a maximum of 12 characters') continue while True: birth = input('Please input student birthday mm/dd/yy \n') ...
# # PySNMP MIB module ROHC-UNCOMPRESSED-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/ROHC-UNCOMPRESSED-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:27:12 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016,...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ...
def create_lattice(max_gen): current = [tuple(len(max_gen)*[0])] tree = [] while current != []: tree.append(current) copy = current next_lvl = [] for elem in range(len(copy)): l = list(copy[elem]) for i in range(len(l)): new_l = l.copy...
def create_lattice(max_gen): current = [tuple(len(max_gen) * [0])] tree = [] while current != []: tree.append(current) copy = current next_lvl = [] for elem in range(len(copy)): l = list(copy[elem]) for i in range(len(l)): new_l = l.cop...
def main( array, value ): for i in range( array.size ): array[i] = array[i] + value return array
def main(array, value): for i in range(array.size): array[i] = array[i] + value return array
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def rob(self, root: TreeNode) -> int: @lru_cache(maxsize=None) def dfs(node, can_ro...
class Solution: def rob(self, root: TreeNode) -> int: @lru_cache(maxsize=None) def dfs(node, can_rob, acc_sum): if not node: return acc_sum max_sum = acc_sum if can_rob: left_sum = dfs(node.left, False, 0) right_su...
CONFIRM = '\N{WHITE HEAVY CHECK MARK}' CANCEL = '\N{NO ENTRY SIGN}' SUCCESS = '\N{THUMBS UP SIGN}' FAILURE = '\N{THUMBS DOWN SIGN}'
confirm = '✅' cancel = '🚫' success = '👍' failure = '👎'
''' Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tree. Input: root = [3,1,4,3,null,1,5] Output: 4 Explanation: Nodes in blue are good. Root Node (3) is always a good node. Node 4...
""" Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tree. Input: root = [3,1,4,3,null,1,5] Output: 4 Explanation: Nodes in blue are good. Root Node (3) is always a good node. Node 4...
class Edge: def __init__(self, node, weight): self.node = node self.weight = weight class Node: def __init__(self, index): self.index = index self._distance = float('inf') self._parent = None self._neighbors = [] @property def distance(self): ...
class Edge: def __init__(self, node, weight): self.node = node self.weight = weight class Node: def __init__(self, index): self.index = index self._distance = float('inf') self._parent = None self._neighbors = [] @property def distance(self): r...
#background color black = 0,0,0 #colors in order of intuitively determined distinctness. Assuming a black background white = 255,255,255 blue = 0, 0, 255 red = 255, 0, 0 green = 0, 255, 0 gray = 127,127,127 lightblue = 0, 255, 255 purple = 255, 0, 255 #bluered yellow = 255, 255, 0 #redgreen seagreen = 127, 255, 127...
black = (0, 0, 0) white = (255, 255, 255) blue = (0, 0, 255) red = (255, 0, 0) green = (0, 255, 0) gray = (127, 127, 127) lightblue = (0, 255, 255) purple = (255, 0, 255) yellow = (255, 255, 0) seagreen = (127, 255, 127) mauve = (255, 127, 127) violet = (127, 127, 255) lightgray = (190, 190, 190) bluegreen = (0, 127, 1...
# Copyright 2018 Arkady Shtempler. # # 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 wri...
grep_string = ' ERROR ' result_dir = 'LogTool_Result_Files' overcloud_logs_dir = '/var/log/containers' undercloud_logs_dir = ['/var/log/containers', '/home/stack'] overcloud_ssh_user = 'heat-admin' overcloud_ssh_key = '/home/stack/.ssh/id_rsa' overcloud_home_dir = '/home/' + overcloud_ssh_user + '/' source_rc_file_path...
ix.enable_command_history() ix.application.select_next_instances(False) ix.disable_command_history()
ix.enable_command_history() ix.application.select_next_instances(False) ix.disable_command_history()
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def skywalking_data_collect_protocol_dependencies(): rules_proto() com_github_grpc_grpc() def com_github_grpc_grpc(): http_archive(name='com_github_grpc_grpc', sha256='3ccc4e5ae8c1ce844456e39cc11f1c991a7da74396faabe83d779836ef449bce', ur...
class Solution: # @param A: An integers list. # @return: return any of peek positions. def findPeak(self, A): # write your code here l, r = 1, len(A) - 2 while l <= r: m = (l + r) / 2 if A[m - 1] >= A[m]: r = m - 1 elif A[m] <= A[m ...
class Solution: def find_peak(self, A): (l, r) = (1, len(A) - 2) while l <= r: m = (l + r) / 2 if A[m - 1] >= A[m]: r = m - 1 elif A[m] <= A[m + 1]: l = m + 1 else: return m
# We are given an array a of length n consisting of integers. We can apply the following operation, # consisting of several steps, on the array a zero or more times: # - we select two different numbers in the array a[i] and a[j], # - we remove i-th and j-th elements from the array. # For example, if n=6 and a=[1, 6, 1,...
def epic_transformation(T, n): count = [] for j in range(len(T)): if T[j] not in count: count.append([T[j], 0]) for j in range(len(T)): for k in range(len(count)): if T[j] == count[k][0]: count[k][1] += 1 max_amount = 0 for j in range(len(count...
# Turn on debugging DEBUG = True USE_X_SENDFILE = False
debug = True use_x_sendfile = False
y=123 y="hola mundo" #esto es python3 def sumar(a,b): z=a+b return z def restar(a,b): z=a-b return z
y = 123 y = 'hola mundo' def sumar(a, b): z = a + b return z def restar(a, b): z = a - b return z
{ "includes": [ "../../common.gypi" ], "variables": { # This is what happens when you still keep the support for VAX VMS, Xenix, Windows CE and OS/2 in 2021 # Cmon, seriously, the last version of Xenix was in 1989 "UNIX_defines%": [ "CURL_SA_FAMILY_T=sa_family_t", "GETHOSTNAME_TYPE_ARG2=size_t", ...
{'includes': ['../../common.gypi'], 'variables': {'UNIX_defines%': ['CURL_SA_FAMILY_T=sa_family_t', 'GETHOSTNAME_TYPE_ARG2=size_t', 'HAVE_ALARM=1', 'HAVE_ALLOCA_H=1', 'HAVE_ARPA_INET_H=1', 'HAVE_ARPA_TFTP_H=1', 'HAVE_ASSERT_H=1', 'HAVE_BASENAME=1', 'HAVE_BOOL_T=1', 'HAVE_CONNECT=1', 'HAVE_DECL_GETPWUID_R=1', 'HAVE_DLFC...
# # PySNMP MIB module TPLINK-LLDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-LLDP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:17:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ...
# Write a function # Problem Link: https://www.hackerrank.com/challenges/write-a-function/problem def is_leap(year): leap = False # Write your logic here if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: leap = True return leap year = int(input()) print(is_leap(year))
def is_leap(year): leap = False if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: leap = True return leap year = int(input()) print(is_leap(year))
# function that receives two string arguments and checks whether they are same-length strings # (returns True in this case otherwise false). def lengthEqual(line1,line2): return len(line1) == len(line2) print("Enter the strings for comparison: ") text1 = input("First string arguement: ") text2 = input("Second ...
def length_equal(line1, line2): return len(line1) == len(line2) print('Enter the strings for comparison: ') text1 = input('First string arguement: ') text2 = input('Second string arguement: ') print(length_equal(text1, text2))
# -*- coding: utf-8 -*- class Bubble: def __init__(self, x, y, v, c, s): self.bub_x = x self.bub_y = y self.bub_v = v self.bub_c = c self.bub_s = s def update(self): self.bub_y -= self.bub_s
class Bubble: def __init__(self, x, y, v, c, s): self.bub_x = x self.bub_y = y self.bub_v = v self.bub_c = c self.bub_s = s def update(self): self.bub_y -= self.bub_s
# -*- coding:utf-8 -*- class Solution: def Permutation(self, ss): # write code here if len(ss) == 0: return [] ss = sorted(list(ss)) used = [False] * len(ss) self.ans = [] def dfs(temp,used): if len(temp) == len(ss): self.ans.ap...
class Solution: def permutation(self, ss): if len(ss) == 0: return [] ss = sorted(list(ss)) used = [False] * len(ss) self.ans = [] def dfs(temp, used): if len(temp) == len(ss): self.ans.append(''.join(temp)) return ...
# Created by Egor Kostan. # GitHub: https://github.com/ikostan # LinkedIn: https://www.linkedin.com/in/egor-kostan/ def assert_sudoku_by_column(board: list) -> bool: row_length = len(board[0]) for i in range(0, row_length): col = set() for row in board: col.add(row[i]) i...
def assert_sudoku_by_column(board: list) -> bool: row_length = len(board[0]) for i in range(0, row_length): col = set() for row in board: col.add(row[i]) if len(col) != row_length: print('assert_sudoku_by_column') return False return True
# coding: utf8 REPO_URL = 'https://github.com/baijiangliang/year2018' GIT_EMAIL_CMD = 'git config --get user.email' CHECK_GIT_DIR_CMD = 'git rev-parse --is-inside-work-tree' GIT_COMMIT_SEPARATOR = 'git-commit-separator' GIT_LOG_FORMAT = GIT_COMMIT_SEPARATOR + '%H%n%P%n%an%n%ae%n%at%n%s%n' GIT_REMOTE_URL_CMD = 'git co...
repo_url = 'https://github.com/baijiangliang/year2018' git_email_cmd = 'git config --get user.email' check_git_dir_cmd = 'git rev-parse --is-inside-work-tree' git_commit_separator = 'git-commit-separator' git_log_format = GIT_COMMIT_SEPARATOR + '%H%n%P%n%an%n%ae%n%at%n%s%n' git_remote_url_cmd = 'git config --get remote...
n, q = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] cd = [list(map(int, input().split())) for _ in range(q)] r = [[] for _ in range(n)] for i, j in ab: r[i - 1].append(j - 1) r[j - 1].append(i - 1) a = [0] * n b = [(0, 0)] c = [False] * n c[0] = True while b: i, j =...
(n, q) = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] cd = [list(map(int, input().split())) for _ in range(q)] r = [[] for _ in range(n)] for (i, j) in ab: r[i - 1].append(j - 1) r[j - 1].append(i - 1) a = [0] * n b = [(0, 0)] c = [False] * n c[0] = True while b: (i...
def Function(x, y, q): q = '' print('Enter coordinate x') x = int(input('')) print('Enter coordinate y') y = int(input('')) if (x>0) and (y>0): q = 'Point is located in the first quarter' return q elif (x<0) and (y>0): q = 'Point is located in the second quarter' ...
def function(x, y, q): q = '' print('Enter coordinate x') x = int(input('')) print('Enter coordinate y') y = int(input('')) if x > 0 and y > 0: q = 'Point is located in the first quarter' return q elif x < 0 and y > 0: q = 'Point is located in the second quarter' ...
def getInput(): test_cases = int(input()) counter = 0 input_numbers = [] while counter < test_cases: input_numbers.append(input()) counter += 1 return input_numbers def checkIfOddDigitPresent(number): for digit in str(number): if int(digit) % 2 != 0: retur...
def get_input(): test_cases = int(input()) counter = 0 input_numbers = [] while counter < test_cases: input_numbers.append(input()) counter += 1 return input_numbers def check_if_odd_digit_present(number): for digit in str(number): if int(digit) % 2 != 0: ret...
# A - B # B - A # C - @ # D # E # F with open('flag.enc', 'rb') as f: data = f.read()[1::2] with open('flag.dec', 'wb') as f: f.write(data)
with open('flag.enc', 'rb') as f: data = f.read()[1::2] with open('flag.dec', 'wb') as f: f.write(data)
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
pack_virtualenv_doesnt_exist = '\nVirtual environment for pack "%s" doesn\'t exist. If you haven\'t installed a pack using\n"packs.install" command, you can create a new virtual environment using\n"st2 run packs.setup_virtualenv packs=%s" command\'\n'
# --------------------------------------------------------------- Imports ---------------------------------------------------------------- # # System # Pip # Local # ---------------------------------------------------------------------------------------------------------------------------------------- # # ---...
class Coingecko: def __init__(self): return
ACCESS_TOKEN=""#enter your ACCESS TOKEn ACCESS_TOKEN_SECRET=""#Enter your access token secret CONSUMER_KEY=""#enter your consumer or api key CONSUMER_SECERT=""#enter you consumer secret or api secret
access_token = '' access_token_secret = '' consumer_key = '' consumer_secert = ''
def reverse(text): output = list(text) output.reverse() return "".join(output)
def reverse(text): output = list(text) output.reverse() return ''.join(output)
try: common.weather_location except: weatherLocation = settings.settings.value("data/WeatherLocation") if not weatherLocation: location = QInputDialog.getText(self, "Location", "Enter your current location here:") if location[1]: common.weather_location = location[0] sett...
try: common.weather_location except: weather_location = settings.settings.value('data/WeatherLocation') if not weatherLocation: location = QInputDialog.getText(self, 'Location', 'Enter your current location here:') if location[1]: common.weather_location = location[0] ...
def gen_fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b fi = gen_fibonacci() for i in range(20): print(fi.next())
def gen_fibonacci(): (a, b) = (0, 1) while True: yield a (a, b) = (b, a + b) fi = gen_fibonacci() for i in range(20): print(fi.next())
#!/usr/bin/python # -*- coding: utf-8 -*- lib_file = open('/srv/http/.config/cmus/lib.pl', encoding='UTF-8') # errors can occurs if there is no encoding parameter tracks = lib_file.readlines() library = [] for x in tracks: library.append(x) for x in library: # DEBUG MODE print('<li>' + x.split('/home/arle...
lib_file = open('/srv/http/.config/cmus/lib.pl', encoding='UTF-8') tracks = lib_file.readlines() library = [] for x in tracks: library.append(x) for x in library: print('<li>' + x.split('/home/arlen/Music/Rock_Metal/')[1] + '</li>')
n1 = float(input('Digite uma distancia em metros: ')) print('adistancia {}m corresponde ha:'.format(n1)) print('{:.3f}km'.format(n1/1000)) print('{}Cm'.format(n1*100)) print('{}Mm'.format(n1*1000))
n1 = float(input('Digite uma distancia em metros: ')) print('adistancia {}m corresponde ha:'.format(n1)) print('{:.3f}km'.format(n1 / 1000)) print('{}Cm'.format(n1 * 100)) print('{}Mm'.format(n1 * 1000))
def test_component_in_pipeline(base_parser): assert "conll_formatter" in base_parser.pipe_names, ( f"{'conll_formatter'} is not a component in the parser's pipeline." " This indicates that something went wrong while registering the component in the utils.init_nlp function." " This does not n...
def test_component_in_pipeline(base_parser): assert 'conll_formatter' in base_parser.pipe_names, f"{'conll_formatter'} is not a component in the parser's pipeline. This indicates that something went wrong while registering the component in the utils.init_nlp function. This does not necessarily mean that the compone...
# -*- test-case-name: calculus.test.test_base_2 -*- class Calculation(object): def add(self, a, b): return a + b def subtract(self, a, b): return a - b def multiply(self, a, b): return a * b def divide(self, a, b): return a / b
class Calculation(object): def add(self, a, b): return a + b def subtract(self, a, b): return a - b def multiply(self, a, b): return a * b def divide(self, a, b): return a / b
# Created by MechAviv # Map ID :: 931050910 # Peacetime Edelstein : Edelstein Outskirts 2 sm.hideUser(True) sm.forcedInput(0) sm.forcedInput(2) sm.sendDelay(30) sm.forcedInput(0) OBJECT_1 = sm.sendNpcController(2159369, -1050, -30) sm.showNpcSpecialActionByObjectId(OBJECT_1, "summon", 0) OBJECT_2 = sm.sendNpcControl...
sm.hideUser(True) sm.forcedInput(0) sm.forcedInput(2) sm.sendDelay(30) sm.forcedInput(0) object_1 = sm.sendNpcController(2159369, -1050, -30) sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0) object_2 = sm.sendNpcController(2159376, -1800, -30) sm.showNpcSpecialActionByObjectId(OBJECT_2, 'summon', 0) sm.moveNpcB...
{ "targets": [ { "target_name": "compress", "sources": [ "compress.cc" ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], "cflags": ["-g"] } ] }
{'targets': [{'target_name': 'compress', 'sources': ['compress.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags': ['-g']}]}
class GumballMachine: def __init__(self, number_gumballs) -> None: self.no_quarter_state = NoQuarterState(self) self.sold_out_state = SoldOutState(self) self.has_quarter_state = HasQuarterState(self) self.sold_state = SoldState(self) self.count = number_gumballs if nu...
class Gumballmachine: def __init__(self, number_gumballs) -> None: self.no_quarter_state = no_quarter_state(self) self.sold_out_state = sold_out_state(self) self.has_quarter_state = has_quarter_state(self) self.sold_state = sold_state(self) self.count = number_gumballs ...
EXPECTED = {'X683': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'types': {'IntegerList1': {'members': [{'name': 'elem', 'type': 'INTEGER'}, ...
expected = {'X683': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'types': {'IntegerList1': {'members': [{'name': 'elem', 'type': 'INTEGER'}, {'name': 'next', 'optional': True, 'type': 'IntegerList1'}], 'type': 'SEQUENCE'}, 'OptionallySignedUTF8String': {'members': [{'name': '...
def _merge(list_1, list_2): merged = [] ix_1, ix_2 = 0, 0 while all([list_1[ix_1:], list_2[ix_2:]]): val_1, val_2 = list_1[ix_1], list_2[ix_2] if val_2 < val_1: merged.append(val_2) ix_2 += 1 continue merged.append(val_1) ix_1 += 1 ...
def _merge(list_1, list_2): merged = [] (ix_1, ix_2) = (0, 0) while all([list_1[ix_1:], list_2[ix_2:]]): (val_1, val_2) = (list_1[ix_1], list_2[ix_2]) if val_2 < val_1: merged.append(val_2) ix_2 += 1 continue merged.append(val_1) ix_1 += 1 ...
# # PySNMP MIB module ASCEND-MIBTRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBTRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:12:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint...
div = 0 res = 0 for x in reversed(range(2, 39)): div += 1 res += ((x - 1) + (x)) / div print(((" +") if (div != 1) else ""), f" ({x - 1} * {x}/ {div})", end="") print("\nResultado = " + str(res))
div = 0 res = 0 for x in reversed(range(2, 39)): div += 1 res += (x - 1 + x) / div print(' +' if div != 1 else '', f' ({x - 1} * {x}/ {div})', end='') print('\nResultado = ' + str(res))
DatabaseABI = [ { "inputs": [ { "internalType": "address", "name": "factoryAddress", "type": "address" }, { "internalType": "address", "name": "creatorAddress", "type": "address" } ], "stateMutability": "n...
database_abi = [{'inputs': [{'internalType': 'address', 'name': 'factoryAddress', 'type': 'address'}, {'internalType': 'address', 'name': 'creatorAddress', 'type': 'address'}], 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'anonymous': False, 'inputs': [{'indexed': True, 'internalType': 'address', 'name': '...
def main(): addition = 0 addition = compute_sum() print("The sum is:", addition) def prompt_number(): number = -1 while(number < 0): number = int(input("Enter a positive number: ")) if number < 0: print("Invalid entry. The number must be positive.") retur...
def main(): addition = 0 addition = compute_sum() print('The sum is:', addition) def prompt_number(): number = -1 while number < 0: number = int(input('Enter a positive number: ')) if number < 0: print('Invalid entry. The number must be positive.') return pro...
heritage_url = None backend_url = 'https://www.yeastgenome.org/webservice' secret_key = 'secret key here' sender = 'email address here' author_response_file = 'file with full path here' compute_url = '' # elasticsearch_address = 'http://localhost:9200' elasticsearch_address = 'http://ec2-34-221-214-103.us-west-2.comput...
heritage_url = None backend_url = 'https://www.yeastgenome.org/webservice' secret_key = 'secret key here' sender = 'email address here' author_response_file = 'file with full path here' compute_url = '' elasticsearch_address = 'http://ec2-34-221-214-103.us-west-2.compute.amazonaws.com:9200' log_directory = None
# This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE shortnames = [ "Aql","And","Scl","Ara","Lib","Cet","Ari","Sct","Pyx","Boo","Cae","Cha","Cnc","Cap","Car","Cas","Cen","Cep","Com","Cvn","Aur","Col","Cir","Crt","CrA","CrB","Crv","Cru","Cyg","Del","Dor","Dra","N...
shortnames = ['Aql', 'And', 'Scl', 'Ara', 'Lib', 'Cet', 'Ari', 'Sct', 'Pyx', 'Boo', 'Cae', 'Cha', 'Cnc', 'Cap', 'Car', 'Cas', 'Cen', 'Cep', 'Com', 'Cvn', 'Aur', 'Col', 'Cir', 'Crt', 'CrA', 'CrB', 'Crv', 'Cru', 'Cyg', 'Del', 'Dor', 'Dra', 'Nor', 'Eri', 'Sge', 'For', 'Gem', 'Cam', 'CMa', 'UMa', 'Gru', 'Her', 'Hor', 'Hya'...
User.objects.create(email='instructor1@bogus.com', password='boguspwd') User.objects.create(email='instructor2@bogus.com', password='boguspwd') User.objects.create(email='instructor3@bogus.com', password='boguspwd') User.objects.create(email='student1@bogus.com', password='boguspwd') User.objects.create(email='student2...
User.objects.create(email='instructor1@bogus.com', password='boguspwd') User.objects.create(email='instructor2@bogus.com', password='boguspwd') User.objects.create(email='instructor3@bogus.com', password='boguspwd') User.objects.create(email='student1@bogus.com', password='boguspwd') User.objects.create(email='student2...
# bitoperations are fun, not that efficiency would be significant def encode(number): if number < 0: return None if number == 0: return b'\x00' varint_bytes = [] while number > 0: varint_bytes.append((number & 0x7f) | 0x80) number >>= 7 varint_bytes[-1] &= 0x7f ...
def encode(number): if number < 0: return None if number == 0: return b'\x00' varint_bytes = [] while number > 0: varint_bytes.append(number & 127 | 128) number >>= 7 varint_bytes[-1] &= 127 return bytes(varint_bytes) def decode(varint): if check_encoded(vari...
def tmx(tileset_images, tiles): return '''<?xml version="1.0" encoding="UTF-8"?> <map version="1.0" orientation="orthogonal" renderorder="right-down" width="94" height="79" tilewidth="256" tileheight="256" nextobjectid="1"> <tileset firstgid="1" name="all" tilewidth="256" tileheight="256" tilecount="7426" columns...
def tmx(tileset_images, tiles): return '<?xml version="1.0" encoding="UTF-8"?>\n<map version="1.0" orientation="orthogonal" renderorder="right-down" width="94" height="79" tilewidth="256" tileheight="256" nextobjectid="1">\n <tileset firstgid="1" name="all" tilewidth="256" tileheight="256" tilecount="7426" columns...
def rule30(list_, n): res=[0]+list_+[0] for i in range(n): temp=res[:] for j,k in enumerate(res): if j==0: res[j]=(k or temp[j+1]) elif j==len(temp)-1: res[j]=temp[j-1]^(k) else: res[j]=temp[j-1]^(k or temp[j+1])...
def rule30(list_, n): res = [0] + list_ + [0] for i in range(n): temp = res[:] for (j, k) in enumerate(res): if j == 0: res[j] = k or temp[j + 1] elif j == len(temp) - 1: res[j] = temp[j - 1] ^ k else: res[j] = t...
def resolve(): ''' code here ''' N = int(input()) A_list = [int(item) for item in input().split()] Q = int(input()) queries = [[int(item) for item in input().split()] for _ in range(Q)] memo = [0 for _ in range(10**5+1)] for item in A_list: memo[item] += 1 bas...
def resolve(): """ code here """ n = int(input()) a_list = [int(item) for item in input().split()] q = int(input()) queries = [[int(item) for item in input().split()] for _ in range(Q)] memo = [0 for _ in range(10 ** 5 + 1)] for item in A_list: memo[item] += 1 base = sum(...
# level design by Michael Abel # ................................................................................................................. def func_sand(): sys.stdout = KConsole sys.stderr = KConsole def switched(): unoccupied=False for (i,j) in [ (i,j) for i in range(3,6) for j in range(3,6) ]: if...
def func_sand(): sys.stdout = KConsole sys.stderr = KConsole def switched(): unoccupied = False for (i, j) in [(i, j) for i in range(3, 6) for j in range(3, 6)]: if world.isUnoccupiedPos(kiki_pos(i, j, 0)): unoccupied = True if not unoccupied: ...
with open("input.txt") as file: lines = file.read().split("\n") nums = [int(n) for n in lines[0].split(",")] numbers = {} for i,number in enumerate(nums): numbers[number] = [i] last_number = number i = len(numbers) while True: if last_number not in numbers: next_number = 0 if nex...
with open('input.txt') as file: lines = file.read().split('\n') nums = [int(n) for n in lines[0].split(',')] numbers = {} for (i, number) in enumerate(nums): numbers[number] = [i] last_number = number i = len(numbers) while True: if last_number not in numbers: next_number = 0 if next...
_base_ = [ '../_test_/models/resnet18_simsiam_dimcollapse_lpips.py', '../_test_/datasets/imagenet1p5r_mocov2_wori_b64_cluster.py', '../_test_/schedules/sgd_coslr-200e_in30p_kd.py', '../_test_/default_runtime.py', ] # set base learning rate optimizer_config = dict() # grad_clip, coalesce, bucket_size_m...
_base_ = ['../_test_/models/resnet18_simsiam_dimcollapse_lpips.py', '../_test_/datasets/imagenet1p5r_mocov2_wori_b64_cluster.py', '../_test_/schedules/sgd_coslr-200e_in30p_kd.py', '../_test_/default_runtime.py'] optimizer_config = dict() lr = 0.003 custom_hooks = [dict(type='SimSiamHook', priority='HIGH', fix_pred_lr=T...
a = 1 while a: a = int(input()) ans = a * (a + 1) * (2 * a + 1) // 6 print(ans)
a = 1 while a: a = int(input()) ans = a * (a + 1) * (2 * a + 1) // 6 print(ans)
# OPTIMISED BUBBLE SORT. def BubbleSort(A): swapped = 1 for i in range(len(A)): if (swapped == 0): return for k in range(len(A) - 1, i, -1): if (A[k] < A[k - 1]): swap(A, k, k - 1) swapped = 1 def swap(A, x, y): temp = A[x] A[x]...
def bubble_sort(A): swapped = 1 for i in range(len(A)): if swapped == 0: return for k in range(len(A) - 1, i, -1): if A[k] < A[k - 1]: swap(A, k, k - 1) swapped = 1 def swap(A, x, y): temp = A[x] A[x] = A[y] A[y] = temp a = [12...
# # PySNMP MIB module INTEL-LOG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-LOG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:43:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ...
def display_message(): print("I learn how to use function in this chapter.") display_message()
def display_message(): print('I learn how to use function in this chapter.') display_message()
# Created by http:#oleddisplay.squix.ch/ Consider a donation # In case of problems make sure that you are using the font file with the correct version! SansSerif_plain_11Bitmaps = [ # Bitmap Data: 0x00, # ' ' 0xAA,0xA2, # '!' 0xAA,0xA0, # '"' 0x12,0x0A,0x1F,0xC4,0x82,0x47,0xF0,0xA0,0x90, # '#' 0x21,0xEA,0x28,0x70...
sans_serif_plain_11_bitmaps = [0, 170, 162, 170, 160, 18, 10, 31, 196, 130, 71, 240, 160, 144, 33, 234, 40, 112, 162, 188, 32, 128, 98, 37, 9, 65, 160, 11, 5, 33, 72, 140, 48, 36, 16, 12, 9, 20, 83, 16, 246, 168, 82, 73, 36, 136, 145, 36, 146, 144, 34, 167, 28, 168, 128, 16, 16, 16, 254, 16, 16, 16, 160, 224, 128, 17, ...
#! /usr/bin/env python3 # counts the number of regions in a matrix # vertically and horizontally connected # e.g. # [1, 0, 1, 1] # [0, 1, 0, 0] # [1, 1, 0, 1] # has 4 regions class Patch(object): def __init__(self, visited, value): self.visited = visited self.value = value def __repr__(self)...
class Patch(object): def __init__(self, visited, value): self.visited = visited self.value = value def __repr__(self): return 'visited = %s, value = %s' % (self.visited, self.value) def initialize(region): for row in region: yield [patch(visited=False, value=field) for fie...
def mermaid(doc, name, content, width=1024): j = doc.docsite._j # TODO: *4 needs to be redone to use mermaid pure in javascript return "TODO: *4 mermaid macro not implemented yet"
def mermaid(doc, name, content, width=1024): j = doc.docsite._j return 'TODO: *4 mermaid macro not implemented yet'
editionMap = { "Greece": "el_gr", "Indonesia": "id_id", "Romania": "ro_ro", "Philippines": "en_ph", "Zimbabwe": "en_zw", "Sweden": "sv_se", "Saudi Arabia": "ar_sa", "Australia": "au", "Belgium (Dutch)": "nl_be", "Hungary": "hu_hu", "Chile": "es_cl", "Belgium (French)": "f...
edition_map = {'Greece': 'el_gr', 'Indonesia': 'id_id', 'Romania': 'ro_ro', 'Philippines': 'en_ph', 'Zimbabwe': 'en_zw', 'Sweden': 'sv_se', 'Saudi Arabia': 'ar_sa', 'Australia': 'au', 'Belgium (Dutch)': 'nl_be', 'Hungary': 'hu_hu', 'Chile': 'es_cl', 'Belgium (French)': 'fr_be', 'Mexico': 'es_mx', 'Hong Kong': 'hk', 'Tu...
''' Handling Exceptions (Errors) ''' # print(x) # Traceback (most recent call last): # File "/home/rich/Desktop/CarlsHub/Comprehensive-Python/ClassFiles/ErrorsExceptionsHandling/Errors.py", line 11, in <module> # print(x) # NameError: name 'x' is not defined ...
""" Handling Exceptions (Errors) """ x = 20 try: print(x) except: print('Variable is not defined.') else: print('Hello') finally: print('You may get an error if no variable is specified')
def solve(a, b): m, n = len(a), len(b) cache = [[0 for __ in range(m + 1)] for _ in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): if a[j - 1] == b[i - 1]: cache[i][j] = cache[i - 1][j - 1] + 1 else: cache[i][j] = max(cache...
def solve(a, b): (m, n) = (len(a), len(b)) cache = [[0 for __ in range(m + 1)] for _ in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): if a[j - 1] == b[i - 1]: cache[i][j] = cache[i - 1][j - 1] + 1 else: cache[i][j] = max(cac...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 if len(A) < 3: return 0 A = sorted(A) product_A = A[0] * A[1] * A[-1] product_B = A[-1] * A[-2] * A[-3] max_product = max(product_A, product_B...
def solution(A): if len(A) < 3: return 0 a = sorted(A) product_a = A[0] * A[1] * A[-1] product_b = A[-1] * A[-2] * A[-3] max_product = max(product_A, product_B) return max_product
''' Problem 017 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. ...
""" Problem 017 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. ...
class Config(object): def __init__(self): self.servers = [ "127.0.0.1" ] self.keyspace = 'at_inappscoring'
class Config(object): def __init__(self): self.servers = ['127.0.0.1'] self.keyspace = 'at_inappscoring'
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"request_headers": "00_core.ipynb", "get_as_raw_json": "00_core.ipynb", "get_next_as_raw_json": "00_core.ipynb", "timestamp_now": "00_core.ipynb", "new_bundle": "00_core.ip...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'request_headers': '00_core.ipynb', 'get_as_raw_json': '00_core.ipynb', 'get_next_as_raw_json': '00_core.ipynb', 'timestamp_now': '00_core.ipynb', 'new_bundle': '00_core.ipynb', 'new_list': '00_core.ipynb', 'extract_references_from_resource': '00_co...
palavras = ('aprender', 'programar', 'Linguagem', 'python', 'cruso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercado', 'programador', 'futuro') for p in palavras: # para cada palavra dentro do array de palavra print(f'\nNa palavra {p.upper()} temos', end='') for letra in p: # para...
palavras = ('aprender', 'programar', 'Linguagem', 'python', 'cruso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercado', 'programador', 'futuro') for p in palavras: print(f'\nNa palavra {p.upper()} temos', end='') for letra in p: if letra.lower() in 'aeiou': print(letra, end=' ')
with open("input.txt", "r") as f: lines = f.readlines() for line1 in lines: for line2 in lines: total = int(line1) + int(line2) if total == 2020: print(f"line1: {line1}") print(f"line2: {line2}") print(f"Multiply: {int(line1) * int...
with open('input.txt', 'r') as f: lines = f.readlines() for line1 in lines: for line2 in lines: total = int(line1) + int(line2) if total == 2020: print(f'line1: {line1}') print(f'line2: {line2}') print(f'Multiply: {int(line1) * int(...
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'common_audio', 'type': 'static_library', 'dependencies': ['<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers'], 'include_dirs': ['resampler/include', 'signal_processing/include'], 'direct_dependent_settings': {'include_dirs': ['resampl...
''' Topic : Algorithms Subtopic : SolveMeFirst Language : Python Problem Statement : sum of the above two integers Url : https://www.hackerrank.com/challenges/solve-me-first/problem ''' def solveMeFirst(a:int,b:int): # Hint: Type return a+b below return a + b num1 = int(input()) num2 = int(in...
""" Topic : Algorithms Subtopic : SolveMeFirst Language : Python Problem Statement : sum of the above two integers Url : https://www.hackerrank.com/challenges/solve-me-first/problem """ def solve_me_first(a: int, b: int): return a + b num1 = int(input()) num2 = int(input()) res = solve_me_first...
EXTERNAL_DEPS = [ "@jackson-core//jar:neverlink", "@jackson-databind//jar", "@jackson-annotations//jar", "@jackson-dataformat-yaml//jar", "@snakeyaml//jar", ]
external_deps = ['@jackson-core//jar:neverlink', '@jackson-databind//jar', '@jackson-annotations//jar', '@jackson-dataformat-yaml//jar', '@snakeyaml//jar']
def is_leap(year): leap = False # Write your logic here if year%400==0: leap=True elif year%100==0: leap=False elif year%4==0: leap=True return leap year = int(input())
def is_leap(year): leap = False if year % 400 == 0: leap = True elif year % 100 == 0: leap = False elif year % 4 == 0: leap = True return leap year = int(input())
def evalQuadratic(a, b, c, x): ''' a, b, c: numerical values for the coefficients of a quadratic equation x: numerical value at which to evaluate the quadratic. ''' # Your code here return (a*(x**2))+(b*x)+c
def eval_quadratic(a, b, c, x): """ a, b, c: numerical values for the coefficients of a quadratic equation x: numerical value at which to evaluate the quadratic. """ return a * x ** 2 + b * x + c
''' Author : kazi_amit_hasan Problem: Integer Sequence Dividing Solution: https://codeforces.com/blog/entry/64439 ''' n = int(input()) print(((n * (n + 1)) // 2) % 2)
""" Author : kazi_amit_hasan Problem: Integer Sequence Dividing Solution: https://codeforces.com/blog/entry/64439 """ n = int(input()) print(n * (n + 1) // 2 % 2)
#!/usr/bin/env python3 x = int(input("Enter number ")) if(x % 2 == 0): print("Even") else: print("Odd")
x = int(input('Enter number ')) if x % 2 == 0: print('Even') else: print('Odd')
class Solution(object): def isPalindrome(self, s): s = re.sub(r"\W+", r"", s.lower()) return s == s[::-1]
class Solution(object): def is_palindrome(self, s): s = re.sub('\\W+', '', s.lower()) return s == s[::-1]