content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# author: brian dillmann
# for rscs
class State:
def __init__(self, name):
if not isinstance(name, basestring):
raise TypeError('State name must be a string')
if not len(name):
raise ValueError('Cannot create State with empty name')
self.name = name
self.transitions = []
self.outputs = {}
def addO... | class State:
def __init__(self, name):
if not isinstance(name, basestring):
raise type_error('State name must be a string')
if not len(name):
raise value_error('Cannot create State with empty name')
self.name = name
self.transitions = []
self.outputs ... |
ids = dict()
for line in open('feature/fluidin.csv'):
id=line.split(',')[1]
ids[id] = ids.get(id, 0) + 1
print(ids)
| ids = dict()
for line in open('feature/fluidin.csv'):
id = line.split(',')[1]
ids[id] = ids.get(id, 0) + 1
print(ids) |
# Written by Matheus Violaro Bellini
########################################
# This is a quick tool to visualize the values
# that a half floating point can achieve
#
# To use this code, simply input the index
# of the binary you wa... | def interpret_float(num):
result = 0
base = 0
is_negative = 0
if num[0] == 1:
is_negative = 1
is_zero = num[2] == num[3] == num[4] == num[5] == num[6] == 0
is_one = num[2] == num[3] == num[4] == num[5] == num[6] == 1
if is_zero:
return 0
elif is_one and is_negative:
... |
def sum_fibs(n):
fibo = []
a, b = 0, 1
even_sum = 0
for i in range(2, n+1):
a, b = b, a+b
fibo.append(b)
for x in fibo:
if x % 2 == 0:
even_sum = even_sum + x
return even_sum
print(sum_fibs(9)) | def sum_fibs(n):
fibo = []
(a, b) = (0, 1)
even_sum = 0
for i in range(2, n + 1):
(a, b) = (b, a + b)
fibo.append(b)
for x in fibo:
if x % 2 == 0:
even_sum = even_sum + x
return even_sum
print(sum_fibs(9)) |
# Recursion needs two things:
# 1: A base case (if x then y)
# 2: A Recursive (inductive) case
# a way to simplify the problem after simple ops.
# 1: factorial
def factorial(fact):
if fact <= 1: # Base Case: x=1
return 1
else:
return fact * factorial(fact-1)
print(factorial(6))
def... | def factorial(fact):
if fact <= 1:
return 1
else:
return fact * factorial(fact - 1)
print(factorial(6))
def exponential(b, n):
if n == 1:
return b
else:
return b * exponential(b, n - 1)
print(exponential(2, 5))
def palindrome(strPalindrome):
if len(strPalindrome) <=... |
# Subset rows from India, Hyderabad to Iraq, Baghdad
print(temperatures_srt.loc[("India", "Hyderabad"):("Iraq", "Baghdad")])
# Subset columns from date to avg_temp_c
print(temperatures_srt.loc[:, "date":"avg_temp_c"])
# Subset in both directions at once
print(temperatures_srt.loc[("India", "Hyderabad"):("Iraq"... | print(temperatures_srt.loc[('India', 'Hyderabad'):('Iraq', 'Baghdad')])
print(temperatures_srt.loc[:, 'date':'avg_temp_c'])
print(temperatures_srt.loc[('India', 'Hyderabad'):('Iraq', 'Baghdad'), 'date':'avg_temp_c']) |
# 15/15
number_of_lines = int(input())
compressed_messages = []
for _ in range(number_of_lines):
decompressed = input()
compressed = ""
symbol = ""
count = 0
for character in decompressed:
if not symbol:
symbol = character
count = 1
continue
... | number_of_lines = int(input())
compressed_messages = []
for _ in range(number_of_lines):
decompressed = input()
compressed = ''
symbol = ''
count = 0
for character in decompressed:
if not symbol:
symbol = character
count = 1
continue
if character =... |
class Score:
def __init__(self):
self._score = 0
def get_score(self):
return self._score
def add_score(self, score):
self._score += score | class Score:
def __init__(self):
self._score = 0
def get_score(self):
return self._score
def add_score(self, score):
self._score += score |
# coding: utf-8
password_livechan = 'annacookie'
url = 'https://kotchan.org'
kotch_url = 'http://0.0.0.0:8888'
| password_livechan = 'annacookie'
url = 'https://kotchan.org'
kotch_url = 'http://0.0.0.0:8888' |
a=input()
k = -1
for i in range(len(a)):
if a[i] == '(':
k=i
print(a[:k].count('@='),a[k+5:].count('=@')) | a = input()
k = -1
for i in range(len(a)):
if a[i] == '(':
k = i
print(a[:k].count('@='), a[k + 5:].count('=@')) |
# -*- coding: utf-8 -*-
def main():
s = input()
k = int(input())
one_count = 0
for si in s:
if si == '1':
one_count += 1
else:
break
if s[0] == '1':
if k == 1:
print(s[0])
elif one_count >= k:
print... | def main():
s = input()
k = int(input())
one_count = 0
for si in s:
if si == '1':
one_count += 1
else:
break
if s[0] == '1':
if k == 1:
print(s[0])
elif one_count >= k:
print(1)
elif one_count < k:
pr... |
# Huu Hung Nguyen
# 09/19/2021
# windchill.py
# The program prompts the user for the temperature in Celsius,
# and the wind velocity in kilometers per hour.
# It then calculates the wind chill temperature and prints the result.
# Prompt user for temperature in Celsius
temp = float(input('Enter temperature in d... | temp = float(input('Enter temperature in degrees Celsius: '))
wind_velocity = float(input('Enter wind velocity in kilometers/hour: '))
wind_chill_temp = 13.12 + 0.6215 * temp - 11.37 * wind_velocity ** 0.16 + 0.3965 * temp * wind_velocity ** 0.16
print(f'The wind chill temperature in degrees Celsius is {wind_chill_temp... |
def read_next(*args, **kwargs):
for arg in args:
for elem in arg:
yield elem
for item in kwargs.keys():
yield item
for item in read_next("string", (2,), {"d": 1, "I": 2, "c": 3, "t": 4}):
print(item, end='')
for i in read_next("Need", (2, 3), ["words", "."]):
print(i)
| def read_next(*args, **kwargs):
for arg in args:
for elem in arg:
yield elem
for item in kwargs.keys():
yield item
for item in read_next('string', (2,), {'d': 1, 'I': 2, 'c': 3, 't': 4}):
print(item, end='')
for i in read_next('Need', (2, 3), ['words', '.']):
print(i) |
class Enrollment:
def __init__(self, eid, s, c, g):
self.enroll_id = eid
self.course = c
self.student = s
self.grade = g
| class Enrollment:
def __init__(self, eid, s, c, g):
self.enroll_id = eid
self.course = c
self.student = s
self.grade = g |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
cl = headA
cr = headB
cc = {}
while cl != None:
... | class Solution:
def get_intersection_node(self, headA: ListNode, headB: ListNode) -> ListNode:
cl = headA
cr = headB
cc = {}
while cl != None:
cc[cl] = 1
cl = cl.next
while cr != None:
if cr in cc:
return cr
els... |
class Light:
def __init__(self, always_on: bool, timeout: int):
self.always_on = always_on
self.timeout = timeout | class Light:
def __init__(self, always_on: bool, timeout: int):
self.always_on = always_on
self.timeout = timeout |
class PrimeNumbers:
def getAllPrimes(self, n):
sieves = [True] * (n + 1)
for i in range(2, n + 1):
if i * i > n:
break
if sieves[i]:
for j in range(i + i, n + 1, i):
sieves[j] = False
for i in range(2, n + 1):
... | class Primenumbers:
def get_all_primes(self, n):
sieves = [True] * (n + 1)
for i in range(2, n + 1):
if i * i > n:
break
if sieves[i]:
for j in range(i + i, n + 1, i):
sieves[j] = False
for i in range(2, n + 1):
... |
for i in range(int(input())):
s = input()
prev = s[0]
cnt = 1
for i in range(1,len(s)):
if prev == s[i]:
cnt+=1
else:
print("{}{}".format(cnt,prev),end="")
prev = s[i]
cnt =1
print("{}{}".format(cnt,prev)) | for i in range(int(input())):
s = input()
prev = s[0]
cnt = 1
for i in range(1, len(s)):
if prev == s[i]:
cnt += 1
else:
print('{}{}'.format(cnt, prev), end='')
prev = s[i]
cnt = 1
print('{}{}'.format(cnt, prev)) |
#!/usr/bin/python3
if __name__ == "__main__":
# open text file to read
file = open('write_file.txt', 'w')
# read a line from the file
file.write('I am excited to learn Python using Raspberry Pi Zero\n')
file.close()
file = open('write_file.txt', 'r')
data = file.read()
print(data)
file.close() | if __name__ == '__main__':
file = open('write_file.txt', 'w')
file.write('I am excited to learn Python using Raspberry Pi Zero\n')
file.close()
file = open('write_file.txt', 'r')
data = file.read()
print(data)
file.close() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Frame:
def __init__(self, control):
self.control=control
self.player=[]
self.timer=self.control.timer
self.weapons=self.control.rocket_types
self.any_key=True
def draw(self):
self.player=self.control.world... | class Frame:
def __init__(self, control):
self.control = control
self.player = []
self.timer = self.control.timer
self.weapons = self.control.rocket_types
self.any_key = True
def draw(self):
self.player = self.control.world.gamers[self.control.worm_no]
h... |
class UndergroundSystem:
def __init__(self):
self.inMap = {}
self.outMap = {}
def checkIn(self, id: int, stationName: str, t: int) -> None:
self.inMap[id] = (stationName, t)
def checkOut(self, id: int, stationName: str, t: int) -> None:
start = self.i... | class Undergroundsystem:
def __init__(self):
self.inMap = {}
self.outMap = {}
def check_in(self, id: int, stationName: str, t: int) -> None:
self.inMap[id] = (stationName, t)
def check_out(self, id: int, stationName: str, t: int) -> None:
start = self.inMap[id][1]
... |
class Hangman:
text = [
'''\
____
| |
| o
| /|\\
| |
| / \\
_|_
| |______
| |
|__________|\
''',
'''\
____
| |
| o
| /|\\
| |
| /
_|_
| |______
| |
|__________|\
''',
'''\
____
| |
| o
| /|\\
| |
|
_|_
| |_____... | class Hangman:
text = [' ____\n | |\n | o\n | /|\\\n | |\n | / \\\n _|_\n| |______\n| |\n|__________|', ' ____\n | |\n | o\n | /|\\\n | |\n | /\n _|_\n| |______\n| |\n|__________|', ' ____\n | |\n | o\n | /|\\\n | |\n |\n _|_\n| |____... |
# Reverse bits of a given 32 bits unsigned integer.
# For example, given input 43261596 (represented in binary as 00000010100101000001111010011100),
# return 964176192 (represented in binary as 00111001011110000010100101000000).
#
# Follow up:
# If this function is called many times, how would you optimize it?
# https... | def reverse_bits(d, bits_to_fill=32):
print('{0:b}'.format(d))
n = d.bit_length()
rev_d = 0
need_to_shift = 0
for shift in range(n):
need_to_shift += 1
print('{0:b}'.format(d >> shift))
if d & 1 << shift:
rev_d = rev_d << need_to_shift | 1
need_to_shif... |
print("Welcome to Civil War Predictor, which predicts whether your country will get in Civil War 100% Correctly.\nUnless It Doesn't.")
country = input("What country would you like to predict Civil War for? ")
if 'America' in country: #note that this does not include the middle east or literally any-fucking-where else, ... | print("Welcome to Civil War Predictor, which predicts whether your country will get in Civil War 100% Correctly.\nUnless It Doesn't.")
country = input('What country would you like to predict Civil War for? ')
if 'America' in country:
print('Your country will have a civil war soon!')
else:
print('Your country wi... |
class CUFS:
START: str = "/{SYMBOL}/Account/LogOn?ReturnUrl=%2F{SYMBOL}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3D{REALM}"
LOGOUT: str = "/{SYMBOL}/FS/LS?wa=wsignout1.0"
class UONETPLUS:
START: str = "/{SYMBOL}/LoginEndpoint.aspx"
GETKIDSLUCKYNUMBERS: str = "/{SYMBOL}/Start.mvc/GetKidsLuckyNumbers"
... | class Cufs:
start: str = '/{SYMBOL}/Account/LogOn?ReturnUrl=%2F{SYMBOL}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3D{REALM}'
logout: str = '/{SYMBOL}/FS/LS?wa=wsignout1.0'
class Uonetplus:
start: str = '/{SYMBOL}/LoginEndpoint.aspx'
getkidsluckynumbers: str = '/{SYMBOL}/Start.mvc/GetKidsLuckyNumbers'
g... |
class Solution:
def minimumDeletions(self, s: str) -> int:
answer=sys.maxsize
hasa=0
hasb=0
numa=[0]*len(s)
numb=[0]*len(s)
for i in range(len(s)):
numb[i]=hasb
if s[i]=='b':
hasb+=1
for i in range(len(s)-1,-1... | class Solution:
def minimum_deletions(self, s: str) -> int:
answer = sys.maxsize
hasa = 0
hasb = 0
numa = [0] * len(s)
numb = [0] * len(s)
for i in range(len(s)):
numb[i] = hasb
if s[i] == 'b':
hasb += 1
for i in range(... |
def fibona(n):
a = 0
b = 1
for _ in range(n):
a, b = b, a + b
yield a
def main():
for i in fibona(10):
print(i)
if __name__ == "__main__":
main()
| def fibona(n):
a = 0
b = 1
for _ in range(n):
(a, b) = (b, a + b)
yield a
def main():
for i in fibona(10):
print(i)
if __name__ == '__main__':
main() |
def is_palindrome(s):
for i in range(len(s)):
if not (s[i] == s[::-1][i]):
return False
return True
def longest_palindrome(s):
candidates = []
for i in range(len(s)):
st = s[i:]
while st:
if is_palindrome(st):
candidates.append(st)
... | def is_palindrome(s):
for i in range(len(s)):
if not s[i] == s[::-1][i]:
return False
return True
def longest_palindrome(s):
candidates = []
for i in range(len(s)):
st = s[i:]
while st:
if is_palindrome(st):
candidates.append(st)
... |
a = 23
b = 143
c = a + b
d = 1000
e = d + c
F = 300
print(a)
print(b)
print(d)
print(e)
| a = 23
b = 143
c = a + b
d = 1000
e = d + c
f = 300
print(a)
print(b)
print(d)
print(e) |
# Copyright 2017 Google Inc. All rights reserved.
#
# 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 a... | airports = {u'ABQ': u'Albuquerque International Sunport Airport', u'ACA': u'General Juan N Alvarez International Airport', u'ADW': u'Andrews Air Force Base', u'AFW': u'Fort Worth Alliance Airport', u'AGS': u'Augusta Regional At Bush Field', u'AMA': u'Rick Husband Amarillo International Airport', u'ANC': u'Ted Stevens A... |
# The [Hu] system
# The similar philosophy but different approach of GAN.
# A revivable self-supervised Learning system
# The theory contains two:
# 1. The Hu system consists of two agents: the first agent try to provide a good initial solution for the second
# to optimize until the solution meets the specified req... | class Hu(object):
def __init__(self):
self.layers = [] |
# 15/15
games = [input() for i in range(6)]
wins = games.count("W")
if wins >= 5:
print(1)
elif wins >= 3:
print(2)
elif wins >= 1:
print(3)
else:
print(-1)
| games = [input() for i in range(6)]
wins = games.count('W')
if wins >= 5:
print(1)
elif wins >= 3:
print(2)
elif wins >= 1:
print(3)
else:
print(-1) |
N = int(input())
qnt_copos = 0
for i in range(1, N + 1):
L, C = map(int, input().split())
if L > C:
qnt_copos += C
print(qnt_copos) | n = int(input())
qnt_copos = 0
for i in range(1, N + 1):
(l, c) = map(int, input().split())
if L > C:
qnt_copos += C
print(qnt_copos) |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# coding=UTF-8
#------------------------------------------------------------------------------
# Copyright (c) 2007-2021, Acoular Development Team.
#------------------------------------------------------------------------------
# separate file to find out about version without importing the acoular lib
__author_... | __author__ = 'Acoular Development Team'
__date__ = '5 May 2021'
__version__ = '21.05' |
# CHeck if running from inside jupyter
# From https://stackoverflow.com/questions/47211324/check-if-module-is-running-in-jupyter-or-not
def type_of_script():
try:
ipy_str = str(type(get_ipython()))
if 'zmqshell' in ipy_str:
return 'jupyter'
if 'terminal' in ipy_str:
r... | def type_of_script():
try:
ipy_str = str(type(get_ipython()))
if 'zmqshell' in ipy_str:
return 'jupyter'
if 'terminal' in ipy_str:
return 'ipython'
except:
return 'terminal' |
# A Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
# Create tuple
fruits = ('Apples', 'Oranges', 'Grapes')
# Using a constructor
# fruits2 = tuple(('Apples', 'Oranges', 'Grapes'))
# Single value needs trailing comma
fruits2 = ('Apples',)
# Get value
print(fruits[1])
# Can't chan... | fruits = ('Apples', 'Oranges', 'Grapes')
fruits2 = ('Apples',)
print(fruits[1])
fruits[0] = 'Pears'
del fruits2
print(len(fruits))
fruits_set = {'Apples', 'Oranges', 'Mango'}
print('Apples' in fruits_set)
fruits_set.add('Grape')
fruits_set.remove('Grape')
fruits_set.add('Apples')
fruits_set.clear()
del fruits_set
print... |
n = int(__import__('sys').stdin.readline())
a = [int(_) for _ in __import__('sys').stdin.readline().split()]
res = [-1] * n
for i in range(n):
for j in range(n):
if a[j] > i:
continue
c = 0
for front in range(i):
if res[front] > j:
c += 1
if c ... | n = int(__import__('sys').stdin.readline())
a = [int(_) for _ in __import__('sys').stdin.readline().split()]
res = [-1] * n
for i in range(n):
for j in range(n):
if a[j] > i:
continue
c = 0
for front in range(i):
if res[front] > j:
c += 1
if c ... |
# coding=utf-8
region_name = ""
access_key = ""
access_secret = ""
endpoint = None
app_id = ""
acl_ak = ""
acl_access_secret = ""
| region_name = ''
access_key = ''
access_secret = ''
endpoint = None
app_id = ''
acl_ak = ''
acl_access_secret = '' |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Script to calculate Basic Statistics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Equation for the mean: $\\mu_x = \\sum_{i=1}^{N}\\frac{x_i}{N}$\n",
"\n",
"### Equation for the sta... | {'cells': [{'cell_type': 'markdown', 'metadata': {}, 'source': ['## Script to calculate Basic Statistics']}, {'cell_type': 'markdown', 'metadata': {}, 'source': ['### Equation for the mean: $\\mu_x = \\sum_{i=1}^{N}\\frac{x_i}{N}$\n', '\n', '### Equation for the standard deviation: $\\sigma_x = \\sqrt{\\sum_{i=1}^{N... |
#
# PySNMP MIB module ALVARION-TOOLS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-TOOLS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:22:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_notification_enable,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionNotificationEnable')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_valu... |
# TODO - Update THINGS value with your things. These are the SNAP MACs for your devices, ex: "abc123"
# Addresses should not have any separators (no "." Or ":", etc.). The hexadecimal digits a-f must be entered in lower case.
THINGS = ["XXXXXX"]
PROFILE_NAME = "default"
CERTIFICATE_CERT = "certs/certificate_cert.pem"
C... | things = ['XXXXXX']
profile_name = 'default'
certificate_cert = 'certs/certificate_cert.pem'
certificate_key = 'certs/certificate_key.pem'
cafile = 'certs/demo.pem' |
RUN_TEST = False
TEST_SOLUTION = 739785
TEST_INPUT_FILE = "test_input_day_21.txt"
INPUT_FILE = "input_day_21.txt"
ARGS = []
def game_over(scores):
return scores[0] >= 1000 or scores[1] >= 1000
def losing_player_score(scores):
return scores[0] if scores[0] < scores[1] else scores[1]
def main_part1(
in... | run_test = False
test_solution = 739785
test_input_file = 'test_input_day_21.txt'
input_file = 'input_day_21.txt'
args = []
def game_over(scores):
return scores[0] >= 1000 or scores[1] >= 1000
def losing_player_score(scores):
return scores[0] if scores[0] < scores[1] else scores[1]
def main_part1(input_file)... |
class dotRebarEndDetailStrip_t(object):
# no doc
RebarHookData=None
RebarStrip=None
RebarThreading=None
| class Dotrebarenddetailstrip_T(object):
rebar_hook_data = None
rebar_strip = None
rebar_threading = None |
x = 1
if x == 1:
print("x is 1")
else:
print("x is not 1")
| x = 1
if x == 1:
print('x is 1')
else:
print('x is not 1') |
# lextab.py. This file automatically created by PLY (version 3.4). Don't edit!
_tabversion = "3.4"
_lextokens = {
"SHORT": 1,
"BOOLCONSTANT": 1,
"USHORT": 1,
"UBYTE": 1,
"DUBCONSTANT": 1,
"FILE_IDENTIFIER": 1,
"ULONG": 1,
"FILE_EXTENSION": 1,
"LONG": 1,
"UNION": 1,
"TABLE": 1... | _tabversion = '3.4'
_lextokens = {'SHORT': 1, 'BOOLCONSTANT': 1, 'USHORT': 1, 'UBYTE': 1, 'DUBCONSTANT': 1, 'FILE_IDENTIFIER': 1, 'ULONG': 1, 'FILE_EXTENSION': 1, 'LONG': 1, 'UNION': 1, 'TABLE': 1, 'IDENTIFIER': 1, 'STRING': 1, 'INTCONSTANT': 1, 'ENUM': 1, 'NAMESPACE': 1, 'LITERAL': 1, 'UINT': 1, 'BYTE': 1, 'INCLUDE': ... |
#
# Copyright (c) 2017 Amit Green. All rights reserved.
#
@gem('Gem.Core')
def gem():
@export
def execute(f):
f()
return execute
#
# intern_arrange
#
@built_in
def intern_arrange(format, *arguments):
return intern_string(format % arguments)
#
# lin... | @gem('Gem.Core')
def gem():
@export
def execute(f):
f()
return execute
@built_in
def intern_arrange(format, *arguments):
return intern_string(format % arguments)
flush_standard_output = PythonSystem.stdout.flush
write_standard_output = PythonSystem.stdout.write
@bu... |
set_name(0x8013923C, "PreGameOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x8013B300, "DRLG_PlaceDoor__Fii", SN_NOWARN)
set_name(0x8013B7D4, "DRLG_L1Shadows__Fv", SN_NOWARN)
set_name(0x8013BBEC, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN)
set_name(0x8013C058, "DRLG_L1Floor__Fv", SN_NOWARN)
set_name(0x8013C144, "StoreBlo... | set_name(2148766268, 'PreGameOnlyTestRoutine__Fv', SN_NOWARN)
set_name(2148774656, 'DRLG_PlaceDoor__Fii', SN_NOWARN)
set_name(2148775892, 'DRLG_L1Shadows__Fv', SN_NOWARN)
set_name(2148776940, 'DRLG_PlaceMiniSet__FPCUciiiiiii', SN_NOWARN)
set_name(2148778072, 'DRLG_L1Floor__Fv', SN_NOWARN)
set_name(2148778308, 'StoreBlo... |
#!/usr/bin/env python3
#############################################################################
# #
# Program purpose: Test whether a number is within 100 of 1000 or #
# 2000. ... | def check_num(some_num):
return abs(1000 - some_num) <= 100 or abs(2000 - some_num) <= 100
if __name__ == '__main__':
user_int = int(input('Enter a number near a {}: '.format(1000)))
if check_num(user_int):
print('TRUE')
else:
print('False') |
STATS = [
{
"num_node_expansions": 5758,
"plan_cost": 130,
"plan_length": 130,
"search_time": 10.8434,
"total_time": 11.515
},
{
"num_node_expansions": 9619,
"plan_cost": 127,
"plan_length": 127,
"search_time": 21.8034,
"total_t... | stats = [{'num_node_expansions': 5758, 'plan_cost': 130, 'plan_length': 130, 'search_time': 10.8434, 'total_time': 11.515}, {'num_node_expansions': 9619, 'plan_cost': 127, 'plan_length': 127, 'search_time': 21.8034, 'total_time': 22.4716}, {'num_node_expansions': 5995, 'plan_cost': 107, 'plan_length': 107, 'search_time... |
'''
This program will do the following:
1. Ask for input of the amount of organisms
2. Ask for input of the daily population increase in percent
3. Ask for input of the maximum days the organism multiplies
4. Calculate the total population per day
5. Print the results for each day
'''
# ===Begin Loop
whi... | """
This program will do the following:
1. Ask for input of the amount of organisms
2. Ask for input of the daily population increase in percent
3. Ask for input of the maximum days the organism multiplies
4. Calculate the total population per day
5. Print the results for each day
"""
while True:
organisms = int(in... |
def bool_strings():
bools = []
for b in ['T', 'true', 'True', 'TRUE', 'F', 'false', 'False', 'FALSE']:
bools.append((b.lower().startswith('t'), b))
return bools
def test_bool_scalars(tmp_path, helpers):
helpers.do_test_scalar(tmp_path, bool_strings())
def test_bool_one_d_arrays(tmp_path, help... | def bool_strings():
bools = []
for b in ['T', 'true', 'True', 'TRUE', 'F', 'false', 'False', 'FALSE']:
bools.append((b.lower().startswith('t'), b))
return bools
def test_bool_scalars(tmp_path, helpers):
helpers.do_test_scalar(tmp_path, bool_strings())
def test_bool_one_d_arrays(tmp_path, helpe... |
class Solution:
def containsCycle(self, grid: List[List[str]]) -> bool:
rows, cols, visited, directions = len(grid), len(grid[0]), set(), [(0, 1), (1, 0), (0, -1), (-1, 0)]
def dfs(row, col, parentX, parentY, length):
visited.add((row, col))
for dirX, dirY in directi... | class Solution:
def contains_cycle(self, grid: List[List[str]]) -> bool:
(rows, cols, visited, directions) = (len(grid), len(grid[0]), set(), [(0, 1), (1, 0), (0, -1), (-1, 0)])
def dfs(row, col, parentX, parentY, length):
visited.add((row, col))
for (dir_x, dir_y) in direc... |
print(
min(
filter(
lambda x: x % 2 != 0,
map(
int,
input().split()
)
)
)
)
| print(min(filter(lambda x: x % 2 != 0, map(int, input().split())))) |
X = 1
def nester():
X = 2
print(X)
class C:
X = 3
print(X)
def method1(self):
print(X)
print(self.X)
def method2(self):
X = 4
print(X)
self.X = 5
print(self.X)
I = C()
I.method1()
I.method2(... | x = 1
def nester():
x = 2
print(X)
class C:
x = 3
print(X)
def method1(self):
print(X)
print(self.X)
def method2(self):
x = 4
print(X)
self.X = 5
print(self.X)
i = c()
I.method1()
I.method... |
#from django import http
# adapted from http://djangosnippets.org/snippets/2472/
class CloudMiddleware(object):
def process_request(self, request):
if 'HTTP_X_FORWARDED_PROTO' in request.META:
if request.META['HTTP_X_FORWARDED_PROTO'] == 'https':
request.is_secure = lambda: Tru... | class Cloudmiddleware(object):
def process_request(self, request):
if 'HTTP_X_FORWARDED_PROTO' in request.META:
if request.META['HTTP_X_FORWARDED_PROTO'] == 'https':
request.is_secure = lambda : True
return None |
'''
A simple script for printing numbers
'''
def func1():
'''
func1 is simple methdo which shows the number which are entered inside.
'''
first_num = 1
second_num = 2
print(first_num)
print(second_num)
func1()
# When we run this program using pylint then we can get our code evaluted.
# I... | """
A simple script for printing numbers
"""
def func1():
"""
func1 is simple methdo which shows the number which are entered inside.
"""
first_num = 1
second_num = 2
print(first_num)
print(second_num)
func1() |
class Solution:
def dfs(self, image: List[List[int]], sr: int, sc: int, newColor: int, DIR: List[List[int]], startColor: int) -> List[List[int]]:
image[sr][sc] = newColor
visited = set()
visited.add((sr,sc))
for direction in DIR:
newRow, newCol = sr + di... | class Solution:
def dfs(self, image: List[List[int]], sr: int, sc: int, newColor: int, DIR: List[List[int]], startColor: int) -> List[List[int]]:
image[sr][sc] = newColor
visited = set()
visited.add((sr, sc))
for direction in DIR:
(new_row, new_col) = (sr + direction[0],... |
# Author : Babu Baskaran
# Date : 05/04/2019 Time : 17:00 pm
# Solution for problem number 1
# taking user input
user1=int (input("Please Enter a Positive Integer : "))
# assigning user input into a variable
start = user1
# set i start value into 1
i = 1
# set value of variable ans to zero
ans = 0
# check the i val... | user1 = int(input('Please Enter a Positive Integer : '))
start = user1
i = 1
ans = 0
while i <= start:
ans = ans + i
i = i + 1
print(ans) |
units = {
"DecimalDegrees": "degrees",
"WGS_1984": "WGS84",
"Meters": "meters",
"": "",
"Unknown": "Unknown",
}
| units = {'DecimalDegrees': 'degrees', 'WGS_1984': 'WGS84', 'Meters': 'meters', '': '', 'Unknown': 'Unknown'} |
class CommandResponse(object):
def __init__(self):
self.messages = []
self.named = {}
self.errors = []
def __getitem__(self, name):
return self.get_named_data(name)
@property
def active_user(self):
return self.get_named_data('active_user')
@property
... | class Commandresponse(object):
def __init__(self):
self.messages = []
self.named = {}
self.errors = []
def __getitem__(self, name):
return self.get_named_data(name)
@property
def active_user(self):
return self.get_named_data('active_user')
@property
de... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findTilt(self, root: TreeNode) -> int:
sum_tree, tilt_tree = self.sum_and_tilt(root)
return tilt_tree
def sum_an... | class Solution:
def find_tilt(self, root: TreeNode) -> int:
(sum_tree, tilt_tree) = self.sum_and_tilt(root)
return tilt_tree
def sum_and_tilt(self, root):
if not root:
return (0, 0)
(sum_left, tilt_left) = self.sum_and_tilt(root.left)
(sum_right, tilt_right)... |
'''
Comparison data as seen here,
http://www.nand2tetris.org/
'''
'''------------------------- Arithmetic gates -------------------------'''
k_halfAdder = [
# [ a, b, ( sum, carry ) ]
[ 0, 0, ( 0, 0 ) ],
[ 0, 1, ( 1, 0 ) ],
[ 1, 0, ( 1, 0 ) ],
[ 1, 1, ( 0, 1 ) ],
]
k_fullAdder = [
# [ a, b, c, ( sum, carry ... | """
Comparison data as seen here,
http://www.nand2tetris.org/
"""
'------------------------- Arithmetic gates -------------------------'
k_half_adder = [[0, 0, (0, 0)], [0, 1, (1, 0)], [1, 0, (1, 0)], [1, 1, (0, 1)]]
k_full_adder = [[0, 0, 0, (0, 0)], [0, 0, 1, (1, 0)], [0, 1, 0, (1, 0)], [0, 1, 1, (0, 1)], [1, 0, 0... |
class QuizBrain:
def __init__(self,question_list):
self.question_number = 0
self.score = 0
self.question_list = question_list
def next_question(self):
self.guess = input(f"Q{self.question_number + 1}: {self.question_list[self.question_number].question} True or False: ")
... | class Quizbrain:
def __init__(self, question_list):
self.question_number = 0
self.score = 0
self.question_list = question_list
def next_question(self):
self.guess = input(f'Q{self.question_number + 1}: {self.question_list[self.question_number].question} True or False: ')
... |
mooniswap_abi = [
{
"inputs": [
{"internalType": "contract IERC20", "name": "_token0", "type": "address"},
{"internalType": "contract IERC20", "name": "_token1", "type": "address"},
{"internalType": "string", "name": "name", "type": "string"},
{"internalType":... | mooniswap_abi = [{'inputs': [{'internalType': 'contract IERC20', 'name': '_token0', 'type': 'address'}, {'internalType': 'contract IERC20', 'name': '_token1', 'type': 'address'}, {'internalType': 'string', 'name': 'name', 'type': 'string'}, {'internalType': 'string', 'name': 'symbol', 'type': 'string'}, {'internalType'... |
msg = None
if msg:
print(msg)
| msg = None
if msg:
print(msg) |
def counter(c_var):
while True:
try:
c_var = c_var + 1
except KeyboardInterrupt:
print('Counter now at: ' + str(c_var))
def counter_p(c_var):
while True:
c_var = c_var + 1
print(c_var) | def counter(c_var):
while True:
try:
c_var = c_var + 1
except KeyboardInterrupt:
print('Counter now at: ' + str(c_var))
def counter_p(c_var):
while True:
c_var = c_var + 1
print(c_var) |
# Type definiton for (type, data) tuples representing a value
# See http://androidxref.com/9.0.0_r3/xref/frameworks/base/libs/androidfw/include/androidfw/ResourceTypes.h#262
# The 'data' is either 0 or 1, specifying this resource is either
# undefined or empty, respectively.
TYPE_NULL = 0x00
# The 'data' holds a ResTa... | type_null = 0
type_reference = 1
type_attribute = 2
type_string = 3
type_float = 4
type_dimension = 5
type_fraction = 6
type_dynamic_reference = 7
type_dynamic_attribute = 8
type_first_int = 16
type_int_dec = 16
type_int_hex = 17
type_int_boolean = 18
type_first_color_int = 28
type_int_color_argb8 = 28
type_int_color_r... |
words=['Aaron',
'Ab',
'Abba',
'Abbe',
'Abbey',
'Abbie',
'Abbot',
'Abbott',
'Abby',
'Abdel',
'Abdul',
'Abe',
'Abel',
'Abelard',
'Abeu',
'Abey',
'Abie',
'Abner',
'Abraham',
'Abrahan',
'Abram',
'Abramo',
'Abran',
'Ad',
'Adair',
'Adam',
'Adamo',
'Adams',
'Adan',
'Addie',
'Addison',
'Addy',
'Ade',
'Adelbert',
'Adham',
'Adla... | words = ['Aaron', 'Ab', 'Abba', 'Abbe', 'Abbey', 'Abbie', 'Abbot', 'Abbott', 'Abby', 'Abdel', 'Abdul', 'Abe', 'Abel', 'Abelard', 'Abeu', 'Abey', 'Abie', 'Abner', 'Abraham', 'Abrahan', 'Abram', 'Abramo', 'Abran', 'Ad', 'Adair', 'Adam', 'Adamo', 'Adams', 'Adan', 'Addie', 'Addison', 'Addy', 'Ade', 'Adelbert', 'Adham', 'Ad... |
# by Kami Bigdely
# Extract class
class Actor:
def __init__(self, first_name, last_name, birth_year, movies, email) -> None:
self.first_name = first_name
self.last_name = last_name
self.birth_year = birth_year
self.movies = movies
self.email = email
def send_hiring_... | class Actor:
def __init__(self, first_name, last_name, birth_year, movies, email) -> None:
self.first_name = first_name
self.last_name = last_name
self.birth_year = birth_year
self.movies = movies
self.email = email
def send_hiring_email(self):
print('Email sent... |
#creating a function
def cal(one,two):
three=float(one)-float(two)
print(three)
return
cal(1,4)
| def cal(one, two):
three = float(one) - float(two)
print(three)
return
cal(1, 4) |
class XYZfileWrongFormat(Exception):
pass
class XYZfileDidNotExist(Exception):
pass
| class Xyzfilewrongformat(Exception):
pass
class Xyzfiledidnotexist(Exception):
pass |
def number_length(a: int) -> int:
# your code here
# algorithm
# 1) Will recive an argument called "a" of datatype "int"
# 2) Convert the integer into a string
# 3) Calculate the length of the string
# 4) Return the Length of the string
return len(str(a))
def number_length_two(a: int) -> in... | def number_length(a: int) -> int:
return len(str(a))
def number_length_two(a: int) -> int:
mystring = str(a)
mylength = len(mystring)
return mylength
if __name__ == '__main__':
print('Example:')
print(number_length(10))
assert number_length(10) == 2
assert number_length(0) == 1
asse... |
# URI Online Judge 2152
N = int(input())
for n in range(N):
entrada = [int(i) for i in input().split()]
if entrada[2] == 0: estado = 'fechou'
else: estado = 'abriu'
print('{:02d}:{:02d} - A porta {}!'.format(entrada[0], entrada[1], estado)) | n = int(input())
for n in range(N):
entrada = [int(i) for i in input().split()]
if entrada[2] == 0:
estado = 'fechou'
else:
estado = 'abriu'
print('{:02d}:{:02d} - A porta {}!'.format(entrada[0], entrada[1], estado)) |
# Count and display the number of vowels,
# consonants, uppercase, lowercase characters in string
def countCharacterType(s):
vowels = 0
consonant = 0
lowercase = 0
uppercase = 0
for i in range(0, len(s)):
ch = s[i]
if ((ch >= 'a' and ch <= 'z') or
(ch >= 'A' and ch... | def count_character_type(s):
vowels = 0
consonant = 0
lowercase = 0
uppercase = 0
for i in range(0, len(s)):
ch = s[i]
if ch >= 'a' and ch <= 'z' or (ch >= 'A' and ch <= 'Z'):
if ch.islower():
lowercase += 1
if ch.isupper():
upp... |
class Solution:
def __init__(self, N: int, blacklist: List[int]):
self.validRange = N - len(blacklist)
self.dict = {}
for b in blacklist:
self.dict[b] = -1
for b in blacklist:
if b < self.validRange:
while N - 1 in self.dict:
N -= 1
self.dict[b] = N - 1
... | class Solution:
def __init__(self, N: int, blacklist: List[int]):
self.validRange = N - len(blacklist)
self.dict = {}
for b in blacklist:
self.dict[b] = -1
for b in blacklist:
if b < self.validRange:
while N - 1 in self.dict:
... |
totalelements=int(input())
numeratorele=[int(ele) for ele in input().split()]
denomele=[int(ele) for ele in input().split()]
resnumerator=0
if len(numeratorele) == len(denomele):
for i in range(totalelements):
cal=numeratorele[i]*denomele[i]
resnumerator+=cal
print(round(resnumerator/sum(denomele)... | totalelements = int(input())
numeratorele = [int(ele) for ele in input().split()]
denomele = [int(ele) for ele in input().split()]
resnumerator = 0
if len(numeratorele) == len(denomele):
for i in range(totalelements):
cal = numeratorele[i] * denomele[i]
resnumerator += cal
print(round(resnumerator /... |
def foo():
'''
>>> from mod import Good as Good
'''
pass # Ignore PyUnusedCodeBear
| def foo():
"""
>>> from mod import Good as Good
"""
pass |
#!/usr/bin/env python3
# Conditional statements check for a condition,
# and act accordingly.
# Python uses the `if/elif/else` structure for this.
# Example 1
if 2 > 1:
print("2 greater than 1")
# Example 2
var1 = 1
var2 = 10
if var1 > var2:
print("var1 greater than var2")
else:
print("var2 greater than ... | if 2 > 1:
print('2 greater than 1')
var1 = 1
var2 = 10
if var1 > var2:
print('var1 greater than var2')
else:
print('var2 greater than var1')
value = input('What is the price for that thing?')
value = int(value)
if value < 10:
print("That's great!")
elif 10 <= value <= 20:
print('I would still buy it... |
class Rollout:
'''
Usage: rollout = Rollout(state)
'''
def __init__(self, state):
self.state_list = [state]
self.action_list = []
self.reward_list = []
self.act_val_list = []
self.done = False
def append(self, state, action, reward, done, act_val):
... | class Rollout:
"""
Usage: rollout = Rollout(state)
"""
def __init__(self, state):
self.state_list = [state]
self.action_list = []
self.reward_list = []
self.act_val_list = []
self.done = False
def append(self, state, action, reward, done, act_val):
s... |
#!/usr/bin/env python
TEST_PUBLIC_KEY = 5764801
CARD_PUBLIC_KEY = 18499292
DOOR_PUBLIC_KEY = 8790390
def find_loop_size(
target_key,
subject=7,
starting_value=1,
):
value = starting_value
loop_size = 0
while value != target_key:
value = value * subject
value = value % 20201227... | test_public_key = 5764801
card_public_key = 18499292
door_public_key = 8790390
def find_loop_size(target_key, subject=7, starting_value=1):
value = starting_value
loop_size = 0
while value != target_key:
value = value * subject
value = value % 20201227
loop_size += 1
return loop... |
class BaseDerivative:
def __init__(self, config, instance, *args, **kwargs):
self.config = config
self.instance = instance
| class Basederivative:
def __init__(self, config, instance, *args, **kwargs):
self.config = config
self.instance = instance |
class Solution:
def reorderedPowerOf2(self, N: int) -> bool:
x="".join(i for i in sorted(str(N)))
for i in range(30):
s="".join(i for i in sorted(str(2**i)))
if s==x:
print(s)
return True
return False
| class Solution:
def reordered_power_of2(self, N: int) -> bool:
x = ''.join((i for i in sorted(str(N))))
for i in range(30):
s = ''.join((i for i in sorted(str(2 ** i))))
if s == x:
print(s)
return True
return False |
#-----------------------------------------------------------------------------
# Copyright (c) 2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | hiddenimports = ['pywt._extensions._cwt'] |
def bbox_mk(p1, p2, offset=(0, 0)):
x1 = min(p1[0], p2[0]) - offset[0]
x2 = max(p1[0], p2[0]) + offset[0]
y1 = min(p1[1], p2[1]) - offset[1]
y2 = max(p1[1], p2[1]) + offset[1]
return (x1, y1), (x2, y2)
def bbox_add_point(bbox, p, offset=(0, 0)):
x1 = min(bbox[0][0], p[0] - offset[0])
x2 ... | def bbox_mk(p1, p2, offset=(0, 0)):
x1 = min(p1[0], p2[0]) - offset[0]
x2 = max(p1[0], p2[0]) + offset[0]
y1 = min(p1[1], p2[1]) - offset[1]
y2 = max(p1[1], p2[1]) + offset[1]
return ((x1, y1), (x2, y2))
def bbox_add_point(bbox, p, offset=(0, 0)):
x1 = min(bbox[0][0], p[0] - offset[0])
x2 =... |
#!/usr/bin/python3
def isprime(n):
if n == 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def primes(n = 1):
while(True):
if isprime(n): yield n
n += 1
for n in primes():
if n > 100: break
print(n)
| def isprime(n):
if n == 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def primes(n=1):
while True:
if isprime(n):
yield n
n += 1
for n in primes():
if n > 100:
break
print(n) |
#!/usr/bin/env python
class Service(object):
pass
| class Service(object):
pass |
model_params = dict(
image_shape=(1, 256, 256),
n_part_caps=30,
n_obj_caps=16,
scae_regression_params=dict(
is_active=True,
loss='mse',
attention_hp=1,
),
scae_classification_params=dict(
is_active=False,
n_classes=1,
),
pcae_cnn_encoder_params=dic... | model_params = dict(image_shape=(1, 256, 256), n_part_caps=30, n_obj_caps=16, scae_regression_params=dict(is_active=True, loss='mse', attention_hp=1), scae_classification_params=dict(is_active=False, n_classes=1), pcae_cnn_encoder_params=dict(out_channels=[128] * 4, kernel_sizes=[3, 3, 3, 3], strides=[2, 2, 1, 1], acti... |
# -*- coding: utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __eq__(self, other):
return (
other is not None and
self.val == other.val and
self.left == other.left and
self.rig... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __eq__(self, other):
return other is not None and self.val == other.val and (self.left == other.left) and (self.right == other.right)
class Solution:
def remove_leaf_nodes(self, roo... |
class Solution:
def longestPalindrome(self, s: str) -> int:
str_dict={}
for each in s:
if each not in str_dict:
str_dict[each]=0
str_dict[each]+=1
result=0
odd=0
for k, v in str_dict.items():
if v%2==0:
resul... | class Solution:
def longest_palindrome(self, s: str) -> int:
str_dict = {}
for each in s:
if each not in str_dict:
str_dict[each] = 0
str_dict[each] += 1
result = 0
odd = 0
for (k, v) in str_dict.items():
if v % 2 == 0:
... |
for desi in Parameters.GetAllDesignPoints():
for message in GetMessages():
if (DateTime.Compare(message.DateTimeStamp, startTime) == 1) and (message.DesignPoint == desi.Name):
desi.Retained = False
break
| for desi in Parameters.GetAllDesignPoints():
for message in get_messages():
if DateTime.Compare(message.DateTimeStamp, startTime) == 1 and message.DesignPoint == desi.Name:
desi.Retained = False
break |
def solve(heads,legs):
for i in range(heads+1):
j=heads-i
if (2*i)+(4*j)==legs:
print (i,j)
return
print("No solution")
#Start writing your code here
#Populate the variables: chicken_count and rabbit_count
# Use the below given print stateme... | def solve(heads, legs):
for i in range(heads + 1):
j = heads - i
if 2 * i + 4 * j == legs:
print(i, j)
return
print('No solution')
solve(38, 131) |
class Controller():
def __init__(self):
self.debugger = None
def get_cmd(self):
pass | class Controller:
def __init__(self):
self.debugger = None
def get_cmd(self):
pass |
class Solution:
def countDigitOne(self, n: int) -> int:
if n <= 0:
return 0
ln = len(str(n))
if ln == 1:
return 1
tmp1 = 10 ** (ln - 1)
firstnum = n // tmp1
fone = n % tmp1 + 1 if firstnum == 1 else tmp1
other = firstnum * (ln - 1) * (t... | class Solution:
def count_digit_one(self, n: int) -> int:
if n <= 0:
return 0
ln = len(str(n))
if ln == 1:
return 1
tmp1 = 10 ** (ln - 1)
firstnum = n // tmp1
fone = n % tmp1 + 1 if firstnum == 1 else tmp1
other = firstnum * (ln - 1) *... |
class PathNameChecker(object):
def check(self, pathname: str):
pass
| class Pathnamechecker(object):
def check(self, pathname: str):
pass |
total = 0
line = input()
while line != "NoMoreMoney":
current = float(line)
if current < 0:
print("Invalid operation!")
break
total += current
print(f"Increase: {current:.2f}")
line = input()
print(f"Total: {total:.2f}")
| total = 0
line = input()
while line != 'NoMoreMoney':
current = float(line)
if current < 0:
print('Invalid operation!')
break
total += current
print(f'Increase: {current:.2f}')
line = input()
print(f'Total: {total:.2f}') |
#
# PySNMP MIB module PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:36:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_range_constraint, value_size_constraint) ... |
# -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)][::-1]
memo = [0 for _ in range(n + 1)]
for ai in a:
if memo[ai] == 1:
continue
else:
memo[ai] = 1
print(ai)
for index, m in... | def main():
(n, m) = map(int, input().split())
a = [int(input()) for _ in range(m)][::-1]
memo = [0 for _ in range(n + 1)]
for ai in a:
if memo[ai] == 1:
continue
else:
memo[ai] = 1
print(ai)
for (index, m) in enumerate(memo):
if index == 0... |
#!/usr/bin/env python
# Parse key mapping
keymap = {}
with open('reverb.keymap', 'r') as mapping:
content = mapping.read()
for line in content.split("\n"):
if len(line) > 0:
fields = line.split("\t")
keymap[fields[0]] = fields[1] + "\t" + fields[2] + "\t" + fields[3]
# Training data
train = []
wit... | keymap = {}
with open('reverb.keymap', 'r') as mapping:
content = mapping.read()
for line in content.split('\n'):
if len(line) > 0:
fields = line.split('\t')
keymap[fields[0]] = fields[1] + '\t' + fields[2] + '\t' + fields[3]
train = []
with open('reverb_correct_train.keys', 'r')... |
# AUTHOR: Akash Rajak
# Python3 Concept: Matrix Transpose
# GITHUB: https://github.com/akash435
# Add your python3 concept below
def matrix_transpose():
for i in range(len(A)):
for j in range(len(A[0])):
res[i][j] = A[j][i]
A=[]
print("Enter N:")
n = int(input())
print("Enter Matrix A:")
for... | def matrix_transpose():
for i in range(len(A)):
for j in range(len(A[0])):
res[i][j] = A[j][i]
a = []
print('Enter N:')
n = int(input())
print('Enter Matrix A:')
for i in range(0, n):
temp = []
for j in range(0, n):
x = int(input())
temp.append(x)
A.append(temp)
res =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.