seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
18401918609
def main(): from collections import Counter n, m, *abc = map(int, open(0).read().split()) a = Counter(abc[:n]) *bc, = zip(*[iter(abc[n:])] * 2) bc = sorted(bc, key=lambda x: x[1], reverse=True) c = 0 for i, j in bc: a[j] += i c += i if c > n: break cn...
Aasthaengg/IBMdataset
Python_codes/p03038/s381288078.py
s381288078.py
py
605
python
en
code
0
github-code
90
19381581559
#!/bin/python3 from src.Operations import Operations from src.Balances import Balances from src.LiquidityPool import LiquidityPool from src.Arguments import Arguments from src.util.format_argument import format_argument from src.exceptions.insufficient_funds_exception import InsufficientFundsException from datetime im...
otboss/Uniqo-Token-Market-Simulator
main.py
main.py
py
9,908
python
en
code
0
github-code
90
42828070717
##################################################### # # # This file provides the numerical evidence for # # Conjecture 1 in the article. The details of the # # numerics are explained in Appendix B, section 2. # # ...
timcp/Self-Testing_Pure_TwoQubit_States
numerical_evidence_CKS2018_bounds.py
numerical_evidence_CKS2018_bounds.py
py
7,453
python
en
code
2
github-code
90
1863879154
import description_objects """ summary The classes that will convert the input received as a string for all the objects in the definition module into that object are included in this module. created: 24.05.2020 by kemalbayramag@gmail.com """ class ParseVariable: variable_string=None variable_name=None v...
kemalbayram61/Python-Project-Visualizer
parse_objects.py
parse_objects.py
py
11,508
python
en
code
1
github-code
90
21767399052
import os import time import unittest from selenium import webdriver from selenium.webdriver.common.by import By from page_objects.form_page import FormPage from parameterized import parameterized CHROME_EXECUTABLE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "chromedriver") DATA_SET = [("Online Co...
dudamaciej/Python-Selenium
tests/test.py
test.py
py
2,711
python
en
code
0
github-code
90
24743972899
#The purpose of this file is to build the CSV file that I will use to build the data visualization #importing files that will help the program run from clean_csv import * from lang import * from tweet import * def main(): #Creating the objects that will be used in this program. tweet = Tweets() clean =...
ravenusmc/twitter_analysis
data_collection/main.py
main.py
py
757
python
en
code
0
github-code
90
29415504753
# Helper code import collections # An item can be represented as a namedtuple Item = collections.namedtuple('Item', ['weight', 'value']) # Naive Approach based on Recursion def knapsack_max_value(knapsack_max_weight, items): lastIndex = len(items) - 1 return knapsack_recursive(knapsack_max_weight, items, last...
lorenzowind/python-programming
Data Structures & Algorithms/Project Advanced Algorithms/exercises/knapsack_recursive.py
knapsack_recursive.py
py
1,382
python
en
code
1
github-code
90
74410853096
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier df = pd.read_csv('Iris.csv') #Check null value df.isnull().any() #Check Datatype of the flowers features df....
Jimoh1993/Udemy-Data-Analysis-Visualization-Bootcamp-by-Python-Data-Analytics-Data-Science
Decision Trees on Iris Dataset.py
Decision Trees on Iris Dataset.py
py
2,011
python
en
code
0
github-code
90
29549646987
def ice(x, y): for di in range(4): nx, ny = x + dx[di], y + dy[di] if 0 <= nx < n and 0 <= ny < m and not lst[nx][ny]: lst[nx][ny] = 1 ice(nx, ny) dx = (-1, 0, 1, 0) dy = (0, -1, 0, 1) n, m = map(int, input().split()) lst = [list(map(int, input())) for _ in range(n)] cnt = 0...
moqoru/TIL
220930_Algorithm/220902/이것이 코딩테스트다 연습/음료수 얼려 먹기.py
음료수 얼려 먹기.py
py
444
python
en
code
0
github-code
90
34285908617
# -*- coding: utf-8 -*- """ Models for the video application keep track of uploaded videos and converted versions""" from __future__ import unicode_literals import os from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from django.db import models from ...
ISOF-ITD/teckenlistor
signbank/video/models.py
models.py
py
6,712
python
en
code
1
github-code
90
18583119699
import sys Q = int(sys.stdin.readline().strip()) LR = [] for i in range(Q): LR.append([int(x) for x in sys.stdin.readline().strip().split()]) N = 10**5+1 Primes = list(range(N+1)) Primes[1] = 0 for p in Primes: if p * p > N+1: break if p == 0: continue for i in range(p + p, N+1, p): Primes[i]...
Aasthaengg/IBMdataset
Python_codes/p03476/s981259240.py
s981259240.py
py
561
python
en
code
0
github-code
90
45976750839
import numpy expences = [int(e) for e in open("input.txt").readlines()] ex = numpy.tile(numpy.array(expences), (len(expences), 1)) sums = ex + ex.transpose() indexes = numpy.where(sums==2020)[0] num1, num2 = expences[indexes[0]], expences[indexes[1]] print(num1, num2, num1*num2)
susannmt/adventofcode
adventofcode2020/day1/vectorized_sum20.py
vectorized_sum20.py
py
283
python
en
code
1
github-code
90
9115573083
from calendar import c import enum from rest_framework import serializers from django.contrib.auth.hashers import make_password from .models import * from .forms import * from cloudinary.forms import cl_init_js_callbacks class ModelSerializer(serializers.ModelSerializer): class Meta: model = Model fields = ...
JordanTrz/Antawa-proyecto
backend/api/serializers.py
serializers.py
py
6,103
python
en
code
0
github-code
90
20370681030
# Databricks notebook source # MAGIC %md # MAGIC # MAGIC ## Run the output of recommended optimize statements as a single run or schedule as a periodic job # MAGIC # MAGIC <h4> Run this after the delta optimizer is finished </h4> # MAGIC # MAGIC #### 3 Modes: # MAGIC # MAGIC <ul> 1. <b>include_all_tables</b>: this ...
AbePabbathi/lakehouse-tacklebox
30-performance/delta-optimizer/customer-facing-delta-optimizer/Step 2_ Strategy Runner.py
Step 2_ Strategy Runner.py
py
5,715
python
en
code
21
github-code
90
20171470548
class Phone: manufactured='china' def __init__(self,brand,price,color): self.brand=brand self.price=price self.color=color def send_sms(self,number,text): sms=f'sending:{text} to {number}' return sms my_phone=Phone('Realme',13000,'blue') print(...
itskawsarjamil/python_practices
wk-3/8 intro to class/init.py
init.py
py
506
python
en
code
0
github-code
90
72758700458
import sys input = sys.stdin.readline n, m = map(int,input().split()) nls = [] count = 0 for _ in range(n): nls.append(input()) for _ in range(m): b = input() if b in nls: #b가 nls에 있는지 체크 count += 1 print(count)
chlendyd7/Algorithm
Algorithm_BackJoon/14425.py
14425.py
py
248
python
en
code
0
github-code
90
22315171742
""" 문제 설명 rows x columns 크기인 행렬이 있습니다. 행렬에는 1부터 rows x columns까지의 숫자가 한 줄씩 순서대로 적혀있습니다. 이 행렬에서 직사각형 모양의 범위를 여러 번 선택해, 테두리 부분에 있는 숫자들을 시계방향으로 회전시키려 합니다. 각 회전은 (x1, y1, x2, y2)인 정수 4개로 표현하며, 그 의미는 다음과 같습니다. x1 행 y1 열부터 x2 행 y2 열까지의 영역에 해당하는 직사각형에서 테두리에 있는 숫자들을 한 칸씩 시계방향으로 회전합니다. 다음은 6 x 6 크기 행렬의 예시입니다. grid_example.png...
polkmn222/programmers
python/연습문제/level2/행렬 테두리 회전하기.py
행렬 테두리 회전하기.py
py
2,337
python
ko
code
1
github-code
90
3421800875
# Hello World program in Python class Solution: round = 0 def checkElements(self, input): lenList = [] maxLen = 0 for i in range(len(input)): self.round += 1 print("=======") print("Round: " + str(self.round)) lenList.append(1) ...
wangdu1005/Learn-Algorithm-And-Data-Structure
Google_Find_Increasing_inx_and_val_3_Elements.py
Google_Find_Increasing_inx_and_val_3_Elements.py
py
2,121
python
en
code
0
github-code
90
461759769
import os import pygame import scene import config import common import group import title_sprite import game import intro import common import pytweener import menu from sprite import Sprite class Presents(scene.Scene): "Muestra el logotipo de gcoop y el texto: 'presenta...'" def __init__(self, world): ...
gcoop-libre/ayni
src/presents.py
presents.py
py
4,059
python
en
code
5
github-code
90
29654713081
#Tengo lista de items A = [] #Digamos que tiene cosas HT = {} #HT vacia for item in A: if item in HT.keys(): HT[item] += 1 else: HT[item] = 1 # Ahora para checar item = None count = 0 for i in t.items(): if i[1] >= count: count = i[1] item = i[0] return item #Para la b: i...
miguel-mzbi/SolutionsCrackingTheCode
test.py
test.py
py
376
python
es
code
0
github-code
90
17068243512
# go 배열의 값 : 해당 칸의 다음칸의 인덱스 go = [0] * 33 score = [0] * 33 # 파랑칸에 멈추지 않고 외곽으로만 도는 경우 : index 0 ~ 21 # index 21은 도착칸 # go 배열의 값은 해당 칸의 다음 칸의 index for i in range(21): go[i] = i + 1 go[21] = 21 # 도착칸 go[22], go[23], go[24] = 23, 24, 25 go[25], go[26], go[27] = 26, 27, 20 go[28], go[29] = 29, 25 go[30], go[31], go[3...
sudo-bin/algorithm_study
solved/boj/17825_주사위윷놀이.py
17825_주사위윷놀이.py
py
2,107
python
ko
code
0
github-code
90
43945324626
import json import requests url = 'https://api.foursquare.com/v2/venues/search' params = dict(client_id='PASTE_YOUR_KEY_HERE', client_secret='PASTE_YOUR_SECRET_HERE', v='20180323', ll='42.3495694,-71.0836727', query='george howell', limit=1) resp =...
br3ndonland/udacity-fsnd
4-web-apps/javascript-ajax-apis/foursquare/foursquare-explore.py
foursquare-explore.py
py
704
python
en
code
75
github-code
90
34406148930
from setuptools import setup, find_packages README = 'provide --dry-run functionality for your application' requires = [] tests_require = [ 'pytest', ] setup(name='dryable', version='1.2.0', description=README, long_description=README, url='https://github.com/haarcuba/dryable', author='...
haarcuba/dryable
setup.py
setup.py
py
863
python
en
code
41
github-code
90
36664406465
import numpy as np import matplotlib.pyplot as plt ''' find the minimum point by using simulated annealing method ''' def obj_function(x): y = x ** 3 - 60 * x ** 2 - 4 * x + 6 return y # plot # x = np.linspace(0, 100, 1000) # y = obj_function(x) # plt.plot(x, y) # plt.show() if __name__ == '__main__': ...
zhengxiang1994/optimization
simulated_annealing.py
simulated_annealing.py
py
1,303
python
en
code
1
github-code
90
19305761220
import os import sys import logging import numpy as np import h5py import scipy.io class HRTF(object): def __init__(self, nbChannels, samplingRate, maxLength=None): self.nbChannels = nbChannels self.elevations = None self.azimuths = None self.distances = None self.impulses ...
codyjhsieh/HRTFCNN
utils/hrtf.py
hrtf.py
py
7,229
python
en
code
13
github-code
90
21730877001
from PIL import Image # 读入图片 img = Image.open('000100.png') # 获取图片的宽度和高度 width, height = img.size # 创建一个与原图大小相同的空图 new_img = Image.new('RGB', (width, height)) # 逐像素拷贝像素值 for x in range(width): for y in range(height): pixel = img.getpixel((x, y)) new_img.putpixel((x, y), pixel) ...
niushuqing123/Undergraduate-Final-Year-Project
数据1/make_new_img单张.py
make_new_img单张.py
py
497
python
en
code
0
github-code
90
40936263650
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from datasist.structdata import detect_outliers from category_encoders.binary import BinaryEncoder ## other #from imblearn.over_sampling import SMOTE ## sklearn -- preprocessing from sklearn.preprocessing import StandardSc...
aahmedsherif/FinalProject
utils.py
utils.py
py
15,381
python
en
code
0
github-code
90
72201288298
# Easy # You are given the heads of two sorted linked lists list1 and list2. # Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. # Return the head of the merged linked list. # # # # Example 1: # Input: list1 = [1,2,4], list2 = [1,3,4] # Output: [1,...
ArmanTursun/coding_questions
LeetCode/Easy/21. Merge Two Sorted Lists/21. Merge Two Sorted Lists.py
21. Merge Two Sorted Lists.py
py
1,451
python
en
code
0
github-code
90
17005171001
class Node: def __init__(self, keys=[], leaf=False): self.leaf = leaf self.keys = keys self.pointers = [] class BPlusTree: def __init__(self, t): self.root = None self.t = t def insert(self, key): # Se a raiz da árvore estiver vazia, crie um novo nó raiz ...
josuelopes512/BigNumberCalculator
BPlusTreeNode.py
BPlusTreeNode.py
py
8,136
python
pt
code
0
github-code
90
25677303290
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render,render_to_response from django.http import JsonResponse, HttpResponse # Create your views here. def home(request): c = {} return render_to_response('general/home.html',c) def calculate_significance(request): d ...
wiserthanever/sigcalc
general/views.py
views.py
py
807
python
en
code
0
github-code
90
17959405539
N = int(input()) P = list(map(int,input().split())) ans = 0 for n in range(N-1): if P[n]==n+1 and P[n+1]==n+2: ans+=1 P[n+1] = n+1 elif P[n]==n+1 and P[n+1]!=n+2: ans+=1 if P[-1]==N: print(ans+1) else: print(ans)
Aasthaengg/IBMdataset
Python_codes/p03612/s226415113.py
s226415113.py
py
234
python
en
code
0
github-code
90
20368550551
class Solution: def nextPermutation(self, nums: List[int]) -> None: refpoint = None for index in range(len(nums)-1,0,-1): if nums[index-1]<nums[index]: refpoint = index-1 break temp = [] if refpoint is not None: for ind...
RishabhSinha07/Competitive_Problems_Daily
31-next-permutation/31-next-permutation.py
31-next-permutation.py
py
687
python
en
code
1
github-code
90
18070825339
data=list(input().split()) a=0 b=0 for i in range(0,3): if data[i]=='5': a=a+1 elif data[i]=='7': b=b+1 if (a==2 and b==1): print('YES') else: print('NO')
Aasthaengg/IBMdataset
Python_codes/p04043/s304948561.py
s304948561.py
py
186
python
en
code
0
github-code
90
38108557247
# -*- coding: utf-8 -*- import os import sys import serial import hashlib from binascii import * from libs import bflb_utils try: from serial.tools.list_ports import comports except ImportError: raise exception.GetSerialPortsError(os.name) class FileSerial(object): def _int_to_hex(self...
llamaonaskateboard/bflb-mcu-tool
bflb_mcu_tool/libs/bflb_file_serial.py
bflb_file_serial.py
py
5,298
python
en
code
4
github-code
90
30954053097
from configparser import ConfigParser from pathlib import Path import pytest import shutil import random import string import os from media_library_sqlite import MediaLibrarySQLite from main import MediaLibraryBuilder @pytest.fixture(scope="function") def setup_test_environment(): # 删除数据库文件 db_file = Path("me...
Aquaakuma/py_hlink
test_rebuild.py
test_rebuild.py
py
3,182
python
en
code
0
github-code
90
26969302219
import time import gspread from PyQt5 import QtCore from gspread.exceptions import APIError, NoValidUrlKeyFound from faq_manual import credentials from status_urls import StatusUrl class GDoc(QtCore.QThread): bugStatus = QtCore.pyqtSignal(str) progressStatus = QtCore.pyqtSignal(str) validateStatus = QtC...
EugeneOregon/LinkValidator
gdoc.py
gdoc.py
py
3,818
python
en
code
0
github-code
90
3175442607
import socket, sys from struct import * #importing required libraries # Description string with banner and information desc = "\n" + r""" """"\t\t\t""""__________ __ ____ __. __ """"\t\t\t""""\______ \____________/ |_ | |/ _| ____ ____ _...
mhuzaifi0604/Port-Knocker
Asembler.py
Asembler.py
py
4,508
python
en
code
14
github-code
90
33832067881
""" SlackOutput is a class that implements the BaseOutputProvider interface for Slack messages. """ import dataclasses import os import pydantic import requests from keep.contextmanager.contextmanager import ContextManager from keep.exceptions.provider_exception import ProviderException from keep.providers.base.base_...
keephq/keep
keep/providers/slack_provider/slack_provider.py
slack_provider.py
py
5,359
python
en
code
2,348
github-code
90
40106952791
#!/user/bin env python #-*- coding:utf8 -*- import Pecker import numpy as np from math import sqrt,hypot Slice = 10. #每筆畫精細度設定為10mm if __name__ == '__main__': board_len = float(raw_input('Length of Board: ')) init = np.array(map(float,raw_input('Input Init Pos: ').split())) tmp = np.array([0.,0.]) ...
jwc911037/PeckerWriter
Dump/old/PosGoExample.py
PosGoExample.py
py
736
python
en
code
0
github-code
90
18454785023
from datetime import datetime, timedelta class MemoizationError(Exception): '''Raised when memoization process fails.''' pass class memoize: '''Memorizes various results of the function provided dependent on passed parameters. Methods: memoized(self, *resolver) Properties:...
kamzyd/5hzS-Gj3s-L9Is-2FR4
memoization/memoize.py
memoize.py
py
2,790
python
en
code
0
github-code
90
6656267484
#!/usr/bin/env python # -*- coding: utf-8 -*- import runpy import shutil import sys from pathlib import Path import pytest @pytest.fixture def dicom_file(): pydicom = pytest.importorskip("pydicom") return pydicom.data.get_testdata_file("CT_small.dcm") @pytest.fixture def dicom_folder(dicom_file, tmp_path):...
medcognetics/dicom-utils
tests/test_main/test_dicom_types.py
test_dicom_types.py
py
991
python
en
code
0
github-code
90
38304771230
# given a string, compute recursively a new string where all the lowercase 'x' chars have been moved to the end of the string def end_x(str): if not len(str): return '' if str[0] != 'x': return str[0] + end_x(str[1:]) else: return end_x(str[1:]) + 'x' print(end_x('xxre')) print(end_x('xxhixx')) print(end_x('...
jemtca/CodingBat
Python/Recursion-1/end_x.py
end_x.py
py
331
python
en
code
0
github-code
90
44939285088
val_1 = float(input('Wpisz pierwszą dowolną liczbę: ')) val_2 = float(input('Wpisz drugą dowolną liczbę: ')) suma = val_1 + val_2 roznica = val_1 - val_2 iloraz = val_1 / val_2 iloczyn = val_1 * val_2 print(f'Suma to: {suma}.') print(f'Różnica to: {roznica}.') print(f'Iloraz to: {iloraz}.') print(f'Iloczyn to: {ilocz...
Korki-Pola/korki-pola
2.-programowanie/zadania/04-python-keywords-cd/zadanie-2.py
zadanie-2.py
py
433
python
pl
code
0
github-code
90
42039542940
""" There are a total of n courses you have to take labelled from 0 to n - 1. Some courses may have prerequisites, for example, if prerequisites[i] = [ai, bi] this means you must take the course bi before the course ai. Given the total number of courses numCourses and a list of the prerequisite pairs, return the orde...
nilay-gpt/LeetCode-Solutions
graphs/topological_sort/course_scheduleII.py
course_scheduleII.py
py
2,270
python
en
code
2
github-code
90
11359649095
def adding_dict(student_name): # Ф-ция заполнения данных dic = made_dic(reading_data(student_name)) # Ф-ция создаёт из строки вида "Kat: ; M: 1 5 3 5 4; R: 5 4 5" список словарей print(reading_data(student_name)) # print(dic) hold = '0' subj_tamp = ' ' + input('Ведите название предмета \n:...
SB44444/PythonSeminar_8_tasks_1
tamp_read.py
tamp_read.py
py
3,870
python
ru
code
0
github-code
90
35716412801
from dataclasses import dataclass import pytest from secfsdstools.a_utils.dbutils import DB, DBStateAcessor sql_create = """ CREATE TABLE IF NOT EXISTS testtable1 ( col1, col2 ) """ sql_create_status = """ CREATE TABLE IF NOT EXISTS status ( keyName, ...
HansjoergW/sec-fincancial-statement-data-set
tests/a_utils/test_dbutils.py
test_dbutils.py
py
3,103
python
en
code
12
github-code
90
4264271063
notas = (2, 4, 6, 8) def contenido(lista, indice): try: resultado = lista[indice] except: resultado = None return resultado # Calcular la media indice = 0 suma = 0 while contenido(notas, indice) != None: suma = suma + notas[indice] indice = indice + 1 media = suma / i...
acelerarepos/pensamiento-computacional
media05.py
media05.py
py
450
python
pt
code
0
github-code
90
35071334741
from datetime import date import time from openerp.osv import orm, fields from openerp.osv import fields, osv from openerp.tools.translate import _ class payment_order_create(osv.osv_memory): _inherit = 'payment.order.create' def create_payment(self, cr, uid, ids, context=None): flag = 0 partn...
excedogit/GameFarm
gff_account_eft_export/eft_export.py
eft_export.py
py
5,227
python
en
code
0
github-code
90
30628245598
## BUDGET ANALYSIS (v2) import sys import time import random stored = {} total_list = [0] budget_store = [0] # -------------------- PROGRESS BAR CODE ------------------------ def updt(total, progress): barLength, status = 20, "" progress = float(progress) / float(total) if progress >= 1.: progre...
edunzer/MIS285_PYTHON_PROGRAMMING
RANDOM/4.3_hard_with_progress_bar.py
4.3_hard_with_progress_bar.py
py
3,914
python
en
code
0
github-code
90
40491794953
#!/usr/bin/env python3 import os import sys import glob import subprocess import multiprocessing import shlex import argparse parser = argparse.ArgumentParser() parser.add_argument('--basic', action='store_true', help='Test only basic functionality') parser.add_argument('--verbose', action='store_true', help='Prin...
FreddyYJ/PyVerilog
run_tests.py
run_tests.py
py
14,822
python
en
code
0
github-code
90
34132815180
def find_highest_bidder(Bidders): max_bid = None max_bidder = None for Name, Bid in Bidders.items(): if max_bid == None or Bid > max_bid : max_bid = Bid max_bidder = Name return Name def main(): print("Welcome to the silent auction program.") bidders...
ajaythumala/100-Days-of-Code
100/day_9/silent_auction.py
silent_auction.py
py
902
python
en
code
0
github-code
90
70591347818
import ast import discord import config import traceback import datetime import market import os import psutil from discord.ext import commands, tasks, menus from discord_slash import cog_ext, SlashContext from discord_slash.utils.manage_commands import create_option, create_choice class InventoryMenu(menus.ListPageS...
KAJdev/Melonpan
Cogs/Information.py
Information.py
py
13,758
python
en
code
5
github-code
90
1351899675
from pathlib import Path import hashlib def get_str_md5(fh): for st_r in fh.readlines(): md5_hex = hashlib.md5(st_r.encode()).hexdigest() yield st_r, md5_hex p = Path('.') f_name = p.cwd() / 'recipes.txt' f = open(f_name, 'r', encoding='UTF-8') for ist_r, imd5_hex in get_str_md5(f): print(f...
Sergey-Gorb/apyles4
apyles4job2.py
apyles4job2.py
py
342
python
en
code
0
github-code
90
18524036539
import sys input = sys.stdin.readline N, M = map(int, input().split()) a = [] for _ in range(N): x, y, z = map(int, input().split()) a.append((x, y, z)) res = -float("inf") for k in range(8): dp = [[-float("inf")] * (M + 1) for _ in range(N + 1)] for i in range(N): dp[i][0] = 0 x, y, z = a[i] x *= (...
Aasthaengg/IBMdataset
Python_codes/p03326/s757622160.py
s757622160.py
py
701
python
en
code
0
github-code
90
11508691231
import argparse from ndbc_analysis_utilities.BuoyDataUtilities import getActiveBOI, getMonthlyDF, getMonthName, getNthPercentileSampleWithoutPMF from ndbc_analysis_utilities.NDBCBuoy import NDBCBuoy import matplotlib.pyplot as plt import pandas as pd import numpy as np import datetime def calcNGoodDays(dates: pd.core....
ewackerbarth1/Buoy_Data
PlotNGoodDaysEachYear.py
PlotNGoodDaysEachYear.py
py
3,386
python
en
code
0
github-code
90
18241131929
def main(): N, K, C = map(int, input().split()) S = input() # greedy head, tail = [-C - 1] * (K + 1), [N + C + 1] * (K + 1) idx = 0 for i in range(N): if S[i] == 'o' and i - head[idx] > C: idx += 1 head[idx] = i if idx == K: break ...
Aasthaengg/IBMdataset
Python_codes/p02721/s190544189.py
s190544189.py
py
642
python
en
code
0
github-code
90
5162768798
words = input().split() palindrome = input() palindromes_list = [] for word in words: # if word == word[::-1]: - much slower rev_list = reversed(word) rev_word = "".join(rev_list) if rev_word == word: palindromes_list.append(word) print(palindromes_list) count = words.count(palindrome) print(...
bongoslav/SoftUni-Software-Engineering
1.Python-Fundamentals/05. List Advanced/Lab/L04.py
L04.py
py
354
python
en
code
0
github-code
90
4093725064
#!/usr/bin/env python3 import sys file1_name=sys.argv[1] file2_name=sys.argv[2] file1=open(file1_name,"r") file2=open(file2_name,"r") data1 = file1.read().rstrip() data2 = file2.read().rstrip() if(len(data1)!=len(data2)): print("Length mismatch\n") len_min = min([len(data1),len(data2)]) mismatches = [i for ...
MartinMosbeck/HW_SW_CoDesign_LU
tools/scripts/compare.py
compare.py
py
511
python
en
code
0
github-code
90
16948503381
class Solution: def rangeBitwiseAnd(self, m: int, n: int) -> int: i = 0 while m != n: m >>= 1 n >>= 1 i += 1 return m << i def num_to_binary(self, m: int): if m == 0: return "0" res = "" while m > 0: rem...
iamsuman/algorithms
iv/Leetcode/medium/201_bitwise_and.py
201_bitwise_and.py
py
711
python
en
code
2
github-code
90
28768454916
#general imports import logging #specific imports from std from time import sleep, time from uuid import uuid4 from functools import partial from ipaddress import ip_address #imports from 3rd party from secp256k1_zkp import PrivateKey #general leer imports from leer.syncer import Syncer from leer.core.utils import DOSE...
WTRMQDev/leer
leer/core/core_loop.py
core_loop.py
py
19,441
python
en
code
5
github-code
90
18462637289
import sys #import numpy as np #from collections import defaultdict import math #from collections import deque input = sys.stdin.readline def main(): n = int(input()) dp = [0]*n dp[0] = list(map(int,input().split())) for i in range(1,n): dp[i] = list(map(int,input().split())) dp[...
Aasthaengg/IBMdataset
Python_codes/p03162/s700969248.py
s700969248.py
py
523
python
en
code
0
github-code
90
32762919309
import re # Strip punctuation and normalize each review to lowercase. Check if the keyword appears in the review. # Increment that keywords frequency per occurance. Sort the resultant dict by frequency and lexographically if frequencies are equal. # O(R*W + WlgW) time, R is number of reviews, W is number of keywor...
kelr/practice-stuff
leetcode/amazon-topkkeywords.py
amazon-topkkeywords.py
py
2,023
python
en
code
0
github-code
90
74412921256
''' Created on August 11th 2016 @author: Thierry Souche ''' from bottle import Bottle, request, run from bson.objectid import ObjectId from common.constants import oidIsValid from common.constants import setserver_address, setserver_port from common.constants import setserver_routes from server.backend import Backen...
tsouche/setgame
server/setserver.py
setserver.py
py
11,595
python
en
code
0
github-code
90
26093583560
from model_loader import * import os import numpy as np import tensorflow as tf import pdb from sklearn.metrics import f1_score if __name__ == "__main__": DATA_DIR = "../example_datasets/PUF_4x64/" INPUTS_FILE = "f_4x64_100000.txt" LABELS_FILE = "r_4x64_100000.txt" # DATA_DIR = "../example_datasets/bkp...
lkrizan/ECF_deep_learning
demo/PUF_evaluator.py
PUF_evaluator.py
py
1,568
python
en
code
1
github-code
90
71124242856
import math import cairo from mod_python import apache from igraph import * import MySQLdb def index(): WIDTH, HEIGHT = 32, 32 surface = cairo.ImageSurface.create_for_data (cairo.FORMAT_ARGB32, WIDTH, HEIGHT) ctx = cairo.Context (surface) ctx.scale (WIDTH/200.0, HEIGHT/200.0) # Normalizing the canvas ##pat = c...
laironald/Govt-rddash
py/ron.py
ron.py
py
1,331
python
en
code
0
github-code
90
18154481649
n, k = map(int, input().split()) L, R = [], [] MOD = 998244353 for _ in range(k): t1, t2 = map(int, input().split()) L.append(t1) R.append(t2) dp = [0] * (n+1) dp[1] = 1 acc = [0] * (n+1) acc[1] = 1 for idx1 in range(2, n+1): for idx2 in range(k): if idx1 - L[idx2] < 0: continue ...
Aasthaengg/IBMdataset
Python_codes/p02549/s847665768.py
s847665768.py
py
479
python
en
code
0
github-code
90
28381506411
# -*- coding: utf-8 -*- import io import base64 from PIL import Image import PIL.PdfImagePlugin # activate PDF support in PIL from odoo import models, fields, api from PyPDF2 import PdfFileMerger from odoo.tools import pdf import PyPDF2 from io import BytesIO from reportlab.pdfgen import canvas from PyPDF2 import Pd...
SyentysDevCenter/Fprs_old
invoice_custom_report/models/account_move.py
account_move.py
py
5,701
python
en
code
0
github-code
90
2789427453
# Python functions used in different scripts import numpy as np import pandas as pd import subprocess import os import config_vars as cfg def create_fastq_symlink_nh(gem_id, fastq_path_df, symlink_path): """Creates a symbolic link to a fastq file using cellranger notation for non-hashed samples (see ht...
Single-Cell-Genomics-Group-CNAG-CRG/TonsilAtlas
scRNA-seq/1-cellranger_mapping/scripts/utils.py
utils.py
py
6,462
python
en
code
12
github-code
90
24491707308
from db import DB def get_db(): return DB() class BaseModel: def __init__(self, tablename='Weibo'): self.tablename = tablename self.create() def create(self): with get_db() as db: exists = db.execute("select count(name) from sqlite_master where type = 'table' and name...
fdfinger/swipe-edit-for-wx-xiuxianrebang
model.py
model.py
py
2,598
python
en
code
0
github-code
90
4110532181
import fileinput import math def main(): testFileProvided = True; # Change this to False to test on the same train data trainDataFile = 'traindata.txt' trainLabelFile = 'trainlabels.txt' testDataFile = 'testdata.txt' testLabelFile = 'testlabels.txt' ###################################### # train file process...
WanjinYoo/Data-Mining
Linear classification/q4/main.py
main.py
py
3,626
python
en
code
0
github-code
90
417132665
from selenium import webdriver from selenium.webdriver.common.by import By import time from selenium.webdriver.common.keys import Keys import os driver = webdriver.Chrome() driver.get('http://www.naver.com') element=driver.find_element(By.ID,'query') element.send_keys(Keys.RETURN) driver.find_element(By.ID,'gnb_login_...
SoftBankCorp/AI_semicon
new.py
new.py
py
644
python
en
code
0
github-code
90
8312554439
import socket import cv2 import struct import numpy as np import os # Set up the socket for communication client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Create a socket object with AF_INET (IPv4) address family and SOCK_STREAM (TCP) type # In the case of a webcam server, where real-time video str...
Keilwerth11270/pi-webcam
webcam_client.py
webcam_client.py
py
5,765
python
en
code
0
github-code
90
22364845286
n, s = input().split() n, s = int(n), int(s) bidders = [] for i in range(n): t, b = input().split() bidders.append((int(b), t)) bidders.sort(reverse=True) ans = [] for i in range(n): if bidders[i][0] <= s: ans.append(bidders[i][1]) s -= bidders[i][0] if s > 0: ans = [] print(len(ans...
leonardoAnjos16/Competitive-Programming
Other/intergalactic_bidding.py
intergalactic_bidding.py
py
356
python
en
code
4
github-code
90
29006350373
from cvxpy.expressions.variable import Variable from cvxpy.problems.objective import Minimize from cvxpy.reductions.matrix_stuffing import extract_mip_idx, MatrixStuffing from cvxpy.reductions.cvx_attr2constr import convex_attributes from cvxpy.reductions.utilities import are_args_affine class ConeMatrixStuffing(Matr...
johnjaniczek/SFCLS
venv/lib/python3.5/site-packages/cvxpy/reductions/dcp2cone/cone_matrix_stuffing.py
cone_matrix_stuffing.py
py
1,321
python
en
code
12
github-code
90
72020121258
from pandas.core.frame import DataFrame # Pandas将列表(List)转换为数据框(Dataframe) a=[[1,2,3,4],[5,6,7,8]] #包含两个不同的子列表[1,2,3,4]和[5,6,7,8] data=DataFrame(a) #这时候是以行为标准写入的 print(data) a=[1,2,3,4] #列表a b=[5,6,7,8] #列表b c={"a" : a, "b" : b} #将列表a,b转换成字典 data=DataFrame(c) #将字典转换成为数据框 print(...
todaygood/note-python
practise/dataFrame1.py
dataFrame1.py
py
444
python
zh
code
0
github-code
90
7545624681
from keras import layers from keras import models import rssi_data as train_data import read_test_data as test_data import tensorflow as tf import numpy as np import pandas as pd def one_hot_conversion(a,b): m = np.zeros(3) n = np.zeros(5) m[int(float(a))] = 1 n[int(float(b))] = 1 tmp = np.a...
dabaitudiu/ML_in_Wi-Fi_positioning
Stage5/CNN_BF.py
CNN_BF.py
py
3,153
python
en
code
3
github-code
90
86585971402
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from timeit import default_timer as timer """ RUN AT YOUR OWN RISK, THIS IS MULTITHREADED BENCHMARKING DONE WITH THE CODE FROM THE LAST PROBLEM. IT WILL USE ALL CPU RESOURCES AND CAN UPSET ANTIVIRUS PR...
akswart/phys416code
hw8/code/hw8_exC_parallel_step_opt.py
hw8_exC_parallel_step_opt.py
py
7,084
python
en
code
0
github-code
90
74761151657
"""Desafio 053 - Detector de palíndromo (Aula 01 a 13): Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os espaços.""" # Ler uma frase reverso = '' # Variável para armazenar a versão invertida da frase compara = '' # Variável para armazenar a versão original da frase frase...
dualsgo/meus-estudos
cursoemvideo_python/setembro/exercicios/ex_053.py
ex_053.py
py
884
python
pt
code
0
github-code
90
36880685153
# Local copy of sacad. Downloaded from: https://github.com/desbma/sacad import sacad import asyncio from os import path from utils import slugify # Finds and downloads album art def downloadAlbumArt(album: str, artist: str, is_single: bool = False): try: if is_single: fileName = f'{slugify(art...
MattHalloran/MusicFinder
findAlbumArt.py
findAlbumArt.py
py
1,134
python
en
code
0
github-code
90
18539283459
import sys h,w=map(int,input().split()) l=[] for i in range(h): s=[x for x in input()] l.append(s) for i in range(w): im=max(i-1,0) ip=min(i+1,w-1) for j in range(h): jm=max(j-1,0) jp=min(j+1,h-1) if l[j][i]=="#": if l[jm][i]=="#" or l[jp][i]=="#" or l[j][ip]=="#" or l[j][im]=="#": ...
Aasthaengg/IBMdataset
Python_codes/p03361/s704666823.py
s704666823.py
py
426
python
en
code
0
github-code
90
7016401996
from . import db class News(db.Model): __tablename__="news" title=db.Column(db.String(20),primary_key=True,unique=True,nullable=False,doc="标题") text=db.Column(db.String(20),nullable=True,doc="内容") time=db.Column(db.String(20),nullable=True,doc='时间') author = db.Column(db.String(20), nullable=True, d...
NEPU1960/yjs
main/model/News.py
News.py
py
663
python
en
code
0
github-code
90
7407735126
import pandas as pd import numpy as np from nltk.corpus import stopwords from textblob import Word import re from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectori...
Souvikdebroy/NLP
EmotionDetection.py
EmotionDetection.py
py
4,223
python
en
code
0
github-code
90
35220237081
from Constants import* class Snake: def __init__(self): self.body = [(4, 3), (4, 2), (4, 1)] self.direction = (1, 0) def move(self, grow): new_head = (self.body[0][0] + self.direction[0], self.body[0][1] + self.direction[1]) self.body.insert(0, new_head) if not grow: ...
sawsbuck/Python-Fun
TheSnakeGame/Snake.py
Snake.py
py
939
python
en
code
0
github-code
90
30610125838
"""added ready_for_planning column in Request Revision ID: bd7caeb72cc8 Revises: 4d9e9849b0e3 Create Date: 2021-10-15 17:44:24.038430 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'bd7caeb72cc8' down_revision = '4d9e9849b0e3' branch_labels = None depends_on =...
aykhazanchi/id2207-mmse
migrations/versions/bd7caeb72cc8_added_ready_for_planning_column_in_.py
bd7caeb72cc8_added_ready_for_planning_column_in_.py
py
707
python
en
code
0
github-code
90
7701986155
# HTTP Package # https://www.googleapis.com/books/v1/volumes?q=isbn:1101904224 import urllib.request import json import textwrap # using google books API, we are pulling a GET request with urllib.request.urlopen("https://www.googleapis.com/books/v1/volumes?q=isbn:1101904224") as f: # if this runs we create it as a v...
Coryf65/Python_LearningPath
6 TheStandardLibrary/Ch04/04_07/04_07_Finish.py
04_07_Finish.py
py
828
python
en
code
0
github-code
90
28051688358
from typing import Tuple, List, Set from main_package.fieldEntities.ant import Ant from main_package.field import * from main_package.fieldEntities.base import Base from main_package.fieldEntities.food import Food from main_package.interfaces.attackable import Attackable logging.basicConfig(level=logging.INFO) class...
socialgorithm/hive
main_package/gameBoard.py
gameBoard.py
py
13,692
python
en
code
0
github-code
90
15422794717
import tkinter from tkinter import * from PIL import Image, ImageTk root = Tk() # Create a photoimage object of the image in the path image1 = Image.open("../docs/logos-design/RacingInsights_Icon.png") image1 = image1.resize((100, 100)) test = ImageTk.PhotoImage(image1) label1 = tkinter.Label(image=test) label1.imag...
RacingInsights/RacingInsights-V1
example_code/image_example.py
image_example.py
py
393
python
en
code
0
github-code
90
27090045558
from spack import * class Doxygen(CMakePackage): """Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors),...
matzke1/spack
var/spack/repos/builtin/packages/doxygen/package.py
package.py
py
1,404
python
en
code
2
github-code
90
37396484740
# -*- coding: utf-8 -*- """ @File name : SortingAlgorithms.py @Date : 2020-02-09 16:45 @Description : Thanks to: https://blog.csdn.net/weixin_41190227/article/details/86600821 * Compare Sort: Bubble Sort, Select Sort, Insertion Sort, S...
VickeeX/LeetCodePy
collections_for_interview/SortingAlgorithms.py
SortingAlgorithms.py
py
8,852
python
en
code
0
github-code
90
14065068331
import unittest from datetime import datetime import cf_units as unit import numpy as np import pytest from iris.coords import CellMethod, DimCoord from iris.cube import Cube from iris.exceptions import CoordinateNotFoundError from iris.tests import IrisTest from improver.ensemble_copula_coupling.ensemble_copula_coup...
metoppv/improver
improver_tests/ensemble_copula_coupling/test_ConvertProbabilitiesToPercentiles.py
test_ConvertProbabilitiesToPercentiles.py
py
25,522
python
en
code
95
github-code
90
2798366476
import json from datetime import datetime from http.server import HTTPServer, BaseHTTPRequestHandler # # Abstraction # class NotFoundError(BaseException): pass # Very crude url dispatching def dispatch(request, urlpatterns): for url in urlpatterns: if request.path == url['path']: return u...
PdxCodeGuild/class_salmon
4 Django/examples/jango/jango.py
jango.py
py
1,688
python
en
code
5
github-code
90
9863818255
# # 벽 부수고 이동하기 # from collections import deque # n, m = map(int,input().split()) # graph = [] # for i in range(n): # graph.append(list(map(int,input()))) # # print("my_list : ", my_list) # dx = [1, -1, 0, 0] # dy = [0, 0, 1, -1] # def bfs(a, b): # queue = deque() # queue.append([a, b]) # x, y = queue.pople...
KIMJINMINININN/Algorithm-Study
Baekjoon/DFS_BFS/2206.py
2206.py
py
2,058
python
en
code
0
github-code
90
25696534022
""" Created: 23 Mar. 2020 Author: Jordan Prechac """ from django.db import models from django.utils.translation import gettext_lazy as _ from revibe.utils.classes import default_repr # ----------------------------------------------------------------------------- class File(models.Model): _type_choices = ( ...
Revibe-Music/core-services
cloud_storage/models.py
models.py
py
2,885
python
en
code
2
github-code
90
10304824777
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/9/28 11:43 # @Author : DollA # @File : stark.py # @Software: PyCharm from django.conf.urls import url from django.shortcuts import HttpResponse, render, redirect import functools from types import FunctionType from django.utils.safestring import mark_s...
youxiaodao/stark
stark/service/stark.py
stark.py
py
26,592
python
zh
code
0
github-code
90
35752429211
#!/usr/bin/env python import sys input= sys.stdin.readline sys.setrecursionlimit(1000000) n=int(input()) visit=[0]*(n+1) ans=[0]*(n+1) e=[[] for _ in range(n+1)] for i in range(n-1): a,b=map(int,input().split()) e[a].append(b) e[b].append(a) def dfs(e,v,visit): visit[v]=1 for i in e[v]: ...
hansojin/python
graph/bj11725_recur.py
bj11725_recur.py
py
443
python
en
code
0
github-code
90
18516103729
n = int(input()) a = list(map(int, input().split())) a.insert(0, -1) a.append(-1) m = [] cnt = 0 for i in range(1, len(a)): if a[i] != a[i-1]: if cnt != 0: m.append(cnt) cnt = 1 else: cnt += 1 total = 0 for i in m: total += i // 2 print(total)
Aasthaengg/IBMdataset
Python_codes/p03296/s947906677.py
s947906677.py
py
292
python
en
code
0
github-code
90
18353778369
from collections import deque N, Q = map(int, input().split()) graph = [[] for _ in range(N+1)] for _ in range(N-1): a, b = map(int, input().split()) graph[a].append(b) graph[b].append(a) PX = [tuple(map(int, input().split())) for _ in range(Q)] counter = [0] * (N + 1) for px in PX: p, x = px count...
Aasthaengg/IBMdataset
Python_codes/p02936/s763810074.py
s763810074.py
py
663
python
en
code
0
github-code
90
35051746087
#!/usr/bin/env python3 import unittest from types import SimpleNamespace from unittest import mock from somaticsniper_tool import utils as MOD class ThisTestCase(unittest.TestCase): def setUp(self): super().setUp() def tearDown(self): super().tearDown() class Test__get_region_from_name(Th...
NCI-GDC/somaticsniper-tool
tests/test_utils.py
test_utils.py
py
4,897
python
en
code
0
github-code
90
29878297735
import asyncio from pprint import pprint from asyncdb import AsyncDB from asyncdb.exceptions import default_exception_handler async def connect(db): async with await db.connection() as conn: pprint(await conn.test_connection()) await conn.create( name='tests', fields=[ ...
phenobarbital/asyncdb
examples/test_duckdb.py
test_duckdb.py
py
2,451
python
en
code
23
github-code
90
17504179447
from .base import * import os SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') DEBUG = False ALLOWED_HOSTS = ['*'] STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' AWS_...
lldenisll/backend_papaiz
config/settings/prod.py
prod.py
py
509
python
en
code
0
github-code
90