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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38031017999 | import cv2
import numpy as np
img1 = cv2.imread("img1.png")
img2 = cv2.imread("img2.png")
add = img1 + img2
add = cv2.add(img1 , img2)
# cv2.imshow("added" , add)
weighted = cv2.addWeighted(img1 , 0.4 , img2 , 0.3 , 0)
# cv2.imshow("added" , weighted)
imgLogo = cv2.imread("yt.png")
rows , cols , channels = imgLogo.... | ojasiiitd/opencv-playground | image logic/imgLogic.py | imgLogic.py | py | 1,115 | python | en | code | 0 | github-code | 90 |
38582298449 | # problem: https://leetcode.com/problems/missing-number/
# - TIME: O(n)
# - SPACE: O(n)
# - Pretty fast, but not the most efficient solution. Most intuitive solution. Utilize a hashmap to store all of nums then loop through 0 to n to find which number is missing from nums.
class Solution:
def missingNumber(self... | fabiantorrestech/Data-Structures-Algorithms | Arrays_Matrices/missingNumber_method3_leetcode.py | missingNumber_method3_leetcode.py | py | 729 | python | en | code | 0 | github-code | 90 |
14372349561 | import math
from textwrap import wrap
# Дарова народ
# Кароч тут куча говнокода
# Если почувствуете жжение в глазах, огонь в пукане - рекомендуется закрыть страницу
# Лучше сначала прочитать эту статью и всё понять: https://ru.wikipedia.org/wiki/Метод_Куайна_—_Мак-Класки
class Row:
count = 0
def __init__(sel... | nikmel2803/itmo_informatics_labs | lab_04/lab_04_07.py | lab_04_07.py | py | 10,706 | python | ru | code | 0 | github-code | 90 |
42366103640 | import sqlite3
import unittest
from main import (
goods_validate,
create_table,
goods_append,
import_from_json_to_database,
)
import sys
import os
from json_test_cases import (
TEST_CASE_POSITIVE_ONE_PRODUCT,
TEST_CASE_POSITIVE_N_PRODUCTS,
TEST_CASE_NEGATIVE,
)
sys.path.append(os.path.dirna... | BortnikovaOlga/stc_21_10_py | dz_py_3/test_json.py | test_json.py | py | 3,287 | python | ru | code | 0 | github-code | 90 |
18315752529 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq... | Aasthaengg/IBMdataset | Python_codes/p02852/s679551116.py | s679551116.py | py | 1,044 | python | en | code | 0 | github-code | 90 |
20621246535 | from datetime import datetime
import re
class Test:
def __init__(
self,
serialNumber: str = None,
project: str = None,
startTime: datetime = None,
endTime: datetime = None,
codeVersion: str = None,
fixtureIp: str = None,
status: bool = None,
... | David1906/Xandra-API | Models/Test.py | Test.py | py | 1,103 | python | en | code | 0 | github-code | 90 |
6547483956 | # -*- coding:utf-8 -*-
class Node():
def __init__(self,data=None):
self.data = data
self.next = None
def __str__(self):
return self.data
n1 = Node("1")
n2 = Node("2")
n3 = Node("3")
n1.next = n2
n2.next = n3
# print(n1)
# print(n2)
# print(n3)
# print(n1.next)
# print(n2.next)... | Hacksdream/Leetcode_Training | 2.LinkList/linklist_demo.py | linklist_demo.py | py | 403 | python | en | code | 0 | github-code | 90 |
37413622727 | sock_dtils = {}
# IUT1 should be always the board under test
#(To avoid coc application to be killed if test case fails)
sock_dtils["RSUIUT2"] = {
"ip addr sys": "192.168.20.162",
"ip addr IUT": "192.168.22.93",
"udp port": 13001
}
sock_dtils["RSUIUT1"] = {
"ip addr sys": "192.168.20.162",
"i... | sirajece2010/safe | libs/coc_config.py | coc_config.py | py | 744 | python | en | code | 1 | github-code | 90 |
36938404483 | #!/usr/bin/env python
"""software_license
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribut... | pixlsus/registry.gimp.org_static | registry.gimp.org/files/dorylinux-impaginatore.py | dorylinux-impaginatore.py | py | 12,203 | python | en | code | 178 | github-code | 90 |
28288561606 |
# coding: utf-8
# In[6]:
#print the letters in the input removing duplicates and print it in the same order
from collections import OrderedDict
s=input()
k=OrderedDict()
for i in s:
if i not in k:
k[i]=1
for j in k:
print(j,end='')
# In[ ]:
#INPUT The first line will contain an integer T denot... | Sriram0824/HackerEarthSolutions | Hacker+Earth+Practice.py | Hacker+Earth+Practice.py | py | 6,469 | python | en | code | 0 | github-code | 90 |
38360427408 | import logging
import socket
import ipaddress
import struct
import sys
import threading
import time
from six.moves import queue
_LOG = logging.getLogger(__name__)
# The multicast logs can occur frequently, e.g. every couple seconds. Prevent
# most logs from ending up in the test record by default.
_LOG.setLevel(loggi... | oxiwear-inc/spintop-openhtf | src/openhtf/util/multicast.py | multicast.py | py | 7,214 | python | en | code | 0 | github-code | 90 |
30750239783 | import matplotlib
matplotlib.use("Agg")
import numpy
import os
my_home = os.popen("echo $HOME").readlines()[0][:-1]
from sys import path,argv
path.append('%s/work/mylib/'%my_home)
from Fourier_Quad import Fourier_Quad
from plot_tool import Image_Plot
import emcee
import corner
import time
import matplotlib.pyplot as pl... | hekunlie/astrophy-research | galaxy-galaxy lensing/mass_mapping/MCMC/MCMC_test.py | MCMC_test.py | py | 5,888 | python | en | code | 2 | github-code | 90 |
31683021427 | import torch
import torchvision
import torchvision.transforms as transforms
from PIL import Image
import wandb
def collate_fn(batch):
images = [item['image'] for item in batch]
ids = [item['id'] for item in batch]
token_metadata = [item['token_metadata'] for item in batch]
image_original_url = [item['i... | llctrautmann/ProbPunks | src/utils.py | utils.py | py | 1,605 | python | en | code | 0 | github-code | 90 |
72201270378 | # Medium
# Write a function that takes in an array of words and returns the smallest array of characters needed to form
# all of the words. The characters don't need to be in any particular order.
# For example, the characters [y, r, o, u] are needed to form the words [your, you, or, yo].
# Note: the input words won'... | ArmanTursun/coding_questions | AlgoExpert/Strings/Medium/Minimum Characters For Words/Minimum Characters For Words.py | Minimum Characters For Words.py | py | 1,825 | python | en | code | 0 | github-code | 90 |
18288526885 | # this is a dummy model dont use it for production but you can experiment with it
#In this code, we capture video from the camera, apply motion detection, and play a buzzer sound when motion is detected. The buzz.wav sound file should be replaced with your own sound file.
#Remember to install the required libraries if... | 260703/Hacktoberfest2023 | detect.py | detect.py | py | 1,973 | python | en | code | null | github-code | 90 |
69838723818 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
class Model(dict):
def __getattr__(self, key):
try:
return self[key]
except KeyError:
raise AttributeError(r"'Model' object has no attribute '%s'" % key)
# def __setattr__(self, key, value):
# self[key] = value
clas... | d2rivendell/MyPython | 元类/setattr.py | setattr.py | py | 438 | python | en | code | 0 | github-code | 90 |
21895082672 | """ Advent of Code, 2020: Day 20, a """
from math import prod
with open(__file__[:-5] + "_input") as f:
inputs = [line.strip() for line in f]
def parse_input():
""" Read the input into distinct tiles (lists of edges) """
tiles = []
tile = [""] * 4 # list of 4 strings, in CSS order
id = 0
... | nickspoons/adventofcode | python/2020/aoc_20_a.py | aoc_20_a.py | py | 2,451 | python | en | code | 0 | github-code | 90 |
71846374378 | n = int(input())
d = {}
for i in range(n):
a, b = tuple(map(int, input().split()))
d[a] = b
l = list(map(int, input().split()))
min = n
d1 = {}
for i in range(len(l)):
if d[l[i]] not in d1:
d1[d[l[i]]] = i
else:
if i - d1[d[l[i]]] < min:
min = i - d1[d[l[i]]]
d1[d[l[i... | Shimimas/Algorithms | CodeRun/easy/mark.py | mark.py | py | 343 | python | ko | code | 0 | github-code | 90 |
11968315545 | import requests
import torch
from PIL import Image
from transformers import AlignProcessor, AlignModel
from utils.utils import *
import streamlit as st
def ALIGN_classification_model(image, prompt):
processor = AlignProcessor.from_pretrained("kakaobrain/align-base")
model = AlignModel.from_pretrained("kakaobra... | mhardik003/Models-Gallery | models/align.py | align.py | py | 1,201 | python | en | code | 0 | github-code | 90 |
27983693072 | import numpy as np
from astropy.modeling.models import Gaussian2D
def FFD(ED, TOTEXP=1., Lum=30., fluxerr=0., dur=[], logY=True, est_comp=False):
'''
Given a set of stellar flares, with accompanying durations light curve properties,
compute the reverse cumulative Flare Frequency Distribution (FFD), and
... | jradavenport/FFD | FFD.py | FFD.py | py | 5,613 | python | en | code | 6 | github-code | 90 |
70905713576 | from random import choice
# создаёт объект корабль
class Ship:
def __init__(self, bow_of_the_ship_coordinates, ship_decks, ship_direction):
# координаты корабля
self.coordinates = [(bow_of_the_ship_coordinates[0] + num_deck, bow_of_the_ship_coordinates[1])
if ship_direc... | Archangel-Ray/SkillFactory_courses-profession-Python | 3. Объектно-ориентированное программирование/Модуль C2. Продолжение ООП/Модуль C2 Итоговое задание 2.5.1 (HW-02) - морской бой.py | Модуль C2 Итоговое задание 2.5.1 (HW-02) - морской бой.py | py | 15,402 | python | ru | code | 0 | github-code | 90 |
72789567976 | from math import *
class Single_dive:
def __init__(self,profondeur=20,duree=40):
self.nom="Matin"
self.profondeur = profondeur
self.profondeur_calcul = profondeur
self.duree = duree
self.palier_12m=0
self.palier_9m=0
self.palier_6m=0
self.palier_3m=0
... | alexisdiver49/app_diving | dive_def.py | dive_def.py | py | 5,771 | python | fr | code | 0 | github-code | 90 |
18571638779 | n = int(input())
la1 = [int(w) for w in input().split()]
la2 = [int(w) for w in input().split()]
ans = 0
for i in range(n):
s1 = sum(la1[:i + 1])
s2 = sum(la2[i:])
ans = max(ans, s1 + s2)
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03449/s764672019.py | s764672019.py | py | 213 | python | en | code | 0 | github-code | 90 |
5291436878 | import glob
import os
import random
import warnings
import numpy as np
import torch
import torch.utils.data
import torchvision
from composer.utils import MissingConditionalImportError, dist
PATCH_SIZE = [1, 192, 160]
__all__ = ['PytTrain', 'PytVal']
def build_brats_dataloader(datadir: str,
... | mosaicml/composer | composer/datasets/brats.py | brats.py | py | 9,303 | python | en | code | 4,712 | github-code | 90 |
7840792915 | import PIL.ImageGrab
import pytesseract
import time
from pynput import keyboard
from pynput.keyboard import Key
import linecache
import msgspec
from msgspec import Struct
import pathlib
import json
import math
import datetime
import random
import sys
import traceback
# GLOBALS (Uppercase doesn't mean I'm screaming at ... | leoCottret/cbn-leocottret-mods | GAME_TOOLS/VEHICLE_CREATION_HELPER/Attic/Back_Up/vch_v2.py | vch_v2.py | py | 19,235 | python | en | code | 5 | github-code | 90 |
14267969496 | import json
from os import path
class SettingsError(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class Settings:
def __init__(self):
self.volume = 100
self.bookmarks = []
def load(self):
if not path... | VitiaCatDragon/MusliPlayer | settings.py | settings.py | py | 1,045 | python | en | code | 1 | github-code | 90 |
26437185174 | from dataclasses import is_dataclass
from abc import ABCMeta, abstractmethod
from typing import List, Any, Callable, Dict, Union
from collections import defaultdict
from collections.abc import MutableSequence, Sequence
from itertools import chain
from operator import methodcaller, attrgetter
ListAny = List[Any]
Manage... | nardew/talipp | talipp/indicators/Indicator.py | Indicator.py | py | 5,962 | python | en | code | 177 | github-code | 90 |
73904933735 | """
Functions that translate RNA into their actual Proteins.
Args:
"AUGUUUUCU"
Returns:
["Methionine", "Phenylalanine", "Serine"]
"""
# Exercism Problem
# Translate RNA into their actual Proteins
# Clarifying Questions
# What is the data type of the output? A list
# Are there duplicates? Only in the STOP si... | campbellmarianna/Code-Challenges | python/protein_translation.py | protein_translation.py | py | 2,943 | python | en | code | 0 | github-code | 90 |
3416041591 | import re
import pandas as pd
def preprocess(data):
pattern = '\d{1,2}/\d{1,2}/\d{2,4},\s\d{1,2}:\d{2}\s[APM]{2}\s-\s'
messages = re.split(pattern, data)[1:]
dates = re.findall(pattern, data)
df = pd.DataFrame({'user_messages': messages, 'message_date':dates})
df['message_date'] = pd.to_datetime(d... | krutika-bhalla/WhatsApp-Chat-Analyzer | preprocess.py | preprocess.py | py | 1,485 | python | en | code | 0 | github-code | 90 |
28881157776 | import base64
import datetime as dt
from rest_framework.decorators import api_view
from rest_framework.parsers import JSONParser
from rest_framework.response import Response
from ClientManagementService.models import Client
from KeydabraManagerController.models import Report
from SummaryDXIInsightService.models import... | pat8308vinod/kd | ClientReportController/views.py | views.py | py | 40,536 | python | en | code | 0 | github-code | 90 |
20850754652 | """
Description: rotate the array
"""
from typing import List
from collections import deque
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
n = len(nums)
k = k%n
nums[:] = nums[n-k:]+n... | Harishkumar18/data_structures | coding_challenges/arrays/rotate_array.py | rotate_array.py | py | 653 | python | en | code | 1 | github-code | 90 |
18572122979 | from collections import deque
import sys
input = sys.stdin.readline
inf = pow(10, 10)
n, m = map(int, input().split())
a = [inf] * n
edge = [[] for i in range(n)]
for i in range(m):
l, r, d = map(int, input().split())
l-=1;r-=1
edge[l].append((r, d))
edge[r].append((l, -d))
flag = True
dist = [inf] ... | Aasthaengg/IBMdataset | Python_codes/p03450/s378674164.py | s378674164.py | py | 857 | python | en | code | 0 | github-code | 90 |
29286567824 | import torch
from torch import Tensor
from matplotlib import pyplot as plt
def accuracy(nn_output: Tensor, ground_truth: Tensor, k: int=1):
'''
Return accuracy@k for the given model output and ground truth
nn_output: a tensor of shape (num_datapoints x num_classes) which may
or may not be... | marcozullich/IntroToAI22_CV | scripts/utils.py | utils.py | py | 3,524 | python | en | code | 3 | github-code | 90 |
34554999998 | import requests
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
if __name__ == "__main__":
"""
Usage: ejerciciospark2
"""
spark = SparkSession \
.builder \
.appName("PySparkEjemplo2") \
.getOrCreate()
def getDataFromApi():
url = "ht... | codigosChidosFunLog/PySparkConnect | pyspark/ejerciciospark2.py | ejerciciospark2.py | py | 687 | python | en | code | 0 | github-code | 90 |
22238654846 | #! /usr/bin/env python3
PORT = 7016
TTL = 630
import socket
import sys
from time import time
from datetime import datetime
from udp import *
# Print without newline
def p(s):
sys.stdout.write(s)
known_clients = dict()
def handle_packet(gp):
if gp is None: return
if gp.packet_type != "CLIENT_ID":
return
... | playasystems/hacks | python-lib/collector.py | collector.py | py | 877 | python | en | code | 1 | github-code | 90 |
10750245890 | import timeit
import cv2 as cv
from pipeline.pipeline import Pipeline
from pipeline.libs.file_video_capture import FileVideoCapture
from pipeline.libs.webcam_video_capture import WebcamVideoCapture
from constant_values import RAW_IMAGE_NAME, FRAME_NUMBER_NAME, FRAME_COUNT_NAME, IMAGE_ID_NAME, VIDEO_NAME,\
LOCAL_T... | romanroads/hedwig | python/pipeline/capture_video.py | capture_video.py | py | 2,698 | python | en | code | 0 | github-code | 90 |
18462214959 | N=int(input())
nums=[]
for _ in range(N):
nums.append(list(map(int, input().split())))
dp = [[0 for _ in range(3)] for _ in range(N)]
for i in range(N):
a,b,c=nums[i]
dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)
dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)
dp[i][2]=max(dp[i-1][0]+c,dp[i-1][1]+c)
num = max... | Aasthaengg/IBMdataset | Python_codes/p03162/s155685028.py | s155685028.py | py | 372 | python | en | code | 0 | github-code | 90 |
18317896459 | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
if N<=0:
ret... | Aasthaengg/IBMdataset | Python_codes/p02855/s341117432.py | s341117432.py | py | 1,235 | python | en | code | 0 | github-code | 90 |
18010886759 | import math
def digit(n):
return math.floor(math.log10(n)) + 1
N = int(input())
sqN = math.sqrt(N)
minD = 0
for i in range(int(sqN) + 2):
if i == 0:
minD = digit(N)
elif N % (i + 1) == 0:
D = max([digit(i + 1), digit(N // (i + 1))])
if minD > D:
minD = D
print(minD) | Aasthaengg/IBMdataset | Python_codes/p03775/s039847013.py | s039847013.py | py | 295 | python | en | code | 0 | github-code | 90 |
1438582162 | import pickle
import numpy as np
import matplotlib.pyplot as plt
import cmocean.cm as cmo
from time_stepper import do_time_stepping
from initial_states import initial_state
from phi4_model import K0
from visualization import hov_plot, save_movie, save_psmovie, save_combomovie
# a class for simulations. You init... | ageorgemorgan/phi4perturbations | simulation_lib.py | simulation_lib.py | py | 5,382 | python | en | code | 0 | github-code | 90 |
17946536579 | from math import floor
from sys import exit
def isinteger(n):
if isinstance(n,int):
return True
if isinstance(n,float):
return n.is_integer()
return False
n = int(input())
for i in range(floor(1700*n/(7000-n)-1),floor(3*n/4)+2):
if 14000*i != (3500+i)*n and 4*i != n:
mini = 350... | Aasthaengg/IBMdataset | Python_codes/p03583/s292815666.py | s292815666.py | py | 712 | python | en | code | 0 | github-code | 90 |
3530041017 | """
### Author: Jacob Parmer, Auburn University
###
### Last Updated: August 10, 2020
"""
import csv
import time
class TVShow:
def __init__(self, title):
self.title = title
self.titleId = ""
self.isAdult = ""
self.startYear = ""
self.genres = []
self.rating = 0.0
self.numOfVotes = 0
"""
Given a show... | jacob-parmer/imdb_scraper | IMDb.py | IMDb.py | py | 3,582 | python | en | code | 0 | github-code | 90 |
18212776639 | s = input()
t = input()
ans = 'No'
if len(s) + 1 == len(t):
for i in range(len(s)):
if s[i] != t[i]:
break
if i == len(s) - 1:
ans = 'Yes'
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p02681/s078620690.py | s078620690.py | py | 194 | python | en | code | 0 | github-code | 90 |
3005770782 | # This file is used to load initial data into database
# First user is loaded and then meals is loaded for the users
import json
import random
FIRST_NAME = [
'Raju', 'Ram', 'Hari', 'Ganesh', 'Gopal', 'Prem', 'Kumar', 'Narayan',
'Balram', 'Anjay', 'Rajesh', 'Hari Shankar',
'Shankar', 'Santosh', 'Sitaram',... | rajsubit/CalorieManagement | dataload_script.py | dataload_script.py | py | 3,284 | python | en | code | 0 | github-code | 90 |
40521226316 | import pickle
import consts
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler, LabelEncoder
# Module ML use model Random Forest
def predict(input_data):
"""
Predict data in runtime
:param input_data: a data like 1 row in dataset
:return: kind of attack... | LotusND/SDN_ML | Runtime.py | Runtime.py | py | 1,153 | python | en | code | 0 | github-code | 90 |
18122285039 | dice_init = input().split()
dicry = {'search':"152304",'hittop':'024135', 'hitfront':'310542'}
num = int(input())
def dicing(x):
global dice
dice = [dice[int(c)] for c in dicry[x]]
for _ in range(num):
dice = dice_init
top, front = map(int, input().split())
while True:
if int(dice[0]) == t... | Aasthaengg/IBMdataset | Python_codes/p02384/s905766039.py | s905766039.py | py | 560 | python | en | code | 0 | github-code | 90 |
3414274261 | def looking_range(seq, target):
sort_seq = sorted(seq)
right = 0
left = 0
mem = sort_seq[0]
while right < len(sort_seq):
if mem == target:
return range(left - 1, right)
elif mem < target:
right += 1
if right < len(sort_seq):
mem += ... | krastykovyaz/dzen_problems | find_range.py | find_range.py | py | 695 | python | en | code | 0 | github-code | 90 |
18446260569 | # 第2回全国统一プログラミング王决定戦予选-A
if False:
N=int(input())
if N%2==0: print(N//2-1)
else: print(N//2)
# 第1回同じ-A
if False:
M,D=map(int,input().split())
ans=0
for m in range(1,M+1):
for d in range(1,D+1):
if len(str(d))==2:
x,y=int(str(d)[0]),int(str(d)[1])
... | Aasthaengg/IBMdataset | Python_codes/p03130/s353849823.py | s353849823.py | py | 1,042 | python | zh | code | 0 | github-code | 90 |
40342561980 | import numpy as np
import pandas as pd
import cv2 as cv
import pickle
from scipy import stats
pos_list = []
class PlImage:
def __init__(self, file_name):
self.filename = file_name.split('.')[0]
self.img_original = cv.imread(file_name, flags=(cv.IMREAD_LOAD_GDAL | cv.IMREAD_ANYDEPTH))
self... | Gigibeau/TWNBA_plinterpreter | TWNBA_plinterpreter.py | TWNBA_plinterpreter.py | py | 6,247 | python | en | code | 0 | github-code | 90 |
9776471110 | import json
if 'merged_data_logger_modules' not in globals():
from brickv.bindings.ip_connection import base58decode
from brickv.data_logger.event_logger import EventLogger
from brickv.data_logger.utils import DataLoggerException, Utilities
from brickv.data_logger.loggable_devices import device_specs
e... | Tinkerforge/brickv | src/brickv/data_logger/configuration.py | configuration.py | py | 18,828 | python | en | code | 18 | github-code | 90 |
13066793104 | # 4. Пользователь вводит целое положительное число. Найдите самую большую цифру в числе.
# Для решения используйте цикл while и арифметические операции.
d = input()
# max = 0
# for i in d:
# if int(i) > max:
# max = int(i)
# print(max)
maxi=0
def maxCount(num, maxi, t_len):
t_len -= 1
... | Yodiculta/Python_new | ex4.py | ex4.py | py | 714 | python | ru | code | 0 | github-code | 90 |
14285185563 | # _*_ coding : UTF-8 _*_
# 开发人员 : ChangYw
# 开发时间 : 2019/7/23 11:16
# 文件名称 : regularExpression.PY
# 开发工具 : PyCharm
import re
pattern = r"[?|&]"
url = 'http://www.python.com/login.jsp?username="python"&pwd="newbie"'
result = re.split(pattern,url)
print(result)
| wenzhe980406/PythonLearning | day07/regularExpression.py | regularExpression.py | py | 303 | python | zh | code | 0 | github-code | 90 |
42900168171 | import json
import requests
from flask import current_app
from lin.exception import NotFound
from app.libs.error_code import WxTplMsgException
from app.libs.utils import datetime_format
from app.models.member import Member
class WxMessage:
def __init__(self, order, access_token, tpl_jump_page=''):
if o... | zcxyun/snack-api-lin | app/libs/wx_msg.py | wx_msg.py | py | 2,135 | python | en | code | 0 | github-code | 90 |
267450234 | import random
import numpy as np
import torch
import torch.utils.data as data
import torch.nn.utils.rnn as rnn_utils
import kaldiio
import warnings
import librosa
warnings.filterwarnings("ignore")
def collate_fn(batch):
batch.sort(key=lambda x: len(x[1]), reverse=True)
seq, label = zip(*batch)
seq_length = ... | lirui-cyber/ISSAC_Lid_Asian | model/data_load.py | data_load.py | py | 5,444 | python | en | code | 1 | github-code | 90 |
14797111477 | #Below code should be able to download images to your local from a csv of links
import csv
import urllib
import lxml.html
import requests
connection = urllib.request.urlopen('https://eonet.sci.gsfc.nasa.gov/api/v2.1/events')
with open('events.csv',encoding="latin1") as csvfile:
csvrows = csv.reader(csvfile, ... | saurabhkumar8112/Microsoft-CodeFunDo- | CodeFundo++/Codefundo.py | Codefundo.py | py | 541 | python | en | code | 3 | github-code | 90 |
17722300710 | import random
# Riddle game
riddles = {
"I have cities but no houses, forests but no trees, and water but no fish. What am I?": "A map",
"I am always hungry, I must always be fed. The finger I touch, will soon turn red. What am I?": "Fire",
"I am not alive, but I grow. I don't have lungs, but I need air. ... | Shahrayar123/Python-Projects | Riddle/riddle.py | riddle.py | py | 989 | python | en | code | 146 | github-code | 90 |
18109763089 | #queue
n,q=(int(i) for i in input().split())
nl=[]
t=[]
et=0
for i in range(n):
na,ti=(j for j in input().split())
# print(t)
nl.append(na)
t.append(int(ti))
i=0
while len(nl)>0:
t[i]-=q
et+=q
# print(t)
if t[i]<=0:
et+=t[i]
print(nl[i]+" "+str(et))
nl.pop(i)
... | Aasthaengg/IBMdataset | Python_codes/p02264/s433905475.py | s433905475.py | py | 383 | python | en | code | 0 | github-code | 90 |
10920019780 | print("the following program simulates a perfect input")
isRunning = True
while(isRunning):
try:
number = int(raw_input("enter a number: "))
except ValueError:
print("not a valid number type try again!:")
isRunning = True
else:
print("you entered " + str(number))
is... | Strongeric89/Python | week4/perfectInput.py | perfectInput.py | py | 364 | python | en | code | 0 | github-code | 90 |
18579544689 | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n, h = map(int, input().split())
aa, bb = [], []
for i in range(n):
a, b = map(int, input().split())
aa.append(a)
bb.append(b)
bb.sort(reverse=True)
maxa = max(aa)
cnt = 0
i=0
... | Aasthaengg/IBMdataset | Python_codes/p03472/s584475296.py | s584475296.py | py | 548 | python | en | code | 0 | github-code | 90 |
25255436052 | import sys
from collections import deque
from itertools import combinations
def bfs(virus):
visited = [[-1] * N for _ in range(N)]
q = deque()
max_dist = 0
for v in virus:
q.append(v)
visited[v[0]][v[1]] = 0
while q:
x, y = q.popleft()
for i in range(4):
... | choinara0/Algorithm | Baekjoon/Graph Algorithm/17142번 - 연구소 3/17142번 - 연구소 3.py | 17142번 - 연구소 3.py | py | 1,145 | python | en | code | 0 | github-code | 90 |
28108595308 | # coding=utf-8
import nltk
import random
from nltk.corpus import movie_reviews
documents = [(list(movie_reviews.words(fileid)), category)
for category in movie_reviews.categories()
for fileid in movie_reviews.fileids(category)]
random.shuffle(documents)
all_words = nltk.FreqDist(w.lower() ... | liangtaohy/LotusStorm | nltk_tuturial/nltk_ch06_1.3.py | nltk_ch06_1.3.py | py | 908 | python | en | code | 1 | github-code | 90 |
15806735652 | #!/home/wizard/anaconda3/bin/python
from time import time, sleep
from functools import wraps
def mesure(func):
@wraps(func)
def wrapper(*args,**kwargs):
"""wrapper function"""
t = time()
result = func(*args,**kwargs)
print(f'{func.__name__} time:{ time() - t}, doc:{func.__doc__... | DikranHachikyan/python-programming-20190318 | ex45.py | ex45.py | py | 708 | python | en | code | 1 | github-code | 90 |
18426900639 | S = input()
ans = 0
for l in range(len(S)):
for r in range(l, len(S)):
T = S[l:r+1]
if set(T) <= set('ACGT'):
ans = max(ans, r-l+1)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03086/s425679958.py | s425679958.py | py | 177 | python | en | code | 0 | github-code | 90 |
34378151329 |
values = df['COMPANIES']
phases = df['MEASURE']
colors = ['rgb(32,155,160)',
'rgb(253,93,124)',
'rgb(28,119,139)',
'rgb(182,231,235)']
n_phase = len(phases)
plot_width = 800
# height of a section and difference between sections
section_h = 100
section_d = 10
# multiplicat... | MidaxoInc/midaxo-dev | Mode/midaxo/spaces/Marketing/SMarketing_ Direct Sales Report.ae91403cfe11/notebook/cell-number-4.0b00170850e8.py | cell-number-4.0b00170850e8.py | py | 2,588 | python | en | code | 1 | github-code | 90 |
30604449784 | """Calculate the network locations for a large dataset by chunking the
inputs and solving in parallel.
This is a sample script users can modify to fit their specific needs.
Note: Unlike in the core Calculate Locations tool, this tool generates
a new feature class instead of merely adding fields to the original.... | Esri/public-transit-tools | transit-network-analysis-tools/parallel_calculate_locations.py | parallel_calculate_locations.py | py | 17,568 | python | en | code | 159 | github-code | 90 |
18546861189 | import sys
from bisect import bisect_left
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(input())
A = list(map(int, input().split()))
A.sort()
MAX = max(A)
A = A[:-1]
target = MAX / 2
idx = bis... | Aasthaengg/IBMdataset | Python_codes/p03380/s055320147.py | s055320147.py | py | 622 | python | en | code | 0 | github-code | 90 |
18292110119 | import re
n = int(input())
s = input()
a = []
ans = 0
for i in range(n):
if s[i] == 'A':
a.append(i)
for i in a:
if s[i:i+3] == 'ABC':
ans += 1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02812/s325707175.py | s325707175.py | py | 178 | python | en | code | 0 | github-code | 90 |
39021142363 | from numpy.testing import *
import numpy as np
import StringIO
class RoundtripTest:
def test_array(self):
a = np.array( [[1,2],[3,4]], float)
self.do(a)
a = np.array( [[1,2],[3,4]], int)
self.do(a)
a = np.array( [[1+5j,2+6j],[3+7j,4+8j]], dtype=np.csingle)
self.do... | houseind/robothon | GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/lib/tests/test_io.py | test_io.py | py | 8,948 | python | en | code | 22 | github-code | 90 |
709385025 |
def fib(n):#Fib without DP
global count
count += 1
if n == 1:
return 0
if n == 2:
return 1
return fib(n - 1) + fib(n - 2)
def dpFib(n):#Fib with DP
global count
global fibs
count += 1
if fibs.get(n) is None:
fibs[n] = dpFib(n - 1) + dpFib(n - 2) # Memoi... | Varanasi-Software-Junction/pythoncodecamp | dynamicprogramming/fibonacci.py | fibonacci.py | py | 592 | python | en | code | 10 | github-code | 90 |
24601919297 | #https://leetcode.com/problems/last-stone-weight
import heapq
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
heap = [ -x for x in stones ]
heapq.heapify(heap)
while len(heap) > 1:
x , y = heapq.heappop(heap) , heapq.heappop(heap)
if x ==... | irajdeep/DSALearnings | PriorityQueues/max_heap.py | max_heap.py | py | 516 | python | en | code | 1 | github-code | 90 |
17167760056 | def writeJointStateToFile(q_t, filename, DELIMITOR = " "):
"""Write joint state to file. Default delimitor is space
input: (numpy matrix) q_t, (string) filename, (string) DELIMITOR=" "
ouput: void
"""
# q_t is the time sequence of Joint states of the shape (robot.nq, number_of_time_steps)
n_ti... | proyan/useful_recipes | python/useful_recipes/file_io.py | file_io.py | py | 2,827 | python | en | code | 0 | github-code | 90 |
25765922725 | #---------------------------------------------
# CS2020
#
# Counting Vowels a, e, i, o, u
#
# This illustrates the scanning the characters
# in a string and checking if they are vowels.
# The program counts the number of vowels in
# the string
#
# Python 3.0
#
# Author: Thomas Otani
#
#-------------------... | ZakiRucker/GradSchoolCoding | CS2020/Week7/count_vowels.py | count_vowels.py | py | 844 | python | en | code | 0 | github-code | 90 |
29543645597 | # -*- coding: utf-8 -*-
# @Time : 2021/8/30 21:57
# @Author : 模拟卷
# @Github : https://github.com/monijuan
# @CSDN : https://blog.csdn.net/qq_34451909
# @File : Offer_day08_63. 股票的最大利润.py
# @Software: PyCharm
# ===================================
"""假设把某股票的价格按照时间先后顺序存储在数组中,请问买卖该股票一次可能获得的最大利润是多少?
示例 1:
输... | monijuan/leetcode_python | code/Offer/Offer_day08_63. 股票的最大利润.py | Offer_day08_63. 股票的最大利润.py | py | 2,270 | python | zh | code | 0 | github-code | 90 |
35444604516 | """wordcount URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... | trafferazabu/wordcount_project | wordcount/urls.py | urls.py | py | 1,031 | python | en | code | 0 | github-code | 90 |
35752259741 | #!/usr/bin/env python
n=int(input())
dp=[[0]*10 for _ in range(n+1)]
# dp[자리수][앞 숫자]
# n=1인 경우 (자리수=1)는 미리 초기화
for i in range(1,10):
dp[1][i]=1
for i in range(2,n+1):
for j in range(10):
if j==0:
dp[i][j]=dp[i-1][j+1]
elif j==9:
dp[i][j]=dp[i-1][j-1]
else:
... | hansojin/python | dynamicPrgrmg/bj10844.py | bj10844.py | py | 435 | python | en | code | 0 | github-code | 90 |
18377221719 | n, k = map(int, input().split())
nb = k
nr = n-k
mod = 10**9+7
fac = [1] * 2001
fac_inv = [1] * 2001
for i in range(1,2001):
fac[i] = (fac[i-1] * i) %mod
fac_inv[i] = pow(fac[i], mod-2, mod)
# 足してa個をb分割する場合の数(順序考慮)が分かればいい
def f(a,b):
if (a == 0) & (b==0):
return 1
if b <= 0:
return 0
... | Aasthaengg/IBMdataset | Python_codes/p02990/s844809994.py | s844809994.py | py | 663 | python | en | code | 0 | github-code | 90 |
18375860421 | #=====l================================================================
# Program: Homework Assignment #7
# Programmer: Teresa Potts
# Date: Mar 20, 2013
# Abstract: This program calculates the amount due for sales of
# CD-RWs and DVD-RWs (using the code "C" or "c" for CD-RWs
# ... | Musicachic-zz/CITP_110 | CITP 110/Chapter 7/Chapter 7 HW.py | Chapter 7 HW.py | py | 3,056 | python | en | code | 2 | github-code | 90 |
18487323263 | import collections
from collections import OrderedDict
from typing import List
class LRUCache:
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = collections.OrderedDict()
def get(self, key: int) -> int:
# 如果key在字典中,返回value
if key in self.cache:
... | comeonboi/algorithm-practise | loong's code/leetcode/editor/cn/146. LRU 缓存.py | 146. LRU 缓存.py | py | 1,407 | python | en | code | 5 | github-code | 90 |
13831850623 | # DFS를 활용한 경로탐색 복습
# 최단경로의 길이를 아는 것과 그 경로 자체를 아는것은 다름.
# 모든 경로를 탐색하려면 백트레킹이 필수적
def dfs(x,y,n,track,route):
dx = (1,-1,0,0)
dy = (0,0,1,-1)
if x == n-1 and y == n-1 :
temp = route[:]
ans.append(temp)
return
for i in range(4):
nx, ny = x + dx[i], y + dy[i]
if ch... | gyubok-lee/algorithms | week3/3_4.py | 3_4.py | py | 1,015 | python | en | code | 3 | github-code | 90 |
25562044935 | import pytest
from python_compiles_lisp.lexer import IntegerToken, NonValueToken, SymbolToken, Token
from python_compiles_lisp.parser import SyntaxTree, parse_string
LP, RP, S, I, ST = (
NonValueToken.LEFT_PAR,
NonValueToken.RIGHT_PAR,
SymbolToken,
IntegerToken,
SyntaxTree,
)
@pytest.mark.parame... | sukovanej/python-compiles-lisp | tests/test_parser.py | test_parser.py | py | 892 | python | en | code | 0 | github-code | 90 |
13173986996 | from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ui.wdgCaratteristicheArchitettonicheChild_ui import Ui_Form
from MultipleChoiseCheckList import MultipleChoiseCheckList
from AutomagicallyUpdater import *
class WdgCaratteristicheArchitettonicheChild(QWidget, MappingOne2One, Ui_Form):
def __init__(self, pare... | faunalia/rt_omero | WdgCaratteristicheArchitettonicheChild.py | WdgCaratteristicheArchitettonicheChild.py | py | 3,065 | python | en | code | 0 | github-code | 90 |
43449275259 | from django.urls import path
from .views import *
urlpatterns = [
path('index/codigos',CodigoCieList.as_view(),name='indexCodigoCie'),
path('index/activo',CodigoCieListActivo.as_view(),name='indexCodigoCieActivo'),
path('index/anulado',CodigoCieListAnulado.as_view(),name='indexCodigoCieAnulado'),
path(... | alexis-code/HIS | his/apps/codigocie/urls.py | urls.py | py | 527 | python | es | code | 0 | github-code | 90 |
43147050911 | ## Import ##
import easygui as egui
import math
import random
## --- --- ##
#
#
#
def main():
#
#
## Global variables ##
kamper = 12 #alltid 12 kamper på tippekupongen
pure_res = [] #for kun resultatene, for å kunne velge gardering
present_res = [] #liste for å presentere resultatene
possible_res = {0:"H",1:"U",... | Raspeball/Tippekupong | tippekupongen.py | tippekupongen.py | py | 1,632 | python | no | code | 0 | github-code | 90 |
19885405186 | import os
import codecs
import json
from tqdm import tqdm
from pyltp import Segmentor, Postagger, NamedEntityRecognizer
from pyltp import SentenceSplitter
import jieba
from jieba.analyse import textrank
def doprocess():
# 载入模型 词典
jieba.load_userdict('WordsDic/userdict_.txt')
jieba.analyse.set_stop_words(... | Jeafi/EventEvolutionaryGraph | featureprocess.py | featureprocess.py | py | 4,993 | python | en | code | 6 | github-code | 90 |
29108250335 | import sys
while True:
try:
card = int(input('Number: '))
except ValueError:
continue
length = len(str(card))
if length < 13:
print('INVALID')
break
else:
break
card_list = [int(x) for x in str(card)]
od = card_list[-1::-2]
ed = card_list[-2:... | arifinjaz/samll-python-projects | credit/credit.py | credit.py | py | 890 | python | en | code | 0 | github-code | 90 |
18226595169 | a, b, c, d = map(int, input().split())
i = 0
i1 = 0
while a > 0:
a -= d
i += 1
while c > 0:
c -= b
i1 += 1
if i >= i1:
print('Yes')
else:
print('No')
| Aasthaengg/IBMdataset | Python_codes/p02700/s173945075.py | s173945075.py | py | 178 | python | en | code | 0 | github-code | 90 |
43012680034 | import os
import cv2
import numpy as np
import torch
from termcolor import cprint
from yacs.config import CfgNode as CN
from oib.datasets.freihand import FreiHAND_v2_Extra
from oib.datasets.texturedmano import TexturedMano
from oib.utils.builder import DATASET
from oib.utils.logger import logger
def uv2map(uv, size=... | oakink/OakInk-Image-Benchmark | oib/external/cmr/data_adaptor.py | data_adaptor.py | py | 6,007 | python | en | code | 8 | github-code | 90 |
32289164579 | from dataclasses import dataclass
from typing import Optional, List, Any
from enum import Enum
@dataclass
class ChannelMessage:
ChannelId: Optional[int] = None
ChannelMessageTranslations: Optional[List[Any]] = None
Message: Optional[str] = None
@dataclass
class Message:
URL: None
DetourId: None
... | NateShoffner/python-rrta | src/rrta/models/route.py | route.py | py | 3,677 | python | en | code | 0 | github-code | 90 |
14745519890 | # Inserting an item into a sorted singly linked list:
'''
This is very useful to add item to list in position that it needs to be in
'''
def InsertCell(top, new_cell):
#Find the cell before where the new cell belongs
while (top.next != None) and (top.next.value < new_cell.value):
top = top.next... | eneskemalergin/Essential_Algorithms | Insertion_sorted_list.py | Insertion_sorted_list.py | py | 734 | python | en | code | 24 | github-code | 90 |
21985358914 | '''
Suppose a sorted array A is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
The array will not contain duplicates.
NOTE 1: Also think about the case when there are duplicates. Does your current solution work? How does the time complexi... | prashik856/cpp | InterviewBit/BinarySearch/1.Practice/2.RotatedArray.py | 2.RotatedArray.py | py | 1,945 | python | en | code | 0 | github-code | 90 |
424745449 | '''
May 2017
@author: Burkhard
'''
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
#--------------------------------------------------------------
fig = Figure(figsize=(12, 5), facecolor='white')
#----------------------------------... | PacktPublishing/Python-GUI-Programming-Cookbook-Second-Edition | Chapter05/Ch05_Code/Matplotlib_labels_two_charts_scaled_dynamic.py | Matplotlib_labels_two_charts_scaled_dynamic.py | py | 1,848 | python | en | code | 311 | github-code | 90 |
15640741208 | from __future__ import division
import os
import numpy as np
from PIL import Image
import torch as t
from skimage import transform as sktsf
import attacks
from model import FasterRCNNVGG16
from trainer import BRFasterRcnnTrainer
from torch.autograd import Variable
from data.dataset import pytorch_normalze
from data.dat... | longtzx/object-detection-attacks | UEA/tess.py | tess.py | py | 6,293 | python | en | code | 16 | github-code | 90 |
18476531139 | from collections import deque, Counter
N = input()
l = len(N)
h = deque(['3','5','7'])
rlt = 0
while h:
a = h.popleft()
if int(N) >= int(a):
dic = Counter(a)
if dic['3'] > 0 and dic['5'] > 0 and dic['7'] > 0:
rlt += 1
if len(a) < l:
for s in ('3','5','7'):
h.append(a+s)
print(rlt... | Aasthaengg/IBMdataset | Python_codes/p03212/s903080396.py | s903080396.py | py | 321 | python | en | code | 0 | github-code | 90 |
19052322864 | import pyscreenshot as ImageGrab
from PIL import Image
def AutoSave_Thumbnail():
if __name__ == '__main__':
img = ImageGrab.grab()
basewidth = 512
size = (512, 512)
wpercent = (basewidth/float(img.size[0]))
hsize = int((float(img.size[1])*float(wpercent)))
... | yaelatletl/PyEPoison | E3DLib/IMAGE.py | IMAGE.py | py | 883 | python | en | code | 0 | github-code | 90 |
20767278651 | # https://www.acmicpc.net/problem/2407
import sys
import collections
memo = collections.defaultdict(int)
def factorial(N):
if N <= 1:
return 1
if memo[N]:
return memo[N]
memo[N] = N * factorial(N-1)
return N * factorial(N-1)
def combination(N, M):
return factorial(N) // (facto... | feVeRin/Algorithm | problems/2407.py | 2407.py | py | 434 | python | en | code | 0 | github-code | 90 |
6324700925 | # -*- encoding: utf-8 -*-
import flask
import gevent.pywsgi
import gevent.monkey
import os
import servicehub
gevent.monkey.patch_all()
app = flask.Flask(__name__)
ctx = servicehub.Context("172.16.8.1:6619")
@app.route("/on_message", methods = ["POST"])
def on_message():
d = flask.request.get_json(force = True)... | hydrocloud/ChatService_testing | main.py | main.py | py | 658 | python | en | code | 1 | github-code | 90 |
7790506138 | from flask import Blueprint, render_template, request, redirect, url_for, flash
from flask_login.utils import login_required
from mba_consent_form.forms import SearchCustomerForm
from mba_consent_form.models import db, Customer, User
from mba_consent_form.secrets import con
cursor = con.cursor()
searcher = Blueprint(... | jankunasm/Micro-Brow-Art-App | mba_consent_form/search/routes.py | routes.py | py | 1,184 | python | en | code | 0 | github-code | 90 |
24669892992 | from unicodedata import name
import requests
import json
from GameData import GameData
import os
import datetime
class PlayerData:
def __init__(self, id=None):
self.api_key = ''
self.game_data = GameData()
self.id = id
self.json = None
def setAPIKey(self, key):
self.ap... | thebrianiac/dsa-seige-eligibility | PlayerData.py | PlayerData.py | py | 2,172 | python | en | code | 0 | github-code | 90 |
26903803333 | def lees_aandeel(file_name):
output = []
with open(file_name) as file:
lines = file.readlines()
for line in lines:
new = line.split(';')
new[-1] = ''.join(new[-1].split(',')).strip()
output.append(new)
return output
def selecteer_kolom(info, file_name):
... | xander27481/informatica5 | 16 - text bestanden/Nasqad.py | Nasqad.py | py | 997 | python | en | code | 0 | github-code | 90 |
19778908012 | # Напишите программу вычисления арифметического выражения заданного строкой.
# Используйте операции +,-,/,. приоритет операций стандартный.
# Например:
# 2+2 => 4;
# 1+2*3 => 7;
# 1-2*3 => -5;
# Добавьте возможность использования скобок, меняющих приоритет операций.
# Например:
# 1+2*3 => 7;
# (1+2)*3 => 9;
from unit... | eamoe/python-course | seminar6/homework-seminar6-task2.py | homework-seminar6-task2.py | py | 4,017 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.