blob_id
large_string
language
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
f4240c657712fe883ee5699a16a0a4dddd834211
Python
thakur-nishant/LeetCode
/1003. Check If Word Is Valid After Substitutions.py
UTF-8
1,703
3.765625
4
[]
no_license
""" We are given that the string "abc" is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) is equal to V. (X or Y may be empty.) Then, X + "abc" + Y is also valid. If for example S = "abc", then examples of valid strings are: "abc", "aabcbc", "abcabc", "...
true
c311d38138c64e384f3e350b157496870661f711
Python
Kafonin/Python
/soccerTeamRoster.py
UTF-8
517
3.765625
4
[]
no_license
playerRoster = dict() myNum = 1 try: while myNum <= 5: jersey = input("Enter player %d's jersey number:\n" % myNum) rating = input("Enter player %d's rating:\n" % myNum) print(end='\n') myNum += 1 playerRoster.update({jersey: rating}) finally: print('ROSTER') ...
true
621e488a7b744ce44a9e40e97cd1712a3ae1611f
Python
daegu-algo-party-210824/younghang_algo
/dfs/bfs/5-9.py
UTF-8
508
3.265625
3
[]
no_license
from collections import deque def bfs (graph, start, visited) : visited[start] = True q = deque([start]) while q : temp = q.popleft() print(temp) for i in graph[temp]: if visited[i] == False : q.append(i) visited[i] = True #adj 리스트 graph...
true
6e63101d99215ceba16670471613b5994fd1923d
Python
DevIcEy777/Recording-Bot
/recordingbot/__init__.py
UTF-8
2,564
3
3
[ "MIT" ]
permissive
import speech_recognition as sr import wave import sys import os class Bot(object): def __init__(self, datapath, voiceapi_cred_file, frame_threshold=60000, clearfiles=True): """ Initialize a bot. Parameters ---------- datapath : str Path for voice files ...
true
326691397555269e45160eef63f09dfdf52413ac
Python
kanyuanzhi/cache-simulator
/src/poisson.py
UTF-8
1,516
2.625
3
[]
no_license
from scipy import integrate from scipy.optimize import fsolve import math import matplotlib as mpl mpl.use('TkAgg') import matplotlib.pyplot as plt from mcav.zipf import Zipf from che import Che def F(t): # return (math.exp(-rate * t)-math.exp(-rate * staleness)) * t # return t*rate*math.exp(-rate*t) ...
true
be4d5c1fb8e00e82178cd8d0993933ce02ff5655
Python
voynow/ConvNet-Architectures
/Residual_network.py
UTF-8
5,271
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 14 22:08:27 2020 @author: voyno """ from keras import Model from keras.layers import Conv2D, AvgPool2D, Flatten, Dense, BatchNormalization, Input, Add, Activation from keras.preprocessing import image class ResNet: def __init__(self, num_...
true
12a32b32ba09a3dc62f5d8c6ed31c883df7fdc4e
Python
loventheair/instagram_autoposter
/fetch_hubble.py
UTF-8
850
2.6875
3
[]
no_license
from aux_funcs import get_file_extension, download_a_pic import requests from pathlib import Path def fetch_hubble_photo(image_id): response = requests.get(f'http://hubblesite.org/api/v3/image/{image_id}') response.raise_for_status() image_files = response.json()['image_files'] image_url = image_files...
true
18dec81455c670be913108a8096bcff48912248a
Python
hxdaze/finite-state-machine
/finite_state_machine/state_machine.py
UTF-8
5,142
2.828125
3
[ "MIT" ]
permissive
import asyncio from enum import Enum import functools import types from typing import NamedTuple, Union from .exceptions import ConditionsNotMet, InvalidStartState class StateMachine: def __init__(self): try: self.state except AttributeError: raise ValueError("Need to set ...
true
1749b1d8c306fad3e01df2b7be157bcb1a507107
Python
john531026/guess-num
/3-2.py
UTF-8
487
4.375
4
[]
no_license
# 產生一個隨機整數1~100 (不要印出來) # 讓使用者重複輸入數字去猜 # 猜對的話 印出 "終於猜對了!" # 猜錯的話 要告訴他比答案大/小 import random r = random.randint(1, 100) n = 0 while n != r: n = input('請猜1-100的數字,請輸入數字:') n = int(n) if n > r: print('你的數字比答案大') elif n < r: print('你的數字比答案小') print('猜到了數字為', n) #else # print('猜到了數字為', n) # break
true
b017f5627eb741d8856f6e0eba1216b5ebcf424f
Python
QAlgebra/qalgebra
/tests/algebra/test_equation.py
UTF-8
4,880
2.671875
3
[ "MIT" ]
permissive
"""Test for the symbolic_equation package. This is maintained as an external package, but we want to test that it integrates well with qalgebra """ import pytest import sympy from symbolic_equation import Eq from sympy.core.sympify import SympifyError from qalgebra import ( Create, Destroy, IdentityOperat...
true
47f6345dfa27d586a40861a569ad8cfe5c47bd36
Python
Coder2Programmer/Leetcode-Solution
/twentySecondWeek/capacity_to_ship_packages_within_d_days.py
UTF-8
591
3.203125
3
[]
no_license
class Solution: def shipWithinDays(self, weights: List[int], D: int) -> int: def helper(threshold): cur, need = 0, 1 for w in weights: if cur + w > threshold: cur = 0 need += 1 cur += w retur...
true
38c323a23d43db5c0687cc8ac6702eda83bfe8dd
Python
lfunderburk/Math-Modelling
/modelling-salmon-life-cycle/scripts/web_scrapping.py
UTF-8
1,976
3.265625
3
[ "MIT", "CC-BY-4.0", "LicenseRef-scancode-public-domain" ]
permissive
# Authors: Rachel Dunn, Laura GF, Anouk de Brouwer, Courtney V, Janson Lin # Date created: Sept 12 2020 # Date modified: # Import libraries from datetime import datetime import pandas as pd import numpy as np import requests from bs4 import BeautifulSoup import sys ##usage: python web_scrapping.py https://www.water...
true
eaf0b529df29e4c66365128fbc6a864da60cd4cb
Python
crypto-com/incubator-teaclave
/tests/scripts/simple_http_server.py
UTF-8
470
2.546875
3
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import SimpleHTTPServer import BaseHTTPServer class HTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_PUT(self): length = int(self.headers["Content-Length"]) path = self.translate_path(self.path) with open(path, "wb") as dst: dst.write(self.rfile.read(length...
true
171880606625e9a6def6361ac8eb696b8462429f
Python
Charles-IV/python-scripts
/scrolling-screen/basic.py
UTF-8
2,331
3.734375
4
[]
no_license
from colorama import Back from random import randint from time import sleep height = 50 width = 100 ground = 2*(height//3) board = [] for y in range(0, height): board.append([]) for x in range(0, width + 5): # 5 buffer """ if y < ground: # if top two thirds board[y].append(Back....
true
e2066135ef9c583feb6a96f04bf0cb1c85360522
Python
0921nihkxzu/meik
/utils/misc.py
UTF-8
530
2.6875
3
[]
no_license
# misc.py # contains miscellaneous helper functions import numpy as np import matplotlib.pyplot as plt def plot_training_loss(model, loss='binary_crossentropy', mode='epoch'): # or mode = 'batch' losses = getattr(model, mode+"_metrics") iters = len(losses) if loss == 'binary_crossentropy': getloss = lambda i...
true
d1111596e4193822e6c7d3a3b4ba2cf3524f90eb
Python
Clauudia/Curso-Python
/Curso-Python/Tareas/Tarea2.py
UTF-8
438
3.53125
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- #UNAM-CERT numero = input('ingresa el número de primos que quieres calcular: ' ) primos = [2] contador = 1 n = 3 def calcula_primos(numero): if(numero < 1): print "Ingresa un entero mayor 0" else: while(contador <= numero): if(n % 2 != 0 and n % (n - 1) != 0): p...
true
8489d917d7a9132ebfb20a30658e48d2c1336583
Python
TianheWu/Keystone
/Interface_Fea_SVM/Get_SVM_Line.py
UTF-8
785
3.578125
4
[]
no_license
# Date: 2020.10.17 # File function: Transform the matrix to lower triangle and append the label to construct a SVM input line # Person write this file: Zijian Feng, Tianhe Wu class Connect: # Send mutual information matrix def __init__(self, matrix_: [[list]], label_: int) -> None: self.matrix = matr...
true
d2a10c39f1270168fddaf13ff1669ce36ac187d7
Python
magniff/bugvoyage
/tests/test_std_types/test_bytearray.py
UTF-8
359
2.65625
3
[]
no_license
import sys from hypothesis import strategies, given, settings, assume if sys.version_info.major == 3 and sys.version_info.minor >= 5: @given( binary_data=strategies.binary().map(bytearray), ) @settings(max_examples=100000) def test_is_integer(binary_data): assert bytearray.fromhex(byte...
true
a5d0167b550b8030f7b80312366947b48429d2be
Python
bada0707/hellopython
/문제/ch3/pch03ex04.py
UTF-8
199
3.859375
4
[]
no_license
x = int(input("x1: ")) y = int(input("y1: ")) x_ = int(input("x2: ")) y_ = int(input("y2: ")) #연산 also = ((x - x_)**2 + (y - y_)**2)**0.5 print("두점 사이에 거리: ",also)
true
edda038f720ddb3e610a2a15bde925d49f7a49ca
Python
theethaj/ku-polls
/polls/tests/test_auth.py
UTF-8
1,502
2.71875
3
[]
no_license
import datetime from django.contrib.auth import get_user_model from django.test import TestCase from django.utils import timezone from django.urls import reverse from polls.models import Question def create_question(question_text, days, duration=1): """ Create a question with the given question_text, given n...
true
03a2e50f46035986c48d425fd227dca3eea66b7a
Python
cgao/IP
/ip.py
UTF-8
228
2.59375
3
[ "MIT" ]
permissive
import socket import os from time import strftime myIP=socket.gethostbyname(socket.gethostname()) time=strftime("updated at %Y-%m-%d %H:%M:%S") f=open('myIP.txt','w') f.write(myIP+'\n') f.write(time+'\n') f.close()
true
ef9432159c9ff4700295cd06d8c15336565d1e4c
Python
Jack-HFK/hfklswn
/pychzrm course/journey_two/day7_PM/day1/signal_.py
UTF-8
300
2.640625
3
[]
no_license
""" 信号方法处理僵尸进程 """ import signal import os # 子进程退出时父进程会忽略,此时子进程自动由系统处理 signal.signal(signal.SIGCHLD,signal.SIG_IGN) pid = os.fork() if pid < 0: pass elif pid == 0: print("Child pid:",os.getpid()) else: while True: pass
true
4b53eeed24fee01914ab4e4e73426d2ce6f6440d
Python
kampfschlaefer/pilite-misc
/gameoflive/src/gol.py
UTF-8
1,996
3.40625
3
[]
no_license
# -*- coding: utf8 -*- # import logging import random class GameOfLive(object): def __init__(self, sizex, sizey): self.logger = logging.getLogger(self.__class__.__name__) self.resizeboard(sizex, sizey) def createboard(self, sizex, sizey): return [ [ 0 for y in range(sizey) ] for x in ...
true
8ba65630c48a0feea3636cd0b44da8baccf4c0df
Python
alzaia/applied_machine_learning_python
/linear_regression/linear_regression_crime_dataset.py
UTF-8
4,691
3.1875
3
[ "MIT" ]
permissive
# Various linear regression models using the crime dataset (ridge, normalization, lasso) import numpy as np import pandas as pd import seaborn as sn import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from adspy_shared_utilities import load_crime_dataset from sklearn.model_selection imp...
true
a03e7e84b0003e23b575a7e881122065b0abf5e7
Python
amidos2006/gym-pcgrl
/gym_pcgrl/envs/probs/ddave/engine.py
UTF-8
12,573
3.296875
3
[ "MIT" ]
permissive
from queue import PriorityQueue directions = [{"x":0, "y":0}, {"x":-1, "y":0}, {"x":1, "y":0}, {"x":0, "y":-1}] class Node: balance = 0.5 def __init__(self, state, parent, action): self.state = state self.parent = parent self.action = action self.depth = 0 if self.parent...
true
78d18a9cd4d9ff37dd567101af56cd5035ab2019
Python
WielkiZielonyMelon/itbs
/src/apply_attack/apply_attack_set_on_fire.py
UTF-8
676
2.5625
3
[]
no_license
import copy from src.apply_attack.apply_attack import fire_tile from src.helpers.convert_tile_if_needed import convert_tile_if_needed from src.helpers.kill_object import kill_object_if_possible from src.helpers.update_dict_if_key_not_present import update_dict_if_key_not_present def apply_attack_set_on_fire(board, a...
true
c4418b9a815e1faa5dc82a6a71b7ba284ddbcc70
Python
nrhint/GitGames
/solver/Solve.py
UTF-8
6,084
2.671875
3
[]
no_license
##Nathan Hinton def test(rowCol): box = [] ## for x in finalLst:#Find numbers in the box if 0 <= rowCol[0] <= 2: l = finalLst[0:3] print(l) if 0 <= rowCol[1] <= 2: for x in l:box+=x[0:3] elif 3 <= rowCol[1] <= 5: for x in l:box+=x[3:6] else:#...
true
e9641e193215b5626b11be36523efda9961829e8
Python
loneharoon/Dominos
/experimental_py/find_slope.py
UTF-8
4,640
2.75
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Here, in this script, I learn how to fit regresssion line to temperature data. Created on Sat Jul 28 08:59:58 2018 @author: haroonr """ import numpy as np import pandas as pd import matplotlib.pyplot as plt #%% dir = "/Volumes/MacintoshHD2/Users/haroonr/Detailed_data...
true
54c2b6f6ccd377d9ed3c3a99f4c7a73a159f5fe0
Python
KienNguyen2021/BMI_calculation
/main.py
UTF-8
228
3.578125
4
[]
no_license
weight = float(input ("enter your weights in kg : ")) height = float(input ("enter your height in meter : ")) bmi = float (weight / (height ** 2)) // 2 power 2 bmi_integer = int(bmi) print ("your BMI is : " + str(bmi_integer))
true
b5c6e3883702de45ea13582ecd4a656e3badba23
Python
craiig/keychain-tools
/compiler_analysis/tag_optimizations.py
UTF-8
8,586
2.53125
3
[]
no_license
#!/usr/bin/env python import json import subprocess from pprint import pprint import argparse import os from bs4 import BeautifulSoup import sys import tempfile import collections import re def load_database(filename): #database = {} database = collections.OrderedDict() if filename and os.path.exists(filen...
true
2ebcdb69c09776f75bdb9ff1196ec25892d23eef
Python
chenjuntu/Projects
/CSC108/assignment 2/a2_type_checker.py
UTF-8
6,049
3.453125
3
[]
no_license
import builtins import stress_and_rhyme_functions # Check for use of functions print and input. our_print = print our_input = input def disable_print(*args): raise Exception("You must not call built-in function print!") def disable_input(*args): raise Exception("You must not call built-in function input!"...
true
e3733dbe6fa60498b7bd17a1d92e57c1f00f3657
Python
Cenibee/PYALG
/python/fromBook/chapter6/string/4_most_common_word/4-s.py
UTF-8
519
3.28125
3
[]
no_license
from typing import Counter, List import re class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: banned = set(banned) words = re.findall('\w+', paragraph.lower()) for word, count in sorted(Counter(words).items(), key=lambda x: x[1], reverse=True): i...
true
f0fe6ffdb51c9f8989d8af9f1b0766388dbd4694
Python
jkbockstael/leetcode
/2020-07-month-long-challenge/day09.py
UTF-8
2,693
4.1875
4
[ "Unlicense" ]
permissive
#!/usr/bin/env python3 # Day 9: Maximum Width of Binary Tree # # Given a binary tree, write a function to get the maximum width of the given # tree. The width of a tree is the maximum width among all levels. The binary # tree has the same structure as a full binary tree, but some nodes are null. # The width of one lev...
true
0f0ea6e1bee503a70a0df0df6edfd60f7ac7133e
Python
akapne01/gym_tower_of_london
/training/utils/planning_helper.py
UTF-8
4,680
2.609375
3
[ "CC-BY-2.0" ]
permissive
from typing import List import numpy as np from networkx.tests.test_convert_pandas import pd from envs.custom_tol_env_dir import ToLTaskEnv from envs.custom_tol_env_dir.tol_2d.mapping import int_to_state, state_to_int from envs.custom_tol_env_dir.tol_2d.state import TolState FILL_VALUE = -100 def init_...
true
3ca7e1a1bfdb46404dc4a2da02347e72ed43f140
Python
jmxdbx/code_challenges
/encryption.py
UTF-8
625
3.359375
3
[]
no_license
""" Solution to hackerrank.com/challenges/encryption """ import math s = input().strip() l_s = len(s) r_f = math.floor(math.sqrt(l_s)) r_c = math.ceil(math.sqrt(l_s)) if (r_f * r_f) >= l_s: row = col = r_f elif (r_f * r_c) >= l_s: row, col = r_f, r_c else: row = col = r_c row_list = ...
true
554c73485edcfa5a3a0b8b6b18db623a1df03ea2
Python
JavierOramas/FAQ-Chat-Bot-Nous
/main.py
UTF-8
6,518
2.921875
3
[]
no_license
from similarity import find_most_similar, find_most_similar_interaction from corpus import CORPUS,TALK_TO_HUMAN # from telegrambot import send_to_user class Bot: def __init__(self): self.event_stack = [] self.interact = [] self.settings = { "min_score": 0.3, "help_e...
true
d5ea5eab3c7de63c249189b9964714e445451547
Python
timeicher/natural-selection
/test.py
UTF-8
141
2.78125
3
[]
no_license
import pygame pygame.init() win = pygame.display.set_mode((1000, 1000)) while True: win.fill ((10,10,10)) pygame.display.update()
true
e760a83031ed7e3003a9a0aa6c66c3e2eefc186b
Python
ken8203/leetcode
/algorithms/partition-list.py
UTF-8
784
3.40625
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def partition(self, head, x): """ :type head: ListNode :type x: int :rtype: ListNode """ if head is None: ...
true
fafab6946720e7e9c5f6756519566d1542f67e16
Python
littlewindcc/Image-Processing
/Sharping&Smoothing/smooth/smoothing.py
UTF-8
791
3.078125
3
[]
no_license
import cv #function for Smoothing def MedianFilter(image): w = image.width h = image.height size = (w,h) iMFilter = cv.CreateImage(size,8,1) for i in range(h): for j in range(w): if i in [0,h-1] or j in [0,w-1]: iMFilter[i,j] = image[i,j] else: ...
true
b20efbf6b85997c1b4115a72d8d8f8d7ff826bd3
Python
kivi239/ML
/LinearRegression/linreg.py
UTF-8
775
3.4375
3
[]
no_license
import random import numpy as np from numpy.linalg import * from numpy import * import matplotlib.pyplot as plt def generate(): N = random.randint(20, 60) a = random.randint(1, 10) b = random.randint(-15, 15) print(a, b) x = np.zeros(N) y = np.zeros(N) for i in range(N): x[i] = rand...
true
2467d880ae64a433e5d3ce40bc6b60aa4b346a03
Python
trinnawat/leetcode-problems
/find-median-from-data-stream.py
UTF-8
1,248
4.03125
4
[]
no_license
''' https://leetcode.com/problems/find-median-from-data-stream/ ''' class MedianFinder: def __init__(self): """ initialize your data structure here. [1, 3, 4] [7, 13, 20] max_heap will maintain left order [-4, -3, -1] min_heap will maintain right order [7, ...
true
a84550029a570946d3c7bbef63137a304c85b63c
Python
gohar67/IntroToPython
/Practice/lecture4/practice3.py
UTF-8
280
3.234375
3
[]
no_license
name = 'Hovhannes' age = 18 password = '182516*' if name == 'Batman': print('Welcome Mr. Batman!') elif age <16: print('Dear %s, you are too young to register' % name) elif '*' not in password or '&' not in password: print('Please enter a different password.')
true
1fc73137bf7fd1a7dd55a4fbbe0f8722ab4ceec1
Python
agus2207/ESCOM
/Evolutionary_Computing/Greedy.py
UTF-8
1,199
4.15625
4
[]
no_license
""" Lab Session 1 Python & Greedy Algorithm -Who created Python? -Explain the game of the name -What is the current version of Python? -Explain the term "pythonic" -Explain the difference between the following: -list -tuple -set -dictionary -array """ import numpy as np def kp(): c = 10 val...
true
f3bfb2ed36f3a43bd8374b737ba03e7bf84a8d94
Python
mycoal99/AlconCapstone
/patient_recognition/segmentation/linecoords.py
UTF-8
583
3.25
3
[ "MIT" ]
permissive
import cv2 import numpy as np def linecoords(lines, imsize): """ Description: Find x-, y- coordinates of positions along a line. Input: lines: Parameters (polar form) of the line. imsize: Size of the image. Output: x,y: Resulting coordinates. """ # print("linecoords") xd = np.arange(imsiz...
true
5ebf85fc384b18927be9857a38c96713fb91814f
Python
maroro0220/PythonStudy
/BOJ_Python/Math1/BOJ_2775_BunyuKing.py
UTF-8
1,496
3.71875
4
[]
no_license
''' 문제 평소 반상회에 참석하는 것을 좋아하는 주희는 이번 기회에 부녀회장이 되고 싶어 각 층의 사람들을 불러 모아 반상회를 주최하려고 한다. 이 아파트에 거주를 하려면 조건이 있는데, “a층의 b호에 살려면 자신의 아래(a-1)층의 1호부터 b호까지 사람들의 수의 합만큼 사람들을 데려와 살아야 한다” 는 계약 조항을 꼭 지키고 들어와야 한다. 아파트에 비어있는 집은 없고 모든 거주민들이 이 계약 조건을 지키고 왔다고 가정했을 때, 주어지는 양의 정수 k와 n에 대해 k층에 n호에는 몇 명이 살고 있는지 출력하라. 단, 아파트에는 0층부터 있고 각층에는 1호부...
true
4fdd7a2cc3a27901858e195d2de172905d417822
Python
powerzbt/reinforcement-learning-code
/第一讲 gym 学习及二次开发/qlearning.py
UTF-8
12,250
2.9375
3
[]
no_license
import sys import gym import random random.seed(0) import time import matplotlib.pyplot as plt grid = gym.make('GridWorld-v0') #grid is a instance of class GridEnv #grid=env.env #创建网格世界 states = grid.env.getStates() #获得网格世界的状态空间. available states actions = grid.env.getAction() #获得网格...
true
9a6263a4a57bc79fb4adc5240a8ac6dbe08e971f
Python
jonahhill/xone
/xone/plots.py
UTF-8
6,238
2.71875
3
[ "Apache-2.0" ]
permissive
import pandas as pd from xone import utils from matplotlib import pyplot as plt def plot_ts( data: (pd.Series, pd.DataFrame), fld='close', tz=None, vline=None, **kwargs ): """ Time series data plots Args: data: data in pd.Series or pd.DataFrame fld: which field to plot fo...
true
01ee3879ac783f9ce94cb88a90e5f10d63da1f21
Python
olokorre/Project
/main.py
UTF-8
2,408
3.359375
3
[]
no_license
import pygame import random class Player(object): def __init__(self, img, largura, altura): self.spritePlayer = pygame.image.load(img) self.hitBox = pygame.Rect(32, 32, 32, 32) self.x = (largura * 0.45) self.y = (altura * 0.8) def mover(self, tecla, bloco): (x, y) = (s...
true
e0f78e5fa708498953962588462495e8f3a2b395
Python
denysfarias/project-euler-net
/problem-010/main.py
UTF-8
480
3.984375
4
[ "MIT" ]
permissive
from time import perf_counter """ https://projecteuler.net/problem=10 Summation of primes Problem 10 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ def naive_approach(): pass def main(): start = perf_counter() primes, primes_sum = naive_app...
true
17249022982908ee6c67f62d7f4d7b41e170aff1
Python
roiti46/Contest
/yukicoder/001-099/024.py
UTF-8
208
2.921875
3
[]
no_license
N = int(raw_input()) s = set(range(10)) for loop in xrange(N): A = raw_input().split() if A[-1] == "YES": s &= set(map(int,A[:-1])) else: s -= set(map(int,A[:-1])) print list(s)[0]
true
b560fbe1d4c7ed9e5b0c77bab17cb2d45f492841
Python
luctivud/Coding-Trash
/weird-sort.py
UTF-8
407
2.765625
3
[]
no_license
for _ in range(int(input())): n, m = map(int, input().split()) arr = list(map(int, input().split())) ind = set(map(int, input().split())) brr = sorted(arr) flag = True for i in range(len(arr)): if arr[i]!=brr[i]: if i not in ind and i-1 not in ind: flag = Fals...
true
e87e54f4458b583b98fdbcd306fad6bbbaf47c2e
Python
HuyaneMatsu/hata
/hata/discord/activity/activity_metadata/tests/test__put_assets_into.py
UTF-8
585
2.578125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import vampytest from ...activity_assets import ActivityAssets from ..fields import put_assets_into def test__put_assets_into(): """ Tests whether ``put_assets_into`` is working as intended. """ assets = ActivityAssets(image_large = 'hell') for input_value, defaults, expected_output in ( ...
true
a8178a3aaf6ad4312ee46e6463ba890b0c1fb8c1
Python
nayeon-hub/daily-python
/baekjoon/#1449.py
UTF-8
215
2.828125
3
[]
no_license
n,l = map(int,input().split()) pipe = sorted(list(map(int,input().split()))) p = pipe[0] cnt = 1 for i in pipe: leng = p+l-1 if i <= leng: continue else: p = i cnt += 1 print(cnt)
true
e892aa0cfe5afaae12a550c13af8b59f55176385
Python
freshklauser/_Repos_HandyNotes
/_FunctionalCodeSnippet/ClassTools/constant.py
UTF-8
686
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- # @Author : Administrator # @DateTime : 2020/6/1 23:20 # @FileName : constant.py # @SoftWare : PyCharm import sys class _Constant: """ 自定义常量类 """ class ConstError(PermissionError): pass class ConstCaseError(ConstError): pass def __setattr__(self, key, val...
true
a3e6d5c267a1c161fd93b20903d400c011d85fa3
Python
Bharanij27/bharanirep
/PyproS23.py
UTF-8
246
3.421875
3
[]
no_license
n=input() x=y=z=0 for i in range(0,len(n)): if n[i]=='G': x+=1 elif n[i]=='L': y+=1 else: z+=1 if x%2==0 and ((y%2!=0 and (z==0 or z%2!=0)) or (z%2!=0 and (y==0 or y%2!=0))): print("yes") else: print("no")
true
d4002303c6f1a6f2ecf696a233ef7fe0271b5ff5
Python
jconning/glittercreate
/glitterproj/glitter/glitterasset.py
UTF-8
7,307
2.546875
3
[]
no_license
import random from glitter.assetactor import AssetActor from glitter.models import Asset from glitter.models import AssetType from xml.dom.minidom import getDOMImplementation from xml.dom.minidom import parseString class GlitterAsset(AssetActor): def setUrl(self, url): self.url = url retu...
true
ec5a721064f4885948e31fca789b8753bd4fd8a4
Python
jzsampaio/dit-reporter
/ditlib.py
UTF-8
2,160
2.515625
3
[]
no_license
import json from datetime import datetime, timedelta local_tz = datetime.now().astimezone().tzinfo def load_issue(f): with open(f, 'r') as fp: out = json.load(fp) out["properties"]["filename"] = f return out def write_issue(fn, issue): with open(fn, 'w') as fp: json.dump(iss...
true
6cbfff7776bf2061d3f19d89425bc1e7cc34137b
Python
xvwvx/python-test
/tmp.py
UTF-8
36
2.890625
3
[]
no_license
for i in range(0, -5): print(i)
true
dddf8305b0fb2466887fa02659c5746afe2f2cf0
Python
taikeung/tf
/cnn/mnist.py
UTF-8
2,687
2.796875
3
[]
no_license
# _*_ coding: utf-8 _*_ ''' Created on 2018年3月22日 卷积神经网络识别mnist @author: hudaqiang ''' from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #忽略烦人的警告 def weight_variable(shape): """ 构建权重矩阵 """ initial = tf.truncated_normal...
true
d71b419b5266b18ffe1b28bb23b08396348ce5d4
Python
Nisoka/nan
/machine_learning/base_algorithm/softmax/kmean.py
UTF-8
6,684
3.140625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # K 均值聚类方法 import load_mnist from numpy import * def loadDataSet(fileName): #general function to parse tab -delimited floats numFeat = len(open(fileName).readline().split('\t')) print(numFeat) dataMat = [] #assume last column is target valu...
true
56112b3bcd59b39898f0ffe1b9bfc0bd1783da3e
Python
marikelo12/geekbrains_python
/lesson_8/hw_8_4.py
UTF-8
2,780
3.1875
3
[]
no_license
from abc import abstractmethod, ABC class Technics(ABC): def __init__(self, model, serial_no): self.model = model self.serial_no = serial_no self.department = None def _set_department(self, department): self.department = department @abstractmethod def __call__(self, d...
true
3e6780e11f2af8d1019bc6ce9f3878d5ee6f9dda
Python
DevinLayneShirley/Intro_Biocomp_ND_318_Tutorial5
/analysis5.py
UTF-8
2,534
3.515625
4
[]
no_license
##### Python Script for Ex 5 # Biocomputing - 9/22/17 # Brittni Bertolet and Devin Shirley ======= # Script for Ex 5 CHALLENGE #Task 1 (Brittni) #SET WORKING DIRECTORY WITH 'wages.csv' INSIDE FOR FOLLOWING CODE TO WORK # For Brittni: os.chdir('/Users/brittnibertolet/Desktop/Intro_Biocomp_ND_318_Tutorial5/') # Read i...
true
009f3a4e9409c44a18776923ffe178f9d8a42dab
Python
dijx/python-simple-games
/war_card_game/war_game.py
UTF-8
2,429
3.5625
4
[]
no_license
from war import classlib import time play_game = 'y' while play_game == 'y': new_game = None prisoners = -1 print('\n'*5) print('================= NEW GAME =================') while new_game not in ['y', 'n']: new_game = input('Play new game? (y/n): ').lower() if new_game == 'n':...
true
1498aa325e50aaf0d1b713d2b00cbffa88023dc7
Python
iarmankhan/Software-Engineering
/Python/hasPairWithSum.py
UTF-8
486
3.65625
4
[]
no_license
# Naive solution def hasPairWithSumNaive(arr, sumX): for i in range(0, len(arr)): for j in range(i+1, len(arr)): if arr[i] + arr[j] == sumX: return True return False def hasPairWithSumBetter(arr, sumX): mySet = {} for i in range(len(arr)): if arr[i] in...
true
d584b7c00887a1e83bf22ea9ab001cf1f028edfc
Python
niteesh2268/coding-prepation
/leetcode/Problems/1590--Make-Sum-Divisible-by-P-Medium.py
UTF-8
626
2.84375
3
[]
no_license
class Solution: def minSubarray(self, nums: List[int], p: int) -> int: sumVals = {0: -1} for i in range(len(nums)): nums[i] = nums[i]%p totSum = sum(nums)%p if totSum == 0: return 0 remSum = 0 answer = len(nums) for i in range(...
true
106269e4efb8661c24196891c4d32389c39080e2
Python
joh47/python-hello-world
/hello.py
UTF-8
612
4.34375
4
[]
no_license
from random import randrange text = input("Guess a number from 1 to 10. \n") if(not text.isdigit()): print("You did not enter a digit.") exit() elif(not int(text) >= 1): print ("Your digit was not at least 1.") exit() elif(not (int(text) <= 10)): print ("Your digit was not smaller than 10.") e...
true
87997d8d6aac02d3908aabd6bb780cd3ef23cd77
Python
maitrongnhan001/Learn-Python
/B3/function_arguments.py
UTF-8
132
2.859375
3
[]
no_license
def func( a, b = 5, c = 10) : print('a is: ', a, ', b is: ', b, ', c is: ', c) func(3, 7) func(25, c = 24) func(c = 25, a = 100)
true
a55166e80efde67845b732cea429b7e5c5ba41c6
Python
SamuelHaidu/pymusicsearch
/pyms.py
UTF-8
7,826
2.734375
3
[ "MIT" ]
permissive
__version__ = "0.2.0" __author__ = "Samuel Haidu" __license__ = "MIT" ''' Module for search music videos in youtube.com and get info in discogs.com You can: -Search videos and artists in youtube -Get the top100 in youtube music -Make a artist search in Discogs -Get the albuns of artist(listed in Discogs from url) ...
true
5c2616d1d6e6c50afc3b5bf9c8cf4133071b598b
Python
walker8088/easyworld
/EasyPython/wax/examples/dragdrop-2.py
UTF-8
3,697
3.21875
3
[]
no_license
# dragdrop-2.py # Demonstrates giving DnD capabilities to controls and # how to use the Clipboard # # Original by Jason Gedge. Modifications by Hans Nowak. from wax import * # One way to use *DropTargets is to override OnDropFiles or OnDropText. class MyFileDropTarget(FileDropTarget): def OnDrop...
true
627e613357b18f06603ce5ca3c7db4c318e9ae33
Python
sakbayeme2014/client_server
/client_transfer.py
UTF-8
810
2.953125
3
[]
no_license
#!/usr/bin/env python import socket import sys if len(sys.argv) <=1: print "Usage : client_transfer.py <ip address> <file to receiving>" print "Usage : client_transfer.py <localhost> </var/receive.txt>" exit() nbytes = 4096 def client_transfer(): host = sys.argv[1] port = 50000 socket_object = socket.socket(...
true
8bf9cdb850f42cc07ceda36f5a30068b49d63611
Python
LunaBlack/DecisionTree
/secondTest/trees.py
UTF-8
3,646
3.09375
3
[]
no_license
#!/usr/bin/env python # -*- coding: UTF-8 -*- # 代码来源:http://www.cnblogs.com/hantan2008/archive/2015/07/27/4674097.html # 该代码实现了决策树算法分类(ID3算法) # 该文件是ID3决策树算法的相关操作 from math import log import operator #计算给定数据集的香农熵 def calcShannonEnt(dataSet): numEntries = len(dataSet) labelCounts = {} ...
true
f0d927de5b424295e6dca266439c3343a0aa172e
Python
AMANKANOJIYA/HacktoberFest2021
/Contributors/Aman Kanojiya/Hello.py
UTF-8
190
2.703125
3
[ "MIT" ]
permissive
print("Hello World !") print("I am Aman Kanojiya") print("I am From India") print("I am 2nd Year Student at IIT Dhanbad.") print("Email : aman.kanojiya4203@gmail.com") print("Github : https://github.com/AMANKANOJIYA")
true
49fd2519f1be9a2baf7384032451fe68b7599480
Python
crazyfables/Academics
/Python/New Scripts/myflask.py
UTF-8
410
2.65625
3
[]
no_license
""" By: Jessica Angela Campisi Date: 10/30/2019 Purpose: Create a web service that displays a chuck norris quote in html """ from flask import Flask from thechuck import get_chuck from mystory import Story app = Flask(__name__) @app.route('/') def home(): #return "<h1> {} </h1>".format(get_chuck()) myStory =...
true
a24f4686d107e0711239764dbda4dd615602f99c
Python
fancy84machine/Python
/Projects/Supervised Learning/Diabetes+Machine+Learning+Pipeline.py
UTF-8
975
2.953125
3
[]
no_license
# coding: utf-8 # In[5]: import pandas as pd import numpy as np from sklearn.pipeline import Pipeline from sklearn.preprocessing import Imputer from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.me...
true
dbd63814376d7fed81b8beb1ecace1d6f293816f
Python
mail2manish/Blockchain-Based-Secure-billing-For-Hospitals-using-Python
/cam.py
UTF-8
2,600
2.703125
3
[]
no_license
from tkinter import* from PIL import Image,ImageTk import cv2 from tkinter import ttk,messagebox import os import sys win = Tk() #code for tkinter window in centre in screen window_width,window_height = 600,310 screen_width = win.winfo_screenwidth() screen_height = win.winfo_screenheight() position_top...
true
237a0d72903501dde1a91c5b4f3de7fb5e83bc7c
Python
ilshadrin/exel
/exel.py
UTF-8
1,418
3.609375
4
[]
no_license
''' читаем из файла data_1 данные и записываем их в эксель ''' import csv from openpyxl import Workbook def read_csv(filename): data=[] with open(filename, 'r', encoding='utf-8') as f: fields=['Stantion', 'street'] reader = csv.DictReader(f, fields, delimiter=',') for row in reade...
true
06db8f279bf359e5b30a6b60fce98a7c53e244f7
Python
hanntonkin/opty
/examples/pendulum_swing_up.py
UTF-8
3,373
3
3
[ "BSD-2-Clause" ]
permissive
"""This solves the simple pendulum swing up problem presented here: http://hmc.csuohio.edu/resources/human-motion-seminar-jan-23-2014 A simple pendulum is controlled by a torque at its joint. The goal is to swing the pendulum from its rest equilibrium to a target angle by minimizing the energy used to do so. """ fr...
true
c7cd71bf36faccf0f5c0a627b337667731cd13f1
Python
sudhanshu-jha/python
/python3/Python-algorithm/Hard/wordTransformer/wordTransformer_test.py
UTF-8
309
2.90625
3
[]
no_license
from wordTransformer import transform import pytest def test_wordTransformer(): dictionary = ["DAMP", "DICE", "DUKE", "LIKE", "LAMP", "LIME", "DIME", "LIMP"] start = "DAMP" stop = "LIKE" path = transform(start, stop, dictionary) assert path == ["DAMP", "LAMP", "LIMP", "LIME", "LIKE"]
true
3ffc5634c94e6acf7288dd2666776c87e639de51
Python
max-sixty/xarray
/xarray/core/dask_array_compat.py
UTF-8
2,383
2.671875
3
[ "Apache-2.0", "BSD-3-Clause", "CC-BY-4.0", "Python-2.0" ]
permissive
import warnings import numpy as np try: import dask.array as da except ImportError: da = None # type: ignore def _validate_pad_output_shape(input_shape, pad_width, output_shape): """Validates the output shape of dask.array.pad, raising a RuntimeError if they do not match. In the current versions of...
true
676b619cd44850b291e63108f6ba9352087f113e
Python
itaykbn/oop-class-assignment-1-zvika
/circle.py
UTF-8
262
3.40625
3
[]
no_license
from shape import Shape import math class Circle(Shape): def __init__(self, radius): self.radius = radius def perimeter(self): return 2 * math.pi * self.radius def area(self): return math.pi * (self.radius * self.radius)
true
a6f66005b3172974d3d2acb82a0161f4ed235483
Python
mjn-at/myNeuralNetwork
/coloredArray.py
UTF-8
189
2.96875
3
[]
no_license
""" creates a colored output of an array """ import numpy as np import matplotlib.pyplot as plt a = np.random.rand(3,3) - 0.5 print(a) plt.imshow(a, interpolation="nearest") plt.show()
true
0b246ecd2cdcf847cedd948a5e94adffa884cefb
Python
94akshayraj/AI-program
/ML ans/day3/MLR4.py
UTF-8
616
2.828125
3
[]
no_license
from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error,mean_absolute_error data = pd.read_csv("/Users/spacslug/ML-Day1/ML ans/day3/data_mruder.txt") data = data.as_matrix() print (dat...
true
a6866311bb766c70271ee265f601afe57f54ae11
Python
lilianluong16/cogworks_team4
/songfp/fingerprinting.py
UTF-8
4,878
3.265625
3
[]
no_license
# This file contains functions for: # song fingerprinting (finding peaks) # fingerprint comparision (comparing peaks to those looked up in the database_ # determining the best match for a song sample # determining whether the best match is sufficient to identify the song import numpy as np import itertools import coll...
true
464387a027a2592119b5dffc3e6b548b04ad2fdc
Python
stevekutz/py_graph_app
/plotdata3.py
UTF-8
996
3.25
3
[]
no_license
import numpy as np from scipy.interpolate import UnivariateSpline from matplotlib import pyplot as plt # generate data samples # data = scipy.stats.expon.rvs(loc=0, scale=1, size=1000, random_state=123) # define empty list data_list = [] # open file and read the content in a list with open('result_5000.txt', 'r') ...
true
5d2b87039571ef3701b6262ae0eda8853a00cbbd
Python
ShantNarkizian/Distributed-sharded-kvstore
/test_assignment3_v2.py
UTF-8
12,641
2.6875
3
[]
no_license
import unittest import requests import time import os ######################## initialize variables ################################################ subnetName = "assignment3-net" subnetAddress = "10.10.0.0/16" replica1Ip = "10.10.0.2" replica1HostPort = "8082" replica1SocketAddress = replica1Ip + ":8080" replica2Ip...
true
a134ebfec6e5f511d03b247240f9ce41c38bda39
Python
juoyi/linshi_demo
/bubble_demo.py
UTF-8
1,188
4.1875
4
[]
no_license
def bubble_sort(li): """ 冒泡排序: 每次都是相邻两个元素之间进行比较,较大者置后,一次大循环过后会将最大者放到最后,同时参与比较的数字减一 :param li: :return: """ for i in range(len(li)-1): # 外层循环,控制循环次数 for j in range(0, len(li)-1-i): # 内层循环,负责控制元素下标 if li[j] > li[j+1]: li[j], li[j+1] = li[j+1], li[j] re...
true
9efbe24b0ea50afc6729b05de7ebc04e929cd788
Python
dprpavlin/OuterBilliards
/ZoneRealPolygonsFor12Gon.py
UTF-8
6,378
2.671875
3
[]
no_license
from workWith12Gon import * from point2D import * from segmentIntersection import * from billiard import * from absqrtn import * from fractions import * import pygame, sys from pygame.locals import * def makeColorFromHash(h): r = h % 256 h /= 256 g = h % 256 h /= 256 b = h % 256 return (r, g, ...
true
39b4bc563539efd781d04a2617a4702da5abf97d
Python
CircuitBreaker437/PythonGeneralTools
/double_linked_list.py
UTF-8
3,418
4.21875
4
[]
no_license
# Filename: double_linked_list.py # Programmer: Marcin Czajkowski # Revision: 4.0 - Final working version - fixed references to nodes in linked list # in removeNode() method # Purpose: The purpose of this script is to create a doubly linked list example. # The single linked list can be achieve...
true
364e2a85707fb780a42ce1f18a0cfea7322b1107
Python
e3561025/pythonWebCatch
/exerciseTest/20190319test2.py
UTF-8
518
2.734375
3
[]
no_license
import tkinter as tk import numpy from tkinter import ttk root = tk.Tk() root.title('wnacg-download') root.geometry('200x200') #root.resizable() #禁止使用者調整大小 label = ttk.Label(root,text='hello world') label.pack() #pack是由上往下擺放 #label.grid(column=0,row=0) count=0 def clickOK(): global count count = count+1 lab...
true
a6083db1f4b6789639e8a92bd306ec7eb79d6149
Python
lanzhiwang/common_algorithm
/sort/06_heap_sort/04.py
UTF-8
1,179
4.34375
4
[]
no_license
""" https://www.cnblogs.com/chenkeyu/p/7505637.html 在最小化堆中取出最小值: 在最小堆中,拿出一个最小值,也就是拿出第一个数 然后把最后一个数放到头的位置,这样树的结构就不会改变,而且操作简单 最后调整最小堆 原始最小堆:[1, 6, 4, 8, 7, 6, 5, 13, 12, 11] """ # 最小堆 def heapify(unsorted, index, heap_size): largest = index left_index = 2 * index + 1 right_index = 2 * index + 2 i...
true
3cdd1b579b41a0ea602f0a6eea9de2bfca3bf87b
Python
facelessg00n/BerlaTools
/berlaJoin.py
UTF-8
4,088
2.984375
3
[]
no_license
""" facelessg00n 2020 Made in Australia Imports data from CSV files output from BERLA iVE Outputs files for contact, calls and SMS data Device name and details added to contact, call and SMS files for easier analysis timestamps normalised Formatted with Black """ import os import pandas as pd import tqdm print("Ber...
true
46b54cc8da3d5da66df7aad869fbd2168c1d4cde
Python
siddharthadtt1/Leet
/142-linked-list-cycle.py
UTF-8
709
3.546875
4
[]
no_license
class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def detectCycle(self, head): """ :type head: ListNode :rtype: ListNode """ if not head or not head.next: #raise Exception('Linked list has less than two nodes') ...
true
c9045316bf411632469bf91843337d99816e8e81
Python
kailash-manasarovar/GCSE_code
/gui_examples/exercise3.py
UTF-8
1,212
3.921875
4
[]
no_license
# CODE for EXERCISE 3 # ------------------- # This exercise introduces # * Difference border styles # * Pack options: side, fill, expand # # The aim of this exercise is to explore layout from tkinter import * import random app = Tk() # Create the top-level window app.title("GUI Example 3") # OPTIONALLY set the ...
true
daadef673408a8771a21de3cca75173f3dc39884
Python
sunshineplan/web-crawler
/crawler/lib/output.py
UTF-8
586
2.71875
3
[]
no_license
#!/usr/bin/python3 # coding:utf-8 import os from csv import DictWriter def saveCSV(filename, fieldnames, content, path=''): path = path.strip('"') if path != '': if os.name == 'nt': path = path + '\\' else: path = path + '/' fullpath = path + filename fullpath ...
true
37b1ef7321447f2952692f053c27f29358606548
Python
eduardogpg/flask_twitter
/app/__init__.py
UTF-8
424
2.703125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask import Flask from flask_sqlalchemy import SQLAlchemy from config import app_config __author__ = 'Eduardo Ismael García Pérez' db = SQLAlchemy() def create_app(config_name): print "Enviroment " + config_name app = Flask(__name__) app.config.from_object(ap...
true
b3b44f0f317e4344183f8299b48830c36a78fa2e
Python
raymondlee00/softdev
/fall/17_csv2db/db_builder.py
UTF-8
1,686
2.890625
3
[]
no_license
#ray. lee. and junhee lee #SoftDev #skeleton :: SQLITE3 BASICS #Oct 2019 import sqlite3 #enable control of an sqlite database import csv #facilitate CSV I/O DB_FILE="discobandit.db" db = sqlite3.connect(DB_FILE) #open if file exists, otherwise create c = db.cursor() #facilitate db ops # wi...
true
b92dddc6833efc2131302d090fe6d87523600396
Python
godspysonyou/everything
/alg/niukesuanfa/7_9checkcompletion.py
UTF-8
930
3.3125
3
[]
no_license
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class CheckCompletion: def chk(self, root): if not root: return False flag = False que = [] que.append(root) while(que): top = que.pop(0...
true
e734096686293b08ba2a9a9995e7b46e295bbc11
Python
cherylchoon/soundcloud_clone
/apps/loginandreg/models.py
UTF-8
3,224
2.515625
3
[]
no_license
from __future__ import unicode_literals from django.db import models from django.contrib import messages from django.core.files.storage import FileSystemStorage from django.core.exceptions import ValidationError from django.core.validators import RegexValidator import bcrypt import datetime onlyLetters = RegexValidato...
true
581d12cd0f32b5c6d9ad70afea17e2f27c161fda
Python
voltelxu/some
/word/word2labels.py
UTF-8
758
2.96875
3
[]
no_license
import re def word2lables(filename, outfile): file = open(filename, 'r') out = open(outfile, 'w+') data = "" for line in file: line = line.strip('\n') words = line.split(" ") for word in words: if len(word) < 3: continue if len(word) == 3: out.write(word + " S\n") data = data + word + " S\n...
true
a6032b68cc6712989d26898becc8b84b0864710c
Python
SongLepal/baekjoon.py
/5547.py
UTF-8
1,509
2.890625
3
[]
no_license
from sys import stdin from collections import deque ox = [ -1, -1, -1, 0, 1, 0] oy = [ -1, 0, 1, 1, 0, -1] ex = [ 0, -1, 0, 1, 1, 1] ey = [ -1, 0, 1, 1, 0, -1] def next(x, y, i): if y % 2 == 0: nx = x + ex[i] ny = y + ey[i] elif y % 2 == 1: nx = x + ox[i] ny = ...
true