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
18496364509
import math import itertools import sys n=int(input()) last=input() log=[] log.append(last) q=[] ans="Yes" for i in range(n-1): tmp=input() q.append(tmp) for i in q: if(i[0]!=last[-1] or i in log): ans="No" break else: last=i log.append(i) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03261/s500458142.py
s500458142.py
py
300
python
en
code
0
github-code
90
31722045254
import io from numpy import mean from numpy import std from numpy import absolute from pandas import read_csv from sklearn.model_selection import cross_val_score, KFold from sklearn.svm import SVR from sklearn.preprocessing import StandardScaler, LabelEncoder, OrdinalEncoder from sklearn.compose import ColumnTransforme...
s33Y377/ml_streamlit
main.py
main.py
py
2,336
python
en
code
0
github-code
90
5827540355
from flask import Flask, request, jsonify import json from waitress import serve from datetime import timedelta import os from minio import Minio from minio.error import ResponseError from flask_cors import CORS import jwt app = Flask(__name__) CORS(app) PORT = 8080 minioClient = Minio(os.environ['MINIO_HTTPS_END...
Open-Innovation-Platform-OIP/minio-microservice
app.py
app.py
py
3,364
python
en
code
0
github-code
90
42045417974
# @Time : 2023.05.15 # @Author : Darrius Lei # @Email : darrius.lei@outlook.com import torch from lib import callback, glb_var, util from agent.net import * from agent.net.optimizer import * logger = glb_var.get_value('log'); def get_optimizer(optim_cfg, net): '''Get Network Parameter Optimizer Parameters...
DarriusL/DRL-ExampleCode
agent/net/net_util.py
net_util.py
py
7,664
python
en
code
4
github-code
90
20747437209
cor_v = 10 ** 20 inc_v = -1 while cor_v - inc_v > 1: bin_v = (cor_v + inc_v) // 2 cost = 0 #条件を満たすcostを全検索 #costが制約を満たすか if cost <= bin_v: cor_v = bin_v else: inc_v = bin_v print(cor_v)
tabi-code/AtCoder
Lib/binary_search.py
binary_search.py
py
263
python
en
code
0
github-code
90
10527121152
import logging from openerp import fields, models, api, _ from openerp.exceptions import Warning, ValidationError from dateutil.relativedelta import relativedelta _logger = logging.getLogger(__name__) class AccountPaymentTerm(models.Model): _inherit = "account.payment.term" @api.one def compute(self, va...
JoryWeb/illuminati
poi_fix/models/account_invoice.py
account_invoice.py
py
2,913
python
en
code
1
github-code
90
3763177868
# • peça para o usuário criar um dicionário com 10 frutas e o preço do quilo. V # • imprima o dicionário completo V # • imprima só os valores V # • imprima os itens com o mesmo valor de preço(se existir) V # • faça uma promoção e altere o valor de duas frutas para 1/3 V # • insira duas novas frutas e seus preços V # ...
SoPVmesmo/Pratica-Python
jan/atv_prova.py
atv_prova.py
py
2,247
python
pt
code
0
github-code
90
72207905578
# -*- coding: utf-8 -*- # @Time : 2019/8/14 0014 10:19 # @Author : 没有蜡笔的小新 # @E-mail : sqw123az@sina.com # @FileName: Delete Node in a Linked List.py # @Software: PyCharm # @Blog :https://blog.csdn.net/Asunqingwen # @GitHub :https://github.com/Asunqingwen """ Write a function to delete a node (except the tail...
Asunqingwen/LeetCode
easy/Delete Node in a Linked List.py
Delete Node in a Linked List.py
py
1,266
python
en
code
0
github-code
90
8847996167
import os from google.cloud import pubsub_v1 project_id = "serverless-project-283717"; def publish_message(userName, message, topic_id): publisher = pubsub_v1.PublisherClient() topic_path = publisher.topic_path(project_id, topic_id) data = message data = data.encode("utf-8") future = publisher.p...
souvikdas0718/LearningManagementSystem_Backend
ChatModule/publishMessage.py
publishMessage.py
py
2,171
python
en
code
0
github-code
90
20851171602
""" optimal solution for search for range O(log n) """ class Solution: # @param A : tuple of integers # @param B : integer # @return a list of integers def searchRange(self, A, B): # binary_search # for first and # last occurance def binary_search(A, B, flag): ...
Harishkumar18/data_structures
interviewbit_problems/search_for_range_optimal_solution.py
search_for_range_optimal_solution.py
py
1,203
python
en
code
1
github-code
90
13903837801
import time from tqdm import tqdm loop = tqdm(total = 4, position=0, leave=False) for k in range(4): #print("substart") subloop = tqdm(total = 2500, position=1, leave=False) for m in range(2500): subloop.update(1) sub_description = str(m) + "/2500" subloop.set_description(...
jam88881/simple-status-bar
main.py
main.py
py
487
python
en
code
0
github-code
90
74946852455
# -*- coding: utf-8 -*- """ Problem 183 - Maximum product of parts Let N be a positive integer and let N be split into k equal parts, r = N/k, so that N = r + r + ... + r. Let P be the product of these parts, P = r × r × ... × r = r^k. For example, if 11 is split into five equal parts: 11 = 2.2 + 2.2 + 2.2 + 2.2 + 2...
yred/euler
python/problem_183.py
problem_183.py
py
1,746
python
en
code
1
github-code
90
18425066059
N = int(input()) s = list(input()) t = 0 for i in range(N): if s[i] == 'R': t += 1 else: t -= 1 if t > 0: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p03080/s118478843.py
s118478843.py
py
152
python
en
code
0
github-code
90
40990031371
''' Created on Oct 6, 2022 @author: boogie ''' from tinyxbmc import abi from tinyxbmc import net from aceengine import const import subprocess import time import signal import os def getbackend(settings): os = abi.detect_os() if os == "linux": return LinuxBackend(settings) elif os == "windows": ...
boogieeeee/repository.boogie
plugin.program.aceengine/aceengine/backend.py
backend.py
py
3,895
python
en
code
1
github-code
90
33993155916
print('while loop문------') ''' 반복문: loop문 [1] while [2] for ---------------- [1] while 변수 초기화식 while 조건식: 실행문 변수증감식 - 조건 체크를 해서 조건이 True이면 실행문을 수행한 뒤, 또 다시 조건 체크를 한다 조건이 True이면 계속 반복 실행한다. False일 경우는 while루프문을 벗어난다 ''' print("Hello Python") print("Hello Python") pr...
eunjijen/IoT_service_Practice
01. pythonProject/ex11While.py
ex11While.py
py
3,435
python
ko
code
0
github-code
90
26919459208
""" Seguem as respostas sugeridas (geralmente existem várias maneiras de resolver um problema em Python). Adicione uma barra invertida no código abaixo, para que seja um código de uma linha. Observe a mudança no resultado. """ a = 12 + 34 -29 b = 12 + 34 \ -29 print(f''' {a} {b} ''')
igrrcardoso/PythonAcademy
exercicio_pyacademy_continuação_de_linha.py
exercicio_pyacademy_continuação_de_linha.py
py
294
python
pt
code
0
github-code
90
4965080622
import sys import os import copy import numpy test_program = 'test/user/hes_fixed.py' if sys.argv[0] != test_program or len(sys.argv) != 1 : usage = 'python3 ' + test_program + '\n' usage += 'where python3 is the python 3 program on your system\n' usage += 'and working directory is the dismod_at distribution...
bradbell/dismod_at
test/user/hes_fixed.py
hes_fixed.py
py
5,978
python
en
code
6
github-code
90
17973277869
from collections import Counter N, M = map(int, input().split()) L = [list(map(int, input().split())) for _ in range(M)] L.sort(key=lambda x: x[0]) ans = [] for i in range(M): if (L[i][0] == 1): ans.append(L[i][1]) if (L[i][1] == N): ans.append(L[i][0]) c = Counter(ans) for i, v in c.items()...
Aasthaengg/IBMdataset
Python_codes/p03645/s436201878.py
s436201878.py
py
400
python
en
code
0
github-code
90
44115760415
class Node: def __init__(self, parent=None, data=None, original_index=None, left_branch=None, right_branch=None): self.parent = parent, self.data = data self.original_index = original_index self.left_branch = left_branch self.right_branch = right_branch class BinaryTree: ...
williamaredal/Python
DataStructures/Binary_tree.py
Binary_tree.py
py
1,596
python
en
code
0
github-code
90
10972789437
# -*- coding: utf-8 -*- # author: itimor a = [ { "path": '/worktickets', "name": '工单管理', "icon": 'list', "children": [ {"path": 'workticket', "name": '工单列表'}, {"path": 'tickettype', "name": '工单类型'}, ] }, { "path": '/users', "na...
OpsWorld/oms
omsBackend/utils/menu.py
menu.py
py
1,198
python
en
code
37
github-code
90
72779924778
from rest_framework import serializers from rest_framework.exceptions import ValidationError from coresys.models import CorePaymentMethod from usersys.funcs.utils.sid_management import sid_getuser from usersys.model_choices.user_enum import role_choice from invitesys.model_choices.invite_enum import handle_method_choic...
fhydralisk/walibackend
invitesys/serializers/invite_api.py
invite_api.py
py
3,316
python
en
code
1
github-code
90
30751824193
import matplotlib matplotlib.use("Agg") import os my_home = os.popen("echo $HOME").readlines()[0][:-1] from sys import path path.append('%s/work/mylib/'%my_home) path.append("E:/Github/astrophy-research/mylib") from plot_tool import Image_Plot from Fourier_Quad import Fourier_Quad import tool_box import numpy from mpi4...
hekunlie/astrophy-research
test/new_PSF_SYM_test/new_PSF_SYM.py
new_PSF_SYM.py
py
10,864
python
en
code
2
github-code
90
6333903415
import os # Three variables are needed to check the progress: # - "likes_stage" to check the number of new likes from the current iteration # - "reached" to propagate to the next iteration the number of # new people reached at the current iteration # - "likes" to count the number of likes overall # Once this is clear,...
sim2000dg/homework1_ADM
problem2_scripts/viral_advertising.py
viral_advertising.py
py
724
python
en
code
0
github-code
90
18248069439
S = input().strip() N = len(S) flag = 0 if S==S[::-1]: x = S[:N//2] if x==x[::-1]: flag = 1 if flag==1: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p02730/s802220251.py
s802220251.py
py
158
python
en
code
0
github-code
90
72575981098
import logging import random from datetime import datetime from time import sleep from random import randint from os import path, remove, makedirs from urllib.parse import urljoin import pyautogui import pandas as pd from selenium.webdriver import Chrome from selenium.webdriver.common.keys import Keys from selenium.we...
Awesome-Austin/DataBrokerBreaker
removers/spokeo.py
spokeo.py
py
3,369
python
en
code
3
github-code
90
18473408049
def resolve(): N, X = map(int, input().split()) As = [1] # レベルiバーガーの厚さ(層の総数)(必ず奇数) Ps = [1] # レベルiバーガーのパティの総数 for i in range(N): As.append(As[i] * 2 + 3) # レベルが1上がると、総数は2倍+3になる Ps.append(Ps[i] * 2 + 1) # レベルが1上がると、パティの数は2倍+1になる def f(n, x): if n == 0: retu...
Aasthaengg/IBMdataset
Python_codes/p03209/s041431150.py
s041431150.py
py
892
python
ja
code
0
github-code
90
18134745119
while True: a, b = map(int, input().split()) if a == b == 0: break for i in range(a): if i == 0 or i == a - 1: print('#' * b) continue print('#', '.' * (b - 2), '#', sep = '') print()
Aasthaengg/IBMdataset
Python_codes/p02404/s369865919.py
s369865919.py
py
218
python
en
code
0
github-code
90
39762172956
import cv2 import cvzone from cvzone.FaceMeshModule import FaceMeshDetector from pythonosc import udp_client import argparse cap = cv2.VideoCapture(0) #0 är den inbyggda kameran. Finns det fler kameror inkopplade byt värde. detector = FaceMeshDetector(maxFaces=1) if __name__ == "__main__": parser = argparse.Argu...
kaarlax/Face_Measure_App
code.py
code.py
py
1,875
python
sv
code
0
github-code
90
8986606412
from sqlalchemy import false, true from card import Card class Player: def __init__(self, name) -> None: self.name = name self.cards = [] def add_card(self, card:Card): self.cards.append(card) def add_cards(self, cards:list): for card in cards: self.add...
oleglyask/Python
labs/projects/Card game/player.py
player.py
py
1,361
python
en
code
0
github-code
90
36643623523
import pickle import numpy as np from flask import Flask, request, render_template app = Flask(__name__) model = pickle.load(open('saved_models/best_model_without_reviews/rfBestWithoutReviews.pkl', 'rb')) cv_model = pickle.load(open('saved_models/cv_model/cv.pkl', 'rb')) lb_model = pickle.load(open('saved_models/ligh...
ukarthikvarma/MachineLearningProjects
Rating_Prediction_Deployment/main.py
main.py
py
2,378
python
en
code
0
github-code
90
3269630110
# step1: text reading and pre-processing from math import log10 import multiprocessing import re import time import pickle from copy import deepcopy import cul_cos words = {} with open("raw.txt", encoding='gbk') as f: line = f.readline() while line: label = line[0:19] if not label: ...
Flappywonders/TF_IDF_SIMILARITY
main2.py
main2.py
py
4,017
python
en
code
0
github-code
90
24282949856
# Comparison of three methods to detect the hand import cv2 import numpy as np import imutils from sklearn.metrics import pairwise from scipy.spatial import distance background = None aWeight = 0.5 camera = cv2.VideoCapture(1) #external webcam top, right, bottom, left = 150, 500, 600, 950 num_fram...
jcwong26/COVID-Smart-Elevator
detection_test.py
detection_test.py
py
6,126
python
en
code
0
github-code
90
36249468657
''' Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. Input: First line consists of T test cases. First line of every test case consists of n, denoting the size of array. ...
Kapil-Pathak/GeeksForGeeks
DP_rod_cutting.py
DP_rod_cutting.py
py
999
python
en
code
0
github-code
90
73094591335
def arithmetic_arranger(problems,args=False): firstline='' secondline='' thirdline='' forthline='' num_of_prob=len(problems) if num_of_prob>5: return "Error: Too many problems." for i in problems: substr=i.split() firstnum=substr[0] operators=substr[1] secondnum=substr[2] if oper...
heavenluv/FreeCodeCamp
Python/boilerplate-arithmetic-formatter/arithmetic_arranger.py
arithmetic_arranger.py
py
3,925
python
en
code
0
github-code
90
35360108855
#!/usr/bin/env python # coding: utf-8 # In[312]: import pandas as pd from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB # In[313]: from sklearn import metrics from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score, matthews_corrcoef from ...
sigurdurb/credit-card-fraud-detector
naive_bayes_detector/detector.py
detector.py
py
3,841
python
en
code
0
github-code
90
8374222688
import cv2 import sys import winsound #giving path of HaarCascade classifier files cascPath1="C:/Users/haarcascade_fullbody.xml" cascPath3="C:/Users/haarcascade_frontalface_default.xml" cascPath4="C:/Users/haarcascade_car.xml" #loading all classifiers bodyCascade = cv2.CascadeClassifier(cascPath1) faceCasc...
SDeosatwar/Image-Processing
vidObjDetection.py
vidObjDetection.py
py
2,205
python
en
code
0
github-code
90
42039540250
""" There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, is it possible for yo...
nilay-gpt/LeetCode-Solutions
graphs/topological_sort/course_schedule.py
course_schedule.py
py
2,045
python
en
code
2
github-code
90
32423215343
import sys import os.path my_libs_path = os.path.normpath(os.path.join(sys.path[0], "../")) sys.path.append(my_libs_path) from matrix import Matrix class GaussMethod: def __init__(self, mtrx=None, vec=None): self.__mtrx = mtrx.copy() if mtrx is not None else Matrix([1, 1]) self.__vector = vec.co...
kri-k/Numerical_methods
lab1/1.5/libs/gauss_method.py
gauss_method.py
py
4,115
python
en
code
0
github-code
90
239307454
#! /usr/bin/python import numpy as np from ml.supervised.classification.common import LinearClassifier from ml.data.handler import DataHandler import sys class NCC(LinearClassifier): __centroids = {} def train(self, train_data_handler): """ :param DataHandler train_data_handler: Data handl...
lawmercado/tu-kl-ml1-lib
supervised/classification/ncc.py
ncc.py
py
2,664
python
en
code
0
github-code
90
23040594808
import queue import time import socket import os import threading import functools import cstar.remote import cstar.endpoint_mapping import cstar.topology import cstar.nodetoolparser import cstar.state import cstar.strategy import cstar.jobrunner import cstar.jobprinter import cstar.jobwriter from cstar.exceptions imp...
wade1990/cstar
cstar/job.py
job.py
py
16,035
python
en
code
null
github-code
90
74331610856
import requests import nltk from nltk import tokenize from nltk.corpus import stopwords from nltk.cluster.util import cosine_distance from nltk.tokenize import sent_tokenize # nltk.download('stopwords') # nltk.download('cosine_distance') # nltk.download('punkt') import numpy as np import networkx as nx import psycopg2 ...
hhelenxu/ReView
python_code_pieces/Transcripts.py
Transcripts.py
py
12,704
python
en
code
0
github-code
90
26218837947
# Platforms for the game # Import a library of functions called "pygame" import pygame from spritesheet_functions import Spritesheet GRASS_LEFT = (315, 393, 39, 39) GRASS_RIGHT = (315, 315, 39, 39) GRASS_MIDDLE = (276, 315, 39, 39) MYCELIUM_LEFT = (78, 235, 39, 39) MYCELIUM_MIDDLE = (39, 235, 39, 39) MYCEL...
xixi-hahaaa/Platformer-Pygame-
GAME/platforms.py
platforms.py
py
2,497
python
en
code
0
github-code
90
18051664387
from paddle.utils import gast from .utils_helper import ( binary_op_output_type, index_in_list, is_dygraph_api, is_numpy_api, is_paddle_api, type_from_annotation, ) __all__ = [] class AstNodeWrapper: """ Wrapper for python gast.node. We need a node wrapper because gast.node doesn...
GreatV/Paddle
python/paddle/jit/dy2static/static_analysis.py
static_analysis.py
py
8,247
python
en
code
null
github-code
90
5581921905
import torch.nn as nn import torch from torchvision.models import vgg19 import torchvision ''' EnhanceNet Implementation in PyTorch by Erik Quintanilla Single Image Super Resolution https://arxiv.org/abs/1612.07919/ This program assumes GPU. ''' class ResidualBlock(nn.Module): def __init__(self, i...
MKashifAli/Motion_Blind_Video_Stabilization
TestScripts/model.py
model.py
py
2,101
python
en
code
6
github-code
90
18567983069
def main(): N = int(input()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] op = sum(B) - sum(A) D = [(b-a+1)//2 if b > a else 0 for a, b in zip(A, B)] print("Yes" if op >= sum(D) else "No") if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03438/s220097421.py
s220097421.py
py
284
python
en
code
0
github-code
90
9519169922
# 2490 윷놀이 for _ in range(3): a = list(map(int, input().split())) i = sum(a) if i == 4: print('E') elif i == 3: print('A') elif i == 2: print('B') elif i == 1: print('C') else: print('D')
whwogur/BOJ
2490.py
2490.py
py
261
python
en
code
0
github-code
90
73781488937
#!/usr/bin/env python import rospy,atexit,sys import tf.transformations import easygopigo3 as easy import numpy as np from geometry_msgs.msg import Twist class motor_driver: # const WHEEL_RADIUS = 0.03325 # radius of wheels WHEEL_DISTANCE = 0.117 # distance between wheels # global var rightS...
isarlab-department-engineering/ros_dt_controller
src/cmdveltest_gopigo_controller_interface.py
cmdveltest_gopigo_controller_interface.py
py
2,631
python
en
code
0
github-code
90
28440422952
#!/usr/bin/env python ##flask app for pourbaix diagrams generation## ##Reflect PNG file on Web, it is a static figure## import StringIO import numpy as np import matplotlib.pyplot as plt from pourbaix_plot import solvated, Pourbaix from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from flas...
MengZ188/Flask_pourbaix_diagrams
app.py
app.py
py
1,592
python
en
code
0
github-code
90
18536905499
# Union-Find def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] def unite(x, y): x = find(x) y = find(y) if x == y: return False if par[x] > par[y]: x, y = y, x par[x] += par[y] par[y] = x return True def same(x,...
Aasthaengg/IBMdataset
Python_codes/p03354/s720077299.py
s720077299.py
py
703
python
en
code
0
github-code
90
31256801837
from collections import deque n = int(input()) dp =[] for i in range(n): dp.append(list(map(int,input().split()))) for i in range(1,n): for j in range(len(dp[i])): if j == 0 : dp[i][j]=dp[i][j]+dp[i-1][j] elif j == len(dp[i])-1 : dp[i][j]=dp[i][j]+dp[i-1][j-1] ...
sungwoo-me/Algorithm
백준/SK_연습/DP/1932.py
1932.py
py
944
python
en
code
0
github-code
90
12959020877
""" File: get_best_nucleotide.py -------------- ADD YOUR DESCRIPTION HERE """ import os import sys from TextGrid import TextGrid, Cell def get_best_nucleotide(nucleotide1, nucleotide2, nucleotide3): """ Given three nucleotides, returns a nucleotide with the most common *non-blank* value. If multiple nucleotid...
Divyaansh313/100DaysofCode
SequenceAssembly.py
SequenceAssembly.py
py
3,702
python
en
code
0
github-code
90
9128455645
import re from langchain.prompts import SystemMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate from langchain.schema import BaseMessage from core.prompt.prompt_template import OutLinePromptTemplate class PromptBuilder: @classmethod def to_system_message(cls, prompt_content: str, in...
parity-asia/hackathon-2023-summer
projects/26-Dynamo/src/ai-project/api/core/prompt/prompt_builder.py
prompt_builder.py
py
1,774
python
en
code
14
github-code
90
2565877846
#!/usr/bin/python3 #-*- coding: utf-8-*- # # Escola del Treball de Barcelona # Administració de Sistemes informàtics # Curs 2022-23 # # Autor: muhammad ahsan # Data: 13/12/2022 # # Versió: 1 # # Descripció: truncament superior de numero # Especificacions d'entrada: # 1 nombres real(float) positivo # # Joc de p...
Nicktt-debug/python
python/ex_sequencial/exer_1.py
exer_1.py
py
521
python
ca
code
0
github-code
90
19276884066
def binary_Searching(alist, data): """ 非递归解决二分查找 :param alist: :return: """ length = len(alist) first = 0 last = length - 1 while first <= last: mid = (last + first) // 2 if alist[mid][1] > data: last = mid - 1 elif alist[mid][1] < data: ...
Jack-Sheng/AddressTreeBuilder
binarySearching.py
binarySearching.py
py
413
python
en
code
0
github-code
90
18182589459
def main(): d = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0} N = int(input()) for _ in range(N): S = input() d[S] += 1 for s in ['AC', 'WA', 'TLE', 'RE']: print(s + ' x ' + str(d[s])) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02613/s672410611.py
s672410611.py
py
258
python
en
code
0
github-code
90
18487724229
N=int(input()) l=[list(map(int,input().split())) for i in range(N)] for i,j,k in l: if k>0: fx,fy,fh=i,j,k for i in range(0,101):#x for j in range(0,101):#y sw=0 cer_h=fh+abs(fx-i)+abs(fy-j) for x,y,h in l: if max(cer_h-abs(i-x)-abs(j-y),0)!=h: sw=1 break ...
Aasthaengg/IBMdataset
Python_codes/p03240/s749433479.py
s749433479.py
py
376
python
en
code
0
github-code
90
31682289817
"""Test the commands of wait_for_db at /core""" from unittest.mock import patch from psycopg2 import OperationalError as psycopg2Error from django.core.management import call_command from django.test import SimpleTestCase from django.db.utils import OperationalError @patch("core.management.commands.wait_for_db.Comm...
BioPyRope/receipe-app-api
app/core/tests/test_wait_for_db.py
test_wait_for_db.py
py
986
python
en
code
0
github-code
90
18440955889
N, A, B, C = map(int, input().split()) l = [int(input()) for _ in range(N)] def dfs(i, a, b, c): if i == N: if a == 0 or b == 0 or c == 0: return float('inf') else: return abs(A-a)+abs(B-b)+abs(C-c)-30 four = dfs(i+1, a, b, c) one = dfs(i+1, a+l[i], b, c) + 10 two...
Aasthaengg/IBMdataset
Python_codes/p03111/s818351066.py
s818351066.py
py
451
python
en
code
0
github-code
90
42289167027
import datetime import pytest from testix import * from comet_llm import datetimes @pytest.fixture(autouse=True) def mock_local_timestamp(patch_module): patch_module(datetimes, "local_timestamp") def test_timer__happyflow(): START_TIMESTAMP = 10 END_TIMESTAMP = 25 DURATION = 15 timer = datet...
comet-ml/comet-llm
tests/unit/test_datetimes.py
test_datetimes.py
py
2,405
python
en
code
287
github-code
90
21963204150
import pandas as pd import numpy as np from statistics import mean from pymongo import MongoClient import os class purchase_data: """docstring for Hospital_data.""" def __init__(self): super(purchase_data, self).__init__() def get_data(self): df = pd.read_csv('/data/train.csv') ...
mankar1257/PREDICTION_SYSTEM
Model/Data.py
Data.py
py
3,784
python
en
code
0
github-code
90
8680828731
import telegram from telegram.ext import Updater, CommandHandler, Filters import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import datetime import io ALLOWED_USERS = ['my_telegram_username', 'someone_else'] OBJECT_OF_CHECKING = 'https://polygon-mainnet.chainstacklabs.com' THRESHOLD = 5 LOG_FIL...
balakhonoff/rpc_node_telegram_checker
chart_bot.py
chart_bot.py
py
2,586
python
en
code
52
github-code
90
710119395
class Edge: def __init__(this, fromloc, toloc, dist): this.fromloc = fromloc this.toloc = toloc this.dist = dist def __str__(self): return "From {0} to {1} dis {2}".format(self.fromloc, self.toloc, self.dist) def printEdges(edges): for edge in edges: print(edge) ...
Varanasi-Software-Junction/pythoncodecamp
prims.py
prims.py
py
681
python
en
code
10
github-code
90
29952996494
from django.shortcuts import render, redirect from django.http import HttpResponse from .forms import URLform from .models import BigUrl # Create your views here. def getUrl(request): if request.method == 'POST': form = URLform(request.POST) if form.is_valid: temp_obj = form.save(commit=...
hdck007/URLshortener
url/views.py
views.py
py
761
python
en
code
0
github-code
90
18036309949
n = int(input()) a = list(map(int, input().split())) a.sort() res = True if n % 2 != 0: if a[0] != 0: res = False print(0) a = a[1:] for i in range(0, len(a), 2): if a[i] != a[i+1]: print(0) res = False break p = 10**9 + 7 if res: print(pow(2, n//2, p))
Aasthaengg/IBMdataset
Python_codes/p03846/s610157670.py
s610157670.py
py
282
python
en
code
0
github-code
90
71966548136
import os import numpy as np import matplotlib.pyplot as plt from trajopt.ilqr.ilqr import iLQR from trajopt.ilqr.objects import ( QuadraticStateValue, QuadraticStateActionValue, AnalyticalLinearDynamics, LinearControl, AnalyticalQuadraticCost, ) class IterativeLqr(iLQR): def __init__( ...
JoeMWatson/input-inference-for-control
baselines/ilqr.py
ilqr.py
py
4,257
python
en
code
20
github-code
90
17944395339
from typing import List, Tuple def main(): n, m = map(int, input().split()) g = [] for _ in range(m): a, b = map(int, input().split()) g.append((a, b)) print(br(n, m, g)) def br(n: int, m: int, g: List[Tuple[int, int]]): ret = 0 for i in range(m): v = set() w ...
Aasthaengg/IBMdataset
Python_codes/p03575/s625868781.py
s625868781.py
py
779
python
en
code
0
github-code
90
5010485205
import typing import flask from flask import request import cauldron as cd from cauldron.cli import commander from cauldron.cli.server import arguments from cauldron.cli.server import authorization from cauldron.cli.server import run as server_runner from cauldron.environ.response import Response from cauldron.runner...
sernst/cauldron
cauldron/cli/server/routes/execution.py
execution.py
py
7,621
python
en
code
78
github-code
90
71945662378
# Given row data per day, create row data per weeks # Sums the columns: QUANTITY, BASE_SPEND_AMT, LOY_CARD_DISC, # COUPON_DISC, NET_SPEND_AMT # String appends the columns: PRODUCT_ID, DEPARTMENT, COMMODITY_DESC # SUB_COMMODITY_DESC, PRICE_PER_PRODUCT # Places the followin...
angerhang/cmuDSC
scripts/printWeeks.py
printWeeks.py
py
4,775
python
en
code
0
github-code
90
24955253490
from django.urls import path from . import views app_name = 'app' urlpatterns = [ path('', views.home_view, name='home'), path('exchange/order/', views.order_exchange_view, name='order'), path(f'exchange/<str:id>/delete/', views.delete_order_view, name='delete'), path('profit/', views.profit, name='p...
feranmi-oj/Web3_Token-erc20_Project_Feranmi_Ojo
socialDex/app/urls.py
urls.py
py
331
python
en
code
0
github-code
90
70298216938
""" @Author: jinzhuan @File: __init__.py.py @Desc: """ from .decoder import * from .encoder import * from .balanced_data_parallel import * __all__ = [ "ConditionalRandomField", "FeedForwardNetwork", "CNN", "LSTM", "BalancedDataParallel", "Biaffine", "MLP", # "EndpointSpanExtractor", ...
jinzhuoran/CogIE
cogie/modules/__init__.py
__init__.py
py
397
python
en
code
63
github-code
90
73825033576
import os import numpy as np import numpy.random as rd from tqdm import tqdm import cv2 ONE_HOT = np.array(['American Shorthair', 'Angora', 'Ashera', 'British Shorthair', 'Exotic', 'Himalayan', 'Maine Coon', 'Persian', 'Ragdoll', 'Siamese', 'Sphynx']) def one_hot(arg_list, classes): if set(a...
FelixPcll/cat-recognizer-cont
pre processing/vectorize_data.py
vectorize_data.py
py
2,209
python
en
code
0
github-code
90
3508125512
import pandas as pd import numpy as np import matplotlib.pyplot as plt import requests api_key = 'RW9XVB8H9ZFI4CCX' # Replace with your actual API key symbol = 'AAPL' # Replace with the stock symbol you want to analyze # url = f'https://api.example.com/endpoint?symbol={symbol}&apikey={api_key}' url = f'https://www....
ethanradd/stock-market-analysis
stock_analysis.py
stock_analysis.py
py
1,149
python
en
code
0
github-code
90
24552582007
from .. import core as c from eudplib import utils as ut from .basicstru import ( EUDJump, EUDJumpIf, EUDJumpIfNot ) from .cshelper import CtrlStruOpener def _IsLoopBlock(block): return 'contpoint' in block # ------- def EUDInfLoop(): def _footer(): block = { 'loopstart': c...
phu54321/eudplib
eudplib/ctrlstru/loopblock.py
loopblock.py
py
3,836
python
en
code
13
github-code
90
18756837050
from typing import Dict, List from neat_core.models.generation import Generation from neat_core.optimizer.neat_reporter import NeatReporter class SpeciesReporterData(object): def __init__(self) -> None: self.min_generation: int = None self.max_generation: int = None # Key SpeciesID, Valu...
simonhauck/MPI_NEAT
code/src/utils/reporter/species_reporter.py
species_reporter.py
py
2,057
python
en
code
3
github-code
90
35712316005
import sys import numpy as np from tools.config_file import NewUserPredictParams from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import OneHotEncoder, KBinsDiscretizer from . import * import json import pandas as pd params = NewUserPredictPa...
Microsoft-tele/NewUserPredict
tools/__init__.py
__init__.py
py
9,410
python
en
code
2
github-code
90
10218174650
# -*- coding: utf-8 -*- """ @what: ABM implementation of Demichelis and Dhillon (2010) """ #from __main__ import * #It is important to import the project's other files after setting the seed #to assure that the same seed will be used throughout import csv import random as rng import numpy as np from scipy.stats impo...
StrategicVotingABMs/model_Demichelis-and-Dhillon2010
source/main.py
main.py
py
4,226
python
en
code
0
github-code
90
13484582387
# -*- coding: utf-8 -*- """ Created on Thu Jul 30 19:30:51 2020 @author: data-anal-ojisan """ import tkinter as tk # 基本形 root = tk.Tk() # ルートウィンドウ(Top-level widget) を作成する root.mainloop() # アプリケーション起動を維持 # タイトル変更 root = tk.Tk() root.title('SampleApp') # アプリケーションタイトルを変更する root.mainloop() # ウィンドウサイズ変更 root = tk.T...
Data-Anal-Ojisan/DataAnalOji.hatena.sample
python_samples/tkinter/00_root_window.py
00_root_window.py
py
1,434
python
ja
code
0
github-code
90
41525922484
# 문제 설명 # 정수 배열 numbers가 주어집니다. # numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. # 제한사항 # numbers의 길이는 2 이상 100 이하입니다. # numbers의 모든 수는 0 이상 100 이하입니다. # numbers result # [2,1,3,4,1] [2,3,4,5,6,7] # [5,0,2,7] [2,5,7,9,12] answer = [] def solution(numbers):...
blessedby-clt/python_basic
프로그래머스 문제풀기/1lv/sample_and_add.py
sample_and_add.py
py
949
python
ko
code
0
github-code
90
37751400498
import gym import gym_minesweeper # must import for create env from agent.DQN import DQN from agent.DDQN import DDQN from agent.DoubleDQN import DoubleDQN from agent.PG import PG from agent.A2C import A2C from agent.DQN_Torch import DQNTorch from game.minesweeper import Game from tqdm import tqdm import numpy as np im...
hanv81/minesweeper
main.py
main.py
py
6,695
python
en
code
0
github-code
90
43313965483
from torchvision import models import torch.nn as nn def get_pretrained_model(model_name): """Retrieve a pre-trained model from torchvision Params ------- model_name (str): name of the model (currently only accepts vgg16 and resnet50) Return -------- model (PyTorch model): cnn ...
Nishita-Kapoor-zz/pneumonia_detection_xrays
models/models.py
models.py
py
1,231
python
en
code
2
github-code
90
5864848117
from pathlib import Path from random import Random from typing import List import numpy as np import torch from torch.nn.utils.rnn import pad_sequence from torch.utils.data.dataloader import DataLoader from torch.utils.data.dataset import Dataset from torch.utils.data.sampler import Sampler from dfa.utils import unpi...
as-ideas/DeepForcedAligner
dfa/dataset.py
dataset.py
py
3,653
python
en
code
69
github-code
90
29988875718
# @Author Brian Chalfant 2020 # Hawaii Pacific University # CSCI3106 - Programming Challenges - Fall 2020 n = int(input()) sets = 1 while n != 0: cycle = n names = [] for _ in range(cycle): names.append(input().strip()) print("SET " + str(sets)) new_order = names[::2] + names[1::2][::-1] ...
CSCI3106/Fall2020KattisSolutions-BrianChalfant
symetricorder.py
symetricorder.py
py
416
python
en
code
0
github-code
90
18149193109
letters = input() num = int(input()) for i in range(num): order = input().split() a = int(order[1]) b = int(order[2]) if order[0] == 'print': print(letters[a:b+1]) if order[0] == 'reverse': p = letters[a:b+1] p = p[::-1] letters = letters[:a] + p + letters[b+1:] i...
Aasthaengg/IBMdataset
Python_codes/p02422/s232925952.py
s232925952.py
py
402
python
en
code
0
github-code
90
41860214095
# Eli Pandolfo # finds longest palindrome in non-sequential subsequence of a string # reference: https://www.geeksforgeeks.org/dynamic-programming-set-12-longest-palindromic-subsequence/ s = 'asvieetionakpoftagtjolpwanotmis' def pal(s): # matrix stores longest palindrome starting at i and ending at j store =...
elip12/misc_algorithms
dynamic_pal.py
dynamic_pal.py
py
2,804
python
en
code
0
github-code
90
18301815639
def main(): N = int(input()) A = list(map(int, input().split())) if 1 not in A: print(-1) exit() next = 1 for a in A: if a == next: next += 1 print(N - next + 1) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02832/s400590330.py
s400590330.py
py
262
python
en
code
0
github-code
90
18321560239
import sys X, Y = map(int, input().split()) def combination(n, r, mod=10**9+7): n1, r = n+1, min(r, n-r) numer = denom = 1 for i in range(1, r+1): numer = numer * (n1-i) % mod denom = denom * i % mod return numer * pow(denom, mod-2, mod) % mod if 2*Y < X or 2*X < Y or (X+Y)%3 != 0: ...
Aasthaengg/IBMdataset
Python_codes/p02862/s847984400.py
s847984400.py
py
425
python
en
code
0
github-code
90
15883430242
#!/home/wizard/anaconda3/bin/python3.7 def main(): t = 11,22,33,44,55,66 #t = (11,22,33,44,55,66) for value in t: print('v={}'.format(value)) for idx,value in enumerate(t[2:],2): print('index={} value={}'.format(idx,value)) for value in range(1,20,2): print('v={}'.format(...
DikranHachikyan/python-verint-20190128
day01/ex06.py
ex06.py
py
368
python
en
code
0
github-code
90
28560453288
""" Молуль для тестрования пакета uMultiphaseFlow """ import unittest import uniflocpy.uMultiphaseFlow.hydr_cor_Beggs_Brill as hydr_cor_Beggs_Brill import uniflocpy.uMultiphaseFlow.friction_Bratland as friction_Bratland import uniflocpy.uWell.uPipe as Pipe import uniflocpy.uMultiphaseFlow.flow_pattern_annulus_Caetano a...
unifloc/unifloc_py
tests/uMultiphaseFlow_test.py
uMultiphaseFlow_test.py
py
3,313
python
en
code
13
github-code
90
684338515
from pytest import fixture from solar.core import resource from solar.dblayer.model import ModelMeta from solar.dblayer.solar_models import Resource @fixture def tagged_resources(): tags = ['n1', 'n2', 'n3'] t1 = Resource.from_dict('t1', {'name': 't1', 'tags': tags, 'base_path': '...
Mirantis/solar
solar/test/test_operations_with_tags.py
test_operations_with_tags.py
py
946
python
en
code
8
github-code
90
8804280902
# Changing items in a list items = [23, 24, 56, 79] print(items) items[1] = 45 print(items) ###################### my_list = [1, 2, 3] print(my_list) my_list[2] = 4 print(my_list) # adding items to a list (using while) emp = list() while True: name = input("whats your name? : ") emp.append(name) if name ==...
tanmaychk/Snak3skin
python learner code/lists.py
lists.py
py
839
python
en
code
2
github-code
90
18556160519
ma = lambda :map(int,input().split()) lma = lambda :list(map(int,input().split())) tma = lambda :tuple(map(int,input().split())) ni = lambda:int(input()) yn = lambda fl:print("YES") if fl else print("NO") import collections import math import itertools import heapq as hq n = ni() ab = [] for i in range(n): ab.appen...
Aasthaengg/IBMdataset
Python_codes/p03409/s470036842.py
s470036842.py
py
735
python
en
code
0
github-code
90
70104352296
import logging import json from zlib import compress from urllib.parse import quote import config import os from base64 import b64encode import tornado.websocket import tornado.web from pystacia import read from ..dbclient.dbclientfactory import DbClientFactory from ..pubsub.pubsubclientfactory import PubSubClientFac...
anandtrex/collabdraw
org/collabdraw/handler/websockethandler.py
websockethandler.py
py
6,160
python
en
code
64
github-code
90
31431081405
from a1_CS19037_3 import Product from a1_CS19037_5 import ProductDB from a1_CS19037_2 import Cart from a1_CS19037_1 import AccountDB from a1_CS19037_4 import User ############ Interface ############### while True: print("*********************") print("Welcome to online shopping mart") print("""...
thehamzajunaid/grocery_store
a1_CS19037_6.py
a1_CS19037_6.py
py
4,088
python
en
code
0
github-code
90
29282021728
# -*- coding: utf-8 -*- from bst import BinarySearchTree from bintree import BinaryNode class BST2(BinarySearchTree): def minimum(self) -> object: """returns the smallest key of the tree. What is its temporal complexity?""" # Complexity: O(log n) if self._root is None: print('...
DominoWw/EDA
tema5-soluciones/tema5-soluciones/tema5-hoja1sol.py
tema5-hoja1sol.py
py
7,442
python
en
code
0
github-code
90
19754055182
def logger(func_to_log): import logging, datetime now = datetime.datetime.now() timestamp = now.strftime("%H:%M:%S") func_name = func_to_log.__name__ logging.basicConfig(filename='{}.log'.format(func_name), level=logging.INFO) def wrapper_func(*args, **kwargs): logging.info(" Functio...
jpisano99/ta_crm_r3
my_app/tool_box/func_lib/log_decorator.py
log_decorator.py
py
686
python
en
code
0
github-code
90
7298615271
import os import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.datasets import mnist os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def my_pretrained(): (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.reshape(-1, 28 * 28).astype("...
ikn1062/small-projects
MNIST/tutorials/tf_tutorial7.py
tf_tutorial7.py
py
1,844
python
en
code
0
github-code
90
73182655658
import os,time,platform os.system('clear') print('[•] Checking Updates...') os.system('git pull') green = ('\033[1;32m') white = ('\033[1;37m') red = ('\033[1;31m') print('<------------------------------------>') bit = platform.architecture()[0] if bit=='64bit': print(f'{red}[•] Join Over Facebook Group {white}') ...
TermuxTahmid/TXI
TRT.py
TRT.py
py
666
python
en
code
0
github-code
90
24999517365
def pivotIndex(nums: [int]) -> int: l = len(nums) if l == 0 or l == 1: return 0 pre = nums[0] s1, s2 = 0, sum(nums)-pre if s1 == s2: return 0 for i in range(1, l): t = nums[i] s1 += pre s2 -= t pre = t if s1 == s2: return i ...
Lycorisophy/LeetCode_python
简单题/724. 寻找数组的中心索引.py
724. 寻找数组的中心索引.py
py
465
python
en
code
1
github-code
90
70728860138
import openpyxl # Global Variables NUM_EMPLOYEES_KDS = 0 NUM_EMPLOYEES_HDC = 0 NUM_EMPLOYEES_OFF = 0 MONTH_TOTAL_DAYS = 0 NORMAL_WORKING_DAYS = 0 DATES_SUNDAYS_LIST = [] DATES_HOLIDAYS_LIST = [] ATTENDANCE_BOOK = openpyxl.load_workbook('Attendance.xlsx') ATTENDA...
hansbala/Office-Attendance
script.py
script.py
py
5,425
python
en
code
0
github-code
90
12687274456
import math def add_three_digits(number): return f"{number:.3f}" def equation_roots(a, b, c): discriminant = math.pow(b, 2) - (4*a*c) first = -4294967296 second = -4294967296 if discriminant > 0: root = math.sqrt(discriminant) first = add_three_digits((-b + root) / (2*a)) s...
RezarTheSergal/Informatics.msk.ru_Solutions
10 класс/Параграфы/§ 66 «Символьные строки», часть II/S/App.py
App.py
py
1,204
python
en
code
0
github-code
90