content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# MathHelper.py - Some helpful math utilities. # Created by Josh Kennedy on 18 May 2014 # # Pop a Dots # Copyright 2014 Chad Jensen and Josh Kennedy # Copyright 2015-2016 Sirkles LLC def lerp(value1, value2, amount): return value1 + ((value2 - value1) * amount) def isPowerOfTwo(value): return (value > 0) an...
def lerp(value1, value2, amount): return value1 + (value2 - value1) * amount def is_power_of_two(value): return value > 0 and value & value - 1 == 0 def to_degrees(radians): return radians * 57.29577951308232 def to_radians(degrees): return degrees * 0.017453292519943295 def clamp(value, low, high):...
# Adds testing.TestEnvironment provider if "env" attr is specified # https://bazel.build/rules/lib/testing#TestEnvironment def phase_test_environment(ctx, p): test_env = ctx.attr.env if test_env: return struct( external_providers = { "TestingEnvironment": testing.TestEnviro...
def phase_test_environment(ctx, p): test_env = ctx.attr.env if test_env: return struct(external_providers={'TestingEnvironment': testing.TestEnvironment(test_env)}) return struct()
def keyquery(): return( set([]) ) def getval(prob): return( prob.file )
def keyquery(): return set([]) def getval(prob): return prob.file
#!/usr/bin/env python3 print('1a') print('1b') print('2a\n') print('2b\n') print('3a\r\n') print('3b\r\n') print('4a\r') print('4b\r') print('5a\n\r') print('5b\n\r')
print('1a') print('1b') print('2a\n') print('2b\n') print('3a\r\n') print('3b\r\n') print('4a\r') print('4b\r') print('5a\n\r') print('5b\n\r')
# You are given a string and your task is to swap cases. # In other words, convert all lowercase letters to uppercase letters and vice versa. def swap_case(s): return s.swapcase() if __name__ == '__main__': s = input() result = swap_case(s) print(result)
def swap_case(s): return s.swapcase() if __name__ == '__main__': s = input() result = swap_case(s) print(result)
# uncompyle6 version 3.7.2 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] # Embedded file name: extract__one_file_exe__pyinstaller\_test_file.py __author__ = 'ipetrash' def say(): print('Hello World!') if __name__ == '__main__': say()
__author__ = 'ipetrash' def say(): print('Hello World!') if __name__ == '__main__': say()
# Law of large number # How to get first line input n, m, k = map(int, input().split()) data = list(map(int, input().split())) solution = 0 count_use_max_value = 0 data.sort(reverse=True) for i in range(0, m): if count_use_max_value >= k: solution += data[1] count_use_max_value = 0 else: ...
(n, m, k) = map(int, input().split()) data = list(map(int, input().split())) solution = 0 count_use_max_value = 0 data.sort(reverse=True) for i in range(0, m): if count_use_max_value >= k: solution += data[1] count_use_max_value = 0 else: solution += data[0] count_use_max_value +...
# FIXME need to fix TWO_RIG_AX_TO_MOVE here; empirically-derived, like we did with safe trajectories # define rig_ax to be moved to achieve either min or max given that we are at designated rough home position TWO_RIG_AX_TO_MOVE = { # rough_home ax1 min max ax2 min max '+x': [('pitch', ...
two_rig_ax_to_move = {'+x': [('pitch', -10, +10), ('roll', -10, +10)], '-x': [('pitch', +160, +172), ('roll', -10, +10)], '+y': [('pitch', +70, +90), ('yaw', -80, -100)], '-y': [('pitch', -90, -110), ('roll', -10, +10)], '+z': [('pitch', -90, -110), ('roll', -10, +10)], '-z': [('pitch', +70, +90), ('yaw', -10, +10)]} e...
# 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 preorderTraversal(self, root: TreeNode) -> List[int]: if root == None: return [] ...
class Solution: def preorder_traversal(self, root: TreeNode) -> List[int]: if root == None: return [] else: cur_list = [root] while True: next_list = [] expanded = False for cur_root in curList: ...
def lambda_handler(event, context): n = int(event['number']) n = n * -1 if n < 0 else n subject = event.get('__TRIGGERFLOW_SUBJECT', None) return {'number': n, '__TRIGGERFLOW_SUBJECT': subject}
def lambda_handler(event, context): n = int(event['number']) n = n * -1 if n < 0 else n subject = event.get('__TRIGGERFLOW_SUBJECT', None) return {'number': n, '__TRIGGERFLOW_SUBJECT': subject}
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:shell.bzl", "shell") def _addlicense_impl(ctx): out_file = ctx.actions.declare_file(ctx.label.name + ".bash") exclude_patterns_str = "" if ctx.attr.exclude_patterns: exclude_patterns = ["-not -path %s" % shell.quote(pattern) fo...
load('@bazel_skylib//lib:paths.bzl', 'paths') load('@bazel_skylib//lib:shell.bzl', 'shell') def _addlicense_impl(ctx): out_file = ctx.actions.declare_file(ctx.label.name + '.bash') exclude_patterns_str = '' if ctx.attr.exclude_patterns: exclude_patterns = ['-not -path %s' % shell.quote(pattern) for...
class Solution: def findComplement(self, num: int) -> int: res =i = 0 while num: if not num & 1: res |= 1 << i num = num >> 1 i += 1 return res class Solution: def findComplement(self, num: int) -> int: i = 1 while i <=...
class Solution: def find_complement(self, num: int) -> int: res = i = 0 while num: if not num & 1: res |= 1 << i num = num >> 1 i += 1 return res class Solution: def find_complement(self, num: int) -> int: i = 1 while...
class C: def foo(self): pass class D: def bar(self): pass class E: def baz(self): pass def f(): return 0 def g(): return x = (C(), D(), E()) a, b, c = x x[0].bar() # NO bar x[1].baz() # NO baz x[2].foo() # baz a.bar() # NO bar b.baz() # NO baz c.foo() # NO ...
class C: def foo(self): pass class D: def bar(self): pass class E: def baz(self): pass def f(): return 0 def g(): return x = (c(), d(), e()) (a, b, c) = x x[0].bar() x[1].baz() x[2].foo() a.bar() b.baz() c.foo()
# 2019-01-15 # csv file reading f = open('score.csv', 'r') lines = f.readlines() f.close() for line in lines: total = 0 count = 0 scores = line[:-1].split(',') # print(scores) for score in scores: total += int(score) count += 1 print("Total = %3d, Avg = %.2f" % (total, t...
f = open('score.csv', 'r') lines = f.readlines() f.close() for line in lines: total = 0 count = 0 scores = line[:-1].split(',') for score in scores: total += int(score) count += 1 print('Total = %3d, Avg = %.2f' % (total, total / count))
# # PySNMP MIB module INTEL-RSVP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-RSVP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:43:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ...
# Algorithms > Bit Manipulation > Counter game # Louise and Richard play a game, find the winner of the game. # # https://www.hackerrank.com/challenges/counter-game/problem # pow2 = [1 << i for i in range(63, -1, -1)] def counterGame(n): player = 0 while n != 1: # print( ["Louise", "Richard"][player]...
pow2 = [1 << i for i in range(63, -1, -1)] def counter_game(n): player = 0 while n != 1: for i in pow2: if n == i: n = n // 2 if n != 1: player = 1 - player break elif n & i == i: n = n - i ...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- def sub_report(): print("Hey, I'm a function inside my subscript.")
def sub_report(): print("Hey, I'm a function inside my subscript.")
# -*- coding: utf-8 -*- TOTAL_SESSION_NUM = 2 REST_DURATION = 5 * 60 BLOCK_DURATION = 2 * 60 MINIMUM_PULSE_CYCLE = 0.5 MAXIMUM_PULSE_CYCLE = 1.2 PPG_SAMPLE_RATE = 200 PPG_FIR_FILTER_TAP_NUM = 200 PPG_FILTER_CUTOFF = [0.5, 5.0] PPG_SYSTOLIC_PEAK_DETECTION_THRESHOLD_COEFFICIENT = 0.5 BIOPAC_HEADER_LINES = 11 BIOPAC_...
total_session_num = 2 rest_duration = 5 * 60 block_duration = 2 * 60 minimum_pulse_cycle = 0.5 maximum_pulse_cycle = 1.2 ppg_sample_rate = 200 ppg_fir_filter_tap_num = 200 ppg_filter_cutoff = [0.5, 5.0] ppg_systolic_peak_detection_threshold_coefficient = 0.5 biopac_header_lines = 11 biopac_msec_per_sample_line_num = 2 ...
# Link to the problem: https://www.codechef.com/problems/STACKS def binary_search(arr, x): l = 0 r = len(arr) while l < r: mid = (r + l) // 2 if x < arr[mid]: r = mid else: l = mid + 1 return l def main(): T = int(input()) while T: T ...
def binary_search(arr, x): l = 0 r = len(arr) while l < r: mid = (r + l) // 2 if x < arr[mid]: r = mid else: l = mid + 1 return l def main(): t = int(input()) while T: t -= 1 _ = int(input()) given_stack = list(map(int, inp...
class CorruptedStateSpaceModelStructureException(Exception): pass class CorruptedStochasticModelStructureException(Exception): pass
class Corruptedstatespacemodelstructureexception(Exception): pass class Corruptedstochasticmodelstructureexception(Exception): pass
API_ACCESS = 'YOUR_API_ACCESS' API_SECRET = 'YOUR_API_SECRET' BTC_UNIT = 0.001 BTC_AMOUNT = BTC_UNIT CNY_UNIT = 0.01 CNY_STEP = CNY_UNIT DIFFERENCE_STEP = 2.0 MIN_SURPLUS = 0.5 NO_GOOD_SLEEP = 15 MAX_TRIAL = 3 MAX_OPEN_ORDERS = 3 TOO_MANY_OPEN_SLEEP = 10 DEBUG_MODE = True REMOVE_THRESHOLD = 20.0 REMOVE_UNREA...
api_access = 'YOUR_API_ACCESS' api_secret = 'YOUR_API_SECRET' btc_unit = 0.001 btc_amount = BTC_UNIT cny_unit = 0.01 cny_step = CNY_UNIT difference_step = 2.0 min_surplus = 0.5 no_good_sleep = 15 max_trial = 3 max_open_orders = 3 too_many_open_sleep = 10 debug_mode = True remove_threshold = 20.0 remove_unrealistic = Tr...
''' Description: python solution of AddTwoNumbers (https://leetcode-cn.com/problems/add-two-numbers/) Author: Kotori Y Date: 2021-04-20 16:49:38 LastEditors: Kotori Y LastEditTime: 2021-04-20 16:51:04 FilePath: \LeetCode-Code\codes\LinkedList\AddTwoNumbers\AddTwoNumbers.py AuthorMail: kotori@cbdd.me ''' # Definition f...
""" Description: python solution of AddTwoNumbers (https://leetcode-cn.com/problems/add-two-numbers/) Author: Kotori Y Date: 2021-04-20 16:49:38 LastEditors: Kotori Y LastEditTime: 2021-04-20 16:51:04 FilePath: \\LeetCode-Code\\codes\\LinkedList\\AddTwoNumbers\\AddTwoNumbers.py AuthorMail: kotori@cbdd.me """ class Sol...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) < 3: return max(nums) n = len(nums) ans1 = self.robHouse(nums[:n-1]) ans2 = self.robHouse(nums[1:]) return max(ans1, ans2) def robHouse(self, nums): prev, curr = 0, 0 for num...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) < 3: return max(nums) n = len(nums) ans1 = self.robHouse(nums[:n - 1]) ans2 = self.robHouse(nums[1:]) return max(ans1, ans2) def rob_house(self, nums): (prev, curr) = (0, 0) ...
class Source: ''' this is a class that defines the source objects ''' def __init__(self,id,name,url,description): self.id = id self.name = name self.url = url self.description = description
class Source: """ this is a class that defines the source objects """ def __init__(self, id, name, url, description): self.id = id self.name = name self.url = url self.description = description
# Warning : Keep this file private # replace the values of the variables with yours ckey = 'SaMpLe-C0nSuMeR-Key' csecret = 'Y0uR-C0nSuMeR-SecRet' atoken = 'Y0Ur-@cCeSs-T0Ken' asecret = 'Y0uR-@cCesS-SeCrEt'
ckey = 'SaMpLe-C0nSuMeR-Key' csecret = 'Y0uR-C0nSuMeR-SecRet' atoken = 'Y0Ur-@cCeSs-T0Ken' asecret = 'Y0uR-@cCesS-SeCrEt'
def main(): def expand(code,times): return times * code def expandString(code): lbi = 0 rbi = 0 for i in range(len(code)): if(code[i] == "["): lbi = i if(code[i] == "]"): rbi = i break count = 1 while code[lbi-count].isdigit(): if(count == 1): ...
def main(): def expand(code, times): return times * code def expand_string(code): lbi = 0 rbi = 0 for i in range(len(code)): if code[i] == '[': lbi = i if code[i] == ']': rbi = i break count = 1 ...
class MyDictSubclass(dict): def __init__(self): dict.__init__(self) self.var1 = 10 self['in_dct'] = 20 def __str__(self): ret = [] for key, val in sorted(self.items()): ret.append('%s: %s' % (key, val)) ret.append('self.var1: %s' % (self.var1,)) ...
class Mydictsubclass(dict): def __init__(self): dict.__init__(self) self.var1 = 10 self['in_dct'] = 20 def __str__(self): ret = [] for (key, val) in sorted(self.items()): ret.append('%s: %s' % (key, val)) ret.append('self.var1: %s' % (self.var1,)) ...
class QueryFileHandler: @staticmethod def load_queries(file_name: str): file = open(file_name, 'r') query = file.read() file.close() query_list = [s and s.strip() for s in query.split(';')] return list(filter(None, query_list))
class Queryfilehandler: @staticmethod def load_queries(file_name: str): file = open(file_name, 'r') query = file.read() file.close() query_list = [s and s.strip() for s in query.split(';')] return list(filter(None, query_list))
K = int(input()) result = 0 for A in range(1, K + 1): for B in range(1, K + 1): if A * B > K: break result += K // (A * B) print(result)
k = int(input()) result = 0 for a in range(1, K + 1): for b in range(1, K + 1): if A * B > K: break result += K // (A * B) print(result)
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
class Toscagraph(object): """Graph of Tosca Node Templates.""" def __init__(self, nodetemplates): self.nodetemplates = nodetemplates self.vertices = {} self._create() def _create_vertex(self, node): if node not in self.vertices: self.vertices[node.name] = node ...
# import requests # from bs4 import BeautifulSoup # with open('file:///home/shubham/fridaybeautifulsoup.html','r') # def table(a,b): # if a==1 : # return 1 # return b*table(a-1,b) # print(table(10,5)) # def pow(n) : # if n==1 : # return 2**n # return 2*pow(n-1) # # print(pow(3)) # d...
d = '' a = ['saikira', 'bhopland', 'petland', 'bhatland'] f = [] for i in a[::-1]: f.append(i[::-1]) print(f)
class NetworkException(Exception): pass class SecretException(Exception): pass
class Networkexception(Exception): pass class Secretexception(Exception): pass
st=input("Enter the binary string\n") l=len(st) a=[] for i in range(l-1,-1,-1): if a==[]: a.append(st[i]) else: p=a.pop() if st[i] != p: a.append(p) a.append(st[i]) if len(a)==0: print(-1) else: for i in range(len(a)): print(a.pop(),end="")
st = input('Enter the binary string\n') l = len(st) a = [] for i in range(l - 1, -1, -1): if a == []: a.append(st[i]) else: p = a.pop() if st[i] != p: a.append(p) a.append(st[i]) if len(a) == 0: print(-1) else: for i in range(len(a)): print(a.pop()...
# Project Euler #6: Sum square difference n = 1 s = 0 s2 = 0 while n <= 100: s += n s2 += n * n n += 1 print(s * s - s2)
n = 1 s = 0 s2 = 0 while n <= 100: s += n s2 += n * n n += 1 print(s * s - s2)
# https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks/problem class MyQueue(object): def __init__(self): self.one = [] self.two = [] def peek(self): return self.two[-1] def pop(self): return self.two.pop() def put(self, value): self.one.append(value) def check(sel...
class Myqueue(object): def __init__(self): self.one = [] self.two = [] def peek(self): return self.two[-1] def pop(self): return self.two.pop() def put(self, value): self.one.append(value) def check(self): if not len(self.two): while s...
line = input() while not line == "Stop": print(line) line = input()
line = input() while not line == 'Stop': print(line) line = input()
# coding=utf-8 class App: DEBUG = False TESTING = False
class App: debug = False testing = False
total_cost = input("Enter the cost of your dream house: ") total_cost = float(total_cost) annual_salary = input("Enter your annual income: ") annual_salary = float(annual_salary) portion_saved = input("Enter the percent of your income you will save: ") if portion_saved.find("%") or portion_saved.startswith("%") : ...
total_cost = input('Enter the cost of your dream house: ') total_cost = float(total_cost) annual_salary = input('Enter your annual income: ') annual_salary = float(annual_salary) portion_saved = input('Enter the percent of your income you will save: ') if portion_saved.find('%') or portion_saved.startswith('%'): po...
def metade(p): r = p / 2 return r def dobro(p): r = p * 2 return r def aumentar(p, taxa): r = p + ((p * taxa) / 100) return r def diminuir(p, taxa): r = p - ((p * taxa) / 100) return r
def metade(p): r = p / 2 return r def dobro(p): r = p * 2 return r def aumentar(p, taxa): r = p + p * taxa / 100 return r def diminuir(p, taxa): r = p - p * taxa / 100 return r
# Copyright 2009-2017 Ram Rachum. # This program is distributed under the MIT license. class ReasonedBool: ''' A variation on `bool` that also gives a `.reason`. This is useful when you want to say "This is False because... (reason.)" Unfortunately this class is not a subclass of `bool`, since Pytho...
class Reasonedbool: """ A variation on `bool` that also gives a `.reason`. This is useful when you want to say "This is False because... (reason.)" Unfortunately this class is not a subclass of `bool`, since Python doesn't allow subclassing `bool`. """ def __init__(self, value, reason=Non...
form = 'form.signin' form_username = 'form.signin [name="session[username_or_email]"]' form_password = 'form.signin [name="session[password]"]' form_phone = '#challenge_response' def login(browser, username, password): browser.fill(form_username, username) # For some reason filling of the password is flaky a...
form = 'form.signin' form_username = 'form.signin [name="session[username_or_email]"]' form_password = 'form.signin [name="session[password]"]' form_phone = '#challenge_response' def login(browser, username, password): browser.fill(form_username, username) while not browser.value(form_password): browse...
while True: try: n = int(input()) if ((n >= 0 and n < 90) or n == 360): print('Bom Dia!!') elif (n >=90 and n < 180): print('Boa Tarde!!') elif (n >= 180 and n < 270): print('Boa Noite!!') elif (n >= 270 and n < 360): print('De ...
while True: try: n = int(input()) if n >= 0 and n < 90 or n == 360: print('Bom Dia!!') elif n >= 90 and n < 180: print('Boa Tarde!!') elif n >= 180 and n < 270: print('Boa Noite!!') elif n >= 270 and n < 360: print('De Madrugada...
class PytraitError(RuntimeError): pass class DisallowedInitError(PytraitError): pass class NonMethodAttrError(PytraitError): pass class MultipleImplementationError(PytraitError): pass class InheritanceError(PytraitError): pass class NamingConventionError(PytraitError): pass
class Pytraiterror(RuntimeError): pass class Disallowediniterror(PytraitError): pass class Nonmethodattrerror(PytraitError): pass class Multipleimplementationerror(PytraitError): pass class Inheritanceerror(PytraitError): pass class Namingconventionerror(PytraitError): pass
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"URL": "00_downloading_pdfs.ipynb", "PDF_PATH": "00_downloading_pdfs.ipynb", "identify_links_for_pdfs": "00_downloading_pdfs.ipynb", "download_file": "00_downloading_pdfs.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'URL': '00_downloading_pdfs.ipynb', 'PDF_PATH': '00_downloading_pdfs.ipynb', 'identify_links_for_pdfs': '00_downloading_pdfs.ipynb', 'download_file': '00_downloading_pdfs.ipynb', 'collect_multiple_files': '00_downloading_pdfs.ipynb', 'get_ix': '01_p...
SD_COMMENT="This is for local development" SHELTERLUV_SECRET_TOKEN="" APP_SECRET_KEY="ASKASK" JWT_SECRET="JWTSECRET" POSTGRES_PASSWORD="thispasswordisverysecure" BASEUSER_PW="basepw" BASEEDITOR_PW="editorpw" BASEADMIN_PW="basepw" DROPBOX_APP="DBAPPPW"
sd_comment = 'This is for local development' shelterluv_secret_token = '' app_secret_key = 'ASKASK' jwt_secret = 'JWTSECRET' postgres_password = 'thispasswordisverysecure' baseuser_pw = 'basepw' baseeditor_pw = 'editorpw' baseadmin_pw = 'basepw' dropbox_app = 'DBAPPPW'
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ''' def _jupyter_server_extension_paths(): return [{ 'module':'nbtemplate' }]; def _jupyter_nbextension_paths(): return [ dict( section='notebook', src='static', # path is relative to `nbtemplate` directo...
""" """ def _jupyter_server_extension_paths(): return [{'module': 'nbtemplate'}] def _jupyter_nbextension_paths(): return [dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/main'), dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/templateSelector'), dic...
S = input() T = input() i = 0 for s, t in zip(S, T): if s!=t: i += 1 print(i)
s = input() t = input() i = 0 for (s, t) in zip(S, T): if s != t: i += 1 print(i)
# Soccer field easy soccer_easy_gate_pose_dicts = [ { 'orientation': { 'w_val': 1.0, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.0}, 'position': { 'x_val': 0.0, 'y_val': 2.0, 'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.9659256935119629, 'x_val': 0.0, 'y_val': -...
soccer_easy_gate_pose_dicts = [{'orientation': {'w_val': 1.0, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.0}, 'position': {'x_val': 0.0, 'y_val': 2.0, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.9659256935119629, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.2588196396827698}, 'position': {'x_val': 1.599999904632...
print ('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1') print ('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED') numberToSequence = input() def tryCollatz(numberToSequence): collatzCalled = False while(collatzCalled == False): try: numberToSequence = int(numberToSequence) ...
print('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1') print('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED') number_to_sequence = input() def try_collatz(numberToSequence): collatz_called = False while collatzCalled == False: try: number_to_sequence = int(numberToSequence) ...
class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def example(): # Computer 2 + 3 * 0.1 code = [ ('const', 2), ('const', 3), ('const', 0.1), ...
class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def example(): code = [('const', 2), ('const', 3), ('const', 0.1), ('mul',), ('add',)] m = machine()
def formulUygula(derece, liste): mat = [] xDeg = 0 for i in range(derece + 1): mat1 = [] for j in range(derece + 1): gecici = 0 for k in range(1, len(liste) + 1): gecici += k ** xDeg mat1.append(gecici) xDeg += 1 mat.app...
def formul_uygula(derece, liste): mat = [] x_deg = 0 for i in range(derece + 1): mat1 = [] for j in range(derece + 1): gecici = 0 for k in range(1, len(liste) + 1): gecici += k ** xDeg mat1.append(gecici) x_deg += 1 mat....
def LeiaDinheiro(msg): valido = False while not valido: mens = str(input(msg)).replace(',', '.') if mens.isalpha() or mens.strip() == '': print("\033[31mERRO! tente algo valido\033[m") else: valido = True return float(mens)
def leia_dinheiro(msg): valido = False while not valido: mens = str(input(msg)).replace(',', '.') if mens.isalpha() or mens.strip() == '': print('\x1b[31mERRO! tente algo valido\x1b[m') else: valido = True return float(mens)
# # PySNMP MIB module AT-DS3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-DS3-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:13:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
# closures def make_averagr(): series = [] def averager(new_value): series.append(new_value) # free variable total = sum(series) / len(series) return total return averager # print(locals()) av = make_averagr() print(av(10)) print(av(11)) print(av.__code__.co_varnames) # ('n...
def make_averagr(): series = [] def averager(new_value): series.append(new_value) total = sum(series) / len(series) return total return averager av = make_averagr() print(av(10)) print(av(11)) print(av.__code__.co_varnames) print(av.__code__.co_freevars) print(av.__closure__, type(a...
# Public Key PK = "fubotong" # Push request actively PUSH = 0 # Secret Key SK = "(*^%]@XUNLEI`12f&amp;^" # procotol type HTTP = 1 ED2K = 2 BT = 3 TASK_SERVER = "http://open.lixian.vip.xunlei.com/download_to_clouds" #TASK_SERVER = "http://t33093.sandai.net:8028/download_to_clouds" CREATE_SERVER = "%s/create" % TASK_SE...
pk = 'fubotong' push = 0 sk = '(*^%]@XUNLEI`12f&amp;^' http = 1 ed2_k = 2 bt = 3 task_server = 'http://open.lixian.vip.xunlei.com/download_to_clouds' create_server = '%s/create' % TASK_SERVER create_bt_server = '%s/create_bt' % TASK_SERVER create_ed2_k_server = '%s/create_ed2k' % TASK_SERVER query_server = '%s/query' %...
def kth_common_divisor(a, b, k): min_ = min(a, b) divisors = [] for i in range(1, min_+1): if a % i == 0 and b % i == 0: divisors.append(i) return divisors[-k] if __name__ == "__main__": a, b, k = map(int, input().split()) print(kth_common_divisor(a, b, k))
def kth_common_divisor(a, b, k): min_ = min(a, b) divisors = [] for i in range(1, min_ + 1): if a % i == 0 and b % i == 0: divisors.append(i) return divisors[-k] if __name__ == '__main__': (a, b, k) = map(int, input().split()) print(kth_common_divisor(a, b, k))
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. class Foo: def __init__(self, arg1: str, arg2: int) -> None: self.arg1 = arg1 self.arg2 = arg2
class Foo: def __init__(self, arg1: str, arg2: int) -> None: self.arg1 = arg1 self.arg2 = arg2
class Solution: def sequentialDigits(self, low: int, high: int) -> List[int]: nlow, nhigh = len(str(low)), len(str(high)) s = '123456789' result = [] for n in range(nlow, nhigh+1): for i in range(9-n+1): num = int(s[i:i+n]) ...
class Solution: def sequential_digits(self, low: int, high: int) -> List[int]: (nlow, nhigh) = (len(str(low)), len(str(high))) s = '123456789' result = [] for n in range(nlow, nhigh + 1): for i in range(9 - n + 1): num = int(s[i:i + n]) if...
no = int(input('How many Natural Numbers do You Want?? ')) output = 0 i = 0 while i <= no: output = output + i*i i += 1 print(output)
no = int(input('How many Natural Numbers do You Want?? ')) output = 0 i = 0 while i <= no: output = output + i * i i += 1 print(output)
class Log(): def log(self,text): pass def force_p(self,text): print(text) class Print(Log): def log(self,text): print(text) class NoLog(Log) : def log(self,text): pass class MessageLog(Log): def set_channel(self,channel): self.channel = channel async def log(self,text): await self.channel.sen...
class Log: def log(self, text): pass def force_p(self, text): print(text) class Print(Log): def log(self, text): print(text) class Nolog(Log): def log(self, text): pass class Messagelog(Log): def set_channel(self, channel): self.channel = channel ...
class Solution(object): def update(self, board, row, col): living = 0 for i in range(max(row-1, 0), min(row+2, len(board))): for j in range(max(col-1, 0), min(col+2, len(board[0]))): living += board[i][j] & 1 if living == 3 or (living == 4 and board[row][col]): ...
class Solution(object): def update(self, board, row, col): living = 0 for i in range(max(row - 1, 0), min(row + 2, len(board))): for j in range(max(col - 1, 0), min(col + 2, len(board[0]))): living += board[i][j] & 1 if living == 3 or (living == 4 and board[row][...
__all__ = ["State"] class State: def __init__(self, value: str): self.value = value def __eq__(self, other): if not isinstance(other, State): return False else: return self.value == other.value def __hash__(self): return hash(self.value)
__all__ = ['State'] class State: def __init__(self, value: str): self.value = value def __eq__(self, other): if not isinstance(other, State): return False else: return self.value == other.value def __hash__(self): return hash(self.value)
counts = { "FAMILY|ID": 3, "PARTICIPANT|ID": 3, "BIOSPECIMEN|ID": 3, "GENOMIC_FILE|URL_LIST": 3, } validation = {}
counts = {'FAMILY|ID': 3, 'PARTICIPANT|ID': 3, 'BIOSPECIMEN|ID': 3, 'GENOMIC_FILE|URL_LIST': 3} validation = {}
# Create a global variable. my_value = 10 # The show_value function prints # the value of the global variable. def show_value(): print(my_value) # Call the show_value function show_value()
my_value = 10 def show_value(): print(my_value) show_value()
N = int(input()) h = N // 3600 % 24 min = N % 3600 // 60 sec = N % 60 print(h, '%02d' % (min), '%02d' % (sec), sep=':')
n = int(input()) h = N // 3600 % 24 min = N % 3600 // 60 sec = N % 60 print(h, '%02d' % min, '%02d' % sec, sep=':')
# # PySNMP MIB module CTRON-SFPS-PATH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-PATH-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:31:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ...
spec = { 'name' : "a 4-node liberty cluster", # 'external network name' : "exnet3", 'keypair' : "openstack_rsa", 'controller' : "r720", 'dns' : "10.30.65.200", 'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" }, 'Networks' : [ # { 'name' : "liberty" , "start":...
spec = {'name': 'a 4-node liberty cluster', 'keypair': 'openstack_rsa', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'liberty-dataplane', 'subnet': ' 172.16.0.0/24'}, {'name': 'liberty-provider', 'subnet': ' 172.16.1.0/24', 'star...
COM_SLEEP = 0x00 COM_QUIT = 0x01 COM_INIT_DB = 0x02 COM_QUERY = 0x03 COM_FIELD_LIST = 0x04 COM_CREATE_DB = 0x05 COM_DROP_DB = 0x06 COM_REFRESH = 0x07 COM_SHUTDOWN = 0x08 COM_STATISTICS = 0x09 COM_PROCESS_INFO = 0x0a COM_CONNECT = 0x0b COM_PROCESS_KILL = 0x0c COM_DEBUG = 0x0d COM_PING = 0x0e COM_TIME = 0x0f COM_DELAYED_...
com_sleep = 0 com_quit = 1 com_init_db = 2 com_query = 3 com_field_list = 4 com_create_db = 5 com_drop_db = 6 com_refresh = 7 com_shutdown = 8 com_statistics = 9 com_process_info = 10 com_connect = 11 com_process_kill = 12 com_debug = 13 com_ping = 14 com_time = 15 com_delayed_insert = 16 com_change_user = 17 com_binlo...
name, age = "Sharwan27", 16 username = "Sharwan27" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Sharwan27', 16) username = 'Sharwan27' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
# count = 10 # while count>0: # print("Sandip") # count-=1 # name="Sandip" # for char in name: # print(char) # for item in name: # print(item, end=" ") # print("") # print("My name is",name) # print("My name is",name,sep="=") # for item in range(5): # print(item,end=" ") # print("") # for item ...
name = 'Sandip Dhakal!' lenth = len(name) print("Wo'w'") print('Wo"w"') print("Wo'w'") print('San\\dip\\') print('sand\ndip') print('sand\tdip') print('sand\x08dip') check = 'H' not in name print(check) print(type(check))
def potencia(base, inicio=1, fin=10): while inicio < fin: resul=base**inicio yield resul inicio=inicio+1 print(list(potencia(3,1,50)))
def potencia(base, inicio=1, fin=10): while inicio < fin: resul = base ** inicio yield resul inicio = inicio + 1 print(list(potencia(3, 1, 50)))
N_L = input().split() Number_lights = int(N_L[0]) Length = int(N_L[1]) time = 0 last_distance = 0 for x in range(Number_lights): information = input().split() time += int(information[0]) - last_distance remainder = time % (int(information[1]) + int(information[2])) if remainder < int(inform...
n_l = input().split() number_lights = int(N_L[0]) length = int(N_L[1]) time = 0 last_distance = 0 for x in range(Number_lights): information = input().split() time += int(information[0]) - last_distance remainder = time % (int(information[1]) + int(information[2])) if remainder < int(information[1]): ...
PATH_TO_STANFORD_CORENLP = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*' NUM_SPLITS = 1 TRAIN_SIZE = 0.67 # two thirds of the total data # Define entity types here # Each type must have a list of identifiers that do not contain the '_' token # Example of an annotation: # # Kathe Halverson was the only aspec...
path_to_stanford_corenlp = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*' num_splits = 1 train_size = 0.67 ent_types = {'instructor': ['name'], 'class': ['name', 'department', 'id']} all_ids = list(set([i for j in ENT_TYPES for i in ENT_TYPES[j]]))
#!/usr/bin/env python #=================================================================================== #description : Methods for features exploration = #author : Shashi Narayan, shashi.narayan(at){ed.ac.uk,loria.fr,gmail.com})= #date ...
class Feature_Nov27: def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph): split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple) split_feature = split_pattern return split_feature def get_drop_ood_feature(self, ood_node, nodese...
n = int(input()) while(n > 0): n -= 1 a, b = input().split() if(len(a) < len(b)): print('nao encaixa') else: if(a[len(a)-len(b)::] == b): print('encaixa') else: print('nao encaixa')
n = int(input()) while n > 0: n -= 1 (a, b) = input().split() if len(a) < len(b): print('nao encaixa') elif a[len(a) - len(b):] == b: print('encaixa') else: print('nao encaixa')
#1) Multiples of 3 and 5 #If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. #Find the sum of all the multiples of 3 or 5 below 1000. # Solution A def multiples(n): num = 1 while num < n: if num % 3 == 0 or num % 5 == 0: ...
def multiples(n): num = 1 while num < n: if num % 3 == 0 or num % 5 == 0: yield num num += 1 sum(multiples(1000)) sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0])
class Kettle(object): def __init__(self, make, price): self.make = make self.price = price self.on = False kenwood = Kettle("kenwood", 8.99) print(kenwood.make) print(kenwood.price) kenwood.price = 12.75 print(kenwood.price) hamilton = Kettle("hamilton", 14.00) print(hamilton.price)
class Kettle(object): def __init__(self, make, price): self.make = make self.price = price self.on = False kenwood = kettle('kenwood', 8.99) print(kenwood.make) print(kenwood.price) kenwood.price = 12.75 print(kenwood.price) hamilton = kettle('hamilton', 14.0) print(hamilton.price)
# Calculate paycheck xh = input("Enter Hors: ") xr = input("Enter Rate: ") xp = float(xh) * float(xr) print("Pay:", xp)
xh = input('Enter Hors: ') xr = input('Enter Rate: ') xp = float(xh) * float(xr) print('Pay:', xp)
input_s = ['3[abc]4[ab]c', '2[3[a]b]c'] # if '[' not in comp[l+1:r]: # return int(comp[0:l]) * comp[l+1:r] a = '10[a]b' b = '2[2[3[a]b]c]' c = '3[abc]4[ab]c' def findnth(haystack, needle, n): parts= haystack.split(needle, n+1) if len(parts)<=n+1: return -1 return len(haystack)-len(parts[-...
input_s = ['3[abc]4[ab]c', '2[3[a]b]c'] a = '10[a]b' b = '2[2[3[a]b]c]' c = '3[abc]4[ab]c' def findnth(haystack, needle, n): parts = haystack.split(needle, n + 1) if len(parts) <= n + 1: return -1 return len(haystack) - len(parts[-1]) - len(needle) def decomp(comp): l = comp.find('[') r = ...
class CodegenError(Exception): pass class NoOperationProvidedError(CodegenError): pass class NoOperationNameProvidedError(CodegenError): pass class MultipleOperationsProvidedError(CodegenError): pass
class Codegenerror(Exception): pass class Nooperationprovidederror(CodegenError): pass class Nooperationnameprovidederror(CodegenError): pass class Multipleoperationsprovidederror(CodegenError): pass
# coding: utf-8 class Item(object): def __init__(self, name, price, description, image_url, major, minor, priority): self.name = name self.price = price self.description = description self.image_url = image_url self.minor = minor self.major = major self.prior...
class Item(object): def __init__(self, name, price, description, image_url, major, minor, priority): self.name = name self.price = price self.description = description self.image_url = image_url self.minor = minor self.major = major self.priority = priority ...
# class and object (oops concept) class class_8: print() name = 'amar' # class class_9: # name = 'rahul' # age = 23 # def welcome(self): # print("welcome to teckat") # # a = class_9() # create object of class abc # # b = class_8() # # c = class_9() # # # print(abc.name) # accessi...
class Class_8: print() name = 'amar' class Student: def __init__(self): self.name = '' self.age = 0 def input_details(self): self.name = input('Enter name') self.num1 = int(input('Enter 1st marks')) self.num2 = int(input('Enter 2nd marks')) def add(self): ...
with open('iso_list/valid_list.txt') as i: names = i.readlines() with open('iso_list/valid.prediction') as i: p = i.readlines() out = open('iso_list/valid_prediction.txt', 'w') assert len(names) == len(p) for i, n in enumerate(names): n = n[:-1] result = n + ' ' + p[i] out.write(result)
with open('iso_list/valid_list.txt') as i: names = i.readlines() with open('iso_list/valid.prediction') as i: p = i.readlines() out = open('iso_list/valid_prediction.txt', 'w') assert len(names) == len(p) for (i, n) in enumerate(names): n = n[:-1] result = n + ' ' + p[i] out.write(result)
# ''' # Linked List hash table key/value pair # ''' class LinkedPair: def __init__(self, key, value): self.key = key self.value = value self.next = None # ''' # Resizing hash table # ''' class HashTable: def __init__(self, capacity): self.capacity = capacity self.stor...
class Linkedpair: def __init__(self, key, value): self.key = key self.value = value self.next = None class Hashtable: def __init__(self, capacity): self.capacity = capacity self.storage = [None] * capacity def hash(string, max): hash = 5381 for char in string:...
class Solution: def plusOne(self, digits): i = len(digits) - 1 while i >= 0: if digits[i] == 9: digits[i] = 0 i = i - 1 else: digits[i] += 1 break if i == -1 and digits[0] == 0: digits.append(...
class Solution: def plus_one(self, digits): i = len(digits) - 1 while i >= 0: if digits[i] == 9: digits[i] = 0 i = i - 1 else: digits[i] += 1 break if i == -1 and digits[0] == 0: digits.appen...
class A: name="Default" def __init__(self, n = None): self.name = n print(self.name) def m(self): print("m of A called") class B(A): # def m(self): # print("m of B called") pass class C(A): def m(self): print("m of C called") class D(B, C): def __init__(self): self.objB =...
class A: name = 'Default' def __init__(self, n=None): self.name = n print(self.name) def m(self): print('m of A called') class B(A): pass class C(A): def m(self): print('m of C called') class D(B, C): def __init__(self): self.objB = b() self...
''' Created on 1.12.2016 @author: Darren '''''' Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] " '''
""" Created on 1.12.2016 @author: Darren Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] " """
command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '0.0.0.0:{{ .Values.service.internalPort }}' workers = 3 errorlog = '-' accesslog = '-' capture_output = False loglevel = 'debug'
command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '0.0.0.0:{{ .Values.service.internalPort }}' workers = 3 errorlog = '-' accesslog = '-' capture_output = False loglevel = 'debug'
if __name__ == '__main__': n, x = map(int, input().split()) sheet = [] [sheet.append(map(float, input().split())) for i in range(x)] for i in zip(*sheet): print(sum(i)/len(i))
if __name__ == '__main__': (n, x) = map(int, input().split()) sheet = [] [sheet.append(map(float, input().split())) for i in range(x)] for i in zip(*sheet): print(sum(i) / len(i))
class ListaProduto(object): lista_produtos = [ { "id":1, "nome":"pao sete graos" }, { "id":2, "nome":"pao original" }, { "id":3, "nome":"pao integral" }, { "id":4, ...
class Listaproduto(object): lista_produtos = [{'id': 1, 'nome': 'pao sete graos'}, {'id': 2, 'nome': 'pao original'}, {'id': 3, 'nome': 'pao integral'}, {'id': 4, 'nome': 'pao light'}, {'id': 5, 'nome': 'pao recheado'}, {'id': 6, 'nome': 'pao doce'}, {'id': 7, 'nome': 'pao sem casca'}, {'id': 8, 'nome': 'pao caseir...
apiAttachAvailable = u'\u0648\u0627\u062c\u0647\u0629 \u0628\u0631\u0645\u062c\u0629 \u0627\u0644\u062a\u0637\u0628\u064a\u0642 (API) \u0645\u062a\u0627\u062d\u0629' apiAttachNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d' apiAttachPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u06...
api_attach_available = u'واجهة برمجة التطبيق (API) متاحة' api_attach_not_available = u'غير متاح' api_attach_pending_authorization = u'تعليق التصريح' api_attach_refused = u'رفض' api_attach_success = u'نجاح' api_attach_unknown = u'غير معروفة' bud_deleted_friend = u'تم حذفه من قائمة الأصدقاء' bud_friend = u'صديق' bud_neve...
def go(): with open('input.txt', 'r') as f: ids = [item for item in f.read().split('\n') if item] for i in range(len(ids)): for j in range(i + 1, len(ids)): diff_count = 0 for k in range(len(ids[i])): if ids[i][k] != ids[j][k]: ...
def go(): with open('input.txt', 'r') as f: ids = [item for item in f.read().split('\n') if item] for i in range(len(ids)): for j in range(i + 1, len(ids)): diff_count = 0 for k in range(len(ids[i])): if ids[i][k] != ids[j][k]: ...
# -*- coding: utf-8 -*- def main(): abcd = sorted([int(input()) for _ in range(4)]) ef = sorted([int(input()) for _ in range(2)]) print(sum(abcd[1:] + ef[1:])) if __name__ == '__main__': main()
def main(): abcd = sorted([int(input()) for _ in range(4)]) ef = sorted([int(input()) for _ in range(2)]) print(sum(abcd[1:] + ef[1:])) if __name__ == '__main__': main()
# This sample tests a series of nested loops containing variables # with significant dependencies. for val1 in range(10): cnt1 = 4 for val2 in range(10 - val1): cnt2 = 4 if val2 == val1: cnt2 -= 1 for val3 in range(10 - val1 - val2): cnt3 = 4 if val3 ...
for val1 in range(10): cnt1 = 4 for val2 in range(10 - val1): cnt2 = 4 if val2 == val1: cnt2 -= 1 for val3 in range(10 - val1 - val2): cnt3 = 4 if val3 == val1: cnt3 -= 1 if val3 == val2: cnt3 -= 1 ...
# https://app.codesignal.com/arcade/intro/level-2/bq2XnSr5kbHqpHGJC def makeArrayConsecutive2(statues): statues = sorted(statues) res = 0 # Make elements of the array be consecutive. If there's a # gap between two statues heights', then figure out how # many extra statues have to be added so that al...
def make_array_consecutive2(statues): statues = sorted(statues) res = 0 for i in range(1, len(statues)): res += statues[i] - statues[i - 1] - 1 return res
subdomain = 'srcc' api_version = 'v1' callback_url = 'http://localhost:4567/'
subdomain = 'srcc' api_version = 'v1' callback_url = 'http://localhost:4567/'
# Take the values C = int(input()) A = int(input()) # calculate student trips quociente = A // (C - 1) # how many students are letf resto = A % (C - 1) # if there is a student left, you have +1 trip if resto > 0: quociente += 1 # Shows the value print(quociente)
c = int(input()) a = int(input()) quociente = A // (C - 1) resto = A % (C - 1) if resto > 0: quociente += 1 print(quociente)
class TechnicalSpecs(object): def __init__(self): self.__negative_format = None self.__cinematographic_process = None self.__link = None @property def negative_format(self): return self.__negative_format @negative_format.setter def negative_format(self, negative_for...
class Technicalspecs(object): def __init__(self): self.__negative_format = None self.__cinematographic_process = None self.__link = None @property def negative_format(self): return self.__negative_format @negative_format.setter def negative_format(self, negative_fo...
# package marker. __version__ = "1.1b3" __date__ = "Nov 23, 2017"
__version__ = '1.1b3' __date__ = 'Nov 23, 2017'
S=list(input()) S.reverse() N=len(S) R=[0]*N R10=[0]*N m=2019 K=0 R10[0]=1 R[0]=int(S[0])%m for i in range(1,N): R10[i]=(R10[i-1]*10)%m R[i]=(R[i-1]+int(S[i])*R10[i])%m d={} for i in range(2019): d[i]=0 for i in range(N): d[R[i]]+=1 ans=0 for i in range(2019): if i == 0: ans += d[i] ...
s = list(input()) S.reverse() n = len(S) r = [0] * N r10 = [0] * N m = 2019 k = 0 R10[0] = 1 R[0] = int(S[0]) % m for i in range(1, N): R10[i] = R10[i - 1] * 10 % m R[i] = (R[i - 1] + int(S[i]) * R10[i]) % m d = {} for i in range(2019): d[i] = 0 for i in range(N): d[R[i]] += 1 ans = 0 for i in range(201...