text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python3
import csv
import re
categories = {
# group; these are never used alone
'Ba': 'bamboo',
'Pm': 'palm and cycad',
'Su': 'succulent',
# type
'Bu': 'bulb',
'G': 'grass',
'Gc': 'groundcover',
'P': 'perennial',
'S': 'shrub',
'T': 'tree',
'V': 'vi... | {
"repo_name": "kielni/toyon",
"path": "scripts/format_wucols.py",
"copies": "1",
"size": "3439",
"license": "mit",
"hash": 99131805717791760,
"line_mean": 27.4214876033,
"line_max": 107,
"alpha_frac": 0.4594358825,
"autogenerated": false,
"ratio": 3.175438596491228,
"config_test": false,
"has... |
#!/bin/python3
import csv
import sys
import os
types = [
("FuelSystemStatus" , 0x03),
("CalculatedEngineLoad" , 0x04),
("EngineCoolantTemperature" , 0x05),
("ShortTermFuelTrim" , 0x06),
("LongTermFuelTrim" , 0x07),
("IntakeManifoldPressure" , 0x0B),
("EngineRPM" , 0x... | {
"repo_name": "AAU-Racing/embedded_car_g7",
"path": "the_csv_script.py",
"copies": "1",
"size": "2569",
"license": "mit",
"hash": 5230073221937486000,
"line_mean": 28.5287356322,
"line_max": 65,
"alpha_frac": 0.6216426625,
"autogenerated": false,
"ratio": 2.7593984962406015,
"config_test": fals... |
#!/bin/python3
import evdev
import pyudev
from threading import Event
from queue import Queue
# keyboard detection
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
devinput = "/dev/input/"
event_location = ""
device_list = []
monitor.filter_by('input')
print("kissa")
def log_event(actio... | {
"repo_name": "miikka-h/Projektikurssi17",
"path": "pi3/device_finder.py",
"copies": "1",
"size": "1611",
"license": "mit",
"hash": 7920462239913224000,
"line_mean": 22.6911764706,
"line_max": 86,
"alpha_frac": 0.5723153321,
"autogenerated": false,
"ratio": 3.854066985645933,
"config_test": fal... |
#!/bin/python3
import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils
import os
import argparse
import datetime
import sys
import re
import time
def main():
parser = argparse.ArgumentParser()
parser.add_argument('dir', metavar = 'd', help ="Folder of files to be processed and plotted")
parser.add_argument('... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "0_hcphotonics/0_archive/oceanoptics_outdated/plot3D.py",
"copies": "1",
"size": "2867",
"license": "apache-2.0",
"hash": 3626833020412489700,
"line_mean": 35.7564102564,
"line_max": 117,
"alpha_frac": 0.5047087548,
"autogenerated": false,
"rati... |
#!/bin/python3
import imdb, osm
import os
rootfolder ="C:\\Users\\Philip\\Documents\\Programming\\Subtitle-Fetcher\\Subtitles"
def find():
imdbx = imdb.imdb_api()
subfind = osm.subtitleFinder()
result = imdbx.search(input("Name of show:")) #
if len(result) > 1: #TV show
episode_list = {
... | {
"repo_name": "adavier/Subtitle-Fetcher",
"path": "main.py",
"copies": "1",
"size": "1516",
"license": "unlicense",
"hash": 5037168205759099000,
"line_mean": 34.2790697674,
"line_max": 128,
"alpha_frac": 0.5732189974,
"autogenerated": false,
"ratio": 3.6095238095238096,
"config_test": false,
... |
#!/bin/python3
import itertools
import collections
def sliding_window(n, seq):
"""
Copied from toolz
https://toolz.readthedocs.io/en/latest/_modules/toolz/itertoolz.html#sliding_window
A sequence of overlapping subsequences
>>> list(sliding_window(2, [1, 2, 3, 4]))
[(1, 2), (2, 3), (3, 4)]
... | {
"repo_name": "rootulp/hackerrank",
"path": "python/the-birthday-bar.py",
"copies": "1",
"size": "1199",
"license": "mit",
"hash": 8158184554582219000,
"line_mean": 29.7435897436,
"line_max": 87,
"alpha_frac": 0.6180150125,
"autogenerated": false,
"ratio": 3.3121546961325965,
"config_test": fal... |
#!/bin/python3
import json
import os
import argparse
from os.path import dirname
import shutil
def ensure_exists(path):
if not os.path.exists(path):
os.makedirs(path)
def main():
parser = argparse.ArgumentParser(description = "Copy files to the system image's sysroot")
parser.add_argument("--manifest", help = "... | {
"repo_name": "heatd/Onyx",
"path": "usystem/build/image/make_sys_image.py",
"copies": "1",
"size": "1219",
"license": "mit",
"hash": 4764192009120293000,
"line_mean": 22,
"line_max": 91,
"alpha_frac": 0.7054963084,
"autogenerated": false,
"ratio": 3.1256410256410256,
"config_test": false,
"h... |
#!/bin/python3
import json
import sys
import datetime
DAWN_TYPES = {
"string":
{
"var_type": "std::string",
"serializable_type": "dawn::data::string"
},
"uint8":
{
"var_type": "uint8_t",
"serializable_type": "dawn::data::uint8"
},
"uint16":
{
"var_type": "uint16_t",
"serializable_type": "dawn::da... | {
"repo_name": "Deoxyribonucleic/dawn",
"path": "tools/struct_gen.py",
"copies": "1",
"size": "6148",
"license": "mit",
"hash": -6485591943622840000,
"line_mean": 24.093877551,
"line_max": 187,
"alpha_frac": 0.6472023422,
"autogenerated": false,
"ratio": 2.7594254937163374,
"config_test": false,... |
import logging
import sys
import signal
from robot_brain import RobotBrain
__author__ = 'matteo'
LOG_FORMAT = "%(asctime)-15s:%(levelname)-8s:%(threadName)s:%(filename)s:%(funcName)s: %(message)s"
LOG_LEVEL = logging.DEBUG
INTERRUPT_MESSAGE = "input 'q' if you want to exit, just enter (or any other character) to c... | {
"repo_name": "ci-group/robot-baby",
"path": "RobotController/main.py",
"copies": "2",
"size": "1167",
"license": "apache-2.0",
"hash": -6804031222807269000,
"line_mean": 26.7857142857,
"line_max": 101,
"alpha_frac": 0.7035132819,
"autogenerated": false,
"ratio": 3.613003095975232,
"config_test... |
#!/bin/python3
import math
import os
import random
import re
import sys
from bisect import insort, bisect_left
'''
Direct solution
num=30171, days= 10000
38
real 0m34.166s
user 0m34.013s
sys 0m0.079s
https://www.hackerrank.com/challenges/fraudulent-activity-notifications/problem
'''
# Complete the activit... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/fraudulent-activity-notifications.py",
"copies": "1",
"size": "1026",
"license": "mit",
"hash": -4862785069556456000,
"line_mean": 20.8510638298,
"line_max": 79,
"alpha_frac": 0.6354775828,
"autogenerated": false,
"ratio": 2.75806451... |
#!/bin/python3
import math
import os
import random
import re
import sys
from bisect import insort, bisect_right
# Complete the maximumSum function below.
def maximumSum(a, m):
print(a,m)
# Create prefix tree
prefix =[]
p = 0
for v in a:
p = (v % m + p) % m
prefix.append(p)
pre... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/maximum-subarray-sum.py",
"copies": "1",
"size": "1099",
"license": "mit",
"hash": 8310292803039463000,
"line_mean": 20.1346153846,
"line_max": 52,
"alpha_frac": 0.5432211101,
"autogenerated": false,
"ratio": 3.2708333333333335,
"c... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
import copy
def isValid(s):
return "YES" if containsOnlyOneDifferentCharacterCount(s) else "NO"
def containsOnlyOneDifferentCharacterCount(string):
characterCounts = Counter(string)
if allCountsAreEq... | {
"repo_name": "rootulp/hackerrank",
"path": "python/sherlock-and-valid-string.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": 4389947533718483000,
"line_mean": 25.2195121951,
"line_max": 74,
"alpha_frac": 0.6837209302,
"autogenerated": false,
"ratio": 4.24901185770751,
"config_tes... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
def get_all_substring(s):
l = len(s)
alist = []
for i in range(l):
for j in range(i, l):
alist.append(s[i:j+1])
return alist
def is_anagram(str1, str2):
if len(str1) != len(... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Interview Preparation Kit/Dictionaries And Hashmaps/sherlock_and_anagrams.py",
"copies": "1",
"size": "1091",
"license": "apache-2.0",
"hash": -7088810169291291000,
"line_mean": 17.8103448276,
"line_max": 50,
"alpha_frac": 0.5307... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
class OccurencesAndFrequencies:
"""A data structure that optimizes for keeping
track of the number of occurences of a given value
and the frequencies of occurences"""
def __init__(self):
#... | {
"repo_name": "rootulp/hackerrank",
"path": "python/frequency-queries.py",
"copies": "1",
"size": "1793",
"license": "mit",
"hash": 1580771043955442200,
"line_mean": 23.2297297297,
"line_max": 64,
"alpha_frac": 0.5995538204,
"autogenerated": false,
"ratio": 3.5434782608695654,
"config_test": fa... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
def countTriplets(arr, r):
potential_triplets_with_middle = Counter()
potential_triplets_with_end = Counter()
total_triplets = 0
for num in arr:
# num completed potential_triplets_with_end[... | {
"repo_name": "rootulp/hackerrank",
"path": "python/count-triplets.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": 6243899398040594000,
"line_mean": 23.1086956522,
"line_max": 65,
"alpha_frac": 0.6203787196,
"autogenerated": false,
"ratio": 3.43343653250774,
"config_test": false,
... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import deque
class Node:
def __init__(self, node_id, color, neighbors):
self.node_id = node_id
self.color = color
self.neighbors = neighbors
self.marked_to_visit = False
def add_neighbor... | {
"repo_name": "rootulp/hackerrank",
"path": "python/find-the-nearest-clone.py",
"copies": "1",
"size": "2904",
"license": "mit",
"hash": 7582849554744820000,
"line_mean": 26.9230769231,
"line_max": 89,
"alpha_frac": 0.5699035813,
"autogenerated": false,
"ratio": 3.713554987212276,
"config_test"... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import deque
class Node:
def __init__(self, node_id):
self.node_id = node_id
self.neighbors = []
self.marked_to_visit = False
def add_neighbor(self, neighbor_id):
self.neighbors.append(n... | {
"repo_name": "rootulp/hackerrank",
"path": "python/ctci-bfs-shortest-reach.py",
"copies": "1",
"size": "2743",
"license": "mit",
"hash": 6030858248154112000,
"line_mean": 27.2783505155,
"line_max": 72,
"alpha_frac": 0.5745534087,
"autogenerated": false,
"ratio": 3.5393548387096776,
"config_tes... |
#!/bin/python3
import math
import os
import random
import re
import sys
from heapq import heapify, heappush, heappop
def find_medium(min_heap, min_heap_size, max_heap, max_heap_size):
return 0
# Complete the activityNotifications function below.
def activityNotifications(expenditure, d, n):
max_heap = []
... | {
"repo_name": "civilian/competitive_programing",
"path": "hackerrank/fraudulent-activity-notifications.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": -1592991353766880800,
"line_mean": 19.1403508772,
"line_max": 69,
"alpha_frac": 0.5801393728,
"autogenerated": false,
"ratio": 3.180... |
#!/bin/python3
import math
import os
import random
import re
import sys
from heapq import heappush, heappop
class MinHeap:
"""A lightweight wrapper around Python's heap implementation."""
def __init__(self):
self.heap = []
def push(self, value):
heappush(self.heap, value)
def pop(s... | {
"repo_name": "rootulp/hackerrank",
"path": "python/ctci-find-the-running-median.py",
"copies": "1",
"size": "5175",
"license": "mit",
"hash": -5834207197178578000,
"line_mean": 28.2372881356,
"line_max": 75,
"alpha_frac": 0.5605797101,
"autogenerated": false,
"ratio": 3.728386167146974,
"confi... |
#!/bin/python3
import math
import os
import random
import re
import sys
from statistics import median
"""
This solution hits timeout exceptions on test cases.
I think it's because computing the median of the trailing days can be done
faster than using Python's median function. Instead consider using heaps.
"""
def ... | {
"repo_name": "rootulp/hackerrank",
"path": "python/fraudulent-activity-notifications.py",
"copies": "1",
"size": "1774",
"license": "mit",
"hash": 5535541326643579000,
"line_mean": 30.6785714286,
"line_max": 81,
"alpha_frac": 0.7328072153,
"autogenerated": false,
"ratio": 4.059496567505721,
"c... |
#!/bin/python3
import math
import os
import random
import re
import sys
from urllib.request import urlopen
import json
from urllib.parse import urlencode
from pprint import pprint
#https://linuxconfig.org/how-to-perform-http-requests-with-python-part-1-the-standard-library
def url_query(url, query_params):
query... | {
"repo_name": "civilian/competitive_programing",
"path": "_pythonMaratonBook/rest.py",
"copies": "1",
"size": "2453",
"license": "mit",
"hash": 8874696103575550000,
"line_mean": 34.5652173913,
"line_max": 108,
"alpha_frac": 0.6807990216,
"autogenerated": false,
"ratio": 3.1129441624365484,
"con... |
#!/bin/python3
import math
import os
import random
import re
import sys
import copy
class Node:
def __init__(self, data):
self.data = data
self.right = None
self.left = None
def printTree(self):
if self.left != None:
self.left.printTree()
if self.data != -... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/swap-nodes-algo.py",
"copies": "1",
"size": "2214",
"license": "mit",
"hash": -6887566250521644000,
"line_mean": 18.2608695652,
"line_max": 63,
"alpha_frac": 0.5374887082,
"autogenerated": false,
"ratio": 3.2133526850507983,
"confi... |
#!/bin/python3
import math
import os
import random
import re
import sys
import pprint
from collections import Counter
# https://stackoverflow.com/questions/13215789/comparing-anagrams-using-prime-numbers multiplication in primes gives unique response so it's a good way to identify anagrams.
primes = [2, 3, 5, 7, 11, ... | {
"repo_name": "civilian/competitive_programing",
"path": "hackerrank/sherlock-and-anagrams.py",
"copies": "1",
"size": "1351",
"license": "mit",
"hash": 472263783174763900,
"line_mean": 29.0222222222,
"line_max": 210,
"alpha_frac": 0.5862324204,
"autogenerated": false,
"ratio": 3.3358024691358024... |
#!/bin/python3
import math
import os
import random
import re
import sys
import re
from collections import Counter
'''
Special String Again
https://www.hackerrank.com/challenges/special-palindrome-again/problem
'''
def substrCount2(n, s):
answer = 0
prev = s[0]
repeat = False
middle = False
repeat... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/special-palindrome-again.py",
"copies": "1",
"size": "4372",
"license": "mit",
"hash": -3106080072277672400,
"line_mean": 26.6708860759,
"line_max": 88,
"alpha_frac": 0.4629460201,
"autogenerated": false,
"ratio": 3.7495711835334475,... |
#!/bin/python3
import math
import os
import random
import re
import sys
class DoublyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/tree/reverse-a-doubly-linked-list.py",
"copies": "1",
"size": "1617",
"license": "mit",
"hash": -8327703437677288000,
"line_mean": 18.25,
"line_max": 51,
"alpha_frac": 0.5689548547,
"autogenerated": false,
"ratio": 3.3828451882845187,
"config... |
#!/bin/python3
import math
import os
import random
import re
import sys
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
def print_singly_linked_list(node, sep, fptr):
wh... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/LinkedLists/insert_a_node_at_the_tail_0f_a_linked_list.py",
"copies": "1",
"size": "1264",
"license": "apache-2.0",
"hash": -1258715702608360400,
"line_mean": 18.4461538462,
"line_max": 61,
"alpha_f... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the countTriplets function below.
def countTriplets(arr, r):
count = 0
keys = []
values = []
for i in range(len(arr) - 1):
for j in range(i+1, len(arr)):
if arr[j] / r == arr[i]:
key... | {
"repo_name": "osamadel/Hacker-Rank",
"path": "Interviewing Preparation/Count Triplets.py",
"copies": "1",
"size": "1122",
"license": "mit",
"hash": 8607593090807047000,
"line_mean": 20.5769230769,
"line_max": 50,
"alpha_frac": 0.4714795009,
"autogenerated": false,
"ratio": 3.1253481894150417,
... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the gridChallenge function below.
class GridChallenge:
def __init__(self, grid, n):
self.grid = grid
self.n = n
def sort_rows(self):
for row, seq in enumerate(grid):
self.grid[row] = sorte... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Algorithms/Greedy/grid_challenge.py",
"copies": "1",
"size": "1239",
"license": "apache-2.0",
"hash": -5198003436573523000,
"line_mean": 19.3114754098,
"line_max": 52,
"alpha_frac": 0.5092816788,
"autogenerated"... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the isBalanced function below.
class ArrayStack:
def __init__(self):
self._data = []
def is_empty(self):
return len(self._data) == 0
def top(self):
return self._data[-1]
def push(self, elem):... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Stacks/balanced_brackets.py",
"copies": "2",
"size": "1122",
"license": "apache-2.0",
"hash": 2610606923281857000,
"line_mean": 17.0967741935,
"line_max": 69,
"alpha_frac": 0.5026737968,
"autogene... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the matchingStrings function below.
def matchingStrings(strings, queries):
res = []
stringsdict = {}
for string in strings:
if string in stringsdict.keys():
stringsdict[string] = stringsdict[string] + 1... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Arrays/sparse_array.py",
"copies": "1",
"size": "1054",
"license": "apache-2.0",
"hash": 8147774941493913000,
"line_mean": 19.2692307692,
"line_max": 58,
"alpha_frac": 0.5891840607,
"autogenerated... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the minimumBribes function below.
def minimumBribes(q):
freq = {}
for i in range (0, len(q)):
freq[q[i]] = 0
count = 0
too_chaotic = False
finished = False
while(finished != True):... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Interview Preparation Kit/Arrays /new_year_chaos.py",
"copies": "1",
"size": "1090",
"license": "apache-2.0",
"hash": -4203079393727045600,
"line_mean": 19.1851851852,
"line_max": 52,
"alpha_frac": 0.3981651376,
"autogenerated"... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the minimumBribes function below.
def minimum_bribes(final_line):
if invalid(final_line):
return "Too chaotic"
return bubble_sort(final_line)
def invalid(final_line):
return any(did_bribe_more_than_two_people(pe... | {
"repo_name": "rootulp/hackerrank",
"path": "python/new-year-chaos.py",
"copies": "1",
"size": "1126",
"license": "mit",
"hash": -2856573485515863000,
"line_mean": 21.52,
"line_max": 60,
"alpha_frac": 0.5754884547,
"autogenerated": false,
"ratio": 3.3813813813813813,
"config_test": false,
"ha... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the minimumNumber function below.
def minimumNumber(n, password):
# Return the minimum number of characters to make the password strong
isdigit_pass = False
islower_pass = False
isupper_pass = False
issplchar_pa... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Algorithms/Strings/strong_password.py",
"copies": "1",
"size": "1459",
"license": "apache-2.0",
"hash": 133526281851036980,
"line_mean": 25.5272727273,
"line_max": 79,
"alpha_frac": 0.5647703907,
"autogenerated"... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the poisonousPlants function below.
class Stack:
def __init__(self):
self.data = []
self.size = 0
def peek(self):
return self.data[-1]
def front(self):
return self.data[0]
def push(self, elem):
self.data.append(elem... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Stacks/poisonous_plants.py",
"copies": "1",
"size": "2249",
"license": "apache-2.0",
"hash": -9050316889052447000,
"line_mean": 16.7165354331,
"line_max": 50,
"alpha_frac": 0.6207203201,
"autogene... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the rotLeft function below.
def rotLeft(a, d):
n = len(a)
r = a[(d%n):n] + a[0:(d%n)]
print(d%n)
return r
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
nd = input().split()
n ... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Interview Preparation Kit/Arrays /arrays_left_rotation.py",
"copies": "1",
"size": "1028",
"license": "apache-2.0",
"hash": 6136946832996224000,
"line_mean": 15.0625,
"line_max": 48,
"alpha_frac": 0.5408560311,
"autogenerated":... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the sherlockAndAnagrams function below.
def sherlockAndAnagrams(s):
# generate substrings
# for each substring
# compute the frequency of each character
# search for the same frequencies in array
# if a ... | {
"repo_name": "osamadel/Hacker-Rank",
"path": "Interviewing Preparation/Sherlock and Anagrams.py",
"copies": "1",
"size": "1499",
"license": "mit",
"hash": 2024186874772288500,
"line_mean": 26.2545454545,
"line_max": 101,
"alpha_frac": 0.5356904603,
"autogenerated": false,
"ratio": 3.756892230576... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the sockMerchant function below.
def sockMerchant(size, array):
sockTypeQtdDictionary = getSockTypeQtdDictionary(array)
pairsQtd = getPairsQtd(sockTypeQtdDictionary)
return pairsQtd
def getPairsQtd(dictionary):
... | {
"repo_name": "johnfercher/samples",
"path": "python/exercises/socks_challenge.py",
"copies": "1",
"size": "1040",
"license": "mit",
"hash": 25459555582606348,
"line_mean": 20.6666666667,
"line_max": 78,
"alpha_frac": 0.6115384615,
"autogenerated": false,
"ratio": 3.5494880546075085,
"config_te... |
#!/bin/python3
import math
import os
import random
import re
import sys
# def list_comp():
# x = int( raw_input())
# y = int( raw_input())
# n = int( raw_input())
# print([[i, j] for i in range( x + 1) for j in range( y + 1)
# if ( ( i + j ) != n )])
# # Complete the solve function below.
#... | {
"repo_name": "bgroveben/python3_machine_learning_projects",
"path": "hackerrank.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": -5486102388988051000,
"line_mean": 21.68,
"line_max": 65,
"alpha_frac": 0.475308642,
"autogenerated": false,
"ratio": 2.7,
"config_test": false,
"has_... |
#!/bin/python3
import math
import os
import random
import re
import sys
def merge_sort(arr):
if len(arr) == 1:
return arr
mid = len(arr) // 2
left = arr[:mid]
right = arr[mid:]
return merge(merge_sort(left), merge_sort(right))
def merge(left, right):
result = []
lnum=len(left)
... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/minimum-absolute-difference-in-an-array.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": 6417777783836465000,
"line_mean": 21.26,
"line_max": 73,
"alpha_frac": 0.5422661871,
"autogenerated": false,
"ratio": 2.99730458221... |
#!/bin/python3
import math
import os
import random
import re
import sys
from bisect import insort, bisect_left
'''
Triple sum
https://www.hackerrank.com/challenges/triple-sum/problem
'''
# Complete the triplets function below.
def triplets1(a, b, c):
a=sorted(set(a))
b=sorted(set(b))
c=sorted(set(c))
... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/triple-sum.py",
"copies": "1",
"size": "1053",
"license": "mit",
"hash": -6726327051744562000,
"line_mean": 18.5,
"line_max": 56,
"alpha_frac": 0.5318138651,
"autogenerated": false,
"ratio": 2.941340782122905,
"config_test": false,... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
'''
Frequency Queries
https://www.hackerrank.com/challenges/frequency-queries/problem
forward index, inverted index
'''
def freqQuery1(queries):
d={}
freq={}
result=[]
for cmd, val in queries:
... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/frequency-queries.py",
"copies": "1",
"size": "2103",
"license": "mit",
"hash": -3428723054348001300,
"line_mean": 20.04,
"line_max": 63,
"alpha_frac": 0.4322396576,
"autogenerated": false,
"ratio": 3.564406779661017,
"config_test"... |
#!/bin/python3
import math
import os
import random
import re
import sys
# From https://en.wikipedia.org/wiki/Kruskal%27s_algorithm#Pseudocode
# KRUSKAL(G):
# A = ∅
# foreach v ∈ G.V:
# MAKE-SET(v)
# foreach (u, v) in G.E ordered by weight(u, v), increasing:
# if FIND-SET(u) ≠ FIND-SET(v):
# A = A ∪ {(u, v... | {
"repo_name": "rootulp/hackerrank",
"path": "python/kruskal-mst.py",
"copies": "1",
"size": "1793",
"license": "mit",
"hash": -8156015203945937000,
"line_mean": 25.6417910448,
"line_max": 83,
"alpha_frac": 0.5663865546,
"autogenerated": false,
"ratio": 3.1537102473498235,
"config_test": false,
... |
#!/bin/python3
import math
import os
import random
import re
import sys
import numpy as np
'''
Common Child
https://www.hackerrank.com/challenges/common-child/problem
'''
# Complete the commonChild function below.
def commonChild(s1, s2):
len1 = len(s1)
len2 = len(s2)
c =[[ 0 for _ in range(len2+1)] for... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/common-child.py",
"copies": "1",
"size": "1174",
"license": "mit",
"hash": -6899565336077817000,
"line_mean": 19.5964912281,
"line_max": 59,
"alpha_frac": 0.471890971,
"autogenerated": false,
"ratio": 2.6742596810933943,
"config_te... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Let's use an adapted form of Kruskal.
# 1. Construct a set for each city.
# 2. Iterate through edges in descending order of "cost to destroy".
# 3. If the edge connects two machines, we must destroy it so add to total time.
# If the edge doe... | {
"repo_name": "rootulp/hackerrank",
"path": "python/matrix.py",
"copies": "1",
"size": "2999",
"license": "mit",
"hash": 6934153658004700000,
"line_mean": 29.5204081633,
"line_max": 80,
"alpha_frac": 0.5904379806,
"autogenerated": false,
"ratio": 3.3606741573033707,
"config_test": false,
"has... |
#!/bin/python3
import math
import os
import random
import re
import sys
class Crossword():
EMPTY = "-"
BLOCKED = "+"
def __init__(self, grid, words):
self.grid = grid
self.words = words
def solve(self):
while self.is_unsolved():
word = self.words.pop()
... | {
"repo_name": "rootulp/hackerrank",
"path": "python/crossword-puzzle.py",
"copies": "1",
"size": "1216",
"license": "mit",
"hash": 4266135880787188700,
"line_mean": 20.7142857143,
"line_max": 61,
"alpha_frac": 0.5361842105,
"autogenerated": false,
"ratio": 4.039867109634551,
"config_test": fals... |
#!/bin/python3
import math
import os
import random
import re
import sys
class FriendCircle:
"""
Roughly a disjoint set.
"""
def __init__(self):
self.circles = {} # person => parent
self.circle_sizes = {} # person => size of the circle they belong to
self.largest_circle_size... | {
"repo_name": "rootulp/hackerrank",
"path": "python/friend-circle-queries.py",
"copies": "1",
"size": "1965",
"license": "mit",
"hash": -2613632460231258000,
"line_mean": 30.1904761905,
"line_max": 77,
"alpha_frac": 0.6106870229,
"autogenerated": false,
"ratio": 3.49644128113879,
"config_test":... |
#!/bin/python3
import math
import os
import random
import re
import sys
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def insert_node(self, ... | {
"repo_name": "rootulp/hackerrank",
"path": "python/reverse-a-linked-list.py",
"copies": "1",
"size": "1524",
"license": "mit",
"hash": -4707718400854474000,
"line_mean": 17.1428571429,
"line_max": 51,
"alpha_frac": 0.5872703412,
"autogenerated": false,
"ratio": 3.334792122538293,
"config_test"... |
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'dynamicArray' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts following parameters:
# 1. INTEGER n
# 2. 2D_INTEGER_ARRAY queries
#
def dynamicArray(n, queries):
# Write your... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Arrays/dynamic_array.py",
"copies": "1",
"size": "1439",
"license": "apache-2.0",
"hash": -3426879760069721600,
"line_mean": 21.484375,
"line_max": 64,
"alpha_frac": 0.5774843641,
"autogenerated":... |
#!/bin/python3
import math
import os
import random
import re
import sys
def arrayManipulation(n, queries):
diffs = getArrayOfDiffs(n, queries)
return maxFromDiffs(diffs)
def maxFromDiffs(diffs):
sumSoFar = 0
maxSoFar = 0
for diff in diffs:
sumSoFar += diff
if sumSoFar > maxSoFar... | {
"repo_name": "rootulp/hackerrank",
"path": "python/array-manipulation.py",
"copies": "1",
"size": "1292",
"license": "mit",
"hash": -3974153537249144300,
"line_mean": 22.9259259259,
"line_max": 70,
"alpha_frac": 0.6021671827,
"autogenerated": false,
"ratio": 3.373368146214099,
"config_test": f... |
#!/bin/python3
import math
import os
import random
import re
import sys
from itertools import zip_longest
#
# Complete the 'minimumSwaps' function below.
#
# The function is expected to return an INTEGER.
# The function accepts STRING status as parameter.
#
# NOTE: This only passes the first three test cases.
def ... | {
"repo_name": "rootulp/hackerrank",
"path": "python/marketing-strategy.py",
"copies": "1",
"size": "1297",
"license": "mit",
"hash": -2278569864581999600,
"line_mean": 20.9830508475,
"line_max": 93,
"alpha_frac": 0.6037008481,
"autogenerated": false,
"ratio": 3.308673469387755,
"config_test": f... |
#!/bin/python3
import math
import os
import random
import re
import sys
"""
Blue Voyant Question by Adam Fletcher:
You’re making a video game in which a character explores a cave. The cave is a grid, and each turn the character can
move up to 5 steps in any cardinal direction represented by an integer (0 for NORTH,... | {
"repo_name": "JDFagan/InterviewInPython",
"path": "questions/magic_potion.py",
"copies": "1",
"size": "2675",
"license": "mit",
"hash": -4774372382710495000,
"line_mean": 25.9797979798,
"line_max": 135,
"alpha_frac": 0.6724073381,
"autogenerated": false,
"ratio": 3.3097893432465924,
"config_te... |
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'countPairs' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER_ARRAY numbers
# 2. INTEGER k
#
def countPairs(numbers, k):
numbers.sort()
i = 0... | {
"repo_name": "civilian/competitive_programing",
"path": "hackerrank/pairs.py",
"copies": "1",
"size": "1186",
"license": "mit",
"hash": 1364003153147848400,
"line_mean": 18.1290322581,
"line_max": 65,
"alpha_frac": 0.5303541315,
"autogenerated": false,
"ratio": 3.6048632218844983,
"config_test... |
#!/bin/python3
import math
import os
import random
import re
import sys
'''
New Year Chaos
https://www.hackerrank.com/challenges/new-year-chaos/problem
'''
def merge_sort(cnt, arr):
if len(arr) == 1:
return cnt, arr
mid = len(arr) // 2
left = arr[:mid]
right = arr[mid:]
cnt,left=merge_s... | {
"repo_name": "MarsBighead/mustang",
"path": "Python/hackerrank/new-year-chaos.py",
"copies": "1",
"size": "1493",
"license": "mit",
"hash": 7222075657616446000,
"line_mean": 20.6376811594,
"line_max": 73,
"alpha_frac": 0.5264567984,
"autogenerated": false,
"ratio": 2.882239382239382,
"config_t... |
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
class Multiset:
def __init__(self):
self.counter = Counter()
def add(self, val):
# adds one occurrence of val from the multiset, if any
self.counter[val] += 1
def remove(se... | {
"repo_name": "rootulp/hackerrank",
"path": "python/python-skill-verification-test/multiset.py",
"copies": "1",
"size": "1504",
"license": "mit",
"hash": 431537757064884600,
"line_mean": 23.6557377049,
"line_max": 70,
"alpha_frac": 0.5252659574,
"autogenerated": false,
"ratio": 3.94750656167979,
... |
#!/bin/python3
import math
import os
import random
import re
import sys
# NOTE: This only passes the first three test cases.
def taskOfPairing(freq):
total = number_of_identical_pairs(freq)
total += number_of_off_by_one_pairs(freq)
return total
def number_of_identical_pairs(freq):
pairs = []
for... | {
"repo_name": "rootulp/hackerrank",
"path": "python/task-of-pairing.py",
"copies": "1",
"size": "1151",
"license": "mit",
"hash": -4120615844628820500,
"line_mean": 21.568627451,
"line_max": 57,
"alpha_frac": 0.5751520417,
"autogenerated": false,
"ratio": 3.2422535211267607,
"config_test": fals... |
#!/bin/python3
import math
import os
import random
import re
import sys
# This solution times out on Hackerrank with Python 3
# However, it passes all test cases with Pypy 3
def countInversions(arr):
global COUNT_INVERSIONS
COUNT_INVERSIONS = 0
mergeSort(arr)
return COUNT_INVERSIONS
def mergeSort(... | {
"repo_name": "rootulp/hackerrank",
"path": "python/ctci-merge-sort.py",
"copies": "1",
"size": "1553",
"license": "mit",
"hash": -1126370522124026000,
"line_mean": 24.0483870968,
"line_max": 67,
"alpha_frac": 0.6336123632,
"autogenerated": false,
"ratio": 3.742168674698795,
"config_test": fals... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Referenced https://www.geeksforgeeks.org/largest-rectangle-under-histogram/
def largestRectangle(heights):
stack = list()
index = 0
largest_rectangle = 0
while index < len(heights):
if (not stack) or (heights[stack[-1... | {
"repo_name": "rootulp/hackerrank",
"path": "python/largest-rectangle.py",
"copies": "1",
"size": "1103",
"license": "mit",
"hash": 8970511711014456000,
"line_mean": 22.4680851064,
"line_max": 77,
"alpha_frac": 0.5720761559,
"autogenerated": false,
"ratio": 3.523961661341853,
"config_test": fal... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Referenced the following notes:
# 1) O(N) solution is possible using stacks; avoid DP for this problem
# 2) Think about how to identify the largest window a number is the minimum for (e.g. for the sequence 11 2 3 14 5 2 11 12 we would make a ma... | {
"repo_name": "rootulp/hackerrank",
"path": "python/min-max-riddle.py",
"copies": "1",
"size": "4767",
"license": "mit",
"hash": 2040602634407701800,
"line_mean": 36.5354330709,
"line_max": 264,
"alpha_frac": 0.6563876652,
"autogenerated": false,
"ratio": 3.5258875739644973,
"config_test": fals... |
#!/bin/python3
import math
import os
import random
import re
import sys
# To address with DP, work through the array, keeping track of the max at each position until you get to the last value of the array. You should start with the base cases defined before iterating through the remainder of the array.
# max @ positi... | {
"repo_name": "rootulp/hackerrank",
"path": "python/max-array-sum.py",
"copies": "1",
"size": "1336",
"license": "mit",
"hash": 8370692559863200000,
"line_mean": 30.0697674419,
"line_max": 231,
"alpha_frac": 0.6511976048,
"autogenerated": false,
"ratio": 3.35678391959799,
"config_test": false,
... |
#!/bin/python3
import math
import urllib.request
import http.server
import json
import codecs
import shlex
import argparse
from datetime import datetime, timedelta
import arrow
import collections
import pickle
import os
import threading
import contextlib
from _secret import HOOK, TOKEN
def to_slack(msg : str):
r... | {
"repo_name": "pavpanchekha/deadbot",
"path": "deadbot.py",
"copies": "1",
"size": "14865",
"license": "mit",
"hash": 2421445402724397600,
"line_mean": 32.0935412027,
"line_max": 147,
"alpha_frac": 0.5679386231,
"autogenerated": false,
"ratio": 3.6598522167487686,
"config_test": false,
"has_n... |
#!/bin/python3
import math
import urllib.request
import http.server
import json
import codecs
import shlex
import argparse
import datetime
import collections
import pickle
import os
import threading
import contextlib
date = datetime.date
from _secret_birthbot import HOOK, TOKEN
def to_slack(msg : str):
req = url... | {
"repo_name": "pavpanchekha/deadbot",
"path": "birthbot.py",
"copies": "1",
"size": "8668",
"license": "mit",
"hash": -1086226070983855600,
"line_mean": 27.2149837134,
"line_max": 147,
"alpha_frac": 0.5589933041,
"autogenerated": false,
"ratio": 3.7384548985757444,
"config_test": false,
"has_... |
#!/bin/python3
import math
def rotate_coordinate(i, j, m, n, r, rotations):
circle = min(i, j, m - i, n - j)
r = rotations[circle]
while r > 0:
if j == circle and i < m - circle:
# Move down
i += 1
elif m - i == circle and j < n - circle:
# Move right
... | {
"repo_name": "thelfensdrfer/hackerrank",
"path": "python/algorithms/implementation/matrix-rotation-algo/solution.py",
"copies": "1",
"size": "1624",
"license": "mit",
"hash": -1697971268213324500,
"line_mean": 25.6229508197,
"line_max": 81,
"alpha_frac": 0.5,
"autogenerated": false,
"ratio": 3.3... |
#!/bin/python3
import math
def solve(a):
count = len(a)
if count == 1:
return "YES"
center = math.floor(count / 2)
a_left = sum(a[0:center])
a_right = sum(a[center + 1:])
direction = None
while center > 0 and center < count - 1:
if a_left < a_right:
if direct... | {
"repo_name": "thelfensdrfer/hackerrank",
"path": "python/algorithms/search/sherlock-and-array/solution.py",
"copies": "1",
"size": "1034",
"license": "mit",
"hash": 7949772954850551000,
"line_mean": 21.9777777778,
"line_max": 54,
"alpha_frac": 0.4564796905,
"autogenerated": false,
"ratio": 3.553... |
#!/bin/python3
import notify2
import argparse
from multiprocessing.connection import Listener, Client
parser = argparse.ArgumentParser()
parser.add_argument(
'-u', '--urgency', metavar='LEVEL',
help='Specifies the urgency level (low, normal, critical).')
parser.add_argument(
'-t', '--expire-time', metava... | {
"repo_name": "phuhl/.dotfiles",
"path": "bin/notify-send.py",
"copies": "1",
"size": "4334",
"license": "mit",
"hash": 4087543889103682600,
"line_mean": 30.6350364964,
"line_max": 79,
"alpha_frac": 0.6052145824,
"autogenerated": false,
"ratio": 3.7394305435720447,
"config_test": false,
"has_... |
#!/bin/python3
import numpy as np
from ConfigSpace.util import impute_inactive_values
from smac.epm.rf_with_instances import RandomForestWithInstances
from smac.epm.rfr_imputator import RFRImputator
from smac.epm.util_funcs import get_types
from smac.runhistory.runhistory import RunHistory
from smac.runhistory.runhist... | {
"repo_name": "automl/SpySMAC",
"path": "cave/utils/convert_for_epm.py",
"copies": "1",
"size": "4065",
"license": "bsd-3-clause",
"hash": 5426463486754895000,
"line_mean": 39.2475247525,
"line_max": 141,
"alpha_frac": 0.6002460025,
"autogenerated": false,
"ratio": 4.292502639915523,
"config_te... |
#!/bin/python3
import numpy as np
from smac.scenario.scenario import Scenario
from smac.tae.execute_ta_run import StatusType
from smac.runhistory.runhistory import RunHistory
from smac.runhistory.runhistory2epm import RunHistory2EPM4LogCost, RunHistory2EPM4Cost
from smac.epm.rf_with_instances import RandomForestWit... | {
"repo_name": "SgnJp/SMAC3",
"path": "smac/parameter_importance/utils/set_up.py",
"copies": "1",
"size": "3650",
"license": "bsd-3-clause",
"hash": -4607293816044485000,
"line_mean": 37.03125,
"line_max": 86,
"alpha_frac": 0.5476712329,
"autogenerated": false,
"ratio": 4.734111543450065,
"confi... |
#!/bin/python3
import os
import shutil
import subprocess
import sys
from os import environ as env
binary_filename = os.path.abspath(sys.argv[1])
master_repository_directory = os.path.abspath(sys.argv[2])
data_repository = sys.argv[3]
data_repository_directory = os.path.abspath(data_repository)
directory = sys.argv[4]... | {
"repo_name": "kivymd/KivyMD",
"path": ".ci/move_binary.py",
"copies": "1",
"size": "2863",
"license": "mit",
"hash": -2854353190442934300,
"line_mean": 27.63,
"line_max": 80,
"alpha_frac": 0.6157876353,
"autogenerated": false,
"ratio": 3.3407234539089847,
"config_test": false,
"has_no_keywor... |
#!/bin/python3
import os
import sys
import socket
import time
import io
# http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
# See chapter 10 for keycodes.
# The following HID Report structure is for example keyboard from Linux kernel documentation
# https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt
# by... | {
"repo_name": "miikka-h/Projektikurssi17",
"path": "zero-client/zero-client.py",
"copies": "1",
"size": "3263",
"license": "mit",
"hash": 5683448491118637000,
"line_mean": 28.1339285714,
"line_max": 107,
"alpha_frac": 0.6015936255,
"autogenerated": false,
"ratio": 3.8208430913348947,
"config_te... |
#!/bin/python3
import os
import sys
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def insert_node(self, node_data):
node = SinglyLinke... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/LinkedLists/compare_two_linked_lists.py",
"copies": "1",
"size": "1812",
"license": "apache-2.0",
"hash": -2232147766072250400,
"line_mean": 19.5909090909,
"line_max": 78,
"alpha_frac": 0.5579470199... |
#!/bin/python3
import os
import sys
#
# Complete the contacts function below.
#
class Node:
def __init__(self, char):
self.char = char
self.children = {}
self.noNames = 0
class Trie:
def __init__(self):
self.root = Node("*")
def addName(self, name):
curr_node = s... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Trie/contacts.py",
"copies": "1",
"size": "1564",
"license": "apache-2.0",
"hash": -64678822739082136,
"line_mean": 26.4385964912,
"line_max": 56,
"alpha_frac": 0.5217391304,
"autogenerated": fals... |
#!/bin/python3
import os
import sys
#
# Complete the equalStacks function below.
#
def get_sum(arr):
sumarr =0
for i in arr:
sumarr = sumarr + i
return sumarr
def equalStacks(h1, h2, h3):
#
# Write your code here.
#
s1, s2, s3 = get_sum(h1), get_sum(h2), get_sum(h3)
print(h1... | {
"repo_name": "MithileshCParab/HackerRank-10DaysOfStatistics",
"path": "Problem Solving/Data Structure/Stacks/equal_stacks.py",
"copies": "1",
"size": "1215",
"license": "apache-2.0",
"hash": -434717380412141100,
"line_mean": 18.2857142857,
"line_max": 59,
"alpha_frac": 0.4872427984,
"autogenerated... |
#!/bin/python3
import os
import sys
# n: the integer number of sticks to buy
# k: the integer number of box sizes the store carries
# b: the integer number of boxes to buy
def bonetrousle(n, k, b):
if (minimumValue(k, b) <= n <= maximumValue(k, b)):
return boxesToBuy(n, k, b)
else:
# -1 indi... | {
"repo_name": "rootulp/hackerrank",
"path": "python/bonetrousle.py",
"copies": "1",
"size": "1864",
"license": "mit",
"hash": 1156997289582412300,
"line_mean": 24.5342465753,
"line_max": 78,
"alpha_frac": 0.6094420601,
"autogenerated": false,
"ratio": 3.1222780569514237,
"config_test": false,
... |
#!/bin/python3
#
import os
import time
import sys
from subprocess import call, DEVNULL
def dprint(*args):
"""Print to both stdout and stderr at the same time to allow for stdout redirection while still seeing the output in real time, rather than buffered like with tee"""
print(*args)
print(*args, file=sys.... | {
"repo_name": "tomalexander/fzcat",
"path": "test/perftest.py",
"copies": "1",
"size": "2338",
"license": "unlicense",
"hash": 5515014277887850000,
"line_mean": 21.2666666667,
"line_max": 169,
"alpha_frac": 0.627031651,
"autogenerated": false,
"ratio": 3.020671834625323,
"config_test": false,
... |
#!/bin/python3
#
import os
import time
import sys
import hashlib
from subprocess import Popen, PIPE
def dprint(*args):
"""Print to both stdout and stderr at the same time to allow for stdout redirection while still seeing the output in real time, rather than buffered like with tee"""
print(*args)
print(*ar... | {
"repo_name": "tomalexander/fzcat",
"path": "test/validationtest.py",
"copies": "1",
"size": "1204",
"license": "unlicense",
"hash": 3938996441563309000,
"line_mean": 22.6078431373,
"line_max": 169,
"alpha_frac": 0.6104651163,
"autogenerated": false,
"ratio": 3.1272727272727274,
"config_test": ... |
#!/bin/python3
import os.path
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GLib, GObject, Gtk, GdkX11, Gst, GstVideo
GObject.threads_init()
Gst.init(None)
class VideoController(GObject.GObject):
__gsignals__ = {
'playback-changed': ( GObject.SIGNAL_RUN_FIRST, None,
... | {
"repo_name": "biogeo/gst-tests",
"path": "VideoController.py",
"copies": "1",
"size": "10449",
"license": "mit",
"hash": 1329650616925820400,
"line_mean": 36.0531914894,
"line_max": 80,
"alpha_frac": 0.5793855871,
"autogenerated": false,
"ratio": 3.6909219357117626,
"config_test": false,
"ha... |
#!/bin/python3
# import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import koi8
import argparse
import sys
import json
import os
font_h = 0
req_chars = []
available_encodings = ["koi8"]
parser = argparse.ArgumentParser(description='Create bitmap from font.')
parser.add_argument('-s'... | {
"repo_name": "SL-RU/MakiseGUI",
"path": "utils/font_creator/gen_bitmap.py",
"copies": "1",
"size": "4438",
"license": "mit",
"hash": -1563937593134229200,
"line_mean": 25.896969697,
"line_max": 78,
"alpha_frac": 0.5784136999,
"autogenerated": false,
"ratio": 3.1034965034965034,
"config_test": ... |
#!/bin/python3
import praw
import smtplib
import requests
import parsel
import re
import io
import json
import os
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from argparse import ArgumentParser
from premailer import Premailer
HEADERS = requests.... | {
"repo_name": "thelostt/reddit-weekly",
"path": "rewe.py",
"copies": "1",
"size": "5215",
"license": "mit",
"hash": -8024244523180697000,
"line_mean": 34.9655172414,
"line_max": 117,
"alpha_frac": 0.5975071908,
"autogenerated": false,
"ratio": 3.504704301075269,
"config_test": false,
"has_no_... |
#!/bin/python3
import queue
def cost_repair(city_connections, number_of_cities, c_lib, c_road):
print("Start")
if c_lib < c_road:
return number_of_cities * c_lib
print("Generate adjacent matrix for " + str(number_of_cities) + "")
adj_cities = [[0] * number_of_cities for row in range(number... | {
"repo_name": "thelfensdrfer/hackerrank",
"path": "python/algorithms/graph-theory/torque-and-development/solution.py",
"copies": "1",
"size": "2186",
"license": "mit",
"hash": 7318582459993071000,
"line_mean": 30.2285714286,
"line_max": 98,
"alpha_frac": 0.5695333943,
"autogenerated": false,
"rat... |
#!/bin/python3
# import random
import copy
import re
from preparation.resources.Resource import gen_resource
from hb_res.explanations import Explanation
# noinspection PyProtectedMember
from preparation.resources.definitions import _raw_data
from preparation import modifiers
from preparation.lang_utils.morphology im... | {
"repo_name": "hatbot-team/hatbot_resources",
"path": "preparation/resources/definitions/parse_definitions.py",
"copies": "1",
"size": "4199",
"license": "mit",
"hash": -5311077117375043000,
"line_mean": 31.352,
"line_max": 116,
"alpha_frac": 0.5853115727,
"autogenerated": false,
"ratio": 2.83391... |
#!/bin/python3
import random
def majority_linear(a):
c = None
n = 0
for e in a:
if not n:
c = e
n = 1
else:
n += 1 if e == c else -1
if n == 0:
c = None
return c if count(a, 0, len(a) - 1, c) > len(a) // 2 else -1
def maj... | {
"repo_name": "rmsr/misc",
"path": "coursera/algorithmic-toolbox/week4/majority_element.py",
"copies": "1",
"size": "1175",
"license": "isc",
"hash": -7959039284073848000,
"line_mean": 22.9795918367,
"line_max": 70,
"alpha_frac": 0.5055319149,
"autogenerated": false,
"ratio": 2.9746835443037973,
... |
#!/bin/python3
import random
print("Hello?")
nouns = ["plane", "planar coefficients", "structure", "disphrenials", "altcurve", "discontinuity", "conjecture", "aliter", "transport of structure", "isomorphism", "algebraic system"]
adjectives = ["argand", "Euler", "Eilenberg", "arbitrarily prime", "coprime", "genefini... | {
"repo_name": "v6/basanese.com",
"path": "mathsentience.py",
"copies": "1",
"size": "1448",
"license": "apache-2.0",
"hash": -3048407597391031300,
"line_mean": 52.3333333333,
"line_max": 330,
"alpha_frac": 0.6458333333,
"autogenerated": false,
"ratio": 2.742857142857143,
"config_test": false,
... |
#!/bin/python3
import relaiscommands as rc
import reliablechoice as tplink
import serial
import time
import socketserver
import sys
DEVICE='/dev/ttyS0'
EXPECTED_CARDS=3
EXPECTED_FIRMWARES = [11]
class RelaisRequestHandler(socketserver.StreamRequestHandler):
def __init__(self, request, client_address, se... | {
"repo_name": "SebastianSchildt/potatonet-power",
"path": "relaisserver.py",
"copies": "1",
"size": "8984",
"license": "mit",
"hash": -3273746292425150000,
"line_mean": 32.3977695167,
"line_max": 136,
"alpha_frac": 0.4979964381,
"autogenerated": false,
"ratio": 3.9982198486871385,
"config_test"... |
#!/bin/python3
import re
import json
import sys
import os
movie_ratings_pattern = re.compile(r"""(?P<distribution>[\d\.\*]{10}?)\t # distribution of votes
(?P<votes>[\d]*?)\t # number of votes
(?P<rating>\d0?\.\d?)\t ... | {
"repo_name": "symat/spark-api-comparison",
"path": "data/prepare_streaming_data.py",
"copies": "1",
"size": "3548",
"license": "bsd-2-clause",
"hash": 520324468058628900,
"line_mean": 32.7904761905,
"line_max": 111,
"alpha_frac": 0.5411499436,
"autogenerated": false,
"ratio": 3.4247104247104247,... |
#!/bin/python3
import re
import json
import sys
pattern = re.compile(r"""(?P<name>[^\t]+?)?\t+ # name
['"]?(?P<title>.+?)['"]?\s* # movie title, optionally quoted
\((?P<year>[\d\?]{4}?).*\) # year
.*""", re.VERBOSE) # anyt... | {
"repo_name": "symat/spark-api-comparison",
"path": "data/parse_actors.py",
"copies": "1",
"size": "1693",
"license": "bsd-2-clause",
"hash": 2418280849179058700,
"line_mean": 27.2166666667,
"line_max": 99,
"alpha_frac": 0.5073833432,
"autogenerated": false,
"ratio": 3.287378640776699,
"config_... |
#!/bin/python3
import re
import json
import sys
pattern = re.compile(r"""\s* # starting whitespaces
(?P<distribution>[\d\.\*]{10}?)\s+ # distribution of votes
(?P<votes>[\d]*?)\s+ # number of votes
... | {
"repo_name": "symat/spark-api-comparison",
"path": "data/parse_ratings_top250_movies.py",
"copies": "1",
"size": "1636",
"license": "bsd-2-clause",
"hash": 7829267653068146000,
"line_mean": 28.2321428571,
"line_max": 88,
"alpha_frac": 0.5122249389,
"autogenerated": false,
"ratio": 3.359342915811... |
#! /bin/python3
import requests, time
from bs4 import BeautifulSoup
from pushbullet import Pushbullet
pb = Pushbullet("API")
# Only first page
catalog = requests.get("http://www.sweclockers.com/forum/118-annonskommentarer")
catalog = BeautifulSoup(catalog.content, "html.parser")
# Gets the keywords from a txt fil... | {
"repo_name": "Hackslashloot/sweclockers_notify",
"path": "sweclockers.py",
"copies": "1",
"size": "2470",
"license": "mit",
"hash": 2014272966678037500,
"line_mean": 23.7,
"line_max": 97,
"alpha_frac": 0.6623481781,
"autogenerated": false,
"ratio": 2.9830917874396135,
"config_test": false,
"... |
#!/bin/python3
import re #regular expressions
import requests
from bs4 import BeautifulSoup
import argparse
import sys
def ProcessGameName(game):
#game = game.lower()
game = game.replace("&","and")
game = game.replace(".","")
game = game.replace(" :",":")
game = re.sub("\(.*\)","",game)
game = game.replace(" "... | {
"repo_name": "mraggi/wineappdb-ratings",
"path": "winehqextract.py",
"copies": "1",
"size": "3577",
"license": "apache-2.0",
"hash": 5060566347422628000,
"line_mean": 25.6940298507,
"line_max": 110,
"alpha_frac": 0.6726306961,
"autogenerated": false,
"ratio": 2.783657587548638,
"config_test": ... |
#!/bin/python3
import re #regular expressions
import requests
from bs4 import BeautifulSoup
import argparse
def ProcessGameName(game):
#game = game.lower()
game = game.replace("&","and")
game = game.replace(".","")
game = game.replace(" :",":")
game = re.sub("\(.*\)","",game)
game = game.replace(" "," ")
game... | {
"repo_name": "mraggi/wineappdb-ratings",
"path": "steamextract.py",
"copies": "1",
"size": "3817",
"license": "apache-2.0",
"hash": -2559386141330995700,
"line_mean": 34.3240740741,
"line_max": 132,
"alpha_frac": 0.6395806029,
"autogenerated": false,
"ratio": 3.0110497237569063,
"config_test":... |
#!/bin/python3
import re #regular expressions
import subprocess
import os
import sys
Games = {} #empty dictionary
def Canonicalize(s):
S = s.lower()
S = S.strip()
S = S.replace('\'',"")
S = S.replace('-',"")
S = S.replace(':',"")
S = S.replace('+',"")
S = S.replace('=',"")
S = S.replace(" "," ")
S = S.repla... | {
"repo_name": "mraggi/wineappdb-ratings",
"path": "winesteamcompare.py",
"copies": "1",
"size": "2101",
"license": "apache-2.0",
"hash": 4090357209592339000,
"line_mean": 24.0119047619,
"line_max": 99,
"alpha_frac": 0.6301761066,
"autogenerated": false,
"ratio": 2.7681159420289854,
"config_test... |
#!/bin/python3
import re #regular expressions
import subprocess
import os
import sys
def Canonicalize(s):
S = s.lower()
S = S.strip()
S = S.replace('\'',"")
S = S.replace('-',"")
S = S.replace(':',"")
S = S.replace('+',"")
S = S.replace('=',"")
S = S.replace(" "," ")
S = S.replace("!","")
S = S.replace("?"... | {
"repo_name": "mraggi/wineappdb-ratings",
"path": "winegogcompare.py",
"copies": "1",
"size": "1843",
"license": "apache-2.0",
"hash": -6116105803478248000,
"line_mean": 24.2465753425,
"line_max": 97,
"alpha_frac": 0.634834509,
"autogenerated": false,
"ratio": 2.7425595238095237,
"config_test":... |
#! /bin/python3
import seabreeze
seabreeze.use('pyseabreeze')
import seabreeze.spectrometers as sb
import datetime
import time
import csv
import os, sys
import argparse
#init
savetime = time.strftime('%Y%m%d_%H%M%S')
dirpath = "data"
fileName = os.path.join(dirpath, savetime)
defaultIntegrationTime = 100 #default in... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "0_hcphotonics/0_archive/oceanoptics_outdated/acquire.py",
"copies": "1",
"size": "1678",
"license": "apache-2.0",
"hash": -2230585056323309600,
"line_mean": 25.21875,
"line_max": 113,
"alpha_frac": 0.6597139452,
"autogenerated": false,
"ratio":... |
#! /bin/python3
import seabreeze
seabreeze.use('pyseabreeze')
import seabreeze.spectrometers as sb
import datetime
import time
import csv
import os, sys
import Gnuplot, Gnuplot.funcutils
import argparse
#init
savetime = time.strftime('%Y%m%d_%H%M%S')
dirpath = "data"
fileName = os.path.join(dirpath, savetime)
defaul... | {
"repo_name": "sunjerry019/photonLauncher",
"path": "0_hcphotonics/0_archive/oceanoptics_outdated/spec.py",
"copies": "1",
"size": "2678",
"license": "apache-2.0",
"hash": -6689640770147551000,
"line_mean": 28.4285714286,
"line_max": 142,
"alpha_frac": 0.6478715459,
"autogenerated": false,
"ratio... |
#!/bin/python3
import sqlite3 as db
import csv
from datetime import datetime, timedelta
csv_file = 'speed.csv'
db_file = 'speed.sqlite'
def main():
# open connection to the database
conn = db.connect(db_file, detect_types=db.PARSE_DECLTYPES | db.PARSE_COLNAMES)
# if table doesn't exist, create it
co... | {
"repo_name": "eddwhite/internet-tester",
"path": "import_csv.py",
"copies": "1",
"size": "1526",
"license": "mit",
"hash": 3435383251062324000,
"line_mean": 32.1739130435,
"line_max": 84,
"alpha_frac": 0.5596330275,
"autogenerated": false,
"ratio": 3.9739583333333335,
"config_test": false,
"... |
#!/bin/python3
import struct
from collections import namedtuple
from sys import argv
from img import Img
Hdr = namedtuple("Hdr", ["signature", "version"])
LogicSD = namedtuple("LogicSD", ["width", "height", "pack", "bcolour", "aspect"])
AppExt = namedtuple("AppExt", ["name", "auth", "data", "saddr"])
Co... | {
"repo_name": "jon-stewart/imghide",
"path": "gif.py",
"copies": "1",
"size": "7182",
"license": "mit",
"hash": -1560057814770901800,
"line_mean": 28.0769230769,
"line_max": 117,
"alpha_frac": 0.522556391,
"autogenerated": false,
"ratio": 3.754312598013591,
"config_test": false,
"has_no_keywo... |
#! /bin/python3
import sys
import os
import requests
import hashlib
import time
import json
class JumpLearn:
base_url = 'http://222.171.146.29/G2S/'
learn_number = 40
def __init__(self,username='',password=''):
self.username = username
self.password = password
self.is_login_url = ... | {
"repo_name": "KeyiYin/USTH-Jump-Learn-Script",
"path": "jump_learn.py",
"copies": "1",
"size": "3108",
"license": "mit",
"hash": 7798475384055402000,
"line_mean": 33.5333333333,
"line_max": 151,
"alpha_frac": 0.592985843,
"autogenerated": false,
"ratio": 3.476510067114094,
"config_test": false... |
#!/bin/python3
import sys
import socket
import time
HID_REPORT_SIZE_BYTES = 8
# Functions
def try_to_connect(socket_object: socket.SocketType, server_address: str, port_number: int) -> bool:
try:
socket_object.connect((server_address, port_number))
except OSError as error:
print("error: " +... | {
"repo_name": "miikka-h/Projektikurssi17",
"path": "test-client/test-client.py",
"copies": "1",
"size": "2773",
"license": "mit",
"hash": 716651448044049700,
"line_mean": 28.5,
"line_max": 107,
"alpha_frac": 0.5164082221,
"autogenerated": false,
"ratio": 4.083946980854197,
"config_test": false,... |
import sys
__author__ = "Sunil"
__copyright__ = "Copyright 2015, hacker_rank Project"
__license__ = "MIT"
__version__ = "1.0.0"
__email__ = "sunhick@gmail.com"
kALPHABETS = 26
class CaesarCipher:
"""
Caesar cipher class with key as encryption phrase
"""
def __init__(self, key):
self.key = k... | {
"repo_name": "Sunhick/hacker_rank",
"path": "Algorithms/Implementation/Caesar-Cipher.py",
"copies": "2",
"size": "1255",
"license": "mit",
"hash": 6282468496959919000,
"line_mean": 20.6379310345,
"line_max": 65,
"alpha_frac": 0.5035856574,
"autogenerated": false,
"ratio": 3.555240793201133,
"c... |
#!/bin/python3
import sys
def bsearch_left(L, x, key=None, lo=None, hi=None):
if key == None:
key = lambda x: x
if lo == None:
lo = 0
if hi == None:
hi = len(L)
begin = lo
end = hi
while lo < hi:
mid = lo + (hi - lo) // 2
... | {
"repo_name": "lilsweetcaligula/Online-Judges",
"path": "hackerrank/algorithms/implementation/easy/divisible_sum_pairs/py/solution.py",
"copies": "1",
"size": "3104",
"license": "mit",
"hash": 5514956877215442000,
"line_mean": 29.1359223301,
"line_max": 81,
"alpha_frac": 0.5341494845,
"autogenerate... |
#!/bin/python3
import sys
def deleteName(dictName, fileName):
startN, endN = None,None
for i in range(len(fileName)):
if(fileName[i] == '('):
startN = i
elif(fileName[i] == ')'):
endN = i
if(startN!=None and endN!=None):
... | {
"repo_name": "VizzerGlitch/pythonPortfolio",
"path": "hackerrank/contests/WorldCodeSprint11/SimpleFilesCommands.py",
"copies": "1",
"size": "2540",
"license": "mit",
"hash": 6060638290255572000,
"line_mean": 28.8823529412,
"line_max": 86,
"alpha_frac": 0.524015748,
"autogenerated": false,
"ratio... |
#!/bin/python3
import sys
def isCavity(lookup, i, j):
if not 0 < i < len(lookup) - 1:
return False
if not 0 < j < len(lookup[0]) - 1:
return False
top, bottom = i - 1, i + 1
left, right = j - 1, j + 1
for x in range(top, bottom + 1):
if x != i and lookup[x][j] >= looku... | {
"repo_name": "lilsweetcaligula/Online-Judges",
"path": "hackerrank/algorithms/implementation/easy/cavity_map/py/solution.py",
"copies": "1",
"size": "1071",
"license": "mit",
"hash": -741601533435554700,
"line_mean": 20,
"line_max": 51,
"alpha_frac": 0.5070028011,
"autogenerated": false,
"ratio"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.