text string | size int64 | token_count int64 |
|---|---|---|
#include "mechine_linux.cc"
#include<node.h>
#include<iostream>
namespace demo {
using std::cout;
using std::endl;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
using v8::Exception;
void Method(const FunctionCallbackInfo<Value>& args)... | 1,160 | 437 |
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2015-2017 Baldur Karlsson
* Copyright (c) 2014 Crytek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (t... | 14,462 | 5,768 |
#include "CameraParams.h"
#include <opencv2/core.hpp>
namespace cam {
////////////// CONSTRUCTORS //////////////
CameraParams::CameraParams() {
}
void CameraParams::init(const cv::Mat& camera_matrix, const cv::Mat& dist_coeff,
cv::Size image_size) {
if (camera_matrix.size() != cv::Size(3, 3)) {
throw std:... | 2,712 | 1,030 |
/*
* RCModelFactory.cpp
*
* Created on: 09.02.2020
* Author: dh
*/
#include "RCModelFactory.h"
namespace progression {
RCModelFactory::RCModelFactory(Model* htn) {
this->htn = htn;
}
RCModelFactory::~RCModelFactory() {
// TODO Auto-generated destructor stub
}
Model* RCModelFactory::getRCmodelSTRIPS() ... | 9,253 | 4,027 |
#include "boxplot.h"
Boxplot::Boxplot(Boxplot* boxplot)
{
m_datacontainer = boxplot->m_datacontainer;
m_global_vis_parameters = boxplot->m_global_vis_parameters;
}
Boxplot::Boxplot(GlobalVisParameters* visparams, DataContainer* datacontainer)
{
m_global_vis_parameters = visparams;
m_datacontainer = datacontainer;... | 3,764 | 1,426 |
#pragma once
#include <vector>
#include <utki/Buf.hpp>
#include <utki/Exc.hpp>
namespace mikroxml{
class Parser{
enum class State_e{
IDLE,
TAG,
TAG_SEEK_GT,
TAG_EMPTY,
DECLARATION,
DECLARATION_END,
COMMENT,
COMMENT_END,
ATTRIBUTES,
ATTRIBUTE_NAME,
ATTRIBUTE_SEEK_TO_EQUALS,
ATTRIBUTE_SEEK_TO_... | 5,227 | 1,956 |
class Solution {
public:
int bulbSwitch(int n) {
int cnt = 0;
for(int i=1;i*i<=n;++i){
cnt++;
}
return cnt;
}
}; | 165 | 66 |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include <vector>
#include "base/file_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/fileapi/media/picasa/p... | 6,003 | 2,212 |
/**
* @file statemachine_test.cpp
*
* @author Tobias Anker <tobias.anker@kitsunemimi.moe>
*
* @copyright MIT License
*/
#include "statemachine_test.h"
#include <libKitsunemimiCommon/statemachine.h>
namespace Kitsunemimi
{
Statemachine_Test::Statemachine_Test()
: Kitsunemimi::CompareTestHelper("Stat... | 5,851 | 2,143 |
//
// Project: LunarGlobe
// SPDX-License-Identifier: Apache-2.0
//
// File: globe/globe_shader.cpp
// Copyright(C): 2018-2019; LunarG, Inc.
// Author(s): Mark Young <marky@lunarg.com>
//
#include <cstring>
#include <fstream>
#include <string>
#include <sstre... | 5,927 | 2,045 |
/*----------------------------------------------------
Copyright 2017 Xilinx, Inc.
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 app... | 15,261 | 6,953 |
//
// Copyright (C) 2016 LAAS-CNRS
//
// Author: Rohan Budhiraja
//
#ifndef SOT_TOOLS_KINEMATIC_PLANNER_HH
#define SOT_TOOLS_KINEMATIC_PLANNER_HH
/* STD */
#include <string>
#include <sstream>
#include <list>
#include <complex>
/* dynamic-graph */
#include <dynamic-graph/entity.h>
#include <dynamic-graph/factory.h>
... | 3,571 | 1,294 |
#include "Item.h"
namespace memcache {
std::atomic<u64> Item::s_cas_(0);
} // namespace memcache
| 101 | 41 |
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SGE_OPENGL_XRANDR_SET_RESOLUTION_HPP_INCLUDED
#define SGE_OPENGL_XRANDR_SET_RESOLUTION_HPP_... | 863 | 368 |
class O_T_TUO_Reg_Base_F:B_T_TUO_Reg_base_F
{
side=0; //OPF_F=0 BLU_F=1 IND_F=2
faction="TUO_T_OPF_F";
};
class O_A_TUO_Reg_base_F:B_A_TUO_Reg_base_F
{
side=0; //OPF_F=0 BLU_F=1 IND_F=2
faction="TUO_A_OPF_F";
};
class O_W_TUO_Reg_Base_F:B_W_TUO_Reg_base_F
{
side=0; //OPF_F=0 BLU_F=1 IND_F=2
faction="TUO_W_OPF_F";... | 3,257 | 2,283 |
#include "cli_test.hpp"
TEST_F(cli_test, no_options)
{
cli_test_result result = execute_app("minions coverage");
std::string expected
{
"minions-coverage\n"
"================\n"
" Try -h or --help for more information.\n"
};
EXPECT_EQ(result.exit_code, 0);
EXPECT_EQ(r... | 1,675 | 632 |
/*
Project 3 - Hashtable and Heapsort
James Halladay
Theory of Algorithms
10/9/2021
This program will render a program that expect a command line
argument being an input text file and an output text file name.
The program will read the data in the input file (strings) and write
... | 2,145 | 705 |
string exe_cmd(const string& cmd) {
int t_ret = 0;
string t_result = "";
t_result.resize(1024);
FILE* fp = popen(cmd.c_str(), "r");
fgets(&t_result[0], t_result.capacity(), fp);
pclose(fp);
return t_result;
}
string get_md5(const string& file) {
char buf[128] = {'\0'};
string cmd = "md5sum ";
cmd.... | 479 | 213 |
#ifndef __OBOTCHA_HTTP_SEC_WEB_SOCKET_KEY_HPP__
#define __OBOTCHA_HTTP_SEC_WEB_SOCKET_KEY_HPP__
#include "Object.hpp"
#include "StrongPointer.hpp"
#include "String.hpp"
#include "ArrayList.hpp"
namespace obotcha {
DECLARE_CLASS(HttpSecWebSocketKey) {
public:
_HttpSecWebSocketKey();
_HttpSecWebSocketKey(Str... | 456 | 182 |
#include<bits/stdc++.h>
using namespace std;
int add_modulo(int a, int b, int N){
return (a+b)%N;
}
int mult_modulo(int a, int b, int N){
return (a*b)%N;
}
int main(){
int a=rand(), b=rand();
a=a%1000;
b=b%1000;
int add_modulo_result = add_modulo(a,b,342);
int mult_modulo_result = mult_modul... | 454 | 205 |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b,c) for(i=a;i<b;i+=c)
#define repp(i,a,b,c) for(i=a;i>b;i+=c)
//--------------------------------------Heapify
void max_heapify(int *a, int i, int n)
{
int l=2*i+1;
int r=2*i+2;
int largest=0;
if(l<=n and a[l]>a[i])
largest=l;
... | 1,342 | 577 |
/*
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display
this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: "PAHNAPLSIIGYIR"
Write the code that will take a string and make this conver... | 1,151 | 406 |
// Copyright (C) 2018-2019 Jonathan Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#ifndef FOONATHAN_LEX_TOKEN_HPP_INCLUDED
#define FOONATHAN_LEX_TOKEN_HPP_INCLUDED
#include <foonathan/lex/spelling.hpp>
... | 4,577 | 1,273 |
#ifndef ELASTY_ALGORITHM_TYPE_HPP
#define ELASTY_ALGORITHM_TYPE_HPP
namespace elasty
{
enum class AlgorithmType
{
Pbd,
Xpbd
};
}
#endif // ELASTY_ALGORITHM_TYPE_HPP
| 195 | 91 |
// 36. Deleting files older than a given date
// Write a function that, given the path to a directory and a duration, deletes all
// the entries (files or subdirectories) older than the specified duration, in a
// recursive manner. The duration can represent anything, such as days, hours,
// minutes, seconds, and so o... | 2,219 | 1,102 |
#include "Singleton.h"
void SingletonCache::Store(const std::type_index& type, void* ptr)
{
//return; //using auto registers breaks this whole thing
m_PointerCache[type] = ptr;
}
void* SingletonCache::Find(const std::type_index& type)
{
if(m_PointerCache.empty()) return nullptr;
for (auto& pair : m_PointerCache)... | 472 | 173 |
/*********************************************************
*
* Part of the answer to exercise 1 in chapter 20
*
* Modified 20.3 from Sams Teach Yourself C++ in 24 Hours by Rogers Cadenhead
* and Jesse Liberty
*
* Compiled with g++ (GCC) 11.1.0
*
*********************************************************/
#include <io... | 3,574 | 1,305 |
// dllreg.cpp -- autmatic registration and unregistration
//
#include "priv.h"
#include <advpub.h>
#include <comcat.h>
// helper macros
// ADVPACK will return E_UNEXPECTED if you try to uninstall (which does a registry restore)
// on an INF section that was never installed. We uninstall sections that ma... | 4,127 | 1,459 |
#include "SmMarginCustomization.h"
#include "PropertyHandle.h"
#include "DetailLayoutBuilder.h"
#include "Widgets/Input/SNumericEntryBox.h"
#include "Editor.h"
bool FSmMarginIdentifier::IsPropertyTypeCustomized(const IPropertyHandle& PropertyHandle) const
{
return PropertyHandle.IsValidHandle() && PropertyHandle.Get... | 11,459 | 4,063 |
/***************************************************************************
*
Copyright 2013 CertiVox IOM Ltd. *
*
This file i... | 9,232 | 4,075 |
#include <iostream>
#include "PowMatrix.h"
using namespace std;
int main() {
int n;
cin >> n;
/*
// Method 1
int dp[n][2];
dp[0][0] = 3;
dp[0][1] = 0;
for(int i = 1; i < n; i++) {
dp[i][0] = dp[i-1][0]*2 + dp[i-1][1]*2;
dp[i][1] = dp[i-1][0];
}
int sum = dp[n-1][0] +... | 843 | 406 |
// Copyright 2010 Golden Hammer Software
#include "GTGUINavigator.h"
#include "GTIdentifiers.h"
#include "GHUtils/GHEventMgr.h"
#include "GHUtils/GHMessage.h"
#include "GHGUIMgr.h"
#include "GHUtils/GHResourceFactory.h"
#include "GHXMLObjFactory.h"
#include "GHGUIPanel.h"
#include "GHXMLNode.h"
#include "GHGUIWidgetRen... | 10,353 | 4,223 |
// Copyright 2012 Cloudera Inc.
//
// 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 agreed to in wr... | 8,738 | 2,960 |
/**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
This ... | 2,837 | 955 |
#include "dbase.h"
dbRecordSet::dbRecordSet() {
ptr = 0;
}
void dbRecordSet::Reset() {
recordSet.Clear();
ptr = 0;
}
void dbRecordSet::Add(int record, dbRecord &rec, Array<String> &orderField, Array<unsigned int> &ordStyle) {
unsigned int j, n, f, l, p, k;
k = orderField.GetCount();
#ifdef _WITH... | 2,728 | 1,164 |
#include "Graph.h"
/**
* @returns The size of the graph.
*/
int Graph::size() const {
return this->succs.size();
}
/**
* Checks if an unit can go from one point to all others of the map.
* @param map The map.
* @param size The size of the map.
* @returns True if all squares of the map are accessible from one.
... | 5,424 | 2,296 |
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to y... | 45,917 | 15,999 |
/*
* Quiver - A graph theory library
* Copyright (C) 2018 Josua Rieder (josua.rieder1996@gmail.com)
* Distributed under the MIT License.
* See the enclosed file LICENSE.txt for further information.
*/
#include <catch2/catch.hpp>
#include <quiver.hpp>
using namespace quiver;
TEST_CASE("disjoint_set", "[quiver][fu... | 1,714 | 857 |
// Copyright 2014, 2019 Chris E. Holloway
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, pu... | 2,366 | 789 |
// Copyright 2018 Dhruvesh Nikhilkumar Patel
//
// 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 appl... | 1,118 | 414 |
#include "Logger.hpp"
#include "TaskPool.hpp"
#include "RefObject.hpp"
class faketype
{
public:
faketype()
{
SIM_LINFO("faketype() "<<SIM_HEX(this));
}
~faketype()
{
SIM_LINFO("~faketype " << SIM_HEX(this));
}
};
sim::RefObject<faketype> temp;
void* run(void* pd)
{
sim::RefObject<faketype> ref = temp;
SIM_... | 795 | 380 |
#include <rc.h>
#include <filter.h>
#include <stdio.h>
#include <math.h>
#define TS 1e-4 // 100us control period
#define NUM_ITERATIONS 20000 // 2 seconds
float rc_buffer1[200];
float rc_buffer2[200];
float rc_buffer3[200];
Filter_t compensator;
float filter_num[3] = {0, 0.00726436941467171, 0.00668055316076471};
fl... | 1,294 | 672 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n + 1];
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
}
int dp[n + 1][n + 1];
memset(dp, sizeof(dp), 0);
int res = INT_MIN;
dp[1][0] = 0;
dp[1][1] = arr[1];
for (int i = 2; i <= n; ++i) {
for (int j = 0; j <= i; +... | 669 | 343 |
#include "cpgf/scriptbind/gscriptbind.h"
#include "cpgf/gglobal.h"
#include "../pinclude/gbindcommon.h"
#include "../pinclude/gscriptbindapiimpl.h"
namespace cpgf {
GScriptObject::GScriptObject(const GScriptConfig & config)
: config(config), owner(nullptr)
{
}
GScriptObject::GScriptObject(const GS... | 5,867 | 1,993 |
#include <QFile>
#include <iostream>
int main()
{
QFile resource1(":/thePrefix/resource1.txt");
if (!resource1.open(QIODevice::ReadOnly))
return 1;
QFile resource2(":/thePrefix/resource2.txt");
if (!resource2.open(QIODevice::ReadOnly))
return 2;
QFile resource3(":/theOtherPrefix/re... | 569 | 187 |
/*
Plugin-SDK (Grand Theft Auto San Andreas) source file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#include "CCheckpoints.h"
unsigned int MAX_NUM_CHECKPOINTS = 32;
unsigned int &CCheckpoints::NumActiveCPts = *... | 2,388 | 833 |
/*
* Copyright 2009-2017 Alibaba Cloud 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
*
* Unless required... | 4,064 | 1,293 |
#pragma once
#include <vector>
#include <phmap.h>
#include <functional>
namespace RavEngine {
/**
The Unordered Vector provides:
- O(1) erase by iterator
All other complexities for valid behaviors are identical to a regular vector. Elements must be moveable.
Note that the order of elements cannot be guareneed.
*... | 5,833 | 1,754 |
//
// Created by aicdg on 2017/6/19.
//
//
// Chapter: 02 Image Presentation
// Recipe: 16 Presenting an image
#include "S16_Presenting_an_image.h"
namespace VKCookbook {
bool PresentImage(VkQueue queue,
std::vector<VkSemaphore> rendering_semaphores,
std::vector<Prese... | 1,827 | 516 |
#include <iostream>
#include <string>
using namespace std;
class Student {
private:
string name;
string studentID;
int score;
public:
Student(){
}
Student(string name, string studentID, int score){
Student:: name=name;
Student:: studentID=studentID;
St... | 910 | 274 |
/*
Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4
Copyright (C) 2021 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
*/
/*
DO NOT EDIT THIS FILE - the content was created using a source code generator
*/
#include "QFutureWatcherBaseSlots.h"
QFutureWatcherBaseSlot... | 5,895 | 2,405 |
/*
* Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source
* Project (AJOSP) Contributors and others.
*
* SPDX-License-Identifier: Apache-2.0
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Apache License, Version 2.0... | 6,671 | 2,338 |
/*
* Model.cpp
*
* Created on: 13/09/2016
* Author: rey
*/
#include "Headers/Model.h"
#include "Headers/TimeManager.h"
#include "Headers/mathUtil.h"
Model::Model() {
this->aabb.mins.x = FLT_MAX;
this->aabb.mins.y = FLT_MAX;
this->aabb.mins.z = FLT_MAX;
this->aabb.maxs.x = -FLT_MAX;
thi... | 8,973 | 3,770 |
//
// G3MHUDDemoScene.cpp
// G3MApp
//
// Created by Diego Gomez Deck on 12/2/14.
// Copyright (c) 2014 Igo Software SL. All rights reserved.
//
#include "G3MHUDDemoScene.hpp"
//#include <G3MiOSSDK/G3MWidget.hpp>
#include <G3MiOSSDK/MapBoxLayer.hpp>
#include <G3MiOSSDK/LayerSet.hpp>
#include <G3MiOSSDK/CanvasImag... | 10,689 | 3,059 |
/* 参考PDF[BCM2835-ARM-Peripherals.pdf] */
/* RaspberryPI用GPIO操作プログラム */
/*
対応表
PIN NAME
0 GPIO 2(SDA)
1 GPIO 3(SCL)
2 GPIO 4(GPCLK0)
3 GPIO 7(CE1)
4 GPIO 8(CE0)
5 GPIO 9(MISO)
6 GPIO 10(MOSI)
7 GPIO 11(SCLK)
8 GPIO 14(TXD)
9 GPIO 15(RXD)
10 GPIO 17
11 GPIO 18(PCM_CLK)
12 GPIO 22
13 GPIO 23
14 GPIO 24
15 GPIO 25
16 GP... | 1,346 | 851 |
#include "tatami/tatami.h"
#include "Rcpp.h"
#include "tatamize.h"
//[[Rcpp::export(rng=false)]]
Rcpp::IntegerVector tatami_dim(SEXP x) {
auto ptr = extract_NumericMatrix(x);
return Rcpp::IntegerVector::create(ptr->nrow(), ptr->ncol());
}
//[[Rcpp::export(rng=false)]]
Rcpp::NumericMatrix tatami_rows(SEXP x, R... | 1,137 | 424 |
/*
We all know the distributive property that (a1+a2)*(b1+b2) = a1*b1 + a1*b2 + a2*b1 + a2*b2
Explanation
Distributive property is similar for AND and XOR here.
(a1^a2) & (b1^b2) = (a1&b1) ^ (a1&b2) ^ (a2&b1) ^ (a2&b2)
(I wasn't aware of this at first either)
另一种思路, 如果所有arr2 中的数 第一个bit 是奇数个(求所有数第一位bit的xor),if ar... | 1,256 | 654 |
#define MAX 20001
int par[MAX], sz[MAX];
void init(int v) {
par[v] = v;
sz[v] = 1;
}
int find(int v) {
return v == par[v] ? v : par[v] = find(par[v]);
}
void join(int u, int v) {
u = find(u), v = find(v);
if(u != v) {
if(sz[u] < sz[v]) swap(u, v);
par[v] = u;
sz[u] += sz[v];
}
} | 291 | 163 |
#include "Pm2Helper.h"
#include "Process.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <PathCch.h>
#include <locale>
#include <codecvt>
#include <string>
#include <sstream>
void ConvertNarrowToWide(std::string& narrow, std::wstring& wide)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> c... | 1,070 | 413 |
#include "Jahley.h"
#include <json.hpp>
const std::string APP_NAME = "JsonTest";
#ifdef CHECK
#undef CHECK
#endif
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
using json = nlohmann::json;
class Application : public Jahley::App
{
public:
Application(DesktopWindowSettings settings = DesktopWindowSe... | 517 | 192 |
class Solution {
public:
vector<int> runningSum(vector<int>& nums) {
// input: nums array nums = [1,2,3,4]
for(int i=1;i<nums.size();i++){
nums[i]=nums[i-1]+nums[i];
}
return nums;
}
};
| 265 | 102 |
#ifndef __LOOP_MACROS_CPP__
#define __LOOP_MACROS_CPP__
#define START_FERMION_LOOP(gMatrixCoupling) \
\
for(INT i=0;i<Nc;i++){ \
for(INT j=0;j<Nc;j++){ \
\
for(INT alpha=0;alpha<DiracAlgebra::SpinorComponents;alpha++){\
for(INT beta=0;beta<DiracAlgebra::SpinorComponents;beta++){ \
\
if(gMatrixCoupling[alpha][beta]!=0.... | 1,402 | 667 |
/**
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | 2,156 | 749 |
/*******************************************************************\
Module: ANSI-C Linking
Author: Daniel Kroening, kroening@kroening.com
\*******************************************************************/
#include "fix_symbol.h"
/*******************************************************************\
Function: ... | 1,255 | 384 |
//
// Created by Teresa Dong on 4/17/20.
//
#include <string>
#include "mylibrary/leaderboard.h"
#include "mylibrary/player.h"
namespace tetris {
LeaderBoard::LeaderBoard(const std::string& db_path) : db_{db_path} {
db_ << "CREATE TABLE if not exists leaderboard (\n"
" name TEXT NOT NULL,\n"
"... | 1,214 | 415 |
#include <bits/stdc++.h>
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN=2e6+10;
int disjoint[MAXN],dis[MAXN]={0},ans=2e6+10;
int getjoint(int s){
if(disjoint[s]!=s){
int last=disjoint[s];
disjoint[s]=getjoint(disjoint[s]);
dis[s]+=dis[last];
}
return disjoint[s];
... | 628 | 337 |
//Language: GNU C++
#include <map>
#include <set>
#include <list>
#include <stack>
#include <cmath>
#include <queue>
#include <ctime>
#include <cfloat>
#include <vector>
#include <string>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
#includ... | 2,701 | 1,301 |
#pragma once
#include <cassert>
#include "types.hpp"
#include "vector.hpp"
#include "point.hpp"
#include "matrix.hpp"
#include "transforms.hpp"
#define MIN_FOV 10.0f
#define MAX_FOV 90.0f
namespace engine
{
class camera
{
public:
camera(real aspect, real fov = 60.0f, real _near = 1.0f, real _far = 100.0f, const... | 2,162 | 1,038 |
/*
* Copyright 2013 Google Inc.
*
* 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 agreed to... | 1,177 | 412 |
#include "BLEConstantCharacteristic.h"
BLEConstantCharacteristic::BLEConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length) :
BLEFixedLengthCharacteristic(uuid, BLERead, (unsigned char)0)
{
this->_valueLength = this->_valueSize = length;
this->_value = (unsigned char*)value;
... | 906 | 279 |
class Solution {
public:
double findMaxAverage(vector<int>& nums, int k) {
int sum=0;
for(int i=0;i<k;i++){
sum+=nums[i];
}
double avg=(double)sum/k;
int i=0, j=k;
while(j<nums.size()){
sum -= nums[i];
sum += nums[j];
do... | 446 | 159 |
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next, *prev;
};
Node *merge(Node *a, Node *b)
{
// Base cases
if (!a)
return b;
if (!b)
return a;
if (a->data <= b->data)
{
a->next = merge(a->next, b);
... | 1,477 | 518 |
HANDLE_OPCODE(OP_DISPATCH_FF)
/*
* Indicates extended opcode. Use next 8 bits to choose where to branch.
*/
DISPATCH_EXTENDED(INST_AA(inst));
OP_END
| 168 | 66 |
/**
** Isaac Genome Alignment Software
** Copyright (c) 2010-2017 Illumina, Inc.
** All rights reserved.
**
** This software is provided under the terms and conditions of the
** GNU GENERAL PUBLIC LICENSE Version 3
**
** You should have received a copy of the GNU GENERAL PUBLIC LICENSE Version 3
** along with ... | 9,895 | 2,896 |
/*! \file
\brief Declarations of the AnnotationManager that generates a CallGraphStandard.
\authors Arun Chauhan (2001 as part of Mint), Nathan Tallent, Michelle Strout, Priyadarshini Malusare
\version $Id: ManagerCallGraphStandard.hpp,v 1.6 2004/11/19 19:21:50 mstrout Exp $
Copyright (c) 2002-2005, Rice U... | 3,036 | 921 |
//==============================================================
// Copyright (C) 2004 Danny Chapman
// danny@rowlhouse.freeserve.co.uk
//--------------------------------------------------------------
//
/// @file capsule.cpp
//
//=====================================... | 3,611 | 1,260 |
#include "expansion_card.h"
namespace BiosHomeAutomator {
ExpansionCard::ExpansionCard(unsigned int id) {
this->id = id;
}
ExpansionCard::~ExpansionCard(void) { }
unsigned int ExpansionCard::get_id(void) {
return id;
}
}; | 244 | 90 |
// copyright (c) Frank Mori Hess <fmhess@users.sourceforge.net> 2008-04-13
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _POET_DETAIL_UTILITY_HPP
#define _POET_DETAIL_UTILITY_HPP
#include <boost/... | 850 | 392 |
#pragma once
#include "DLL.hpp"
#include <functional>
namespace System
{
/**
* \brief Encapsulates a method that has specified parameters and returns a value of the type specified by the TResult
* parameter. Unlike in other .NET languages, the first paramenter correspondes to TResult.
* \tpa... | 1,378 | 412 |
#include "module_wrap.h"
namespace endo {
ModuleWrap::ModuleWrap(Isolate* isolate, Local<Module> module, Local<String> url)
: module_(isolate, module),
url_(isolate, url) {};
bool ModuleWrap::operator==(Local<Module>& mod) {
return module_.Get(Isolate::GetCurrent())->GetIdentityHash() == mod->GetIdentityHash... | 493 | 172 |
/*
Copyright (c) 2007 Cyrus Daboo. 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
Unless re... | 2,542 | 852 |
#pragma once
#include <SDL.h>
#include <memory>
#include "Texture.hpp"
#include "Sprite.hpp"
#include "Clock.hpp"
#include "Input.hpp"
#include "Event.hpp"
#include "SceneStateMachine.hpp"
#include "scenes/SceneSplashScreen.hpp"
#include "scenes/SceneGame.hpp"
namespace Helio
{
class Game
{
private:
Event even... | 606 | 230 |
/**
* ****************************************************************************
* Copyright (c) 2015, Robert Lukierski.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributi... | 29,740 | 9,304 |
/* Copyright 2020 Alibaba Group Holding Limited. 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
Unless required by applicable law o... | 2,657 | 958 |
#include <lighting.h>
GW::RenderEngine::Lighting::Lighting()
{
}
GW::RenderEngine::Lighting::~Lighting()
{
}
void GW::RenderEngine::Lighting::setDirectionalLight(const DirectionalLight & light)
{
m_directionalLight = light;
}
void GW::RenderEngine::Lighting::addPointLight(const PointLight & light)
{
m_pointLights... | 1,339 | 493 |
#include "Transform.h"
void Transform::UpdateTRS()
{
mat4 modelMatrix = mat4(1);
modelMatrix = glm::translate(modelMatrix, position);
modelMatrix = glm::rotate(modelMatrix, glm::radians(rotaiton.x), vec3(1, 0, 0));
modelMatrix = glm::rotate(modelMatrix, glm::radians(rotaiton.y), vec3(0, 1, 0));
modelMatrix = gl... | 1,234 | 507 |
#include "lvgl/ButtonMatrix.hpp"
using namespace lvgl;
LVGL_OBJECT_ASSERT_SIZE(ButtonMatrix);
ButtonMatrix::ButtonMatrix(const char * name){
m_object = api()->btnmatrix_create(screen_object());
set_user_data(m_object,name);
}
| 233 | 84 |
//============================================================================
//
// This file is part of GPSTk, the GPS Toolkit.
//
// The GPSTk is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; ei... | 15,067 | 5,087 |
/*
* Copyright 2016 Intel Corporation
*
* 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 agre... | 23,275 | 9,130 |
/*
* Copyright (c) 2018-2022 curoky(cccuroky@gmail.com).
*
* This file is part of my-own-x.
* See https://github.com/curoky/my-own-x for further info.
*
* 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... | 2,137 | 651 |
#include <bits/stdc++.h>
#include <SDL2/SDL.h>
using namespace std;
#include "cpu/cpu.hpp"
#include "cpu/cpu.cpp"
#include "ops/ops.hpp"
#include "ops/ops.cpp"
#include "gui/gui.hpp"
#include "gui/gui.cpp"
#include "gpu/gpu.hpp"
#include "gpu/gpu.cpp"
const int fps = 60;
const int ticks_per_frame = 1000 / 60;
// TODO... | 2,261 | 928 |
#include "../include/init.h"
// void init() {
// init_timer();
// init_uart();
// can_init();
// ADC_internal& adc_internal = ADC_internal::getInstance();
// } | 174 | 65 |
// Time: O(n * l), l is the max length of numbers
// Space: O(l)
class Solution {
public:
int sumOfDigits(vector<int>& A) {
int min_num = *min_element(A.begin(),A.end());
int total = 0;
while (min_num) {
total += min_num % 10;
min_num /= 10;
}
return... | 346 | 129 |
#include "power.h"
#include "util/log.h"
#include "gpio.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_clkpwr.h"
#include "lpc17xx_wdt.h"
#define POWER_CONTROL_PORT 2
#define POWER_CONTROL_PIN 13
#define PROGRAM_BUTTON_PORT 2
#define PROGRAM_BUTTON_PIN 12
namespace gpio = openxc::gpio;
using openxc::gpio::GPIO_VA... | 4,244 | 1,655 |
//
// Copyright (c) 2015, J2 Innovations
// Copyright (c) 2012 Brian Frank
// Licensed under the Academic Free License version 3.0
// History:
// 06 Jun 2011 Brian Frank Creation
// 19 Aug 2014 Radu Racariu<radur@2inn.com> Ported to C++
//
#include "time.hpp"
#include <sstream>
#include <ctime>
///////////////... | 2,228 | 735 |
#include "image.h"
#include "image_cpu.h"
#include "transforms/interpolation.h"
#include "utils/utilities.h"
using namespace std;
Interval roundIntervalToInt(const Interval& i) {
Interval in = i.meet({0, 1});
float inf = in.inf * 255.0f;
int inf_lower = floorf(inf);
if (inf_lower == roundf(inf)) {
inf ... | 40,105 | 15,779 |
//
// Created by benji on 10/11/16.
//
#include "Window.h"
#include "Context.h"
void glfwErrorCallback(int error, const char* description) {
std::cerr << _RED("There was a glfw error : ") << description << _RED(" (" + std::to_string(error) + ")") << std::endl;
}
Window::Window(std::string title) {
std::cou... | 2,095 | 770 |
#include "core/Distributor.h"
using namespace BeeeOn;
Distributor::~Distributor()
{
}
| 88 | 36 |
/****************************************************************************************
* @author: kzvd4729 created: 2019-12-08 18:03:30
* solution_verdict: AC language: C++14 (GCC 5.4.1)
* run... | 862 | 280 |
#include "libdocscript/runtime/datatype.h"
#include "libdocscript/runtime/procedure.h"
#include "libdocscript/runtime/value.h"
#include "libdocscript/runtime/environment.h"
#include "libdocscript/interpreter.h"
namespace libdocscript::runtime {
// +--------------------+
// Constructor
// +--------------------+
... | 1,313 | 387 |