text
string
size
int64
token_count
int64
// Font generated by stb_font_inl_generator.c (4/1 bpp) // // Following instructions show how to use the only included font, whatever it is, in // a generic way so you can replace it with any other font by changing the include. // To use multiple fonts, replace STB_SOMEFONT_* below with STB_FONT_consolas_32_usascii...
38,090
27,562
#include "CFGReader.h" CFGReader::CFGReader(std::ifstream* file) { if(file == nullptr) { return; } std::string line; while(getline(*file, line)) { long index = line.find('='); if(index != std::string::npos) { std::string attribute = line.substr(0, index); std::string value = line.substr(index + 1, ...
623
259
// Autogenerated from CppHeaderCreator on 7/27/2020 3:09:45 PM // Created by Sc2ad // ========================================================================= #pragma once #pragma pack(push, 8) // Begin includes // Including type: System.SystemException #include "System/SystemException.hpp" #include "utils/il2cpp-util...
2,863
856
#include "include/scexpressionparser.h" #include <QStack> #include <QDebug> #include "include/sctokenoperations.h" const SCExpressionParser SCExpressionParser::shared; SCExpressionParser::SCExpressionParser() {} SCParsedExpression SCExpressionParser::parse(const SCInExpression &exp) { QStack<SCToken> opStack;...
2,734
792
#include "item.h" #include <sstream> #include <boost/iostreams/stream.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> namespace server::core { using namespace boost; item::item() { _type = type::unknown; } item::item(type type) : item() { set_type(type); } it...
1,001
404
template<typename dType> attention_layer<dType>::attention_layer(int LSTM_size,int minibatch_size, int device_number, int D, int longest_sent,cublasHandle_t &handle,neuralMT_model<dType> *model, bool feed_input,bool clip_gradients,dType norm_clip,bool dropout,dType dropout_rate,global_params &params,bool bi_side) {...
28,923
14,470
#include <iostream> using namespace std; int opa(int a); int main() { int n; cin >> n; cout << opa(n); return 0; } int opa(int n){ if(n == 1 || n == 0){ return n; }else{ return opa(n - 1) + opa (n-2); } return 0; }
271
124
#include <algorithm> #include <array> #include <cstddef> #include <cstdint> #include <iostream> #include <numeric> template <size_t Q> class mln { using Table = std::array<std::array<uint8_t, Q>, Q>; static Table generate_compression_table(const uint32_t *in, const size_t n) { std::array<std::arra...
2,306
836
// File: ./src/wrapalignlib.cpp // Date: 2018-10-15 // #include <pybind11/pybind11.h> #include <pybind11/stl.h> namespace py = pybind11; using namespace pybind11::literals; void wrapPairwiseAlign(py::module &); void wrapPseudoMultiAlign(py::module &); PYBIND11_MODULE(alignlib, m) { wrapPairwiseAlign(m); wrapPseudoMul...
334
149
// written at 10:47 on 15 Feb 2017 #include <bits/stdc++.h> #define IOS std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); // #define __DEBUG__ #ifdef __DEBUG__ #define DEBUG(...) printf(__VA_ARGS__) #else #define DEBUG(...) #endif #define filename "" #define setfile() freopen(fi...
1,568
674
// // Copyright © 2020 Sandcastle Software Ltd. All rights reserved. // // This file is part of 'Oaknut' which is released under the MIT License. // See the LICENSE file in the root of this installation for details. // #include <oaknut.h> class Drawer : public LinearLayout { public: Drawer() : LinearLayout() { ...
4,210
1,176
#ifndef BDBTIME_HH #define BDBTIME_HH //----------------------------------------------------------------------------- // // File and Version Information: // $Id: BdbTime.hh 496 2010-01-13 17:10:44Z stroili $ // // Description: // Class BdbTime. // This is a persistent time class. // // Environment: //...
11,795
3,774
using namespace std; #include <iostream> int main () { int n = 7; int m = 3; cout << "n = " << n << endl; cout << "m = " << m << endl; cout << "n+m = " << n+m << endl; cout << "n-m = " << n-m << endl; cout << "n*m = " << n*m << endl; cout << "n/m = " << n/m << endl; cout << "n%m =...
434
203
#include <SDL/SDL.h> #include <SDL/SDL_ttf.h> #include "graphicsEditor.hpp" #include "utils.hpp" SDL_Color translate_color(Uint32 int_color) { #if SDL_BYTEORDER != SDL_BIG_ENDIAN SDL_Color color={ (Uint8) ((int_color & 0x00ff0000)/0x10000), (Uint8) ((int_color & 0x0000ff00)/0x100), (Uint8) (int_color & 0x0...
1,788
857
/** * @author Clément Bazerque */ /** * Test application for the DFN DisparityImageEdres */ /** * @addtogroup DFNsTest * @{ */ #include <DisparityImage/DisparityImageEdres.hpp> #include <GuiTests/ParametersInterface.hpp> #include <GuiTests/MainInterface.hpp> #include <GuiTests/DFNs/DFNTestInterface.hpp> #inclu...
7,245
2,878
/** * Routines for numerically evaluating the jacobian numerically * in the non-linear solver. */ #include <iostream> #include "DREAM/Solver/SolverNonLinear.hpp" #include "FVM/BlockMatrix.hpp" #include "FVM/UnknownQuantity.hpp" using namespace DREAM; /** * Evaluate jacobian numerically using finite difference ...
3,093
1,119
#include "UIMatrixWindow.h" #include <IconsFontAwesome5.h> #include <spdlog/fmt/fmt.h> #include <Core/Application.h> #include <Core/Utils.h> #include "Components/Components.h" using namespace entt::literals; namespace Project { UIMatrixWindow::UIMatrixWindow(GraphSystem& graphSystem, std::string name) : Engine::...
2,223
895
#include "artist.h" using namespace DB; Artist::Artist(QObject *parent) :QObject(parent) { } Artist::Artist(quint64 id, QByteArray name, bool albumArtist, QObject *parent) : QObject(parent), id{id}, albumArtist{albumArtist}, name{name} { } Artist::~Artist() { emit artistDeleted(this); } void Artist::s...
1,061
420
#include "sim/init.hh" extern "C" { void init_param_RubyPort(); } EmbeddedSwig embed_swig_param_RubyPort(init_param_RubyPort, "m5.internal._param_RubyPort");
213
75
#include "connection.hpp" using namespace evias::network; /** * searchQueue * * pop the queue's first element or the first with identification reqId. * * \note returned object has to be free'd * \return netPacket* */ netPacket *evias::network::netConnection::searchQueue(__netRequest_t reqId) { ...
1,816
585
// n_11328.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다. // #include <iostream> #include <string> using namespace std; int arr1[26]; int arr2[26]; int main() { int lp = 0; cin >> lp; for (int i = 0; i < lp; ++i) { fill(arr1 + 0, arr1 + 26, 0); fill(arr2 + 0, arr2 + 26, 0); string s1, s2; cin ...
1,048
970
// Copyright (C) 2021 Arthur LAURENT <arthur.laurent4@gmail.com> // This file is subject to the license terms in the LICENSE file // found in the top-level of this distribution #pragma once #include <functional> #include <memory> #include <mutex> #include <storm/core/Memory.hpp> #include <storm/core/NonCopy...
1,241
384
/* * * Copyright 2013 Alan Race * * 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...
2,177
775
//////////////////////////////////////////////////////////////////// // // Georg Umlauf, (c) 2020 // //////////////////////////////////////////////////////////////////// #include "AffineMap.h" // constructors AffineMap::AffineMap (double t) { for (int j=0; j<4; j++) for (int i=0; i<4; i++) m_aatData[i][j] =...
4,104
2,080
#include "modtrack.h" ModifiedRaceTracker::ModifiedRaceTracker() : HybridRaceTracker() { initializationHelper(); } ModifiedRaceTracker::ModifiedRaceTracker(unsigned int wr, unsigned int rd) : HybridRaceTracker(wr, rd) { initializationHelper(); } ModifiedRaceTracker::~ModifiedRaceTracker() { } void Mod...
4,986
1,703
#include <Nephilim/AngelScriptEXT/ASXRuntime.h> #include <Nephilim/AngelScriptEXT/ASXEngine.h> #include <angelscript.h> NEPHILIM_NS_BEGIN ASXRuntime::ASXRuntime() : m_context(NULL) { } ASXRuntime::ASXRuntime(ASXEngine& engine) { m_context = engine.get()->CreateContext(); } ASXRuntime::~ASXRuntime() { if(m_conte...
769
322
/* * Copyright 2020 OmniSci, 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 t...
21,640
7,934
/* * example-rtc.cpp * * Copyright (c) 2010 Marc Kirchner * 2011 David Sichau * */ #include <libpipe/config.hpp> #include <stdlib.h> #include <exception> #include <iostream> #include <set> #include <boost/pointer_cast.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include <...
17,532
4,775
/**************************************************************************** ** ** Copyright (C) 2012-2015 The University of Sheffield (www.sheffield.ac.uk) ** ** This file is part of Liger. ** ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General ** Public Licen...
2,942
927
/** * Copyright Soramitsu Co., Ltd. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ #ifndef TEST_FRAMEWORK_TEST_LOGGER_HPP #define TEST_FRAMEWORK_TEST_LOGGER_HPP #include "logger/logger.hpp" #include "logger/logger_manager_fwd.hpp" /// Allows to log objects, which have toString() method without call...
753
262
#include "stdafx.h" #include "ImageEditHelper.h" #include <opencv2\imgproc.hpp> using namespace cv; using namespace std; ImageEditHelper::ImageEditHelper() { this->converter = new ConversionHelper(); this->rectangleMethods = new RectangleHelper(); this->imageInfo = new ImageInformationHelper(); this->transformati...
2,797
941
/* Copyright (c) 2014 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #include "kernel/type_checker.h" #include "kernel/environment.h" #include "library/module.h" #include "library/constants.h" namespace lean { static name * ...
1,331
471
#include "handler_base.h" #include <base/timer.h> #include <base/config.hpp> #include <base/logger/logger.h> #include <module_net/net/nat_type.hpp> #include <module_net/session_manager.h> #include <module_peer/routing_table.h> #include <module_peer/partner_table.h> #define BASE_REGISTER(_FUNC) std::bind(&HandlerBase::...
11,053
5,471
#include "StdAfx.h" /* #include "JKDefragStruct.h" #include "JKDefragLog.h" #include "JkDefragLib.h" #include "JkDefragGui.h" */ JKDefragGui *JKDefragGui::m_jkDefragGui = 0; JKDefragGui::JKDefragGui() { m_jkLib = JKDefragLib::getInstance(); m_bmp = NULL; jkStruct = new JKDefragStruct(); m_s...
38,754
17,427
/** * 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 you under the Apache License, Version 2.0 (the * "License"); you...
2,056
616
// Date & Time using CTime #include "stdafx.h" #include "Date.h" #include "MessageBox.h" #include "StringInput.h" // Helper functions for dealing with Edit boxes static bool vrfyMnth( int cnt, TCchar ch, int& v); static bool vrfyDay( int cnt, TCchar ch, int& v); static bool vrfyYr( int cnt, TCchar ch, int& v); ...
9,432
3,866
/* $Id: jni_algorithm_angluin.cpp 1081 2009-11-11 16:33:40Z davidpiegdon $ * vim: fdm=marker * * This file is part of libalf. * * libalf 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 ver...
4,572
1,638
#include "lib/universal_include.h"
36
14
#ifndef __UTILITY_CONTAINER_HELPER_IN_PLACE_T__ #define __UTILITY_CONTAINER_HELPER_IN_PLACE_T__ /** * \file ignore_t.hpp * \author Inochi Amaoto * */ #include<utility/config/utility_config.hpp> #include<utility/trait/trait_helper.hpp> namespace utility { namespace container { namespace helper { ...
1,354
545
///////////////////////////////////////////////////////////// /** @file StreamInterface.cpp * @ingroup Utils * * @author Luk2010 * @version 0.1A * * @date 04/01/2013 - 23/03/2014 * * Implements the Streams class. * **/ ///////////////////////////////////////////////////////////// #include "StreamInterface...
1,591
531
#include "PID.h" using namespace std; /* * TODO: Complete the PID class. */ PID::PID() {} PID::~PID() {} void PID::Init(double Kp, double Ki, double Kd) { // Assign to instance variables this -> Kp = Kp; this -> Ki = Ki; this -> Kd = Kd; // Initialize errors to zero ...
3,011
1,222
// Copyright (c) 2014-2017 Jae-jun Kang // See the file LICENSE for details. #include "x2boost/event.hpp" #include <boost/functional/hash.hpp> #include <boost/thread/once.hpp> #include "x2boost/deserializer.hpp" #include "x2boost/event_factory.hpp" #include "x2boost/serializer.hpp" using namespace x2boost; namespa...
2,484
903
/* Hork Engine Source Code MIT License Copyright (C) 2017-2022 Alexander Samusev. This file is part of the Hork Engine Source Code. 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 rest...
8,267
3,240
// CSCI 216 Fundamentals of Programming II Spring 2015 // Program #1: Getting started // Author: Tomas Ochoa // Date Due: 26 January 2015 // // This object of this program is to do some simple file processing. The program will first // ask the user to input a file name. If it doesn't exist it will continue to as...
4,022
1,381
//circle.cpp #include "circle.h" using std::cout; void Circle::draw() { cout<<"Circle\n"; }
96
40
/* * ofxTweener.cpp * openFrameworks * * Created by Sander ter Braak on 26-08-10. * */ #include "ofxTweener.h" ofxTweener Tweener; ofxTweener::ofxTweener(){ _scale = 1; setMode(TWEENMODE_OVERRIDE); } void ofxTweener::addTween(float &var, float to, float time, void (^callback)(float * arg)){ addTween(var...
4,199
1,873
#include "iostream" #include "iomanip" using namespace std; int main() { double f = 3.14159; cout << setprecision(5) << f << '\n'; cout << setprecision(9) << f << '\n'; cout << fixed; cout << setprecision(5) << f << '\n'; cout << setprecision(9) << f << '\n'; cout << setw(15) << f << '\n'; return 0; }
319
133
#include <iostream> #include "Human.hpp" int main() { Human bob; std::cout << bob.identity() << std::endl; std::cout << bob.getBrain().identity() << std::endl; return 0; }
189
72
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2020 UniPro <ugene@unipro.ru> * http://ugene.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * ...
5,576
1,757
/////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2007, 2010 Michael A. Jackson for BlueQuartz Software // All rights reserved. // BSD License: http://www.opensource.org/licenses/bsd-license.html // // This code was written under United States Air Force Contract num...
11,651
3,745
#include <iostream> #include <queue> using namespace std; int main() { queue<int> q; q.push(11); while (!q.empty()) { int x = q.front(); q.pop(); cout << x << endl; int y = x / 2; if (y > 1) { if ((x % 2)) { q.push(y - 1); q.push(y + 1); } else { q.pus...
345
153
// Created on: 1997-03-27 // Created by: Alexander BRIVIN and Dmitry TARASOV // Copyright (c) 1997-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under //...
2,410
779
#include "rController.h" #include "de/hackcraft/log/Logger.h" #include "de/hackcraft/world/Entity.h" #include "de/hackcraft/world/World.h" #include "de/hackcraft/world/object/cMech.h" #include "de/hackcraft/world/sub/weapon/rTarcom.h" #include <cstdlib> #include <cassert> #include <sstream> using std::string; L...
11,581
3,872
#include "./general/general.cpp"
34
12
#include "Logger.h" using namespace std; Logger::Logger(int redLedPin, int greenLedPin, int baudRate /*= 115200*/): _ledsLogger(LedsLogger::Create(redLedPin, greenLedPin)) { Serial.begin(baudRate); Serial.setDebugOutput(true); } void Logger::OnCommand(const String &commandName, int commandId) const { Serial.printl...
1,756
748
#include <iostream> #include <cstdio> using namespace std; int solve_x(int x) { if (x == 1) { return 0; } else if (x == 2) { return 1; } else if (x & 1) { return 1 + solve_x(x - 1); } else { return 2; } } int solve() { int n; scanf("%d", &n); return solve_x(n); } int main() { int t...
392
184
#ifndef UnityEngine_GameObject_DEFINED #define UnityEngine_GameObject_DEFINED // This .hpp file was compiled via beatsaber-hook/shared/helper.py's Parse Mode. // Created by Sc2ad. // Methods may not be valid! #include <dlfcn.h> #include <string_view> #include "../utils/typedefs.h" #include "../utils/il2cpp-functions.hp...
7,932
2,370
/* * Copyright (c) 2015, Christian Menard * Copyright (C) 2020 Nils Asmussen, Barkhausen Institut * All rights reserved. * * Redistribution and use in source and binary forms, with or without * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the follo...
5,388
1,775
/************************************************************************** * copyright : (C) 2007,2011 by Lukáš Lalinský * email : lalinsky@gmail.com **************************************************************************/ /***********************************************************...
30,756
9,841
#include"Tree.h" treeNode* BinTree::CreateTree(char* str) { treeNode* st[100]; treeNode* p = NULL; int top, k, j = 0; top = -1; char ch = str[j]; treeNode* b = NULL; while (ch != '\0') { switch (ch) { case'(': top++; st[top] = p; k = 1; break; case')': top--; break; case',': k =...
3,060
1,611
#define DEFINE_JOINT(CLASS) \ /* This macro allow to define a specific joint on std::shared_ptr<CLASS> that inherites from CLASS. */ \ template ...
12,382
2,161
#include "asset.h" #include "xenon/core/log.h" namespace xe { void copyAssetMetaRuntimeData(const Asset* source, Asset* target) { target->metadata.handle = source->metadata.handle; target->metadata.type = source->metadata.type; target->metadata.path = source->metadata.path; target->runtimeData.loaded = sour...
1,330
466
/////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// // // CCC AAA V V ...
5,641
1,802
#include "tests/memory_resource/memory_resource_mini.hpp" #include "tests/memory_resource/memory_resource_fwd.hpp" //------------------------------------------------------------------------------ namespace memory_resource_tests { //------------------------------------------------------------------------------ void...
478
116
#ifndef MIX_DD_bdd_manager_HPP #include "../bdd_manager.hpp" #endif namespace teddy { template<class VertexData, class ArcData> auto bdd_manager<VertexData, ArcData>::variable_not (index_t const i) -> bdd_t { return this->negate(this->variable(i)); } template<class VertexData, clas...
4,303
1,297
#include "CpAvOpenhomeOrgMediaServer1.h" #include <OpenHome/Net/Core/CpProxy.h> #include <OpenHome/Net/Private/CpiService.h> #include <OpenHome/Private/Thread.h> #include <OpenHome/Net/Private/AsyncPrivate.h> #include <OpenHome/Buffer.h> #include <OpenHome/Net/Cpp/CpDevice.h> #include <OpenHome/Net/Private/CpiDevice.h>...
34,408
11,558
#include <iostream> #include <map> #include <memory> // inline function through a macro // if it is not handling correctly it will create bugs //#define Square(A) (A*A) // In c++ instead a macro we use inline functions // inline keyword tells the compiler to substitute the caller of the function in // where inline f...
2,178
611
//Language: GNU C++ #include <stdio.h> #include <iostream> #include <string.h> #include <stdlib.h> #include <time.h> #define abs(a) (((a)>0)?(a):(-(a))) #define max(a, b) (((a)>(b))?(a):(b)) #define min(a, b) (((a)<(b))?(a):(b)) #define N 303 #define oo int(1e9) #define eps 1e-8 using namespace std; bool g[N][N],...
1,590
767
#include <iterator> #include "AnimationPlayer.h" namespace nest { using namespace std; void AnimationPlayer::advanceTime(float dt) { time += dt; int i, j = poses.size(); PoseData *pose = NULL; AnimationChannel *channel = NULL; vector<QuatKeyFrame>::iterator k; QuatKeyFrame *quatFirst = NULL, *quatSe...
3,475
1,725
#include "SpLog.h" #include "ExePathHelper.h" #include <stdlib.h> #include <string.h> #include <stdarg.h> #define LOG_DIRECTORY ( "Log") #define BINARY_EXTENSION (".bin") #define TEXT_EXTENSION (".log") #define GetFileNameWithoutExtension(_fn) { \ char* pPos = strr...
12,743
5,245
#include "graphics/bloomFFT.h" #include "utils/loadshader.h" BloomFFT::BloomFFT(vks::VulkanDevice * vulkanDevice) { this->vulkanDevice = vulkanDevice; this->device = vulkanDevice->logicalDevice; } BloomFFT::~BloomFFT() { } // Find and create a compute capable device queue void BloomFFT::getComputeQueue() { uint32...
13,823
5,033
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ void inorder(TreeNode *root, vector<int> &arr) { if (root == NULL) { return; } inorder(root->left, arr); arr.push_back(root->...
604
260
// // FaseMontanha.cpp // Jogo-SFML // // Created by Matheus Kunnen Ledesma on 11/10/19. // Copyright © 2019 Matheus Kunnen Ledesma. All rights reserved. // #include "FaseMontanha.hpp" namespace Game { namespace Fases { // Const const string FaseMontanha::CONFIG_FILE("Resources/config/fase_b_config.json"); // C...
4,474
1,630
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int ans = 0; if(n % 5 != 0) ans++; printf("%d\n", (n / 5) + ans); return 0; }
165
80
#include "State.h" State::State() { bankPosition = Vector2D(208, 624); homePosition = Vector2D(624, 624); minePosition = Vector2D(272, 112); saloonPosition = Vector2D(1040, 624); } State::~State() { delete agent; } void State::Init(Agent * agent, Uint32 delayTime) { this->agent = agent; this->delayTime = dela...
394
170
//Language: GNU C++ #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <climits> #include <vector> #include <queue> #include <cstdlib> #include <string> #include <set> #include <stack> #define LL long long #define pii pair<int,int> #define INF 0x3f3f3f3f using name...
2,326
958
#ifndef JSON_UTILS_HPP__ #define JSON_UTILS_HPP__ #include <string> #include <clang-c/Index.h> #include <jsoncons/json.hpp> namespace cclyzer { namespace ast_exporter { namespace jsonexport { typedef jsoncons::json json_t; // Recording routines void record_extent( j...
1,792
507
class Solution { public: vector<int> productExceptSelf(vector<int>& nums) { int p=1; int ctr=0; int zp=1; for(int i:nums) { p*=i; if(i==0) ++ctr; if(ctr>1){ vector<int>ans(nums.size(),0); retu...
601
198
#include<bits/stdc++.h> #include <iostream> using namespace std; bool prime(long long n) { if (n <= 3) { return (n > 1); } if (((n % 2) == 0) || ((n % 3) == 0)) { return false; } long i = 5; while ((i * i) <= n) { if (((n % i) == 0) || ((n % (i + 2)) == 0)) { return fals...
1,499
638
#include "BackgroundSubstractor.h" BackgroundSubstractor::BackgroundSubstractor(){ vector<string> files = globVector("input/*"); sort(files.begin(), files.end()); for (int i = 0 ; i < files.size(); i++){ cout<<files[i]<<endl; Frame f(files[i]); frames.push_back(f); } h = frames[0].mat.rows; w...
4,673
2,137
#ifndef _ENGINE_COLLISION_LISTENER_HPP #define _ENGINE_COLLISION_LISTENER_HPP #include "Collision_listener.hpp" #include <cstdint> namespace physics_2d { class Body_2d; } namespace gom { class Game_object; } class Engine_collision_listener final : public physics_2d::Collision_listener { public: Engine_collisi...
1,290
439
#ifndef JUST_TEST_HPP #define JUST_TEST_HPP // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. // 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) #include <string> #include <vector> #include <iostr...
8,218
2,889
// ============================================================================= // High Performance ParalleX Library (libhpx) // // Copyright (c) 2013-2017, Trustees of Indiana University, // All rights reserved. // // This software may be modified and distributed under the terms of the BSD // license. See the C...
2,023
795
/** * dynamicEDT3D: * A library for incrementally updatable Euclidean distance transforms in 3D. * @author C. Sprunk, B. Lau, W. Burgard, University of Freiburg, Copyright (C) 2011. * @see http://octomap.sourceforge.net/ * License: New BSD License */ /* * Copyright (c) 2011-2012, C. Sprunk, B. Lau, W. Burgard, Univer...
16,104
8,109
/// Laser controller /// /// (c) Koheron #ifndef __DRIVERS_LASER_CONTROLLER_HPP__ #define __DRIVERS_LASER_CONTROLLER_HPP__ #include <context.hpp> #include <xadc.hpp> #include <eeprom.hpp> #include <chrono> namespace Laser_params { constexpr uint32_t power_channel = 1; //xadc channel constexpr uint32_t curren...
4,543
1,681
#include "mps.h" #include <chrono> #include <iostream> #include <thread> using namespace mps; constexpr auto MessageCount = 100; constexpr auto MessageInterval = std::chrono::seconds(1); int main(int argc, char* argv[]) { // sanity check to check that we have enough arguments. if (argc != 3) { std::cout << ...
1,409
478
#include "opencv2/highgui/highgui.hpp" #include <iostream> using namespace cv; using namespace std; int main(int argc, char* argv[]) { VideoCapture cap(0); // open the video camera no. 0 if (!cap.isOpened()) // if not success, exit program { cout << "Cannot open the video cam" << endl; r...
1,259
410
#include "vmt.hpp" #include <stdint.h> #include <unistd.h> #include <sys/mman.h> int pagesize = sysconf(_SC_PAGE_SIZE); int pagemask = ~(pagesize-1); int unprotect(void* region) { mprotect((void*) ((intptr_t)region & pagemask), pagesize, PROT_READ|PROT_WRITE|PROT_EXEC); return PROT_READ|PROT_EXEC; } void pro...
816
313
#include <flatland_plugins/simple.h> #include <pluginlib/class_list_macros.h> #include <ros/ros.h> using namespace flatland_server; namespace flatland_plugins { void Simple::OnInitialize(const YAML::Node &config) { ROS_ERROR_STREAM("Hello world"); } }; PLUGINLIB_EXPORT_CLASS(flatland_plugins::Simple, flatland_server...
335
120
/** * @file <loop-functions/IcraLoopFunc.cpp> * * @author Antoine Ligot - <aligot@ulb.ac.be> * * @license MIT License */ #include "TuttiFrLoopFunc.h" /****************************************/ /****************************************/ TuttiFrLoopFunction::TuttiFrLoopFunction() { m_unClock = 0; m...
10,425
3,434
/** * $Id$ * * Copyright (C) * 2014 - $Date$ * Martin Wolf <boostnumpy@martin-wolf.org> * This file has been adopted from <boost/python/detail/caller.hpp>. * * @file boost/numpy/dstream/detail/caller.hpp * @version $Revision$ * @date $Date$ * @author Martin Wolf <boostnumpy@martin-wolf.org> * * ...
6,723
2,131
//********************************************************* // Matrix_File.cpp - Matrix File Input/Output //********************************************************* #include "Matrix_File.hpp" //----------------------------------------------------------- // Matrix_File constructors //--------------------------------...
2,604
815
/* * * Copyright (C) 2015-2018, J. Riesmeier, Oldenburg, Germany * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation are maintained by * * OFFIS e.V. * R&D Division Health * Escherweg 2 * D-26121 Oldenburg, Germany * * * Module: dcmsr * *...
9,451
2,429
/* * ----------------------------------------------------------------------------- * Created by Ulysses Carlos on 03/25/2020 at 10:57 PM * * Chapter20_08.cc * * Define a function that counts the number of characters in a Document. * ----------------------------------------------------------------------------- ...
5,049
1,750
#include "texture_handler.h" TextureHandler* TextureHandler::mInstance = nullptr; bool TextureHandler::add_texture(const std::string& filePath, texture_t& id, SDL_Renderer* renderer) { id = std::hash<std::string>()(filePath); if (mTextures.find(id) != mTextures.end()) { return true; } SDL_Surface* sur = IMG_L...
2,742
1,112
// Solution 1. Straight forward, 165ms class Solution { public: int maxProduct(vector<string>& words) { int maxlen = 0; for(int i = 0; i < words.size(); i++) for(int j = i + 1; j < words.size(); j++){ if(words[i].size() * words[j].size() <= maxlen) continue; ...
1,223
426
#pragma once #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include <boost/asio/ip/tcp.hpp> namespace io { namespace asio = boost::asio; namespace ssl = asio::ssl; typedef asio::ip::tcp tcp; typedef boost::system::error_code error_code; static const error_code Success = boost::system::errc...
2,264
758
/* * Copyright (C) 2012 The Android Open Source Project * * 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...
103,251
41,675
#include "QueueNode.h" #include <iostream> int main(void) { Queue<int> q; int temp; q.enqueue(1); q.enqueue(50); q.enqueue(30); q.enqueue(80); q.enqueue(10); q.enqueue(7); q.printQueue(); while(!q.isEmpty()) { q.dequeue(temp); } q.printQueue(); return 0; }
282
140
#include "CAN.h" #include "CANMotor.h" #include "CANUtils.h" #include <chrono> #include <cmath> #include <condition_variable> #include <mutex> #include <queue> #include <thread> #include <vector> extern "C" { #include "../HindsightCAN/CANCommon.h" #include "../HindsightCAN/CANMotorUnit.h" #include "../HindsightCAN/CA...
2,870
1,173