language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 2,232 | 3.296875 | 3 | [] | no_license | """ Lesson 08 HPNorton furniture rental """
from pathlib import Path
import os
import logging
LOG_FORMAT = "%(asctime)s:%(lineno)-3d %(levelname)s %(message)s"
LOG_FILE_SYSTEM = 'system.log'
FORMATTER = logging.Formatter(LOG_FORMAT)
FILE_HANDLER_SYSTEM = logging.FileHandler(LOG_FILE_SYSTEM, mode='w')
FILE_HANDLER_... |
Java | UTF-8 | 880 | 2.65625 | 3 | [] | no_license | package Lab2;
import java.util.Scanner;
public class Lab2_2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Scanner scanner1 = new Scanner(System.in);
System.out.print("ชื่อ-สกุล: ");
String a = scanner.nextLine();
System.out.print("เล... |
Java | UTF-8 | 883 | 3.75 | 4 | [] | no_license | package com;
import java.util.Stack;
public class RecurssiveStackStort {
public static void main(String[] args) {
Stack<Integer> stack = new Stack<Integer>();
stack.push(30);
stack.push(-5);
stack.push(18);
stack.push(14);
stack.push(-3);
sortStack(stack);
System.out.println(" \n\nStack elem... |
C# | UTF-8 | 933 | 2.90625 | 3 | [] | no_license | using GeneralWPFClassLibrary;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using TechTalk.SpecFlow;
namespace GeneralWPF.Tests.ClassLibrary.CommandProcessing
{
[Binding]
public class CommandProcessingSteps
{
ExampleCommandProcessor proc;
[Given(@"a I have a new text command processor")]
... |
C++ | UTF-8 | 1,223 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "mario/net/EventLoop.h"
#include "mario/base/easylogging++.h"
#include <functional>
#include <stdint.h>
#include <unistd.h>
mario::EventLoop* g_loop;
int cnt = 0;
void printTid() {
LOG(INFO) << "pid = " << getpid() << ", tid = " << mario::CurrentThread::tid();
}
void print(const std::string msg) {
... |
Java | UTF-8 | 936 | 1.898438 | 2 | [] | no_license | package com.business.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.business.entity.WorkflowOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Description: business
* <p>
* Created by w_kiven on 2020/12/2 15:43
*/
... |
Python | UTF-8 | 2,427 | 3.21875 | 3 | [
"MIT"
] | permissive | # Matt Grimm
# USAFA
# Sonar Test
# 19 October 2016
# Documentation: stackoverflow.com/questions/18994912/ending-an-infinite-while-loop
# electrosome.com/hc-sr04-ultrasonic-sensor-raspberry-pi/
import RPi.GPIO as GPIO
import time
import sys,signal
# This is something I wanted to learn real quick.
# It... |
C++ | UTF-8 | 1,253 | 2.6875 | 3 | [] | no_license | #include "pch.hpp"
#include "vibrant/mouse.hpp"
#include "vibrant/body.hpp"
namespace vibrant
{
using namespace entityx;
void MouseSystem::update(EntityManager &es, EventManager &events, MouseUpdate mouse)
{
Body::Handle body;
Mouseable::Handle mouseable;
for (entityx::Entity entity : es.entities_with_compone... |
Markdown | UTF-8 | 2,853 | 3.046875 | 3 | [] | no_license | # Parallel Tempering on Hierarchical Hidden Markov Models
The datasets analysed for this study can be found at https://link.springer.com/article/10.1007/s13253-017-0282-9
The R scripts are provided below in chronological order of development (i.e. as presented in the paper).
The average running times for the algorit... |
Shell | UTF-8 | 819 | 4.09375 | 4 | [] | no_license | #!/bin/bash
set -u
disk_device=${1:-}
file=
if [[ -f $disk_device ]]; then
file=$disk_device
sudo kpartx -av $file
disk_device=$(losetup --associated $file | cut -d: -f1)
echo "Using loop device: $disk_device for file: $file"
fi
if [[ ! -b $disk_device ]]; then
cat << EOL
Possible disks:
$(sud... |
C | UTF-8 | 1,800 | 2.578125 | 3 | [
"BSD-2-Clause"
] | permissive | #pragma once
#include <stdint.h>
enum file_system_service_request
{
FILE_OPEN = 1,
FILE_CLOSE = 2,
FILE_READ = 3,
FILE_WRITE = 4,
GET_FILE_INFO = 5,
FILE_FIND = 6,
GET_SUBDIRECTORY_ENTRY = 7
};
struct raw_file_system_request
{
uint64_t data[128]; // 1ko for file system request, i think ... |
Java | UTF-8 | 1,660 | 3.328125 | 3 | [] | no_license | package com.dsa.quicksort;
import java.util.Arrays;
public class QuickSortImpl implements QuickSort {
public static int[] unsortedArray = {11,16,2,8,1,9,4,7,91,17,1,90,16,15,4,3,2,90};
@Override
public int partition(int[] array,int beg,int end) {
System.out.println(array);
int partitionI... |
Python | UTF-8 | 2,089 | 2.5625 | 3 | [] | no_license |
# coding: utf-8
import tensorflow as tf
import math
import data_helpers
import sequence_labelling_model_bidirectional
sequences, labels = data_helpers.load_and_pad_seqences_and_labels()
sequences, labels = data_helpers.shuffle_data_and_labels(sequences, labels)
seq_train, seq_dev, labels_train, labels_dev = data_hel... |
Python | UTF-8 | 2,465 | 3.5625 | 4 | [] | no_license | import unittest
import sys
def custom_sort(arr):
"""
Your sorting algorithm here
"""
pass
def is_not_in_descending_order(a):
"""
Check if the list is not descending (means "rather ascending")
"""
for i in range(len(a) - 1):
if a[i] > a[i + 1]:
return False
ret... |
Shell | UTF-8 | 434 | 3.140625 | 3 | [] | no_license |
VERSION=3350500
set -e
cd `dirname $0`
mkdir -p downloads
cd downloads
if [ ! -f sqlite-amalgamation-${VERSION}.zip ]; then
curl https://www.sqlite.org/2021/sqlite-amalgamation-${VERSION}.zip -o sqlite-amalgamation-${VERSION}.zip
fi
cd -
mkdir -p tmp
cd tmp
unzip ../downloads/sqlite-amalgamation-${VERSION}.zip... |
Java | UTF-8 | 1,603 | 1.789063 | 2 | [
"Apache-2.0"
] | permissive | package org.hswebframework.payment.payment.service;
import org.hswebframework.payment.payment.entity.PaymentOrderEntity;
import org.hswebframework.web.commons.entity.PagerResult;
import org.hswebframework.web.commons.entity.param.QueryParamEntity;
import org.hswebframework.web.service.*;
import java.util.Date;
import... |
C# | UTF-8 | 6,480 | 2.6875 | 3 | [
"MIT"
] | permissive |
using System;
using System.Diagnostics;
using System.IO.Ports;
using System.Threading;
using System.Threading.Tasks;
using NLog;
namespace adrilight
{
internal class SerialStream : IDisposable
{
private ILogger _log = LogManager.GetCurrentClassLogger();
// private readonly byte[] _messagePr... |
JavaScript | UTF-8 | 2,490 | 2.75 | 3 | [] | no_license | 'use strict';
/**
* Config object
* It consists of configs for:
* Robot class
* Messenger class
* Playground class
*/
var config = {};
var path = require('path');
module.exports = config;
config.app = {
root: path.resolve(__dirname),
},
config.playground = {
startPointX: 0,
startPointY: 0,
... |
Java | UTF-8 | 445 | 1.765625 | 2 | [] | no_license | package com.songshu.third_part_tools;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@Data
public class ExportVo implements Serializable{
@ExcelFiled(colName="游戏名称")
public String gameName;
@ExcelFiled(colName="渠道名称")
public String channelName;
@ExcelFiled(colName="日期",dateFormat="yyyy-... |
PHP | UTF-8 | 1,553 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Rules;
use App\Link;
use Illuminate\Contracts\Validation\Rule;
class ValidateAliasRule implements Rule
{
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
... |
PHP | UTF-8 | 5,328 | 3.015625 | 3 | [] | no_license | <?php
namespace Anax\Book\HTMLForm;
use Anax\HTMLForm\FormModel;
use Psr\Container\ContainerInterface;
use Anax\Book\Book;
/**
* Form to update an item.
*/
class UpdateForm extends FormModel
{
/**
* Constructor injects with DI container and the id to update.
*
* @param Psr\Container\ContainerInt... |
Java | UTF-8 | 78 | 1.75 | 2 | [] | no_license | package com.kdc.interfaces;
public interface ITest {
void sayHello();
}
|
Java | UTF-8 | 1,193 | 2.34375 | 2 | [] | no_license | package top.duyt.web.user.dto;
public class IndexImgDto {
/**
* 已上传的主页图片id
*/
private int imgId;
/**
* 主标题
*/
private String mainTitle;
/**
* 副标题
*/
private String subTitle;
/**
* 连接
*/
private String link;
/**
* 图像剪切起始的纵轴坐标
*/
private int cropedY;
public IndexImgDto() {
}
publi... |
Rust | UTF-8 | 4,651 | 3.546875 | 4 | [
"MIT"
] | permissive | use std::env;
use std::io::prelude::*;
use std::fs::File;
/// Struct representing the interpreter state
///
/// # todo list
/// * implement it
pub struct Interpreter {
/// Instruction pointer
ip: usize,
/// Data pointer
dp: usize,
/// Brainfuck machine memory
mem: Box<[u8]>,
/// Source cod... |
Python | UTF-8 | 276 | 2.84375 | 3 | [] | no_license | #nose testexample
#nosetests nose1.py
import unittest
class TddInPythonExample(unittest.TestCase):
def test_calculator_add_method_returns_correct_result(self):
calc = Calculator()
result = calc.add(2,2)
self.assertEqual(4, result) |
Python | UTF-8 | 801 | 4.5 | 4 | [] | no_license | def cheese_and_crackers( cheese_count, boxes_of_crackers ):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket.\n"
print "We can just give the function numbers directly:"
cheese_and_crackers... |
PHP | UTF-8 | 839 | 3.046875 | 3 | [] | no_license | <?php
$path = "pub/media/csv/Sullivans_Web_Price_List_New.txt";
if(file_exists($path))
{
$handle = fopen($path, "r");
$lines = [];
if (($handle = fopen($path, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
$lines[] = $data;
}
fclose($handle)... |
C++ | UTF-8 | 1,176 | 3.03125 | 3 | [] | no_license | #include "Hypnowheel_Lib.h"
#include <Arduino.h>
// Abstraction for turning on an entire LED
void ledOn(byte led) {
led = led * 3; // Convert LED number to the pin number
ledArray[led].state = ON;
ledArray[led+1].state = ON;
ledArray[led+2].state = ON;
// Each LED is RBG and a set of three pins
// Color fu... |
PHP | UTF-8 | 2,554 | 2.765625 | 3 | [] | no_license | <?php
include_once '../src/GildedRose.php';
include_once '../test/ItemBuilder.php';
class GildedRoseTest extends PHPUnit_Framework_TestCase {
public function test_items_degradan_calidad(
) {
$unItem = ItemBuilder::newItem()
->withQuality(5)
->build();
GildedRose::updateQuality(array($unItem));
$this->a... |
Java | UTF-8 | 411 | 2.4375 | 2 | [
"Apache-2.0"
] | permissive | package com.aop.domain;
import org.springframework.stereotype.Component;
@Component
public class TestBeanImpl implements TestBean {
private String testStr = "testStr";
public String getTestStr() {
return testStr;
}
public void setTestStr(String testStr) {
this.testStr = testStr;
}
public void test(int n... |
Go | UTF-8 | 3,747 | 3 | 3 | [
"Apache-2.0"
] | permissive | package manifest
import (
"fmt"
"reflect"
"testing"
"github.com/1dustindavis/gorilla/pkg/config"
)
var (
// store original data to restore after each test
origCachePath = config.CachePath
origManifest = config.Current.Manifest
origURL = config.Current.URL
origDownloadFile = downloadFile
ori... |
Python | UTF-8 | 6,030 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
from PIL import Image
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import transforms, datasets, models
from torch import optim
class Network(nn.Module):
"""Neural Network"""
def __init__(self, input_units, output_units, hidden_units, drop_p=0.5):
... |
PHP | UTF-8 | 2,255 | 2.5625 | 3 | [] | no_license | <?php
$connection = mysqli_connect("localhost", "root", "", "treasurehall");
if (!$connection) {
die("Connection failed:" . mysqli_connect_error());
}
// echo "Connection successful";
if (isset($_POST["regnumber_check"])) {
$regnumber = $_POST["regnumber"];
$query = " SELECT * FROM foreignexamstudents WHERE... |
C++ | UTF-8 | 485 | 2.671875 | 3 | [] | no_license | #ifndef __FISHEYE_H__
#define __FISHEYE_H__
#include "Camera.h"
#include "Vector3D.h"
#include "Point2D.h"
class Fisheye : public Camera
{
public:
Fisheye();
~Fisheye();
public:
Vector3D ray_direction(const Point2D& p,
const int hres,
const int vres,
const float s,
float& r)const;
... |
C | UTF-8 | 1,584 | 3.171875 | 3 | [] | no_license | /*
* @lc app=leetcode id=464 lang=c
*
* [464] Can I Win
*
* https://leetcode.com/problems/can-i-win/description/
*
* algorithms
* Medium (27.25%)
* Total Accepted: 36K
* Total Submissions: 132.1K
* Testcase Example: '10\n11'
*
* In the "100 game," two players take turns adding, to a running total, any
... |
Python | UTF-8 | 2,759 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
import sys
import PIL
from PIL import Image
import numpy as np
import cv2
exif_orientation_table = [{'angle': 0, 'flip': False}, # 0-ingore
{'angle': 0, 'flip': False}, # 1-horizontal(normal)
{'angle': 0, 'flip': True}, # 2-mirror horizontal
... |
Java | UTF-8 | 175 | 1.859375 | 2 | [] | no_license | package com.delta2.colours.filters.image;
public class LightnessVignetteFilter extends VignetteFilter {
public LightnessVignetteFilter(double exp) {
super(2, exp);
}
}
|
C++ | UTF-8 | 1,845 | 2.5625 | 3 | [] | no_license | #include "at/AnalysisWithTreeAndHist.h"
#include "at/AnalysisBase.h"
#include "rt/MiscTools.h"
#include <iostream>
using namespace std;
namespace at
{
// construct:
AnalysisWithTreeAndHist::AnalysisWithTreeAndHist
(
const std::string& root_file_name,
const std::string& tree_name,
... |
Markdown | UTF-8 | 3,174 | 2.8125 | 3 | [] | no_license | ```yaml
area: Nottinghamshire
og:
description: Police have made an arrest in connection with a report of a man tricking his way into a pensioner's home in Kirkby-in-Ashfield, telling her that he worked for the council, before stealing her handbag.
image: https://www.nottinghamshire.police.uk/_npt_customisation... |
C# | UTF-8 | 1,382 | 2.671875 | 3 | [] | no_license | using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Models;
using Newtonsoft.Json;
using SqsWriter.Sqs;
namespace SqsWriter.Controllers
{
[Route("api/[controller]")]
public class PublishController : Controller
{
private readonly ... |
Java | UTF-8 | 2,295 | 1.789063 | 2 | [] | no_license | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: UserSetContactInfo.java
package com.facebook.katana.service.method;
import android.content.Context;
import android.content.Intent;
import com.fac... |
Swift | UTF-8 | 4,218 | 2.84375 | 3 | [
"MIT"
] | permissive | //
// NewBooksViewController.swift
// BookStore
//
// Created by Soojin Ro on 10/06/2019.
// Copyright © 2019 Soojin Ro. All rights reserved.
//
import UIKit
import BookStoreKit
final class NewBooksViewController: UIViewController {
private(set) var books = [Book]()
override func viewDidLoad() {
... |
C# | UTF-8 | 1,536 | 2.6875 | 3 | [] | no_license | using System.Collections.Generic;
using UnityEngine;
class RandomProcreation<G> : Procreation<G> where G : Gene, new()
{
public List<DNA<G>> BuildNextGeneration(List<DNA<G>> fittest, int generationSize, int survivorKeepPercentage, int mutationChance, int mutationRate, bool autoProcreation) {
List... |
Shell | UTF-8 | 242 | 2.984375 | 3 | [] | no_license | #!/bin/sh
mkdir -p /etc/mkinitfs/features.d
for i in files modules; do
for j in /etc/mkinitfs/$i.d/*; do
[ -e "$j" ] || continue
case "$j" in
*.apk-new) continue;;
esac
mv $j /etc/mkinitfs/features.d/${j##*/}.$i
done
done
exit 0
|
Java | UTF-8 | 250 | 1.6875 | 2 | [] | no_license | package src.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class MainTest {
/**
* Test the main
*/
@Test
public void test() {
assertEquals(2, 2);
}
}
|
PHP | ISO-8859-1 | 764 | 3.515625 | 4 | [] | no_license | <?
/**
=begin
titulo: Calculadora
enunciado: Dado um nmero, um operador e outro nmero, exibir a operao desejada.
exemplos:
5 x 6: 5 x 6 = 30
10 + 34: 10 + 34 = 44
21 - 1: 21 - 1 = 20
18 / 2: 18 / 2 = 9
3 % 2: operador % invalido!
dificuldade: 2
linguagem: php
solucao: Utilizar o switch para decid... |
PHP | UTF-8 | 1,992 | 2.96875 | 3 | [] | no_license | <?php
require_once ('./model/Model.php');
class Comment extends Model {
protected $id;
protected $postId;
protected $author;
protected $authorEmail;
protected $comment;
protected $reported;
protected $moderated;
protected $date;
// Constructor
public function __construct(array... |
Ruby | UTF-8 | 1,165 | 3.625 | 4 | [] | no_license | class PolyTreeNode
attr_reader :parent, :children, :value
def initialize(value, parent = nil, children = [])
@value = value
@parent = parent
@children = children
end
def parent=(node)
@parent.children.delete(self) if @parent
@parent = node
node.children << self if node && !node.childr... |
PHP | UTF-8 | 2,332 | 2.59375 | 3 | [] | no_license | <?php
use Dominio\Regras;
use Entidade\{Usuario, Modulo, Perfil};
/**
* @group Dominio
*/
class RegrasTest extends PHPUnit_Framework_TestCase
{
private static $regras;
public static function setUpBeforeClass()
{
self::$regras = self::getRegras();
}
/**
* @dataProvider acessos
... |
Markdown | UTF-8 | 19 | 2.828125 | 3 | [
"MIT"
] | permissive | # jay-kim-portfolio |
Java | UTF-8 | 647 | 2.390625 | 2 | [] | no_license | package io.github.wanmudong.spidersina.spider.demo.gecco;
/**
* @author :wanmudong
* @date :Created in 2019/5/17 10:39
* @description:
* @modified By:
* @version: $
*/
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegrexUtil {
public static String match(String content) {
... |
Java | UTF-8 | 886 | 3.8125 | 4 | [] | no_license | import java.util.Scanner;
public class Encryption {
public static void main(String[] args) {
int digits, digit1, digit2 , digit3, digit4;
System.out.println("Please enter a four-digit number:");
Scanner number = new Scanner(System.in);
digits = number.nextInt();
int temp = 0;
while (digit... |
C# | UTF-8 | 1,209 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Clue.Models;
namespace Clue.Controllers
{
class CategoriesController
{
private GameMemory _context;
public CategoriesController()
{
_context = new Game... |
Go | UTF-8 | 508 | 3.25 | 3 | [] | no_license | package main
import (
"fmt"
"math"
)
func diagonalDifference(arr [][]int32) int32 {
var lsum, rsum int32 = 0, 0
var nTimes = len(arr)
for i := 0; i < nTimes; i++ {
for j := 0; j < nTimes; j++ {
if i == j {
lsum += arr[i][j]
}
if i+j == nTimes-1 {
rsum += arr[i][j]
}
}
}
diff := ma... |
SQL | UTF-8 | 4,444 | 4.15625 | 4 | [] | no_license | --drop table if exists "IBF-pipeline-output".dashboard_triggers_per_day;
truncate table "IBF-pipeline-output".dashboard_triggers_per_day;
insert into "IBF-pipeline-output".dashboard_triggers_per_day
select tpd.country_code
,'Current' as current_prev
-- ,case when date_part('day',age(current_date,to_date(date,'yyyy-mm... |
Java | UTF-8 | 412 | 2.84375 | 3 | [
"MIT"
] | permissive | import org.junit.*;
import static org.junit.Assert.*;
public class ToDoTest {
@Test
public void ToDo_instantiatesCorrectly_true() {
ToDo myToDo = new ToDo("Learn to code");
assertEquals(true, myToDo instanceof ToDo);
}
@Test
public void task_instantiatesWithDescription_true() {
ToDo myToDo = ne... |
C# | UTF-8 | 1,309 | 3.6875 | 4 | [
"MIT"
] | permissive | using System;
using System.Net.Http;
using System.Threading;
namespace WhatIsBackgroundThread
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var url = "https://www.google.com";
Thread thread1 = new Thread(LogEvery5Sec... |
TypeScript | UTF-8 | 546 | 2.609375 | 3 | [] | no_license | import mongoose, { Schema, Document } from 'mongoose'
import { v4 as uuidv4 } from 'uuid'
export interface IAttempt extends Document {
_id: string
phone_number: number
attempts: number
}
const AttemptSchema: Schema<IAttempt> = new Schema({
_id: {
type: String,
default: uuidv4
},
... |
PHP | UTF-8 | 1,684 | 3.03125 | 3 | [] | no_license | <?php
require "config.php";
$db = dbConnect();
$team = strip_tags($_POST['team']);
$stmt = "SELECT teamId, name From team";
$result = $db->query($stmt);
startPage("User Input");
echo "<table align='center' frame='box' width='30%' border='1px' style='border-collapse: collapse'>";
echo "<th colspan='3' bgcolor='#a... |
Ruby | UTF-8 | 1,921 | 3.703125 | 4 | [] | no_license | quit = 0
while quit != 1
exact_Or_Approximate = "null"
puts"Welcome to the circle calculator!"
puts"Would you like to calculate:"
puts"area or circumference?"
uchoice = gets.chomp
if "area" == uchoice or uchoice == "a" or uchoice == "1" or uchoice == "Area" or uchoice == "A"
puts "What is the radius of y... |
Python | UTF-8 | 1,077 | 3.5625 | 4 | [] | no_license | '''
给定一个非负整数数组 A,返回一个数组,在该数组中, A 的所有偶数元素之后跟着所有奇数元素。
你可以返回满足此条件的任何数组作为答案。
示例:
输入:[3,1,2,4]
输出:[2,4,3,1]
输出 [4,2,3,1],[2,4,1,3] 和 [4,2,1,3] 也会被接受。
提示:
1 <= A.length <= 5000
0 <= A[i] <= 5000
'''
from typing import List
class Solution:
def sortArrayByParity(self, A: List[int]) -> List[int]:
len_ = ... |
Java | UTF-8 | 1,418 | 2.125 | 2 | [] | no_license | package com.gurjeet.customelistviewdemo;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class CountryActivity extends AppCompatAct... |
C++ | UTF-8 | 702 | 3.375 | 3 | [] | no_license | // LeetCode
//
// Created by Hongyan on 01/10/17.
// Copyright © 2017 Hongyan. All rights reserved.
//
class Solution {
private:
void findLongestPalindrome(string& s, int i, int j, int& maxLen, int& startPos ) {
while(i >= 0 && j < s.length() && s[i] == s[j]) {
i--;
j++;
}
if(j - i - 1> maxLen) {
... |
C++ | UTF-8 | 1,144 | 2.703125 | 3 | [] | no_license | #include "Module.h"
void Module::CommonLoad(CBReader *reader)
{
//load name
m_name = "";
while (true)
{
std::string str = reader->ReadString();
if (str.find("#") != std::string::npos)
{
break;
}
else
{
m_name.append(str + " ");
}
}
m_description = "";
while (true)
{
... |
C# | UTF-8 | 1,591 | 2.84375 | 3 | [] | no_license | using System.Collections.Generic;
using System.Linq;
using BomberMan.Common;
using BomberMan.Common.Components.StateComponents;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace BomberMan.Screens
{
/// <summary>
/// Klasa bazowa dla wszytskich menu zawierających przyciski, które... |
C++ | UTF-8 | 1,008 | 2.53125 | 3 | [] | no_license | #ifndef BUILDABLEPROPERTY_H
#define BUILDABLEPROPERTY_H
#include <property.h>
enum Color
{
Red,
Blue,
Yellow,
Green
};
class BuildableProperty : public Property
{
public:
BuildableProperty(const unsigned &, const QString &, const Color &, const unsigned &, const unsigned &);
BuildableProperty... |
Java | UTF-8 | 576 | 2.15625 | 2 | [] | no_license | package package2;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import utilities.Base;
public class ParameterTest extends Base {
//String url = "https://www.google.com/"; -- delete this after add in xml
@Parameters({"URL", "UserName"})
@Test
public void searchTest(String url,... |
JavaScript | UTF-8 | 230 | 2.890625 | 3 | [] | no_license | Array.prototype.unsplit = function(a){
var str = "";
for(var i = 0; i<this.length; i++){
str += arr[i];
if(!a && a!==""){
str += ",";
}
else if(a){
str+=a;
}
}
return str;
};
//Create your own join() function; |
Markdown | UTF-8 | 5,840 | 2.84375 | 3 | [] | no_license | ---
title: 'Ajax js'
date: '2020-01-02'
---
<div markdown='1' align='center'>
<img src='/img/ajax.png'/>
</div>
# AJAX
## Introducción
AJAX significa "JavaScript y XML asíncronos". Aunque el nombre incluye XML, JSON se usa con más frecuencia debido a su formato más simple y menor redundancia. AJAX permite al u... |
Python | UTF-8 | 962 | 2.921875 | 3 | [] | no_license | from PIL import Image
import random as rd
imgx = 512
imgy = 512
image = Image.new("RGB", (imgx, imgy))
for x in range(imgx):
for y in range(imgy):
image.putpixel((x,y),(0,0,0))
snakenum = 65
r= 0
g = 0
b = 0
lol = 0
global turn
global snakey
turn = 0
def pr():
global turn, snakey
turn = snakey
for x in range(s... |
JavaScript | UTF-8 | 1,704 | 3.640625 | 4 | [] | no_license | /*
Caldo o freddo
Scrivi un programma che dati sette valori relativi alle temperature della settimana
stabilisca la giornata più calda e quella più fredda.
Esempio:
Input: a = 10, b = -2, c = 31, d = 22, e = 15, f = -6, g = 7
Output: giornata più calda = 31, giornata più fredda = -6
http://www.impar... |
PHP | UTF-8 | 695 | 3.5 | 4 | [] | no_license | <!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>array asociativo equipo</title>
</head>
<body>
<?php
echo "Equipo antes de añadir a otro jugador";
$equipo1 = array (
'Jose' => 'Base',
'Elena' => 'Esco... |
Java | UTF-8 | 1,096 | 2.125 | 2 | [
"Apache-2.0"
] | permissive | package com.routing.august;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class ThirdRouting {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
CamelContex... |
C# | UTF-8 | 2,411 | 2.6875 | 3 | [] | no_license | using ERP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using TestApp.ServiceReference1;
namespace TestApp
{
class MainViewModel : ViewModelBase
{
#region Fields
Empservice... |
Python | UTF-8 | 2,481 | 3.671875 | 4 | [] | no_license | def pre_flop_strength_1():
# Sklansky hand groups: lower group value means better ranking of cards
# "http://www.thepokerbank.com/strategy/basic/starting-hand-selection/sklansky-groups/"
ranks = "23456789TJQKA"
suits = "cdhs"
# input hand for evaluation
hand = input('Enter the hand:').split()... |
Python | UTF-8 | 1,463 | 2.5625 | 3 | [] | no_license | import os
def getNIDdb(year=0, month=0, day=0):
nids = {}
for i in os.listdir('/usr/local/tcs/tums/rrd/'):
if not ".nid" in i:
continue
if not "total" in i:
continue
try:
n, iface, fdate = i.split('_')
d, m, y, j = fdate.split('-')
... |
Python | UTF-8 | 405 | 3.859375 | 4 | [] | no_license | def pascalTriangle(numRows):
res = []
if numRows == 0:
return res
first = [1]
res.append(first)
for i in range(1, numRows):
row = [1]
prev = res[i-1]
for j in range(1, i):
row.append(prev[j-1] + prev[j])
row.append(1)
res.append(row)
... |
C | UTF-8 | 1,018 | 3.78125 | 4 | [
"MIT"
] | permissive | /**
* mario.c
*
* Ahasanul Basher Hamza
* ahasanulhamza133@gmail.com
*
* hamza133
*
* A program that recreates half-pyramid using hashes (#) for blocks
*
*
**/
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
// using do-while loop for asking user the right input
do
... |
Python | UTF-8 | 899 | 3.953125 | 4 | [] | no_license | # 4. Представлен список чисел. Определить элементы списка, не имеющие повторений.
# Сформировать итоговый массив чисел, соответствующих требованию.
# Элементы вывести в порядке их следования в исходном списке.
# Для выполнения задания обязательно использовать генератор.
# Пример исходного списка: [2, 2, 2, 7, 23, 1... |
JavaScript | UTF-8 | 2,312 | 3.953125 | 4 | [] | no_license | var engineAndISP = []; //declaring empty arrays
var engine = [];
function Engine(name,exhastSpeed) { //constructor used to input engine parameters
this.name = name;
this.exhastSpeed = exhastSpeed;
this.isp = 0;
}
function calcISP(engine,callback,options) { //function to calculate ISP. Takes in an engine object... |
Java | UTF-8 | 690 | 2.234375 | 2 | [] | no_license | package com.rest.shifts.domain;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.time.LocalDateTime;
public class ShiftDto {
private int id;
private LocalDateTime from;
private LocalDateTime to;
private int workerId;
public ShiftDto(int id, LocalDateTime from, LocalDateTime to... |
Java | UTF-8 | 637 | 3.09375 | 3 | [] | no_license | package com.train;
import java.util.Scanner;
public class Tester {
public static void main(String[] args) {
int exit = 0;
while (exit != -1){
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter number of tickets:\t");
int ticket = scanner.ne... |
Markdown | UTF-8 | 485 | 2.515625 | 3 | [] | no_license | # mini-questionnaire-app
This app allows pass questionnaires for registered users and create new questionnaires for admin
# it runs on http://localhost:8080/
# default users
DB has 2 users those you can use for testing:
username: 'user' password: 'user' - has only role 'USER';
username: 'admin' password: 'admin' - has ... |
C# | UTF-8 | 2,555 | 2.921875 | 3 | [] | no_license | using EugeneForUwp.Configuration;
using EugeneForUwp.Network;
namespace EugeneForUwp
{
public class Eugene
{
private ConfigurationFileReader _configFileReader;
private Configuration.Configuration _configuration;
private double _currentSoftwareVersion;
/// <summary>
//... |
C++ | UTF-8 | 494 | 2.640625 | 3 | [] | no_license | #include <cstdio>
int x[3000000];
int y[3000000];
int n, m;
const int M = 1000000007;
int main()
{
x[0] = 1;
for (int i = 1; i <= 2000000; i++)
{
x[i] = (long long)x[i - 1] * i % M;
}
y[1] = 1;
for (int i = 2; i <= 2000000; i++)
{
y[i] = (-(long long)(M / i) * y[M % i] % M + M) % M;
}
for (int i = 2; i <... |
Java | UTF-8 | 1,171 | 2.21875 | 2 | [] | no_license | package com.percussion.pso.relationshipbuilder;
import static java.util.Arrays.asList;
import java.util.Collection;
import com.percussion.error.PSException;
import com.percussion.services.assembly.PSAssemblyException;
public class PSFolderRelationshipBuilder extends PSAbstractRelationshipBuilder {
pri... |
Java | UTF-8 | 1,711 | 3.140625 | 3 | [] | no_license | /**
* COPYRIGHT. Harry Wu 2010. ALL RIGHTS RESERVED.
* Project: EasyPhoto
* Author: Harry Wu <harrywu304@gmail.com>
* Created On: Jun 28, 2008 5:12:21 PM
*
*/
package org.shaitu.easyphoto.util;
import java.util.Collection;
/**
* String referred method
* @author lx5
*/
public class StringUtil {
/**
*... |
Java | UTF-8 | 1,933 | 3.75 | 4 | [] | no_license | import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
/**
* This is a Predator class that inheritance all of the methods and shapes from the super class Creature
* In class it contains the a move method that allows the object to change its direction
* @author S... |
Java | UTF-8 | 720 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | package com.nimbusds.jose.util;
import java.util.Arrays;
import com.nimbusds.jose.util.ByteUtils;
import junit.framework.TestCase;
/**
* Tests the byte utilities.
*/
public class ByteUtilsTest extends TestCase {
public void testConcat() {
byte[] a1 = { (byte)1, (byte)2 };
byte[] a2 = { (byte)3, (byte)4 }... |
JavaScript | UTF-8 | 628 | 4.3125 | 4 | [] | no_license | // Exercicios
console.log('ola');
// Qual o resultado da seguinte expressão?
var total = 10 + 5 * 2 / 2 + 20;
console.log(total);
// resposta = 35
// Crie uma expressões que retorna NaN
var mes = 'agosto';
var ano = 2020;
console.log(ano * mes);
// Somar a string '200' com o número 50 e retornar 250
var ... |
Markdown | UTF-8 | 2,116 | 2.8125 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: "AI for policing in southeast China"
tags: idc
permalink: policing
---
### AI for policing in Jiangxi province in southeast China.
In Nanchang, the capital of Jiangxi province in southeast China, a crowd of 60,000 people had gathered for a concert. This was about 1% of the population of the ci... |
JavaScript | UTF-8 | 4,380 | 4 | 4 | [] | no_license | // Level: MediumGiven an array of integers, print all combinations of size X.
// Questions to Clarify:
// Q. Can the array have duplicates?
// A. No, you can assume there are no duplicate numbers.
// Q. What to print if X is greater than the size of the array?
// A. Print nothing, as there will be no valid combinations... |
C++ | UTF-8 | 2,350 | 3.59375 | 4 | [] | no_license | #include "pch.h"
#include "Bitmap.h"
Bitmap::Bitmap(int len)
{
// Setting the max number of elements in the Bitmap
length = len;
// Creating the array to store length number of objects
int numberOfElements = 1 + (length / (8 * sizeof(char)));
mapPtr = new char[numberOfElements];
// Initialise all elements to... |
PHP | UTF-8 | 374 | 3.125 | 3 | [] | no_license | <?php
class usuario {
private $id, $nome, $email, $senha;
function __set($prop, $val) {
$this->$prop = $val;
}
function __get($prop) {
return $this->$prop;
}
function __construct($id, $nome, $email, $senha) {
$this->id = $id;
$this->nome = $nome;
$this->em... |
Python | UTF-8 | 1,663 | 4.03125 | 4 | [] | no_license | print("-- 슬라이싱 --")
nums = [0,1,2,3,4,5,6,7,8,9]
print(nums[2:5]) # 3번째 원소부터 5번째 원소까지
print(nums[:4]) # 첫번째 원소 부터 4번째 원소까지
print(nums[6:])
print(nums[1:7:2]) # 2번째 원소, 네번째 원소, 6번째 원소
print("-- 인덱스를 사용한 대입 --")
score = [ 88, 95, 70, 100, 99 ]
print(score[2])
score[2] = 55 # 3번째 원소를 55로 바꿈
print(score)
score[2] = [55,... |
C# | UTF-8 | 606 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | using System;
namespace FubuMVC.Core.Behaviors.Conditional
{
public class LambdaConditional : IConditional
{
private readonly Func<bool> _condition;
public LambdaConditional(Func<bool> condition)
{
_condition = condition;
}
public bool ShouldEx... |
Java | UTF-8 | 2,402 | 2.265625 | 2 | [] | no_license | package com.mfu.web.controller;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframewor... |
PHP | UTF-8 | 1,293 | 2.6875 | 3 | [] | no_license | <?php
class ManagerTeam extends Team
{
public function __construct()
{
parent::__construct();
}
public function getNotification($idPlayer, $statusPlayer)
{
if ($idPlayer == false || $statusPlayer == false)
return 'Parâmetros session inexistente na função: ' . __FUNCTION__ . ' Linha: ' . __LINE__ . ' Arqu... |
Python | UTF-8 | 559 | 2.703125 | 3 | [] | no_license | from socket import *
from time import ctime
HOST = ''
PORT = 21567
BUFSIZE = 1024
ADDR = (HOST,PORT)
tcpSerSock = socket(AF_INET,SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
while True:
print 'waiting for connection'
tcpClickSock, addr = tcpSerSock.accept()
print '... connected form:', addr
... |
Markdown | UTF-8 | 6,550 | 2.796875 | 3 | [] | no_license | 七七
由于那传音老人的连番指示,沈元通已经对他产生了亲切之感,不由运功呼道:“敢请老前辈显现法驾,以便晚辈叩见一下!”
那苍老的声音哈哈笑道:“时候到了,我们自会见面,何必急在今天。”
二人赶到江边,果见江边有三株立的撑天古树,沈元通神目扫处,数丈之外,便已见到那居中的树杈间,悬着一只掌大纸包。
沈元通身似电闪,伸手取下纸包,只见包面上老气横秋地写一行字道:“沈娃娃收拆。”纸包之内,只有一本四五页的小绢册,封面上题着“天籁之音”四字。
沈元通翻开蝉页,发现里面还夹着一只便条,上写寥寥数字:“三箫合壁,广布天音,镇魔卫道,廓乾朗坤。”
沈元通知道这张便笺是那传音老人所写,当下慎... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.