text
string
size
int64
token_count
int64
#include "Settings.h" bool Settings::LoadSettings(const bool a_dumpParse) { auto [log, success] = J2S::load_settings(FILE_NAME, a_dumpParse); if (!log.empty()) { _ERROR("%s", log.c_str()); } return success; } decltype(Settings::globalSpeedMult) Settings::globalSpeedMult("globalSpeedMult", 1.0f); decltype(Se...
2,041
719
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "posting_priority_queue.hpp" #include "posting_priority_queue_merger.h" namespace search { template <class Reader, class Writer> void PostingPriorityQueueMerger<Reader, Writer>::mergeHeap(W...
4,507
1,396
#ifndef MainScene_hpp #define MainScene_hpp #include <stdio.h> #include <iostream> #include <ft2build.h> #include <map> #include <thread> #include <queue> #include FT_FREETYPE_H #include "Scene.hpp" #include "Definitions.h" #include "Animation.hpp" #include "Utils.hpp" #include "SpriteMap.hpp" #include "ShaderProgram....
967
336
/*! \file Framebuffer.inl * \author Jared Hoberock * \brief Inline file for Framebuffer.h. */ #include "Framebuffer.h" Framebuffer::Framebuffer(void):Parent() { setTarget(GL_FRAMEBUFFER_EXT); } // end Framebuffer::Framebuffer() void Framebuffer::attachTexture(const GLenum textureTarget, ...
1,905
482
//////////////////////////////////////////////////////////////////////////////////////// // // CLASSFAC.CPP // // Purpose: Contains the class factory. This creates objects when // connections are requested. // // Copyright (c) 1997-2002 Microsoft Corporation, All Rights Reserved // ///////////////...
5,320
1,790
/* //////////////////////////////////////////////////////////// File Name: yswin32systemfont.cpp Copyright (c) 2017 Soji Yamakawa. All rights reserved. http://www.ysflight.com Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are me...
12,373
5,874
#pragma once namespace cmsl::sema { class add_declarative_file_node; class add_subdirectory_node; class add_subdirectory_with_declarative_script_node; class add_subdirectory_with_old_script_node; class binary_operator_node; class block_node; class bool_value_node; class break_node; class cast_to_reference_node; class ...
6,028
1,874
// // Created by MurphySL on 2020/10/23. // #include "weavess/component.h" namespace weavess { void ComponentSearchRouteGreedy::RouteInner(unsigned int query, std::vector<Index::Neighbor> &pool, std::vector<unsigned int> &res) { const auto L = index->getPar...
41,473
11,763
/********************************************************************** * Copyright (c) 2008-2016, Alliance for Sustainable Energy. * All rights reserved. * * 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 t...
3,909
1,302
// Copyright 2015 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 "platform/graphics/BitmapImageMetrics.h" #include "platform/Histogram.h" #include "third_party/skia/include/core/SkColorSpaceXform.h" #include "...
4,345
1,547
#include <bits/stdc++.h> using namespace std; int tab[1000009]; pair <int, int> srt[1000009]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for(int i = 1; i <= n; i++) { cin >> tab[i]; srt[i] = make_pair(tab[i], i); } ...
1,249
505
// 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 may...
13,436
4,511
#include "Direct3DDevice8.h" bool gamerender = false; CDirect3DDevice8::CDirect3DDevice8(IDirect3D8* d3d, HWND hwnd, IDirect3DDevice8* device, D3DPRESENT_PARAMETERS* pPresentationParameters) : m_d3d(d3d) , m_device(device) { } CDirect3DDevice8::~CDirect3DDevice8() { } HRESULT WINAPI CDirect3DDevice8...
17,728
6,670
#include "LoadDataWidget.h" LoadDataWidget::LoadDataWidget(QWidget *parent) : QWidget(parent) { m_gui.setupUi(this); QWidget::setWindowTitle("Select files!"); m_gui.lineEdit_test->setText("/Users/abdullah/Desktop/gender_detection/src/material/test"); m_gui.lineEdit_training->setText("/Users/abdull...
1,952
691
#include <iostream> #include "console.h" #include "simpio.h" #include "stack.h" using namespace std; struct HanoiTask { int num_disks; char start_pile; char finish_pile; char temp_pile; }; const char PILE_A = 'A'; const char PILE_B = 'B'; const char PILE_C = 'C'; void MoveHanoiTower(int n); void Move...
2,305
851
/* * BSD 3-Clause License * * 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 copyright notice, this * list of conditions and the following disc...
2,682
1,017
//---------------------------------Spheral++----------------------------------// // FixedSmoothingScale // // Implements the static fixed smoothing scale option. // // Created by JMO, Wed Sep 14 13:50:49 PDT 2005 //----------------------------------------------------------------------------// #ifndef __Spheral_NodeSpac...
3,150
850
#include "gtest/gtest.h" #include "../Verkehrssituation.h" class VerkehrssituationTest : public testing::Test { protected: void SetUp() override { verkehrssituation = Sensor::Verkehrssitation(); } Sensor::Verkehrssitation verkehrssituation; }; TEST_F(VerkehrssituationTest , has_data) { auto me...
2,252
804
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ #include "bdb.h" #include "configuration.h" #include <cassert> #include <sstream> #ifdef HAVE_LIBDB namespace fawn { BDB::BDB() : dbp_(NULL) { } BDB::~BDB() { if (dbp_) Close(); } FawnDS_Return...
14,400
4,938
/* * box2ddestructionlistener.cpp * Copyright (c) 2011 Joonas Erkinheimo <joonas.erkinheimo@nokia.com> * Copyright (c) 2011 Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> * * This file is part of the Box2D QML plugin. * * This software is provided 'as-is', without any express or implied warranty. * In no event wi...
4,924
1,260
////////////////////////////////////////////////// /// Group Members: Andrew Kim, Ethan Rodriguez /// ////////////////////////////////////////////////// #include <iostream> using namespace std; class State { public: State(); void printSize() const; void setName(string name) { this->name = name;...
1,259
408
#include "mpiconvolution.h" #include "utils.h" using namespace std; using namespace utils; using namespace fftwpp; void init(Complex **F, unsigned int X, unsigned int Y, unsigned int Z, unsigned int x0, unsigned int y0, unsigned int z0, unsigned int x, unsigned int y, unsigned int z, ...
7,224
2,879
/////////////////////////////////////////////////////////////////////////////// // // IMPORTANT NOTICE // // The following open source license statement does not apply to any // entity in the Exception List published by FMSoft. // // For more information, please visit: // // https://www.fmsoft....
4,132
1,233
#include "ProcessLauncher.h" namespace nac { ProcessLauncher::ProcessLauncher(std::string strFilePath_,std::string strDirectory_) : strFilePath(strFilePath_), strDirectory(strDirectory_) { if (strDirectory.empty()) { std::string strTemp; split_path(strFilePath,strDirectory,strTemp); } } ...
1,044
400
#include <stdio.h> #include <string.h> #include <stdlib.h> void print_rgb(int q) { float r = ((q >>16) & 0xff); float g = ((q >> 8) & 0xff); float b = (q & 0xff); float y = r * 0.299f + g * 0.587f + b * 0.114f; float u = 0.492f * (b - y); float v = 0.492f * (r - y); fprintf(stdout, "%.1f ...
806
387
/* * factory.cpp is part of the Movie Store Simulator, a C++ program that * offers the function of borrow, return, or stock with up to 10,000 * customers and 26 genres of movies * * @author Bill Zhao, Lucas Bradley * @date March 12th */ #include "factory.h" #include <iostream> // buildMovie takes a string Inpu...
616
202
#include <boost/ut.hpp> // boost::ut relies on static destructors so if // we don't defer LLVM coverage report until after // ut's destructor we won't get any coverage. #if defined(__llvm__) && defined(ANGONOKA_COVERAGE) extern "C" { int __llvm_profile_runtime; void __llvm_profile_initialize_file(void); int __llvm_pro...
554
194
/* * MtpMetadataCache.cpp * * Author: Jason Ferrara * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 3 as published by the Free Software Foundation. * * This software is distributed in the hope that it will be useful...
2,791
1,077
/* * Copyright (c) 2013, Hernan Saez * 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 con...
4,176
1,272
#pragma once #include <PP/compose.hpp> #include <PP/cv_qualifier.hpp> #include <PP/decompose_pair.hpp> #include <PP/overloaded.hpp> #include <PP/to_type_t.hpp> #include <PP/value_t.hpp> namespace PP { PP_CIA decompose_const = compose( overloaded( []<typename T>(type_t<const T>) { return...
548
206
// // matchOrder.cpp // study6 // // Created by yujeong on 2021/03/05. // #include <iostream> #include <algorithm> #include <vector> using namespace std; int tc , n; int rus_r[100], kor_r[100]; vector<int> russian; vector<int> korean; int match() { sort(korean.begin(), korean.end()); int res = 0; for ...
989
403
/* * Copyright © 2012-2013 Red Hat, Inc. * * 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...
9,427
3,262
#include <iostream> using namespace std; long long n; long long num(long long x) { if (x < 3) return x; long long r = x / 3, m = x - r - (r << 1); return (m + 1) * num(r) + m; } int main() { cin >> n; cout << n - num(n); return 0; }
256
109
/************************************************************************* * Copyright (c) 2015, Synopsys, Inc. * * All rights reserved. * * * * Redistribution and...
9,590
3,427
#include <iostream> using namespace std; int main() { long long n; cin >> n; if(n & 1) cout << -1LL * (n + 1LL) / 2LL << '\n'; else cout << n / 2LL << '\n'; }
169
83
#include <iostream> #include <string> #include <fstream> #include <definitions.h> #include <coords.h> #include <particlefilter.h> #include <random> struct LogData { int stamp; std::vector<Robot> poseEstimates; Robot wcs; std::vector<Robot> hypos; std::vector<DirectedCoord> odo; std::vector<Visi...
4,417
1,364
#include <GL/glew.h> #include "VboBufferVec2.hpp" namespace MGL { VboBufferVec2::VboBufferVec2(std::vector<Vec2> const& data) : m_data(data) {} void VboBufferVec2::bufferData(int const location) const { bind(); glBufferData(GL_ARRAY_BUFFER, m_data.size() * sizeof(Vec2), &m_data.at(0), GL_STATIC_DRAW); glVer...
473
201
const String forward = "/smartcar/control/throttle/forward"; const String reverse = "/smartcar/control/throttle/reverse"; const String left = "/smartcar/control/steering/left"; const String right = "/smartcar/control/steering/right";
233
70
// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet.h" #include "walletdb.h" #include <stdint.h> #include <boost/foreach.hpp> #include <boost/test/unit_te...
4,515
1,992
//////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2005 // Packet Engineering, Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification is not permitted unless authorized in writing by a duly // appointed officer of ...
6,202
2,381
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: fltkImage2DViewerWindow.cxx,v $ Language: C++ Date: $Date: 2002/10/15 15:16:54 $ Version: $Revision: 1.20 $ Copyright (c) 2002 Insight Consortium....
13,688
4,959
/* * fontLoader.hpp * * Created on: Jul 23, 2016 * Author: Tomas Stibrany */ #ifndef FONT_FONTLOADER_HPP_ #define FONT_FONTLOADER_HPP_ #include "../chip8Types.hpp" namespace chip8 { namespace core { namespace memory { class RAM; } } } namespace chip8 { namespace font { class Font; } } using ...
573
245
// Copyright (c) 2012 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 "chrome/browser/ui/pdf/pdf_unsupported_feature.h" #include "base/bind.h" #include "base/utf_string_conversions.h" #include "base/values.h" #...
15,151
4,879
// Copyright 2004-2008 Roman Yakovenko. // 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 __temporary_variable_to_be_exported_hpp__ #define __temporary_variable_to_be_exported_hpp__ #include <string> nam...
1,897
681
// -*- C++ -*- #if !defined(__cpt_Face3_ipp__) #error This file is an implementation detail of the class Face. #endif namespace cpt { //! A 3-D face on a b-rep. template<typename T> class Face<3, T> { public: // // Public types. // //! The number type. typedef T Number; //! A...
20,057
6,424
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <cassert> using namespace std; namespace { template <typename T> class AddElements final { public: explicit AddElements(const T elem1) : elem1_{elem1} { } T add(const T elem2) { return ele...
1,434
460
#ifndef LEDS_HPP #define LEDS_HPP #include "hwlib.hpp" /// @file /// \brief /// leds class /// \details /// This is a class for color for 5 leds. class leds{ private: hwlib::pin_out & l1; hwlib::pin_out & l2; hwlib::pin_out & l3; hwlib::pin_out & l4; hwlib::pin_out & l5; /// \brief /// ...
953
370
// Distributed under the BSD 2-Clause License - Copyright 2012-2021 Robin Degen #include <aeon/math/size2d.h> #include <aeon/math/size2d_stream.h> #include <gtest/gtest.h> using namespace aeon; TEST(test_size2d, test_size2d_default_int) { [[maybe_unused]] math::size2d<int> size; } struct external_size2d { i...
1,274
619
/* CirKit: A circuit toolkit * Copyright (C) 2009-2015 University of Bremen * Copyright (C) 2015-2017 EPFL * * 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, in...
4,852
1,648
// // Created by grant on 1/2/20. // #include "gtest/gtest.h" #include "stms/log_test.cpp" #include "stms/async_test.cpp" #include "stms/general.cpp" #if STMS_SSL_TESTS_ENABLED // Toggle SSL tests, disable for travis # include "stms/ssl_test.cpp" #endif
259
113
#include "com_bitvectortest.h" // Library headers. #include <boost/shared_ptr.hpp> #include <boost/test/test_tools.hpp> #include <boost/test/unit_test_suite.hpp> // PCRaster library headers. // Module headers. #include "com_bitvector.h" /*! \file This file contains the implementation of the BitVectorTest clas...
1,395
477
#ifndef __SINGLETON_HPP__ #define __SINGLETON_HPP__ #include "noncopyable.hpp" namespace etl { namespace utils { template<class T> class singleton : public noncopyable { public: static T& instance() { static T i; return i; } protected: singleton() {} }; } //utils } //etl #endif // __...
336
129
#include <iostream> #include "CUnit.h" #include "CExceptionUnit.h" #include "CArcUnit.h" #include "CVertexUnit.h" #include "CGraphUnit.h" #include "CGraphParserUnit.h" #include "CHashMapUnit.h" #include "../CException.h" #include "CGraphToolboxUnit.h" void CUnit::UNITassertError(const char * pcMessage) { perror(pcMes...
1,524
578
/******************************************************************************\ * Author: Matthew Beauregard Smith * * Affiliation: The University of Texas at Austin * * Department: Oden Institute and Institute for Cellular and Molecular Biology...
14,440
5,547
//16bit binary adder with carry #include<iostream> using namespace std; uint16_t b16_adder(uint16_t a,uint16_t b) { uint32_t total32=0; total32=a+b; uint16_t rem=(total32>>16); uint16_t total16=(total32); uint16_t real_total=(total16+rem); return real_total; } //pointer to data array and array size uint16_t c...
635
302
/** * * You can modify and use this source freely * only for the development of application related Live2D. * * (c) Live2D Inc. All rights reserved. */ #include "L2DMatrix44.h" namespace live2d { namespace framework { L2DMatrix44::L2DMatrix44() { identity(); } ...
2,524
1,029
#include "setting.h" #include "math/fft.h" #include "utils/logger.h" #include "audio/audio_tools.h" using namespace bacchus; const float tol18 = 1e-4f; const int ulpDif = 256*1024; void FftCrossTest(const matxf& x, const matxcx& resy) { matxcx y = DFT(x); int n = y.size(); EXPECT_EQ(resy.size(), n); f...
1,926
973
// Generated by the gRPC C++ plugin. // If you make any local change, they will be lost. // source: gimbal/gimbal.proto #include "gimbal/gimbal.pb.h" #include "gimbal/gimbal.grpc.pb.h" #include <functional> #include <grpcpp/impl/codegen/async_stream.h> #include <grpcpp/impl/codegen/async_unary_call.h> #include <grpcp...
25,842
8,891
// This file is part of the "x0" project, http://github.com/christianparpart/x0> // (c) 2009-2018 Christian Parpart <christian@parpart.family> // // Licensed under the MIT License (the "License"); you may not use this // file except in compliance with the License. You may obtain a copy of // the License at: http://op...
9,983
3,534
#/********************************************************************************/ #/* */ #/* Copyright 2011 Alexander Vorobyev (Voral) */ #/* http://va-soft.ru/ ...
78,938
22,805
#ifndef __PBDCEX_CORE_EX_HPP_XX__ #define __PBDCEX_CORE_EX_HPP_XX__ #pragma once #include <cstdio> #include <cstdarg> #include <cstdint> #include <cstring> #include <cassert> #include <string> #include <algorithm> namespace pbdcex { namespace util { static inline uint64_t FNV_1A_Hash64(const unsigned char * data, s...
24,246
8,053
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved // Plugin written by Philipp Buerki. Copyright 2017. All Rights reserved.. #include "../OnlineSubsystemB3atZUtils/Public/B3atZOnlineBeacon.h" #include "Engine/NetConnection.h" #include "EngineGlobals.h" #include "Engine/Engine.h" DEFINE_LOG_CATEGORY(LogBeaco...
5,951
2,102
// Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include <gtest/gtest.h> #include <interpolate_shape_inference.hpp> #include <openvino/op/constant.hpp> #include <openvino/op/interpolate.hpp> #include <openvino/op/parameter.hpp> #include <utils/shape_inference/shape_inference.hpp...
7,208
2,607
#include<iostream> #include<bits/stdc++.h> using namespace std; //Macros #define read(a) scanf("%d",&a) #define CLEAR(a,b) memset(a,b,sizeof(a)) #define VI(a) vector<a> #define lld long long int #define ulld unsigned long long int #define PI acos(-1.0) #define Gamma 0.5772156649015328606065120900824024310421 int arr...
1,107
538
/** * \file dnn/src/naive/elemwise_multi_type/opr_impl_1.cpp * MegEngine is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distri...
4,730
1,883
#include <fcntl.h> #include <string.h> #include "LocalConn.h" #include "Tunnel.h" #include "lib/Util.h" void LocalConn::handleRead() { try{ int bs = splice(fd_, NULL, pipe_fds_[1], NULL, 2048, SPLICE_F_MOVE | SPLICE_F_NONBLOCK); if (bs < 0) { SPDLOG_CRITICAL("proxy_id: {} local_fd: {} -> pipe_fd: {} ...
1,361
645
#include "gtclang_dsl_defs/gtclang_dsl.hpp" using namespace gtclang::dsl; stencil Test { storage a, b, c; var tmp; Do { // MS0 vertical_region(k_start, k_start) { tmp = a; } vertical_region(k_start + 1, k_end) { b = tmp(k - 1); } // MS1 vertical_re...
490
207
// DlgStats.cpp : implementation file // #include "stdafx.h" #include "bwchart.h" #include "DlgStats.h" #include "regparam.h" #include "bwrepapi.h" #include "DlgHelp.h" #include "DlgMap.h" #include "Dlgbwchart.h" #include "gradient.h" #include "hsvrgb.h" #include "overlaywnd.h" #include "ExportCoachDlg.h...
129,465
53,138
//#define STB_IMAGE_IMPLEMENTATION #include "RenderingSystem.h" #include "RenderingSystemV2.h" #include "InputEventSystem.h" #include "FPSControlSystem.h" #include "RotateSystem.h" #include "RotateSystemV2.h" #include "FireworksSystem.h" #include "GravityForceSystem.h" #include "DragForceSystem.h" #include "F...
29,311
11,742
#pragma once #include <optional> #include <vector> namespace http { struct RequestState { public: bool abort = false; bool want_line = false; std::optional<size_t> want_bytes; bool ready_to_respond = false; bool in_valid_state() const; }; } std::ostream& operator<<(std::ostream& o, ...
369
117
#include "BackSurfaceCull.hpp" void BackSurfaceCull::operator()(std::shared_ptr<Model> &model, const Point3f &eye) const { std::vector<Polygon> remaining; const auto &polygons = model->Polygons(); const auto &points = model->Points(); const auto &normals = model->Normals(); for (const auto &polyg...
872
288
////////////////////////////////////////////////////////////////////////////////// //// //// cagey-engine - Toy 3D Engine //// Copyright (c) 2014 Kyle Girard <theycallmecoach@gmail.com> //// //// The MIT License (MIT) //// //// Permission is hereby granted, free of charge, to any person obtaining a copy //// of this so...
2,687
856
/* * Copyright (c) 2008 James Molloy, Jörg Pfähler, Matthew Iselin * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "A...
8,085
2,801
#include "Omega_h_timer.hpp" namespace Omega_h { Now now() { Now t; t.impl = std::chrono::high_resolution_clock::now(); return t; } Real operator-(Now b, Now a) { return std::chrono::duration_cast<std::chrono::nanoseconds>(b.impl - a.impl) .count() * 1e-9; } } // end namespace Omega_h...
321
127
#include <CGAL/convex_hull_3.h> #include <possumwood_sdk/node_implementation.h> #include "datatypes/meshes.h" #include "errors.h" namespace { using possumwood::CGALPolyhedron; using possumwood::Meshes; typedef possumwood::CGALPolyhedron Mesh; dependency_graph::InAttr<Meshes> a_inMesh; dependency_graph::OutAttr<Me...
1,321
501
/**************************************************************************/ /** ** @file tListInputData.cpp ** @brief Functions for class tListInputData. ** ** Modifications: ** - changed .tri file format from points-edges-triangles to ** points-triangles-edges, compatible with earlier format (gt 1/98) ...
6,353
2,060
#include <cstddef> #include <cstdint> #include <iostream> #include "types.hpp" uint8_t x[] { 101, 27, 3, 95 }; int main () { uint_sat8_t s = 25; for (const auto& v : x) { s -= v; } // s == 0 s++; // s == 1 for (const auto& v : x) { s *= v; } unsigned j = s; // s == 255 ...
353
164
#include <iostream> #include <stack> #include <string> #include <vector> /* * Solutions: * * 1. Brute-force. We generate every possible substring and if the substring is valid, update the result * to be the length of the longest one of these substrings. * * Time complexity: O(n^3) [where n is the length of the i...
2,522
799
// // Copyright (C) 2004-2011 by Autodesk, Inc. // // This library is free software; you can redistribute it and/or // modify it under the terms of version 2.1 of the GNU Lesser // General Public License as published by the Free Software Foundation. // // This library is distributed in the hope that it will be use...
8,952
2,897
#include <Nephilim/Foundation/DataStream.h> #include <Nephilim/Foundation/IODevice.h> #include <Nephilim/Foundation/String.h> #include <assert.h> #include <stdio.h> NEPHILIM_NS_BEGIN /// Constructs a invalid data stream DataStream::DataStream() : m_device(NULL) { } /// Constructs a data stream from a device DataSt...
4,864
1,929
// // bpfrequencytracker.cpp // barcode_project // // Created by luzhao on 4/21/16. // Copyright © 2016 luzhao. All rights reserved. // #include "bpfrequencytracker.hpp" #include <array> #include <cassert> #include <vector> using std::array; using std::vector; namespace barcodeSpace { BPFrequencyTracker::BPF...
1,881
633
/* * transport.inl * * Created on: Feb 8, 2016 * Author: zmij */ #ifndef WIRE_CORE_TRANSPORT_INL_ #define WIRE_CORE_TRANSPORT_INL_ #include <wire/core/transport.hpp> #include <wire/util/debug_log.hpp> namespace wire { namespace core { template < typename Session, transport_type Type > transport_listener<...
2,627
824
#ifndef MATH_HPP #define MATH_HPP #include <cfloat> #include <cmath> #include <iostream> #include <vector> #include "glm/glm.hpp" using namespace std; #define FLT_CMP(a, b) (abs(a-b)<=FLT_EPSILON) #define DEG2RAD(x) (x*M_PI/180.0) #define RAD2DEG(x) (x*180.0/M_PI) template <typename T> ostream& operator<<(ostream& o, ...
3,249
1,249
#include "anagram.h" namespace anagram { anagram::anagram(string s) { word = s; } vector <string> anagram::matches(vector <string> v) { size_t w; for (int i = 0; i < v.size(); i++) { if (word.length() == v[i].length()) { temp1 = v[i]; for (int j = 0; j < v[i].length(); j++) { v...
732
425
#include "game.h" #include "gui/pause.h" #include "objects/tank.h" #include "util/profiler.h" #include <keypadc.h> #define PLAYER_BARREL_ROTATION DEGREES_TO_ANGLE(5) //1/3 of a second for 90 degree rotation #define PLAYER_TREAD_ROTATION (DEGREES_TO_ANGLE(90) / (TARGET_TICK_RATE / 3)) void handle_movement() { Tan...
2,902
1,136
#include <tuple> #include <cmath> using namespace std; class btb_set_t { public: btb_line_t *lines = NULL; uint8_t depth = 0; // ==================================================================== /// Methods // ====================================================...
1,001
302
#include "../../template.hpp" void GetKMaxSums(vi arr, int k) { int n = arr.size(); vi presum(n + 1); for (int i = 1; i <= n; ++i) { presum[i] = arr[i - 1] + presum[i - 1]; } vi sums; for (int i = 1; i <= n; ++i) { for (int j = i; j <= n; ++j) { sums.push_back(presum...
1,463
633
#include <cxlog/logger/logger.h> NAMESPACE_CXLOG_BEGIN void Logger::Log(Level level, const char *file, std::size_t line, const char *func, std::string &&msg) const { const Additional &additional = this->additional; std::vector<Context> contexts; contexts.reserve(additional.statics->size() + additiona...
2,141
710
// Ivan Carvalho // Solution to https://dmoj.ca/problem/bts17p4 #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; vector<ii> todos; vector<int> menores; int N,M,J; int checa(int t){ menores.clear(); for(ii d : todos){ if(d.second <= t) menores.push_back(d.first); } sort(menores.begin(),menor...
781
407
/*************************************************************************** qgsgrasstools.cpp ------------------- begin : March, 2005 copyright : (C) 2005 by Radim Blazek email : blazek@itc.it *************...
22,647
7,485
 //------------------------------------------------------------------- // include //------------------------------------------------------------------- #include "weoExceptionMessageCreator.h" #include <sstream> namespace pm_mode { /******************************************************************** ...
1,311
453
#ifndef SHADER_HPP_ #define SHADER_HPP_ #include "../jmax.hpp" #include <string> #include <vector> namespace jmax { class Shader { public: Shader(std::string const& filePath, GLenum shaderType = 0); virtual ~Shader(); public: static GLuint compileShaderFile(std::string const& shaderFilePath, GLenum shaderTyp...
546
199
#include <iostream> using namespace std; class Node { public: Node *next; int data; }; void printList(Node *n) { while (n != NULL) { cout << n->data << "\t"; n = n->next; } } void insertAtFront(Node **start_node, int data) { Node *new_node = new Node(); new_node->data = d...
816
300
#include <cstdio> #include <cstring> #include <iostream> #define int long long const int MAX_N = 2000050; const int MOD = 19930726; std::string d, s; int re[MAX_N], cnt[MAX_N]; int n, nn, k; void init(); void manacher(); int quick_pow(int a, int b); signed main() { std::ios::sync_with_stdio(false); std:...
1,807
762
version https://git-lfs.github.com/spec/v1 oid sha256:338e6e57d5446ad622a48ab505a62e4ddf72367f1dd3bd9dee9773f0f43ab857 size 1576
129
90
#include "MTVDemo.hpp" #include "BroadphaseDemo.hpp" int main(int argc, char **argv) { sf::RenderWindow window(sf::VideoMode(800, 600), "Crash2D Demo"); window.setFramerateLimit(60); Demo *demo = new MTVDemo(window); size_t demoId = 0; while (window.isOpen()) { // check all the window's events that were trigg...
974
456
#include "dice.h" #include "randgen.h" // implementation of dice class // written Jan 31, 1994, modified 5/10/94 to use RandGen class // modified 3/31/99 to move RandGen class here from .h file Dice::Dice(int sides) // postcondition: all private fields initialized { myRollCount = 0; mySides = sides; } i...
1,007
354
#include "ProxyResolver.h" #if _WIN32_WINNT < 0x0602 // This stuff became available with Windows 8 # define WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE 0x01000000 # define WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE # define API_GET_PROXY_FOR_URL (6) ...
14,096
4,569
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; #ifndef ONLINE_JUDGE template<typename T> void pr(T a){std::cerr<<a<<std::endl;} template<typename T,typename... Args> void pr(T a, Args... args) {std::cerr<<a<<' ',pr(args...);} #else template<typename... Args> void pr(Ar...
896
458
#include "townmgr.h" #include "companymgr.h" #include "interop/interop.hpp" #include "openloco.h" using namespace openloco::interop; namespace openloco::townmgr { static loco_global_array<town, 80, 0x005B825C> _towns; std::array<town, max_towns>& towns() { auto arr = (std::array<town, max_towns>*...
1,127
428