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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 537 | 2.828125 | 3 | [
"MIT"
] | permissive | package authoringenvironment.view;
import javafx.scene.control.Alert;
/**
* Generates and shows an Alert with an error message
*
* @author Stephen
*
*/
public class AlertGenerator extends Alert {
/**
* Generates an Alert of the type ERROR
*/
public AlertGenerator() {
super(AlertType.ERROR);
}
/**... |
Python | UTF-8 | 1,598 | 3.5 | 4 | [] | no_license | import pandas as pd
import numpy as np
import math
def prepare_data(data_df, train_test_split, *args):
'''
Randomly splits the data according to the given
`train_test_split` (0.2 means 80/20 train/test split).
Only pandas DataFrames or numpy arrays may be provided
in *args -- the same random spli... |
Java | UHC | 704 | 2.90625 | 3 | [] | no_license | package tutorial11;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MyFrame extends JFrame {
// implements ActionListener
JButton btn =new JButton("ݱ");
public MyFrame(){
setTitle("ڹ ");
setSize(300,200);
setLayout(new FlowLayout());
btn.addActionListener(new ActionListener() {
... |
Java | UTF-8 | 4,181 | 2.078125 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
... |
Python | UTF-8 | 4,911 | 3.296875 | 3 | [] | no_license | from discord.ext import commands
import pandas as pd
class RPSgame(commands.Cog):
"""
This Cog adds rock-paper-scissors game
"""
def __init__(self, client):
"""
Client - bot Anbu
rps_data - matrix with players data kind of:
1st_player's_name R/P/S
2... |
JavaScript | UTF-8 | 344 | 3.328125 | 3 | [] | no_license | // Now the worker is effectively the global scope.
// Thus worker.onmessage can be used as onmessage
onmessage = function(e) {
console.log('Message received from main script: ');
console.log(e);
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMe... |
Markdown | UTF-8 | 955 | 3.015625 | 3 | [] | no_license | # MultithreadingSynchronization
This is a solution to a interesting synchonization problem, intend to demo Multi-threading and Synchronization.
Problem: A group of surfers decide to spend an entire day surfing in the
Beach. The surfers show up at random times during the day and come in and out of the water at random t... |
C | UTF-8 | 205 | 2.640625 | 3 | [] | no_license | #include <stdlib.h>
#include "libft.h"
void *ft_memalloc(size_t size)
{
void *dst;
(if !(dst = (size_t)malloc(sizeof(size_t) * size) + 1))
return (NULL);
ft_memset(dst, 0, size);
return (dst);
}
|
C# | UTF-8 | 7,882 | 2.90625 | 3 | [] | no_license | #region 文件描述
/******************************************************************************
* 创建: Daoting
* 摘要:
* 日志: 2014-07-01 创建
******************************************************************************/
#endregion
#region 引用命名
using System;
using System.Globalization;
using System.Runtime.InteropServices;
#... |
Python | UTF-8 | 639 | 3.1875 | 3 | [
"MIT"
] | permissive | from itertools import product
import sys
MAPPING_DICT = {
'0' : '0',
'1' : '1',
'2' : 'abc',
'3' : 'def',
'4' : 'ghi',
'5' : 'jkl',
'6' : 'mno',
'7' : 'pqrs',
'8' : 'tuv',
'9' : 'wxyz',
}
def main(filepath):
with open(filepath, 'r') as f:
for line ... |
C# | UTF-8 | 882 | 2.765625 | 3 | [
"MIT"
] | permissive | using BassClefStudio.GameModel.Graphics;
using BassClefStudio.GameModel.Geometry.Transforms;
using System;
using System.Collections.Generic;
using System.Text;
namespace BassClefStudio.GameModel.Graphics.Commands
{
/// <summary>
/// Represents any command sent to be drawn on an <see cref="IGraphicsSurface"/> ... |
JavaScript | UTF-8 | 12,080 | 2.875 | 3 | [
"MIT"
] | permissive | /*
* Moon 0.1.0
* Copyright 2016, Kabir Shah
* https://github.com/KingPixil/moon/
* Free to use under the MIT license.
* https://kingpixil.github.io/license
*/
"use strict";
(function(window) {
var config = {
silent: false
}
var directives = {};
var components = {};
/**
* Converts... |
Java | UTF-8 | 3,184 | 1.859375 | 2 | [] | no_license | package com.solution.p2p.core.user.dao;
import java.util.List;
import com.solution.p2p.core.common.entity.SysOrganization;
import com.solution.p2p.core.common.entity.SysOrganizationExample;
import org.apache.ibatis.annotations.Param;
public interface SysOrganizationMapper {
/**
* This method was generated b... |
Python | UTF-8 | 215 | 3.890625 | 4 | [] | no_license | def main():
n = int(input('Digite a quantidade de termos da sequência triangular: '))
atual = 0
for c in range(1, n+1):
atual += c
print(f'{atual}', end=' -> ')
print('FIM')
main() |
C# | UTF-8 | 1,656 | 2.828125 | 3 | [] | no_license | //PURPOSE: Build an application for generating quotes for car insurance
//AUTHOR: Robert Manez
using CarInsuranceQuote.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CarInsuranceQuote.Controllers
{
public class HomeController : ... |
C++ | UTF-8 | 1,113 | 2.890625 | 3 | [] | no_license | #include "lista.h"
Lista::Lista()
{
longiLista = 0;
inicio = NULL;
}
Archivo * Lista::agregar(Archivo *arch){
if(longiLista == 0){
inicio = arch;
longiLista++;
return arch;
}
else{
Archivo * temp = inicio;
for(int a = 0; a<longiLista; a++){
if(te... |
C | UTF-8 | 4,246 | 2.984375 | 3 | [] | no_license |
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
int type;
int n;
int **neighbors;
int *degree;
int *included;
int *excluded;
// int *status;
long long unsigned int n_connected;
long long unsigned int n_connected_u;
long long unsigned int n_connected_d;
long long unsigned int n_connecte... |
JavaScript | UTF-8 | 670 | 2.65625 | 3 | [] | no_license |
"use strict";
$( document ).ready(function () {
//create tabs using jquery-ui
$(function() {
$( "#tabs" ).tabs();
});
$("#button").click(function( event ) {
var htmlContent = $("#htmlCode textarea").val();
var cssContent = $("#cssCode textarea").val();
var jsContent = $("#jsCode textarea").val();
//in... |
Java | UTF-8 | 1,976 | 2.8125 | 3 | [] | no_license | package com.quiz.game.entity;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;
import java.util.UUID;
@Getter
@ToString
@NoArgsConstructor
public class Question {
private String questionId;
... |
Java | UTF-8 | 488 | 2.59375 | 3 | [] | no_license | public class Nomes {
static int lChegada = 100;
public static void main(String[] args) {
Thread t = Thread.currentThread();
System.out.println(t.getName());
Grilos grilo1 = new Grilos("Carlos", lChegada);
Grilos grilo2 = new Grilos("joão", lChegada);
Grilos gril... |
Java | UTF-8 | 1,553 | 2.296875 | 2 | [] | no_license | package com.begear.controller.restcontroller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
im... |
Java | UTF-8 | 2,339 | 2.71875 | 3 | [] | no_license | package ristogo.ui.controls.base;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Function;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Side;
import javafx.s... |
C | UTF-8 | 356 | 2.90625 | 3 | [] | no_license | //@venkatesh thirunagiri
/*Given nums = [3,2,2,3], val = 3,
Your function should return length = 2, with the first two elements of nums being 2 */
int removeElement(int* nums, int numsSize, int val){
int i,j=0;
for(i=0;i<numsSize;i++)
{
if(nums[i] != val)
{
nums[j++]=nums[i]... |
Java | UTF-8 | 2,470 | 2.171875 | 2 | [] | no_license |
package com.user.model;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import... |
Java | UTF-8 | 132 | 1.53125 | 2 | [] | no_license | package comum.json.artefatos;
public enum JType {
STRING, OBJECT, ARRAY, NUMBER, NULL, BOOLEAN, DATE, BYTEARRAY, CLASS, ENUM,
}
|
Markdown | UTF-8 | 1,895 | 2.9375 | 3 | [
"MIT"
] | permissive | # Udacity Arcade Game clone · [](https://travis-ci.org/npm/npm) [](https://www.npmjs.com/package/npm) [:
q = deque()
q.append((r, c))
while q:
r, c = q.popleft()
for i in range(4):
nr = r + dr[i]
nc = c + dc[i]
if 0 <= nr < N and 0 <= nc < N:
if visited[nr][nc] == 0 and arr[nr][nc] == 1: #방문... |
SQL | UTF-8 | 13,465 | 3.8125 | 4 | [] | no_license | CREATE TABLE USER(
User_ID MEDIUMINT NOT NULL AUTO_INCREMENT,
Email VARCHAR(50) NOT NULL UNIQUE,
Password VARCHAR(50) NOT NULL,
Date_Joined DATETIME NULL,
Fname VARCHAR(20) NOT NULL,
Mname VARCHAR(20),
Lname VARCHAR(20) NOT NULL,
Gender ENUM('Bay','Bayan') NOT NULL,
Active ENUM('Aktif','Pasif') NOT NULL DEFAU... |
TypeScript | UTF-8 | 1,669 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | interface IUniqueData {
[dataName: string]: number;
}
interface IGenerateColumnDataConfig {
makeRandomUnique: boolean;
fakerFn: () => number | string | undefined;
dataIsNumber?: boolean;
}
const generateColumnData = <DataType>(
uniqueData: IUniqueData,
config: IGenerateColumnDataConfig,
tota... |
C# | UTF-8 | 2,650 | 2.671875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CsvHelper;
using System.IO;
public static class CsvCardLoader{
static string ArtFolder = "Full Size Character Portraits\\";
static Dictionary<string, List<record>> allRecords = new Dictionary<string, List<record>>();
public st... |
TypeScript | UTF-8 | 3,611 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | import { traverseObject } from './traverseObject';
describe('traverseObject', () => {
let keyValuePairsWalked: Array<[string, any]>;
let i: number;
function defaultCallback(key: string, val: any) {
keyValuePairsWalked.push([key, val]);
}
beforeEach(() => {
i = 0;
keyValuePairsWalked = [];
});... |
Python | UTF-8 | 5,686 | 2.828125 | 3 | [] | no_license | #tkinter
from tkinter import *
from tkinter import ttk as ttk, messagebox, filedialog
#systems and shutil
from datetime import datetime, timedelta
from glob import glob
import os
import time
import shutil
#dB
import sqlite3
#creates dB
def createDB():
conn = sqlite3.connect('create_dB.db')
print('Conne... |
Python | UTF-8 | 12,899 | 2.96875 | 3 | [] | no_license | from Infrastracture.repo import RepoError
from datetime import date
from Validations.validations import ValidationError
class UI:
def __init__(self, servStudents, servAssignments, servGrades, servUndo):
self._servStudents = servStudents
self._servAssignments = servAssignments
self._serv... |
Markdown | UTF-8 | 1,413 | 2.78125 | 3 | [
"MIT"
] | permissive | # Muses 72320
Arduino library for communicating with the Muses 72320 audio chip.
The data sheets can be found [here](http://www.njr.com/semicon/PDF/MUSES72320_E.pdf) (pdf).
## Download
Download the latest release over at the [Releases](https://github.com/qhris/Muses72320/releases) page.
## Example
```c++
#include ... |
Java | UTF-8 | 1,327 | 3.203125 | 3 | [] | no_license | package scenario.consequences;
/**
* Scenario interface is the building block of the different
* scenarios that the player will encounter. Through here, multiple
* options of actions will be created as strings and will be implemented
* by specific scenario classes.
*
* Created by Luke Moua on 12/23/2017.
*/
pu... |
Python | UTF-8 | 814 | 2.84375 | 3 | [] | no_license | __author__ = "xiaoyu hao"
from gevent import monkey;
monkey.patch_all() #把当前程序的所有IO操作单独的作上标记,捕捉urllib的IO操作
import gevent
from urllib.request import urlopen
import time
def f(url):
print('GET: %s' % url)
resp = urlopen(url)
data = resp.read()
print('%d bytes received from %s.' % (len(data), url))
u... |
Python | UTF-8 | 4,976 | 3.21875 | 3 | [] | no_license | """
This model utilizes Idzorek et al (2004)'s approach to incorporate user specific confidence levels on views expressed about assets' absolute or relative performance.
The steps are laid out in Thomas Idzorek's 2004 paper:
"A step-by-step guide to the Black-Litterman model: Incorporating user-specified confidence le... |
Java | UTF-8 | 776 | 2.265625 | 2 | [] | no_license | package server;
import GameObject.GameSession;
import GameObject.IGameSession;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* Just a remote Interface to enable access for the Screens therefore no comments->check Server
* @author Fabi
*/
public interface ServerInterface extends Remote{
public ... |
Swift | UTF-8 | 1,963 | 2.65625 | 3 | [] | no_license | //
// LoginNetworkManager.swift
// IssueTracker
//
// Created by Byoung-Hwi Yoon on 2020/11/10.
//
import Foundation
class LoginNetworkManager: NetworkManager {
static let userInfoURL = baseURL + "/api/user"
func requestLogin(code: String, completion: @escaping (Result<JWTToken, NetworkError>) ->... |
C++ | UTF-8 | 307 | 2.625 | 3 | [] | no_license | #ifndef FLIGHT_H
#define FLIGHT_H
#include <iostream>
#include <string>
using namespace std;
class Flight{
private:
public:
std::string from;
std::string to;
int depart;
int arrive;
float price;
Flight(string f, string t, string d, string a, string p);
};
#endif
|
C++ | UTF-8 | 1,334 | 2.734375 | 3 | [] | no_license | #ifndef CODEDBF_H
#define CODEDBF_H
#include "BloomFilter.h"
#include "tools.h"
class CodedBF{
BloomFilter *bf;
int m;
int k;
int setNum;
int codeLen;
public:
int mc_ins, mc_que;
CodedBF();
CodedBF(int _m, int _k, int s);
~CodedBF();
void insert(ELEMENT *elem);
int query(char *elem);
};
CodedBF::CodedBF(... |
C++ | UTF-8 | 1,125 | 3.078125 | 3 | [] | no_license | #include "stdafx.h"
#include "strconv.h"
void Append(std::string* target, const wchar_t* ws, size_t ws_len) {
int const size = WideCharToMultiByte(CP_UTF8, 0, ws,
static_cast<int>(ws_len), 0, 0, 0, 0);
std::vector<char> bytes(size);
WideCharToMultiByte(CP_UTF8, 0, ws, static_cast<int>(ws_len),
&bytes... |
Markdown | UTF-8 | 1,459 | 2.96875 | 3 | [] | no_license | # My Simple Site
## It's simple, and it's mine. Currently undecided about the direction of this project.
### About headers, footers, and why this is.
Of what's in it already and what it started from, it's a navigation bar from a site I saw that wasn't well done. The navbar set me off on this project because it was ... |
Java | UTF-8 | 257 | 1.78125 | 2 | [] | no_license | package com.cai.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Navbar {
private int id;
private String navName;
private String tarurl;
}
|
C# | UTF-8 | 1,753 | 3.5625 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace _08__Balanced_Parentheses
{
public class StartUp
{
public static void Main(string[] args)
{
Stack<char> stackOfParanteses = new Stack<char>();
... |
Java | UTF-8 | 3,499 | 2.140625 | 2 | [] | no_license | /**
* @Copyright (c) 宝库技术团队 www.baoku.com
* @authur Allen
* @Generated: 2016-7-20 上午11:17:52
*/
package com.baoku.dt.model.request;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRoot... |
Java | UTF-8 | 2,368 | 3.953125 | 4 | [] | no_license | package zadaci_09_08_2016;
import java.util.InputMismatchException;
/*
* Great circle distance predstavlja udaljenost izmedju dvije tacke na povrsini sfere.
* Neka nam (x1, y1) i (x2, y2) predstavljaju geografsku sirinu i duzinu dvije tacke.
* Great circle distance izmedju ove dvije tacke moze biti izracu... |
C | UHC | 4,321 | 3.9375 | 4 | [] | no_license | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MALLOC(p,s) ((p) = malloc(s))
#define MAX_SIZE 100
typedef enum { FALSE, TRUE } tBoolean;
typedef struct edge *edgePointer;
typedef struct edge
{
tBoolean marked;
int v1;
int v2;
edgePointer link1;
edgePointer link2;
}Edge;
edge... |
Markdown | UTF-8 | 5,335 | 2.875 | 3 | [] | no_license | 
Photo of SCP-4746 predating their anomalous nature.Visual aid to assist personnel in terminating SCP-4746 on sight.
**Item #:** SCP-4746
**Object Class:** Euclid**Object Class:** N/A
**Special Containment Procedures:** SCP-4746 should be ... |
C++ | UTF-8 | 1,606 | 3.078125 | 3 | [] | no_license | #include "Tile.h"
#include "Palette.h"
#include "Debug.h"
namespace Graphics
{
u32 Tile::nextFreeIdentifier = 1;
//-------------------------------------------------------------------------------------------------
int Tile::GetPixel(int index) const
{
sassert(index >= 0 && index < 64, "Pixel index out of range"... |
Ruby | UTF-8 | 290 | 2.9375 | 3 | [] | no_license | require_relative 'price_list'
require 'json'
class Till
include PriceList
attr_reader :basket, :list
def initialize
@basket = []
@list = get_prices.first["prices"]
end
def add_to_basket(item)
@basket << item
end
def find_price(item)
@list[item]
end
end
|
Python | UTF-8 | 402 | 3.015625 | 3 | [] | no_license | def Test():
x=eval(input())
i=0
while(i<len(x)):
if(i+1<len(x)):
if(check(x[i],x[i+1])):
x[i]=ping(x[i],x[i+1])
x.remove(x[i+1])
i=i+1
print(x)
def check(a,b):
return True if(a[1]>=b[0]) else False
def ping(a,b):
line=[]
line.append... |
Java | UTF-8 | 814 | 1.882813 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package cz.etnetera.reesmo.model.mongodb.monitoring;
import cz.etnetera.reesmo.model.mongodb.MongoAuditedModel;
import org.springframework.data.annotation.Id;
abstract public class Monitoring extends MongoAuditedModel {
@Id
protected String id;
protected boolean enabled;
protected String projectId;
protected... |
Markdown | UTF-8 | 1,249 | 3.984375 | 4 | [] | no_license | 日常生活版:
有四个工厂分别为A、B、C、D,分别向一个仓库(仓库货容量为11)中放入产品。工厂A只能生产产品1(用数字1表示),工厂B只能生产产品2,工厂C只能生产产品3,工厂D只能生产产品4,四个工厂所生产产品入库的顺序为1,2,3,4,1,2,3,4,1……。同时有一个经销商E从仓库中按入库先后顺序取出产品(每次去一个,以打印对应产品的数字编号的形式表示取出成功)。要求打印数字的顺序为插入顺序(各个工厂生产的产品数均为100),并且完成全部入库出库操作耗时控制在200毫秒以内。
程序员版:
有四个生产者线程A、B、C、D,分别向一个固定大小为11的storage数组(int storage[]=new int[15];)中插... |
C++ | UTF-8 | 2,370 | 2.859375 | 3 | [] | no_license | #include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define VIT(i, v) for (i = 0; i < v.size(); i++)
#define IT(it, ds) for (it = ds.begin(); it != ds.end(); it++)
#define FUP(i, n) for (i... |
TypeScript | UTF-8 | 19,079 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive |
namespace WM
{
class Span
{
// Only for DebugLog
Title: string;
// Source control for copying simulation back
Control: Control;
Min: number;
Max: number;
RestSizeStrength: number;
SizeStrength: number;
// Number of controls between thi... |
Java | UTF-8 | 1,864 | 2.46875 | 2 | [] | no_license | package Ywk.UserInterface.Controller;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Prog... |
Swift | UTF-8 | 1,351 | 3.03125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// LoginView.swift
// swift-ui-base
//
// Created by Aravind on 01/06/21.
// Copyright © 2021 Rootstrap. All rights reserved.
//
import SwiftUI
struct LoginView: View {
@ObservedObject var viewModel = LoginViewModel()
var body: some View {
ZStack {
ActivityIndicatorView(isAnimating: $viewMo... |
Java | UTF-8 | 497 | 2.1875 | 2 | [
"Apache-2.0"
] | permissive | package gov.va.med.imaging.exchange.business.taglib.study;
import java.text.DateFormat;
import javax.servlet.jsp.JspException;
public class StudyProcedureDateTag
extends AbstractStudyPropertyTag
{
private static final long serialVersionUID = 1L;
private final DateFormat df = DateFormat.getDateInstance();
@Over... |
C# | UTF-8 | 2,175 | 2.6875 | 3 | [] | no_license | //using Stripe;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Threading.Tasks;
//namespace HotelBackEnd.Services
//{
// public class MakePaymentService
// {
// public static async Task<dynamic> PayAsync(string cardNumber, int month, int year, string cvc, int valu... |
Markdown | UTF-8 | 2,766 | 3.59375 | 4 | [] | no_license | ## 题解:[20190922]#0017 Letter Combinations of a Phone Number
- **题干**
输入一个字符只包含2~9,返回所有可能的字母字符串代表。数字和字母的映射与手机九键一致,如下所示,注意1不匹配任何字母。

示例:
```javascript
// e.g.1
Input: "23"
O... |
Java | UTF-8 | 678 | 3.03125 | 3 | [] | no_license | package chess;
public class CheckInput {
public boolean checkCoordinateValidity(String input){
if (input.length() != 2) {
return false;
}
char f = input.charAt(0);
char m = input.charAt(input.length() - 1);
boolean colval = true;
boolean rowval = true;
if (f != '1' && f != '2' && f != '3' && f !=... |
JavaScript | UTF-8 | 11,527 | 2.9375 | 3 | [] | no_license | const SHA256 = require('crypto-js/sha256');
const EC = require('elliptic').ec;
var ec = new EC('secp256k1');
const { performance } = require('perf_hooks'); //object destructuring
// Class for individual transactions including signatures
class Transaction{
constructor(customerPubKey, merchantPubKey, amount){
... |
Java | UTF-8 | 6,996 | 2.03125 | 2 | [] | no_license | package com.runssnail.weixin.api.request.pay;
import com.runssnail.weixin.api.util.SignUtils;
import com.runssnail.weixin.api.constant.TradeType;
import com.runssnail.weixin.api.exception.ApiRuleException;
import com.runssnail.weixin.api.internal.util.DateUtil;
import com.runssnail.weixin.api.response.pay.UnifiedOrder... |
Python | UTF-8 | 843 | 2.65625 | 3 | [] | no_license | import numpy as np
from scipy.fftpack import dst
maxA = 1
gridpoints = 12
grid = (np.array(list(range(gridpoints))) + 0.5) / gridpoints
Agrid = maxA * grid
fact = 1.0 * np.array(list(range(1, gridpoints + 1)))
fact[-1] /= 2
coeff = np.pi / gridpoints / maxA
n = 1
spatial = 2.7*np.sinc(n * Agrid / maxA) + 3.5 * np.s... |
Python | UTF-8 | 3,722 | 3.78125 | 4 | [] | no_license | """
Author: Kevin Owens
Date: 7 May 2014
Class: MatchMaker
Problem description summary (from TopCoder Tournament Inv 2001 Semi A+B 250): In the context of a dating application, this matches a person with
candidates who meet their gender preference and compatibility, as determined by the number of matching answers to
... |
C# | UTF-8 | 3,009 | 2.546875 | 3 | [] | no_license | public DataTable ReadPasswordProtectedExcel(string ExcelFilePath, string Password)
{
String TempExcelFilePath = string.Empty;
DataTable _DataTable = new DataTable();
#region Get ExcelFile and Remove Password
{
String TempExcelFileName = string.Empty;
String Direc... |
PHP | UTF-8 | 2,875 | 2.9375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | <?php
/**
* @version $Id: class_errors_view.php 2012-01-15 LBO $
* @package A PHP TOOLKIT (APT) Library
* @subpackage libapt-main/views
* @copyright Copyright (C) 2011 Luc BORIES All rights reserved.
* @license Apache License Version 2.0, January 2004; see LICENSE.txt or http://www.apache.org/licenses/
*/
clas... |
Python | UTF-8 | 1,580 | 2.53125 | 3 | [] | no_license | from sys import stdin
MAX = 100010
T =""
n =0
RA = [0 for x in range(MAX)]
tempRA = [0 for x in range(MAX)]
SA = [0 for x in range(MAX)]
tempSA = [0 for x in range(MAX)]
c = [0 for x in range(MAX)]
def countingSort(k):
global T,n,RA,SA,tempRA,tempSA,c
maxi = max(300, n)
c = [0 for x in c]
i = 0
whi... |
Java | UTF-8 | 1,984 | 2.8125 | 3 | [] | no_license | package cn.bronze.util.excel;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ConverterFactory {
private static Map<String, Converter<?,?>> map =
new HashMap<String, Converter<?,?>>();
private static DefaultConverter defaultConverter =
ne... |
Java | UTF-8 | 1,162 | 2.375 | 2 | [] | no_license | package com.kingdee.token;
import java.util.Date;
public class Token {
/* 令牌 */
private String Token;
private String code;
/* 有效期 默认1小时 3600s */
private int Validity;
private String IPAddress;
private String Language;
// 更新时间
private Date Create;
public String getToken() ... |
PHP | UTF-8 | 821 | 3.59375 | 4 | [] | no_license | <html>
<head><title>Ej3</title></head>
<body>
<?php
$num=15;
$resto;
$cociente=$num;
$salida="";
while($cociente>=1){
$resto=$cociente%16;
if($resto>=10){
$resto=restoDecimal($resto);
}
$salida=$resto . "" . $salida;
$cociente=$cociente/16;
}#de while
functi... |
Java | UTF-8 | 9,707 | 1.96875 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
Ruby | UTF-8 | 1,437 | 3.71875 | 4 | [] | no_license | require 'rubygems'
require 'imdb'
class TextReader
def read_from_file
@movies_txt = IO.read("movies.txt")
@movies_txt
turn_into_arr
end
def turn_into_arr
@movies_txt.split("\n").to_a
end
end
class LookOnImdb
def initialize(movies_arr)
@movies_arr = movies_arr
end
def look_for_ratin... |
Java | UTF-8 | 377 | 2.421875 | 2 | [] | no_license | import java.util.*;
public class p6
{
public static void main()
{
int i,l;char ch,ch2;
String s="a d g";String s2="game";l=s.length();
StringTokenizer s1=new StringTokenizer(s);
StringBuffer ss=new StringBuffer(2);
System.out.print(s1.countTokens());
System.out.print(... |
C# | UTF-8 | 2,085 | 2.625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace DarrenCloudDemos.Lib.Tests
{
public class FunctionProgrammingDemoTests
{
/// <summary>
/// 计算物业费
/// </summary>
/// <param name="price">单价</param>
/// <param name="lengh">长</param... |
Markdown | UTF-8 | 981 | 3.03125 | 3 | [
"MIT"
] | permissive | number - odd or even
=======================================
At least 99.9% of the time, any number can be odd or even. This uncertainty can be eliminated with `number-oddoreven`. As it sports an incredibly fast, open-ended API, you can solve all even or odd related problems with only 1 line.
***
### List of features... |
PHP | UTF-8 | 977 | 2.53125 | 3 | [] | no_license | <?php
/**
* This file provides the AJAX call to retrieve quota information using the configured Application Key and Secret.
*/
/**
* Provide the quota information about the currently configured *Application*.
*/
function hewa_ajax_quota() {
ob_clean();
header( 'Content-Type: application/json; charset=UTF-... |
Python | UTF-8 | 1,386 | 2.890625 | 3 | [] | no_license | import functools
from flask import request
from main.errors import BadRequest
def request_parser(query_schema=None, body_schema=None):
"""
Decorator used for request parsing
:param body_schema: Schema for request's query params
:param query_schema: Schema for request's body params
:param schemac... |
Python | UTF-8 | 300 | 3.421875 | 3 | [] | no_license | def repeatedStringMatch(A, B):
myStr = ""
while len(myStr) < len(B):
myStr += A
if B in myStr:
return int(len(myStr) / len(A))
myStr += A
if B in myStr:
return int(len(myStr) / len(A))
return -1
print(repeatedStringMatch("abc", "cabcabca"))
|
Python | UTF-8 | 932 | 2.8125 | 3 | [] | no_license | from collections import deque
h, w = map(int, input().split())
s = [input() for _ in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
def bfs(i, j):
cost = [[-1 for _ in range(w)] for _ in range(h)]
que = deque()
cost[i][j] = 0
que.append((i, j))
if s[i][j] == '#':
return 0
while que:
... |
PHP | UTF-8 | 3,253 | 2.546875 | 3 | [] | no_license | <?php
namespace Application\Model;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Core\Model\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Entidade de Professores
*
* @category Application
* @package Model
*
* @ORM\Entity
* @ORM\Ta... |
JavaScript | UTF-8 | 11,215 | 2.890625 | 3 | [] | no_license | 'use strict';
import store from './store.js';
import api from './api.js';
/******** RENDER FUNCTIONS ********/
function render(id, expand){
renderError();
if(store.adding){
$('main').html(generateAddBookmarkView());
let view = 'adding';
generateCodeBlock(view);
}
else if(store.filt... |
TypeScript | UTF-8 | 2,119 | 2.640625 | 3 | [] | no_license | import { Injectable, Injector, ComponentRef, ComponentFactoryResolver } from 'mojiito-core';
import { OverlayComponent } from '../overlay.component';
@Injectable()
export class Overlay {
static CLASS_NAME = 'overlay';
private _isOpen = false;
private _containerRef: HTMLElement = null;
private _previousConten... |
Swift | UTF-8 | 2,425 | 2.796875 | 3 | [] | no_license | //
// ImageProvider.swift
// WatchFaceTest
//
// Created by Дмитрий on 4/27/21.
// Copyright © 2021 DK. All rights reserved.
//
import Foundation
extension Watchface.Metadata {
public struct ImageProvider: Codable {
public var onePieceImage: Item?
public var twoPieceImageBackground: Item?
... |
C++ | UTF-8 | 855 | 3.21875 | 3 | [] | no_license | #include "Tableau.h"
Tableau::Tableau()
{
}
bool Tableau::addCard(Card* newCard)
{
if (this->cards.size() == 0 && newCard->getRankValue() == 12) //if the tableau is empty and the new card is a king
{
this->cards.push_back(newCard);
return true;
}
else if (this->cards.size() > 0 && this... |
Markdown | UTF-8 | 3,102 | 3.046875 | 3 | [] | no_license | CS61C Fall 2014 Homework 3 Part 2
=================================
TA: Riyaz Faizullabhoy
Due Sunday, October 5th, 2014 @ 23:59:59
Goals
-----
This assignment will cover floating point numbers, and caches.
Submission
----------
Put all your answers in the google form linked
[here](https://docs.google.com/forms/d... |
C++ | UTF-8 | 5,113 | 2.546875 | 3 | [] | no_license | /* --------------------------------------------------------------
File: AXAppStateMgr.cpp
Description: Implementation for the AXAppStateMgr class. See AXAppStateMgr.h for details.
Date: August 2, 2005
Author: James Long
-------------------------------------------------------------- */
#include "AXApp... |
C++ | UTF-8 | 983 | 2.8125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dirs = {{0,1},{1,0},{-1,0},{0,-1}};
int main()
{
int t,n,tc=1;
string in;
cin >> t;
while(t--){
vector<string> matrix;
cin >> n;
for(int i=0;i<n;i++){
cin >> in;
matrix.push_back(in);
... |
Python | UTF-8 | 45 | 3.359375 | 3 | [] | no_license | a = 1
b = 3
print("The product is : " , a*b) |
Markdown | UTF-8 | 14,719 | 2.890625 | 3 | [] | no_license | # Index:
* [os module](#os-module)
* os.environ
* os.environ\['PATH'\], os.pathsep
* [sys module](#sys-module)
* sys.argv
* sys.exit
* misc stuff
* [subprocess module](#subprocess-module)
* [shell or no shell](#shell-or-no-shell)
* [sp.call](#sp-call)
* [sp.check_call](#sp-check-call)
* [s... |
Java | UTF-8 | 3,061 | 2.265625 | 2 | [] | no_license | package com.google.android.apps.unveil.env.gl;
import android.opengl.GLES20;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
public class NV21Quad
{
private final int height;
private ByteBuffer nv21Data;
private final ShaderProgram program;
Polygon quad;
private final int size;
priva... |
Python | UTF-8 | 540 | 2.546875 | 3 | [] | no_license | """
@Time : 2020/12/29 10:35
@Author : Affreden
@Email : affreden@gmail.com
@File : test.py
"""
import torch
import random as rd
import time
import numpy as np
time = time.time()
rd.seed(1)
temp1 = torch.tensor([rd.randint(0, 9) for i in range(48)])
torch.seed()
temp2 = torch.randn(2, 3, 4)
print(temp2.tolist... |
JavaScript | UTF-8 | 2,955 | 3.078125 | 3 | [] | no_license | window.addEventListener("load", () => {
interactionBar()
let obj = {
"Alo": 0,
"Cpc": 0,
"Cpca": 0,
"Pp": 100
}
atualizarGrafico(obj)
})
//Capturar nome usuario
let interactionBar = () => {
do {
nome = prompt("Digite seu nome!");
}
while (nome === null || nome === "") {
document.g... |
C# | UTF-8 | 1,194 | 2.515625 | 3 | [] | no_license | using System;
using System.Windows.Forms;
namespace TaxAideFlashShare
{
public partial class ProgessOverall : Form
{
delegate void EnableOKCallBack();
public ProgessOverall()
{
InitializeComponent();
}
public void ProgShow()
{
... |
SQL | UTF-8 | 939 | 2.828125 | 3 | [] | no_license | create table tq84_virtual_test_4 (
c1 number
);
insert into tq84_virtual_test_4 (c1) values (1);
insert into tq84_virtual_test_4 (c1) values (2);
insert into tq84_virtual_test_4 (c1) values (3);
insert into tq84_virtual_test_4 (c1) values (4);
commit;
create or replace package tq84_virtual_test_pck_4 as
... |
PHP | UTF-8 | 1,722 | 3.09375 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Php Badwords</title>
</head>
<body>
<h2>Titolo del paragrafo</h2>
<!-- START First Section PHP Code-->
<?php
//Creo una variabile contenente un paragrafo di testo:
$paragrafo = 'Lorem ipsum... |
Java | UTF-8 | 4,531 | 2.34375 | 2 | [
"Apache-2.0",
"EPL-1.0",
"LGPL-2.1-only",
"EPL-2.0"
] | permissive | /*
* (C) Copyright 2003-2021, by Barak Naveh and Contributors.
*
* JGraphT : a free Java graph-theory library
*
* See the CONTRIBUTORS.md file distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* te... |
Python | UTF-8 | 250 | 3.03125 | 3 | [] | no_license | from turtle import *
tracer(False)
speed(0)
setup(1400, 700, 0, 0)
colormode(255)
pensize(50)
goto(-750, 380)
seth(-90)
def f():
fd(1300)
seth(0)
fd(6)
r = 95
for i in range(50):
r += 3
pencolor((r, 29, 73))
f()
lt(90)
f()
rt(90)
done()
|
JavaScript | UTF-8 | 284 | 3.21875 | 3 | [] | no_license | function maximumToys(prices, k) {
let count = 0;
let sorted = prices.sort( (a,b) => {return a - b} );
for(let i = 0;i<sorted.length;i++) {
if(k - sorted[i] >= 0) {
k -= sorted[i];
count++;
}
}
return count;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.