text
string
size
int64
token_count
int64
/** 228. Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. **/ #include <iostream> #include "../utils.h" u...
484
166
//************************************************************************ // // Decompiled by @myheart, @synth3r // <https://forum.ragezone.com/members/2000236254.html> // // // FILE: ShopPackage.cpp // // #include "stdafx.h" #if(DECOMPILE_INGAMESHOP==1) #include "ShopPackage.h" #include "StringToken.h" #include "Str...
4,357
1,629
#include "Fireball.h" #include "../../Components.h" #include "../../../Common/Globalbilboulga.h" void Fireball::init(Entity* projectile, std::vector<Entity*>* targets) { ProjectileBase::init(projectile, targets); transform->velocity = velocity; sprite->setAsset("Fireball"); sprite->setCurrentTexture(0); collid...
761
275
// Time: O(s * d * l), l is the average string length // Space: O(s) class Solution { public: string addBoldTag(string s, vector<string>& dict) { vector<bool> bold(s.length()); for (const auto& d: dict) { auto pos = -1; while ((pos = s.find(d, pos + 1)) != string::npos) { ...
788
248
#include <string.h> #include <stdio.h> #include <stdint.h> #include "httpops.hh" int regex_html(char *to_match, char *htmlDoc, size_t length) { const char *pcreErrorStr; int errOffset; pcre * reCompiled = pcre_compile(EVIL_REGEX, 0, &pcreErrorStr, &errOffset, NULL); if (reCompiled == NULL) { fp...
5,954
2,200
#include "../../lib/catch2/catch2.hpp" #include <sstream> #include "../../tools/cli/cli_streams.hpp" #include "../../tools/micro_shell/micro_shell_codes.hpp" #include "../../picross_shell/picross_shell_state.hpp" #include "../../picross_shell/shell_cross_command.hpp" #include "../../core/grid.hpp" #include "../../core...
2,712
984
#include "ethernetHelper.hpp" const int EthernetHelper::size = 14; EthernetHelper::EthernetHelper (uint8_t srcMac[6], uint8_t destMac[6], uint16_t type){ ptr = new struct ethhdr; memcpy(ptr->h_dest, destMac, 6); memcpy(ptr->h_source, srcMac, 6); ptr->h_proto = htons(type); } unsigned char* Et...
478
193
// // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose...
41,980
19,317
// Includes #include <QtWidgets> #include "ui.h" DedicatedSlaveUi::DedicatedSlaveUi(const QString &dir, QWidget *parent) : QWidget(parent), app_slcInstPos(new int[2]) { app_slcInstPos[0] = -1; parentWin = qobject_cast<QMainWindow*>(parent); if(parentWin != 0 ) { // After casting parent widget QMainWindow...
21,662
8,028
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group Copyright (C) 2008 N. Michael Mayer, email: nmmayer@gmail.com This program is free software; you can...
8,949
3,039
#include<iostream>; using namespace std; struct Rectangle{ double width; double height; }; void printRec(Rectangle r){ cout<<"Width:"<<r.width<<endl; cout<<"Height:"<<r.height<<endl; } void initRec(Rectangle* r){ cin>>(*r).width; cin>>(*r).height; } Rectangle initRec(){ Rectan...
508
189
// Copyright 2021 Anthony Paul Astolfi // #pragma once #ifndef BATTERIES_RADIX_QUEUE_HPP #define BATTERIES_RADIX_QUEUE_HPP #include <batteries/assert.hpp> #include <batteries/int_types.hpp> #include <boost/functional/hash.hpp> #include <array> #include <limits> #include <type_traits> namespace batt { template <usi...
5,445
1,913
// bdlde_quotedprintableencoder.cpp -*-C++-*- // ---------------------------------------------------------------------------- // NOTICE // // This component is not up to date with current BDE coding standards, and // should not be used as an example f...
13,114
4,620
#pragma once #include "src/Headers.hpp" #include "src/Heap.hpp" #include "src/Math.hpp" #include "src/Meta.hpp" #include "src/Queue.hpp" #include "src/Sort.hpp" // #include "src/Tensor.hpp"
200
81
/* * CCBFileRunDelay.cp * CCBFileRunDelay * * Created by Qidea on 11/13/13. * * */ #include "CCBFileRunDelay.h" #include "CCBFileRunDelayPriv.h" CFStringRef CCBFileRunDelayUUID(void) { CCCBFileRunDelay* theObj = new CCCBFileRunDelay; return theObj->UUID(); } CFStringRef CCCBFileRunDelay::UUID() { return...
350
164
//===---- CFI.cpp - kCFI LLVM IR analyzes and transformation --------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
11,716
4,243
//Leetcode Problem No 1048. Longest String Chain //Solution written by Xuqiang Fang on 18 May, 2019 #include <iostream> #include <vector> #include <string> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> using namespace std; class Solution{ public: int longes...
1,689
673
#include "preferences.hpp" void Libre::PreferencesWindow::add_themes_to_themes_combo() { std::vector<std::string> v = this->settings.get_children("themes", "name"); for (std::vector<std::string>::iterator i = v.begin(); i != v.end(); i++) { this->ui_pane.get_theme()->get_element()->append(*i); if (*i == thi...
2,876
1,077
#include "thumbnailholder.h" #if defined(Q_OS_SYMBIAN) #include <e32std.h> #include <touchfeedback.h> #endif ThumbnailHolder::ThumbnailHolder() : iPixmap(NULL) { setFlag(QGraphicsItem::ItemClipsToShape); } ThumbnailHolder::~ThumbnailHolder() { delete iPixmap; } QRectF ThumbnailHolder::boundingRect() const ...
1,291
473
#include <opengl/ui_renderer.hpp> #include <opengl/bind.hpp> #include <opengl/draw_info.hpp> #include <opengl/gpu.hpp> #include <opengl/renderer.hpp> #include <opengl/shader.hpp> #include <boomhs/camera.hpp> #include <boomhs/math.hpp> #include <boomhs/rectangle.hpp> #include <boomhs/shape.hpp> using namespace boomhs;...
3,623
1,304
class Solution { public: bool isSorted(vector<int> nums) { vector<int> res; for(int i = 0; i < nums.size(); i++) res.push_back(nums[i]); sort(res.begin(), res.end()); for(int i = 0; i < res.size(); i++) if(res[i] != nums[i]) return false; ...
1,136
433
#include <iostream> #include "quiz.h" using namespace std;
59
21
#include "ProgramLibraryController.h" ProgramLibraryController::ProgramLibraryController() { }
96
25
/* Copyright (c) 2017, Daniel Mensinger * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of co...
4,688
1,809
#include "argparse.h" #include <iostream> using std::string; /** * @brief try to parse the arguments * @param input * @param output * @return return whether there has been an error (true = error, false = no error) */ bool ArgParse::parsingFails(Input& input, Output& output) { size_t mandatoryArguments = 0; ...
2,281
599
#include "stdafx_ao.h" #include "RollingBallShaker.hpp" #include "Function.hpp" #include "Game.hpp" #include "stdlib.hpp" #include "PsxDisplay.hpp" #include "ScreenManager.hpp" #include "Primitives.hpp" void RollingBallShaker_ForceLink() {} namespace AO { const static PSX_Pos16 sRollingBallShakerScreenOffsets_4BB740...
2,837
1,335
#include <cstdio> int main(){ long long l1, r1, l2, r2, k; scanf("%lld %lld %lld %lld %lld", &l1, &r1, &l2, &r2, &k); long long l = (l1 > l2) ? l1 : l2; long long r = (r1 < r2) ? r1 : r2; long long res = r - l + 1; if(l <= k && k <= r){--res;} if(res <= 0){res = 0;} printf("%lld\n", res); ...
337
171
#include "tpuc/Interpreter/cpu/csc.hpp" #include "internal.hpp" #include "tpuc/Dialect/TPU/TPUDialect.h" #include "tpuc/MlirModuleInterpreter.h" static inline int align_up(int x, int n) { if (n == 0 || n == 1) { return x; } return ((x + n - 1) / n) * n; } static inline float UINT8(float data) { return sta...
5,983
2,566
#include "comb.h" int main() { for(int i=0;i<11;i+=1) sweep(30,1000000,10*pow(2,i),1/pow(10,4),0,10,12,10,600,15,0); //sweep steps, total steps, power(uW/cm2),convergence condition,convergence threshold,convergency steps,ADM order,n1 interval,n2 interval,Matrix self multiplication,laser detune //fst...
1,053
493
#include <HazelTM.h> class Sandbox: public HazelTM::Application { public: Sandbox() { } ~Sandbox() { } }; HazelTM::Application* HazelTM::CreateApplication() { return new Sandbox(); }
199
85
#include <stdlib.h> #include "log.h" #include "packet.h" int Packet::parse(){ parsed = true; this->params_.clear(); if(this->len < HEADER_LEN){ return -1; } int size = this->size(); char *head = (char *)this->data(); while(size > 0){ if(head[0] == ' ' || head[0] == '\r'){ head ++; size --; cont...
2,723
1,304
/* * Copyright 2019 Equal Games * 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 ...
1,554
552
#include "DisplayPanelWidget.h" using namespace std; DisplayPanelWidget::DisplayPanelWidget(SamplingProcessViewer *spv, unordered_map<uint, string> *c2l_mapping, QWidget * parent) : QWidget(parent), viewer(spv), class2label(c2l_mapping) { setFixedWidth(440); container = dynamic_cast<QScrollArea*>(parent); QVBoxLa...
5,155
1,929
#include "Application.h" #include "UI_Hierarchy.h" #include "ModuleGOManager.h" #include "GameObject.h" #include "Component.h" #include "Transform.h" #include "Mesh.h" #include "Material.h" #include "ModuleWindow.h" UI_Hierarchy::UI_Hierarchy(bool startEnalbed) : UI_Panel(startEnalbed) { } UI_Hierarchy::~UI_Hierar...
2,015
835
#pragma once // This file is generated from the Game's Reflection data #include <cstdint> namespace RED4ext { namespace quest { enum class QuickItemsSet : uint32_t { Q001_Kereznikov_Heal_Phone = 0, Q003_All = 1, }; } // namespace quest } // namespace RED4ext
270
103
#include "audiostream.hpp" #include <cstring> #include <cassert> // Implement stb_vorbis here! #undef STB_VORBIS_HEADER_ONLY #include <stb_vorbis.h> uint32_t audio_samplerate; uint32_t audio_buffersize; uint32_t audio_channels; AudioStream::AudioStream(int channels) : samples(audio_buffersize * channels), c...
1,184
434
// // Created by 松本拓真 on 2019/11/06. // #include "gtest/gtest.h" #include "bo/bextr.hpp" namespace { constexpr int N = 1<<16; uint64_t rand64() { return uint64_t(random()) | (uint64_t(random()) << 32); } } TEST(Bextr, 64) { for (int i = 0; i < N; i++) { auto val = rand64(); int s = random() % 64; ...
499
264
#pragma once #include "Extensions/Colors.hpp" #include "Extensions/Formatting.hpp" #include "Extensions/Math.hpp" #include "Extensions/Memory.hpp" #include "Extensions/UnrealMemory.hpp"
185
58
#include <cstdio> #include <algorithm> using namespace std; #define NMAX 50 typedef unsigned char u8; static int n, m, _, cnt; static int u[NMAX], v[NMAX]; static u8 s[NMAX]; void dfs(int i) { if (i == m) cnt++; else if (s[u[i]] < s[v[i]]) { dfs(i + 1); swap(s[u[i]], s[v[i]]); dfs(...
1,173
523
#include "TestStopWatch.h" //============================================================================= TestStopWatch::TestStopWatch() //============================================================================= { } //----------------------------------------------------------------------------- void TestStopWat...
1,283
346
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) Elektrobit Automotive GmbH // Alle Rechte vorbehalten. All Rights Reserved. // // Information contained herein is subject to change without notice. // Elektrobit retains ownership and all other rights in the software and e...
835
218
#include "Gear/Math/Matrix.h" NAMESPACE_START(Gear) NAMESPACE_START(Math) #if !defined(USE_SSE) void Matrix::gaussJordanInverse() { /// Gauss-Jordan method Matrix copy(*this); int32_t i, j, k; /// Forward elimination for (i = 0; i < 3; ++i) { int32_t pivot = i; float32_t pivotSize = copy.m[i][i]; pivotS...
1,411
798
#include <vector> using std::vector; class Solution { public: int removeElement_1(vector<int>& nums, int val) { int l = 0, r = nums.size(); while(l < r) { if (nums[l] == val) { nums[l] = nums[r - 1]; r--; } els...
379
125
#ifndef TIMER_HPP #define TIMER_HPP // I use the fact that structs with methods are still POD in memory which is // guranteed by the standard. See: // https://stackoverflow.com/questions/422830/structure-of-a-c-object-in-memory-vs-a-struct #include <iostream> #include <mpi.h> #include <stdio.h> class Timer { public:...
1,166
400
/* -*-c++-*- IfcPlusPlus - www.ifcplusplus.com - Copyright (C) 2011 Fabian Gerold * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * in...
3,993
1,329
#pragma once #include "event_export_def.hpp" #define CQ_MENU(FuncName) \ static void __cq_menu_##FuncName(); \ _CQ_EVENT(int32_t, FuncName, 0)() { \ __cq_menu_##FuncName(); \ return 0; \ } \ static void __cq_...
338
118
// ==== Arithmetic & math functions === static bad_forceinline f32x4 f32x4_add(f32x4 a, f32x4 b) { f32x4 res; res.x = a.x + b.x; res.y = a.y + b.y; res.z = a.z + b.z; res.w = a.w + b.w; return res; } static bad_forceinline f32x4 f32x4_sub(f32x4 a, f32x4 b) { f32x4 res; res.x = a.x -...
10,075
5,586
// Copyright Ross MacGregor 2013 // 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) #pragma once #include "AsioExpress/Error.hpp" #include "AsioExpress/CompletionHandler.hpp" #in...
1,317
396
// Copyright (c) Microsoft Corporation #define SORTPP_PASS #define GUID_DEFINED #define IN __in #define OUT __out #include "h.h"
139
57
#include "lib/universal_include.h" #include <math.h> #include <float.h> #include "lib/vector2.h" #include "lib/vector3.h" Vector3 const g_upVector(0.0f, 1.0f, 0.0f); Vector3 const g_zeroVector(0.0f, 0.0f, 0.0f); void Vector3::RotateAroundX(float angle) { FastRotateAround(Vector3(1,0,0), angle);...
1,038
445
/** * > Author : TISparta * > Date : 11-08-18 * > Tags : Game Theory * > Difficulty : 4 / 10 */ #include <bits/stdc++.h> using namespace std; const int MAX_M = 50; int T, N, M, pile[MAX_M + 1], nim_sum, SGV; int main() { scanf("%d", &T); while (T--) { nim_sum = 0; scanf("%d %d", &N, &M...
669
296
// license:BSD-3-Clause // copyright-holders:Aaron Giles /************************************************************************* BattleToads driver by Aaron Giles **************************************************************************/ #include "emu.h" #include "includes/btoads.h" #include "speaker.h...
13,112
7,106
#include "zxpch.h" #include "Logger.h" namespace ZeXo { Shared<spdlog::logger> Logger::s_CoreLogger; Shared<spdlog::logger> Logger::s_ClientLogger; void Logger::Init() { spdlog::set_pattern("%^[%T] { %n } %v%$"); s_CoreLogger = spdlog::stdout_color_mt("ZeXo Engine"); s_ClientLogger = spdlog::stdout_color...
470
201
#include <bits/stdc++.h> using namespace std; int dp[1007][1007][1]; int diehard(int h,int a,int air){ if(h<=0 || a<=0){ return 0; } if(dp[h][a][air]!=-1){ return dp[h][a][air]; } if(air){ dp[h][a][air]=1+diehard(h+3,a+2,0); return dp[h][a][air]; }else{ ...
1,016
465
#include "ui_frame_buffers.hpp" #include <sstream> #include "../imgui/imgui-SFML.h" #include "../engine.hpp" namespace space { UIFrameBuffers::UIFrameBuffers() : UIWindow("FrameBuffers") { } void UIFrameBuffers::doDraw(Engine &engine) { auto &renderCameras = engine.renderCameras(); ...
630
214
#include "common.h" /* Defines */ #define NUMBER_DIGITS 3 #define DPAD_BUTTONS (LEFT_BUTTON | RIGHT_BUTTON | DOWN_BUTTON | UP_BUTTON) /* Global Variables */ RECORD_T record; char stringBuffer[STRING_BUFFERS][STRING_BUFFER_SIZE]; int8_t dpadX, dpadY; /* Local Variables */ static P...
1,994
947
#include "session.h" #include "mocks.h" #include "create_packet.h" #include <algorithm> using ::testing::SaveArg; using ::testing::InSequence; using ::testing::StrictMock; using ::testing::NiceMock; using ::testing::AtLeast; TEST(Session, timeout) { MockServer server; StrictMock<MockWriter> writer; au...
5,535
1,884
#include <dirent.h> #include <unistd.h> #include <string> #include <vector> #include "linux_parser.h" using std::stof; using std::string; using std::to_string; using std::vector; // An example of how to read data from the filesystem string LinuxParser::OperatingSystem() { string line; string key; string value...
11,754
3,850
// Copyright (c) 2011 Revelux Labs, LLC. All rights reserved. // Use of this source code is governed by a MIT-style license that can be // found in the LICENSE file. #include "macro.h" #include <string> #include <stdio.h> #include <stdlib.h> #include "tilton.h" Macro::Macro() { InitializeMacro(NULL, 0); } Macr...
4,027
1,490
#include <iostream> #include <new> #include <cstdlib> #include <map> #include <string> #include <vector> #include <cmath> using namespace std; int main() { int a = 90; int b = 100; cout << "Address = " << (long)&a << " " << (long)&b << endl; int *p = &a; cout << "p = " << *p << " " << endl; p++...
395
158
#pragma once #include <conduit/async/callback.hpp> #include <conduit/async/immediate_value.hpp> #include <conduit/mem/allocator.hpp> #include <conduit/mixin/awaitable_parts.hpp> #include <conduit/util/tag_types.hpp> #include <exception> namespace conduit::mixin { enum suspend : bool { always = true, never = false }; ...
6,979
2,158
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "randombucket.h" #include <vespa/vdslib/state/random.h> namespace RandomBucket{ uint64_t _num_users; uint64_t _locationbits; bool _scheme = false; storage::lib::RandomGen rg; void setUserD...
970
381
/* *_________________________________________________________________________* * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * * DESCRIPTION: SEE READ-ME * * FILE NAME: virtualmatrix.cpp * * A...
4,617
1,475
#include "basic/listener.h" int main(int argc, char **argv) { ros::init(argc, argv, "listener_node"); Listener listener_node; listener_node.spin(); return 0; }
176
74
#include "Util.h" #include "records\CELL.h" ESM::Record* ESM::getBaseFromREFR(const ESM::Record* refr, ESM::File& file) { return file.findByFormID(refr->fieldOr<uint32_t>("NAME")); } std::vector<ESM::Group>* ESM::findCellChildrenTopLevel(const ESM::Record* cell, ESM::File& file) { int block = getCellBlock(cell); ...
3,527
1,376
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.cpp :+: :+: :+: ...
1,360
428
// // main.cpp // ezWebSockify // // Created by Franck on 22/07/2020. // Copyright © 2020 Frachop. All rights reserved. // #include <ezWebSockifyLib/ezWebSockifyLib.hpp> #include <iostream> #include <limits> #include <csignal> #include <thread> namespace { volatile std::sig_atomic_t gSignalStatus; } void sign...
1,201
501
/** * @file Tools/Streams/InOut.cpp * * Implementation of the streamable function endl. * * @author <a href="mailto:oberlies@sim.tu-darmstadt.de">Tobias Oberlies</a> */ #include "InOut.h" #include <cstring> Out& endl(Out& out) { out.outEndL(); return out; } In& endl(In& in) { in.inEndL(); return in; } ...
542
226
#ifndef RS_FILE_READ_HPP #define RS_FILE_READ_HPP #include "irods/rodsConnect.h" #include "irods/fileRead.h" int rsFileRead( rsComm_t *rsComm, fileReadInp_t *fileReadInp, bytesBuf_t *fileReadOutBBuf ); int _rsFileRead( rsComm_t *rsComm, fileReadInp_t *fileReadInp, bytesBuf_t *fileReadOutBBuf ); int remoteFileRead( rs...
437
185
// Ассемблерные вставки на GCC с флагом -masm=intel в .pro для синтаксиса Intel // (тоже самое можно и через команды .intel_syntax noprefix в начале asm вставки (и после кода, но внутри вставки, надо было вкл обратно AT&T .att_syntax noprefix) // использовать либо глобальные переменные, или локальные объявлять согла...
2,048
840
#include "..\script_component.hpp" class COMPONENT { tag = COMPONENT; class ANTI_ND { file = "modules\anti_nd\functions\anti_nd"; class Init {}; }; };
166
69
/** * @file spMatspMat_test.cpp * * @copyright SPDX-FileCopyrightText: 2022 Battelle Memorial Institute * @copyright SPDX-FileCopyrightText: 2022 University of Washington * * SPDX-License-Identifier: BSD-3-Clause * * @authors * Andrew Lumsdaine * */ #include <tuple> #include <vector> #include "nwgraph/g...
1,551
752
#pragma once #include <time.h> #include <sys/time.h> class Time { double t; public: Time(){ struct timeval time; gettimeofday(&time, NULL); t = time.tv_sec + (double)time.tv_usec/1000000; } Time(double a) : t(a) { } Time(const struct timeval & time){ t = time.tv_sec + (double)time.tv_usec/1000000; } ...
1,224
477
#include "stdafx.h" #pragma hdrstop #include "xrRender_console.h" #include "xrCore/xr_token.h" #include "xrCore/Animation/SkeletonMotions.hpp" u32 ps_Preset = 2; const xr_token qpreset_token[] = {{"Minimum", 0}, {"Low", 1}, {"Default", 2}, {"High", 3}, {"Extreme", 4}, {nullptr, 0}}; u32 ps_r2_smapsize = 2048; const ...
35,453
17,350
#include "stdafx.h" #include "MyDAQ.h" MyDAQ::MyDAQ() { } MyDAQ::~MyDAQ() { } TaskHandle MyDAQ::createWriteTask(string name) { TaskHandle Task = 0; name += "/port0/line4:7"; const char *c_str1 = name.c_str(); DAQmxCreateTask("", &Task); DAQmxCreateDOChan(Task, c_str1, "", DAQmx_Val_ChanForAllLines); retu...
544
252
#include "none.h" Encoders::None::None() {} void Encoders::None::process(std::vector<_postData> &_data) {} void Encoders::None::endProcess(std::vector<_postData> &_data) {}
173
66
#include <iostream> using namespace std; // create a class class Room { private: double length; double breadth; double height; public: double calculateArea() { return length * breadth; } double calculateVolume() { return length * breadth * height; } void set_length() { lengt...
811
314
/** * Copyright (c) 2011-2017 libbitcoin developers (see AUTHORS) * * This file is part of libbitcoin. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the Lic...
5,300
1,691
#include "features.hpp" #include "../../includes.hpp" #include <sstream> bool worldToScreen( const Vector& origin, Vector& screen ) { float w = Globals::worldToScreenMatrix[3][0] * origin.x + Globals::worldToScreenMatrix[3][1] * origin.y + Globals::worldToScreenMatrix[3][2] * origin.z + Globals::worldT...
10,511
3,801
#include <Matrix.hpp> #include <benchmark/benchmark.h> static void BM_init_double(benchmark::State &state) { std::vector<double> row_d(4, 6.786); std::vector<std::vector<double>> vec_d(6, row_d); for (auto _ : state) matrix.init(vec_d); } BENCHMARK(BM_init_double); static void BM_init_string(bench...
546
228
#include "inputwin.hpp" #include <iostream> inputwin::inputwin() : nc::window(nc::points_t(getmaxy(stdscr) - 5, 0, getmaxy(stdscr), getmaxx(stdscr)), nc::border_t(false, true, false, false)) {} void inputwin::on_focus() { clear(); echo(); wmove(winptr(), 1, 0); } void inputwin::get_input(std...
1,025
399
#include <cv.h> #include <highgui.h> int main( int argc, char** argv ) { IplImage* src; if( argc == 2 && (src=cvLoadImage(argv[1], 1))!= 0) { IplImage* h_plane = cvCreateImage( cvGetSize(src), 8, 1 ); IplImage* s_plane = cvCreateImage( cvGetSize(src), 8, 1 ); IplImage* v_plane = cvC...
2,001
791
#include "cml_golden.h" #include <cassert> #define GOLDEN_RADIO 0.6180339887498949L void GoldenSec::Iterate() { assert(func); long double fL, fR; func(xL, params, fL); func(xR, params, fR); if (fL < fR) { b = xR; xR = xL; xL = b - GOLDEN_RADIO * (b - a); } else { a = xL; xL = xR; xR = a + GOLDEN_RA...
548
306
#include "mainwindow.h" #include "ui_mainwindow.h" #include <iostream> #include <string> #include <filesystem> #include <QString> #include <QFileDialog> #include <fstream> #include <iostream> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), file_path() { ui->se...
1,352
476
/* * Copyright (C) 2012 Motorola Mobility Inc. * Copyright (C) 2013 Google Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above...
7,764
2,569
#ifndef __XG_SVG_PARSER_HPP__ #define __XG_SVG_PARSER_HPP__ #include <string> #include <xg/util/dictionary.hpp> #include <iostream> #include "svg_dom.hpp" namespace xg { class SVGLoadException ; class SVGDocument ; class SVGParser { public: SVGParser(SVGDocument &doc): document_(doc) {} void parseString(...
1,737
570
#include<bits/stdc++.h> using namespace std; struct Node{ int data; Node *left; Node *right; Node(int k){ data = k; left = NULL; right = NULL; } } Node *prev = NULL; Node *BTToDLL(Node *root){ if(root == NULL){ return root; } Node* head = BTToDLL(roo...
514
194
/** * @file llvowater.cpp * @brief LLVOWater class implementation * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser Ge...
7,638
3,234
/** * Copyright (c) 2021 OceanBase * OceanBase CE is licensed under Mulan PubL v2. * You can use this software according to the terms and conditions of the Mulan PubL v2. * You may obtain a copy of Mulan PubL v2 at: * http://license.coscl.org.cn/MulanPubL-2.0 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BAS...
4,986
1,902
#include "wiLoadingScreen.h" #include "wiApplication.h" #include <thread> namespace wi { bool LoadingScreen::isActive() { return wi::jobsystem::IsBusy(ctx); } void LoadingScreen::addLoadingFunction(std::function<void(wi::jobsystem::JobArgs)> loadingFunction) { if (loadingFunction != nullptr) { tasks.p...
1,104
434
#include "./graph_node.h" Node::Node() : val(0), neighbors(std::vector<Node*>()) { } Node::Node(int _val) : val(_val), neighbors(std::vector<Node*>()) { } Node::Node(int _val, std::vector<Node*> const & _neighbors): val(_val), neighbors(_neighbors) { }
264
111
#include <graph_types.hpp> #include <algorithm> #include <cassert> #include <string> #include <sstream> #include <iostream> #include <iterator> #include <stdexcept> #include <logger.hpp> #include <utils.hpp> #include <cstring> namespace types { template <class T, class Iterator> void tokenize(const char *str, Iterato...
17,967
6,897
/* GadgetAreaWeapon.cpp (c)2000 Palestar Inc, Richard Lyle */ #include "GadgetAreaWeapon.h" #include "GameContext.h" static Constant AI_USE_AREA_WEAPON( "AI_USE_AREA_WEAPON", 0.75f ); //---------------------------------------------------------------------------- IMPLEMENT_ABSTRACT_FACTORY( GadgetAreaWeapon, Noun...
5,015
2,075
/* * Copyright (C) 2009 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...
85,297
25,197
#include "TextureManager.h" SDL_Texture* TextureManager::LoadTexture(const char* fileName, SDL_Renderer* ren) { SDL_Surface* tmp = IMG_Load(fileName); SDL_Texture* texture = SDL_CreateTextureFromSurface(ren, tmp); SDL_FreeSurface(tmp); return texture; }
283
99
#include<bits/stdc++.h> using namespace std; #define ll long long ll compute_hash(string s){ const int p= 3; const int m= 1e9+9; ll hash_value= 0; ll p_pow= (ll)pow(p,s.length()-1); for(auto c:s){ hash_value= (hash_value+ (c-'a')*p_pow)%m; p_pow= p_pow/p; } return hash_value; } ll rolling_hash(ll H,string p...
976
506
#ifndef SHT30Node_hpp #define SHT30Node_hpp #include <Wire.h> #include <SHT3x.h> #include "SensorNode.hpp" class SHT30Node : public SensorNode { public: explicit SHT30Node(const char *id, const char *name, const int i2cAddress = 0x45); ~SHT30Node(); protected: virtual void setup() override; virt...
929
358
/************************************************************************************ Copyright (C) 2021 by Nicholas LaCroix 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 restrictio...
8,396
3,380
/******************************************************************************* * Copyright 2018 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.o...
26,399
10,362
// From: https://github.com/eteran/cpp-utilities/blob/master/fixed/include/eteran/cpp-utilities/Fixed.h // See also: http://stackoverflow.com/questions/79677/whats-the-best-way-to-do-fixed-point-math /* * The MIT License (MIT) * * Copyright (c) 2015 Evan Teran * * Permission is hereby granted, free of charge, to...
20,283
7,804