text
string
size
int64
token_count
int64
/* module: cvrin.c purpose: cube and cover input routines */ #include <iostream> #include <cmath> #include "espresso.h" static bool line_length_error; static int lineno; void skip_line(std::istream& fpin, std::ostream& fpout, bool echo) { int ch; while ((ch=fpin.get()) != EOF && ch != '\n') if (echo...
21,721
8,766
/*************************************************************************** * Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht * * * * Distributed under the terms of the BSD 3-Clause License. * * ...
1,901
597
#include <type_traits> #include "typelist/reverse.hpp" namespace candy { namespace test { namespace { struct FirstType; struct SecondType; using EmptyTL = Typelist<>; using FirstTL = Typelist<FirstType>; using SecondTL = Typelist<FirstType, SecondType>; using ReverseTL = Typelist<SecondType, FirstType>; static_ass...
595
200
/******************************************************************************* * Copyright (c) 2007, 2008, CerroKai Development * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistribu...
2,772
901
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. =================...
7,356
2,351
#include <tc/crypto/RsaKey.h> tc::crypto::RsaPublicKey::RsaPublicKey(const byte_t* modulus, size_t modulus_size) { static const byte_t kPublicExponent[3] = { 0x01, 0x00, 0x01 }; if (modulus != nullptr && modulus_size != 0) { this->n = tc::ByteData(modulus, modulus_size); this->e = tc::ByteData(kPublicExponent,...
985
411
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD 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, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without...
9,520
3,151
// StringUtils.cpp // This file is part of the EScript programming language (https://github.com/EScript) // // Copyright (C) 2011-2013 Claudius Jähn <ClaudiusJ@live.de> // Copyright (C) 2011-2012 Benjamin Eikel <benjamin@eikel.org> // // Licensed under the MIT License. See LICENSE file for details. // -----------------...
8,771
3,939
// Copyright (c) 2020 LG Electronics, 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 agre...
2,150
699
#include "PixelSampler.h" #include "Camera.h" namespace actracer { PixelSampler *PixelSampler::CreatePixelSampler(PixelSampleMethod method) { switch(method) { case PixelSampleMethod::JITTERED: return new JitteredPixelSampler(); } return nullptr; ...
1,167
373
#include "stdafx.h" #include "AprPool.h" #include "LibraryLoader.h" #include "SvnError.h" #include "SubversionClient.h" #include "SubversionContext.h" #include "Utils.h" #include "ChangeSet.h" #include "Item.h" #include "DiffSummaryCommand.h" #include "DownloadCommand.h" #include "ItemInfoCommand.h" #include "LatestR...
5,883
1,870
#include <gtest/gtest.h> #include <mcutils/math/DegMinSec.h> #include <mcutils/misc/Units.h> //////////////////////////////////////////////////////////////////////////////// class TestDegMinSec : public ::testing::Test { protected: TestDegMinSec() {} virtual ~TestDegMinSec() {} void SetUp() override {} ...
3,420
1,336
/* * File: ThreadDelayFault.cpp * Author: rmartins * * Created on May 3, 2013, 2:06 PM */ #include "ThreadDelayFault.h" ThreadDelayFault::~ThreadDelayFault() { }
175
78
#include<iostream> using namespace std; /* encode: 6bit to 8bit decode: 8bit to 6bit needs padding if: convert 3 bytes of 8 bit data into 4 chunks of 6 bits each don't add new value of 0 to buffer use = sign value char 0 A 16 Q 32 g 48 w 1 B 17 R 33 h 49 x 2 C 18 S 34 i 50 y 3 D 19 T 35 j 51 z 4 E 20 U 36 k 52 0 5 F ...
3,367
1,681
unsigned factorial(unsigned n) { if (n <= 1) { return 1; } return n * factorial(n - 1); } int main() { int i = 7; int j = factorial(i); return j; }
165
75
//====================================================================== /*! \file BsonT_Processing.cpp * * \copydoc Copyright * \author Kristian Bischoff (kb) * \date Feb 8, 2016 *///------------------------------------------------------------------- //=============================================================...
3,600
1,026
#include <stdio.h> int prime[20000005] = {1, 1, 0}; int answer[100005] = {0}; int main(void) { int cnt = 1; long long i, j; for(i = 3; i < 20000000 && cnt <= 100000; i += 2) { if(!prime[i]) { for(j = i * i; j < 20000000; j+=i) prime[j] = 1; if(!prime[i] && !prime[i-2]) answer[cnt++] = i-2...
443
261
/** * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. * http://soramitsu.co.jp * * 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/LICENS...
2,004
644
#include<string> #include<unordered_set> #include<algorithm> #include<iostream> using namespace std; class Solution { public: int lengthOfLongestSubstring(string s) { int n = s.size(); unordered_set<char> set; int length = 0,temp = 0; for (int i = 0; i < n; ++i) for (int j = temp; j < n; ++j) { if (se...
637
310
/* * Copyright (c) 2000, 2020, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ #include "coherence/lang/ClassNotFoundException.hpp" #include <sstream> COH_OPEN_NAMESPACE2(coherence,lang) // ----- constructors ----------...
563
190
#pragma once #include <functional> #include <string> #include "export.hpp" namespace ear { /// A warning message, containing a code and a corresponding message. The code /// does not need to be shown when displaying warnings; the message should /// contain all the information required, the code is just to allow ...
1,337
373
#ifndef VIF_INCLUDING_CORE_VEC_BITS #error this file is not meant to be included separately, include "vif/core/vec.hpp" instead #endif namespace vif { //////////////////////////////////////////// // Vectorization helpers // //////////////////////////////////////////// #define VIF_VECT...
15,233
4,996
#include "TrajetoManhattan.hpp" #include <cmath> double TrajetoManhattan::calcularDistanciaPontos(const Ponto* const p1, const Ponto* const p2) const{ return std::abs(p1->getCoordX() - p2->getCoordX()) + std::abs(p1->getCoordY() - p2->getCoordY()); }
254
107
#include <cstdio> #include <cmath> #include <iostream> #include <string> #include <cstring> #include <algorithm> #include <vector> #include <utility> #include <stack> #include <queue> #define fi first #define se second #define pb push_back #define mp make_pair #define pi 2*acos(0.0) #define eps 1e-9 #...
1,299
700
// Copyright (c) 2019-present, Facebook, Inc. // All rights reserved. // // This source code is licensed under the license found in the // LICENSE file in the root directory of this source tree. // #include <iostream> #include <cstdlib> #include <string> #include <vector> #include <fstream> #include <iomanip> #include...
1,789
1,074
#include<bits/stdc++.h> using namespace std; #define X first #define Y second #define pb push_back #define mp make_pair long long n; long long ar[60][10]; long long dp(long long idx,long long ch) { if(ar[idx][ch]!=-1) return ar[idx][ch]; if(idx==1) return ar[idx][ch]=1; if(ch!=1)///...
738
313
// https://leetcode.com/problems/loud-and-rich/ // In a group of N people (labelled 0, 1, 2, ..., N-1), each person has different // amounts of money, and different levels of quietness. // For convenience, we'll call the person with label x, simply "person x". // We'll say that richer[i] = [x, y] if person x definit...
1,609
511
#pragma once #include <string> #include <vector> #include <map> #include <set> #include <unordered_set> #include <unordered_map> namespace types { typedef int integer_t; typedef integer_t int_t; typedef unsigned int unsigned_integer_t; typedef unsigned_integer_t uint_t; typedef uint_t symbol_t; typedef ...
1,916
722
//////////////////////////////////////////////////////////////////////////////// //! \file AppDlg.hpp //! \brief The AppDlg class declaration. //! \author Chris Oldwood // Check for previous inclusion #ifndef APP_APPDLG_HPP #define APP_APPDLG_HPP #if _MSC_VER > 1000 #pragma once #endif #include <WCL/MainDlg.hpp> ...
746
242
// Copyright 2016 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 <memory> #include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/test/fake_image_serialization_proc...
3,925
1,185
#pragma once #include <atma/platform/allocation.hpp> import atma.types; namespace atma { namespace detail { constexpr size_t header_size = sizeof(size_t) + sizeof(std::atomic_uint32_t) + 4u; constexpr inline size_t allocation_size(size_t alignment, size_t size) { return header_size + (heade...
4,198
1,680
#include "stdafx.h" #include "ColorFlickerComponent.h" #include "GameObject.h" #include "SpriteComponent.h" #include "GameScene.h" #include "Destroyer.h" ColorFlickerComponent::ColorFlickerComponent(const DirectX::XMFLOAT4& colorA, const DirectX::XMFLOAT4& colorB, float speed, std::vector<SpriteComponent*> pS...
1,662
783
/******************************************************************************* * Copyright (c) 2020 robomaster-oss, All rights reserved. * * This program is free software: you can redistribute it and/or modify it * under the terms of the MIT License, See the MIT License for more details. * * You should hav...
1,669
580
#pragma once #include "Arp/System/Core/Arp.h" #include "Arp/Plc/Esm/ProgramBase.hpp" #include "Arp/System/Commons/Logging.h" namespace ProgramWithNestedAndStructInStruct { namespace MyComponent { using namespace Arp; using namespace Arp::Plc::Esm; //#program //#component(MyComponent) class MyProgramImpl ...
1,193
378
#include "al/app/al_App.hpp" #include "al/graphics/al_Font.hpp" #include "al/ui/al_Gnomon.hpp" using namespace al; struct MyApp : public App { Gnomon gnomon; FontRenderer fontRender; void onCreate() { fontRender.load(Font::defaultFont().c_str(), 24, 1024); } void onDraw(Graphics& g) { g.clear(0.2f); ...
690
293
/** ---------------------------------------------------------------------- * Copyright 2014 < Ammar Husain (Carnegie Mellon University) > * * @file pe1.cpp * @author Ammar Husain <ahusain@nrec.ri.cmu.edu> * @date Thu Jul 31 17:18:28 2014 * * @brief Boiler Plate * * ---------------------------------...
2,285
839
/*========================================================================* * * * Copyright (c) 2016 Whiteley Research Inc, all rights reserved. * * * * WHITELEY RE...
8,193
2,669
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int T; cin>>T; for(int i=0; i<T; i++) { double k1,k2,k3,v; cin>>k1>>k2>>k3>>v; double tans = 100/(k1*k2*k3*v); double t = (round(tans*100))/100; if (t<9.58) c...
409
183
#include "DepthRenderPass.h" #include "ResourceManagers/ShaderManager.h" #include "ResourceManagers/BufferManager.h" #include "Resources/Texture.h" #include "Renderer/IRenderer.h" #include "Renderer/RenderZooid.h" #include "Renderer/IGPURenderBuffer.h" #include "Renderer/IGPUFrameBuffer.h" #include "Renderer/IGPUTextu...
10,018
3,795
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/IVUsers.h" #include "llvm/Pass.h" #include "llvm/IR/Function.h" #include "llvm/Support/raw_ostream.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/Utils...
6,901
2,206
/* GPE_Audio.cpp This file is part of: GAME PENCIL ENGINE https://create.pawbyte.com Copyright (c) 2014-2019 Nathan Hurde, Chase Lee. Copyright (c) 2014-2019 PawByte LLC. Copyright (c) 2014-2019 Game Pencil Engine contributors ( Contributors Page ) Permission is hereby granted, free of charge, to any person...
2,699
994
/************************************************************** * * 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...
4,659
1,546
#include <iostream> #include <string> #include <vector> #include "Solver.h" #define COUNT_TIME_MAX 10001 using namespace std; template <class T> Solver<T>::Solver() {} template <class T> Solver<T>::~Solver() {} template <class T> bool Solver<T>::solverJacobi(int iterations, double allowed_convergence, T init_guess...
16,636
8,000
// Fill out your copyright notice in the Description page of Project Settings. #include "TestAttrModifyActor.h" //#if WITH_DEV_AUTOMATION_TESTS // Sets default values ATestAttrModifyActor::ATestAttrModifyActor() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you d...
2,153
776
// Copyright 2020 Hal@shurabaP. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. #ifndef UZUME_VOCODER_CONTOUR_HPP #define UZUME_VOCODER_CONTOUR_HPP namespace uzume { namespace vocoder { /** * Contour represents array values in time axis. ...
773
265
#include "cabinet.h" #include "trayitem.h" #include "shellapi.h" #include "strsafe.h" // // CTrayItem members... // DWORD CTrayItem::_GetStateFlag(ICONSTATEFLAG sf) { DWORD dwFlag = 0; switch (sf) { case TIF_HIDDEN: dwFlag = NIS_HIDDEN; break; ...
8,735
3,261
// // file: stdh.cpp // #include "dbsys.h"
52
30
#include "28BYJ.h" SP28BYJ::SP28BYJ(int pin1, int pin2, int pin3, int pin4) { _p1 = pin1; _p2 = pin2; _p3 = pin3; _p4 = pin4; pinMode(_p1, OUTPUT); pinMode(_p2, OUTPUT); pinMode(_p3, OUTPUT); pinMode(_p4, OUTPUT); _targetPosition = 0; _currentPosition = 0; _time = 12000; ...
2,930
1,160
#include "catch.hpp" #include "BinaryTreeRightSideView.hpp" TEST_CASE("Binary Tree Right Side View") { BinaryTreeRightSideView s; TreeNode *root = nullptr; SECTION("Sample test") { TreeNode *_5 = new TreeNode(5); TreeNode *_4 = new TreeNode(4); TreeNode *_2 = new TreeNode(2, nullpt...
605
214
// Autogenerated, do not edit #include <fonts/GeneratedFont.hpp> FONT_TABLE_LOCATION_FLASH_PRAGMA KEEP extern const touchgfx::GlyphNode glyphs_trebucbd_80_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE = { { 0, 0x0020, 0, 0, 0, 0, 24, 0, 1, 0x00 }, { 0, 0x003F, 29, 60, 59, 4, 35, 0, ...
2,012
1,228
/***************************************************************************** MIT License Copyright (c) 2021 byrcoder 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, includin...
5,907
1,806
/* * Created by Gustavo Viegas (2016/11) */ #ifndef UI_HXX #define UI_HXX #include <SFML/Graphics.hpp> #include <vector> class UI { public: UI(int digits = 3); ~UI(); void loadConf(const std::string& fileName); void update(int score, double updateInterval); void draw(sf::RenderWindow* screen); ...
495
191
#include "nr.h" void NR::mrqmin(Vec_I_DP &x, Vec_I_DP &y, Vec_I_DP &sig, Vec_IO_DP &a, Vec_I_BOOL &ia, Mat_O_DP &covar, Mat_O_DP &alpha, DP &chisq, void funcs(const DP, Vec_I_DP &, DP &, Vec_O_DP &), DP &alamda) { static int mfit; static DP ochisq; int j,k,l; int ma=a.size(); static Mat_DP *oneda_p;...
1,607
960
#include "CodeCommon.h" #include "ConsoleHelp.h" #include <algorithm> #include <map> namespace globals { std::vector<BranchType> globalFunctions; std::vector<BranchType> globalBranches; const size_t globalLocationColumn = 50; size_t globalImageBase = 0; } // globals std::string GenerateName( std::stri...
16,621
8,683
#include "cpm/Logging.hpp" #include "cpm/CommandLineReader.hpp" #include "cpm/init.hpp" #include "cpm/HLCCommunicator.hpp" #include "cpm/Writer.hpp" #include "VehicleCommandTrajectory.hpp" #include "Eight.hpp" #include <iostream> #include <memory> #include <stdlib.h> using std::vector; //Description for bash files...
5,800
1,844
#ifndef COSINESIM #define COSINESIM #include <unordered_map> #include "itemuser.hpp" class CosineSimilarity { private: // Data std::unordered_map<int, std::unordered_map<int, double>> computedSimilarities; // Methods std::unordered_map<int, double> getKNearestNeighbors(std::unordered_map<int, double> ...
428
161
// Implement this. DON'T CLOSE IT #include<bits/stdc++.h> #define mt make_tuple #define mp make_pair #define pu push_back #define INF 1000000001 #define MOD 998244353 #define ll long long int #define ld long double #define vi vector<int> #define vll vector<long long int> #define sc(n) scanf("%d",&n); #define scll(n) sc...
2,581
1,226
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. /**************************************************************************** Unit tests for the TCntPtr smart pointer ****************************************************************************/ #include "precomp.h" #include <atomic> #includ...
12,642
4,761
// AUTOGENERATED FILE - DO NOT MODIFY! // This file generated by Djinni from foo_duplicate_file_creation.djinni #pragma once #include <atomic> #include <experimental/optional> #include "Foo_Callback2.hpp" #ifdef __cplusplus extern "C" { #endif #include "cw__Foo_Callback2.h" #ifdef __cplusplus } #endif struct Djinni...
1,226
411
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/profiler/tfprof_log.proto #include "tensorflow/core/profiler/tfprof_log.pb.h" #include <algorithm> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite....
230,241
86,819
#include "CanvasPath.h" #include "SubPath.h" #include "CircularStack.h" BEGIN_CANVAS_NAMESPACE CanvasPath::CanvasPath() { _maxNumSubPaths = DEFAULT_STACK_SIZE; _maxPathLength = DEFAULT_STACK_SIZE; _needsNewSubpath = false; _subPaths = CircularStack<SubPath>(); } CanvasPath::CanvasPath(unsigned ...
816
313
/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
33,944
11,684
#ifndef MUTANTSTACK_H #define MUTANTSTACK_H #include <stack> template <typename T> class MutantStack : public std::stack<T> { public: typedef typename std::stack<T>::container_type::iterator iterator; typedef typename std::stack<T>::container_type::const_iterator const_iterator; typedef typename std::stac...
1,194
381
#pragma once #include "RawBuffer.hpp" #include "depthai-shared/common/Point3f.hpp" #include "depthai-shared/utility/Serialization.hpp" namespace dai { /// ImgDetection structure struct ImgDetection { uint32_t label; float confidence; float xmin; float ymin; float xmax; float ymax; }; DEPTHAI...
789
271
/************************************************************* * > File Name : P3367_test.cpp * > Author : Tony * > Created Time : 2019/09/21 17:57:40 * > Algorithm : ufs **************************************************************/ #include <bits/stdc++.h> using namespace std; i...
1,933
749
// DUNE-copasi ini file generation // - iniFile class: simple ini file generation one line at a time #pragma once #include <QString> namespace sme { namespace simulate { class IniFile { private: QString text; public: [[nodiscard]] const QString &getText() const; void addSection(const QString &str); void ...
1,155
360
/* Copyright 2020 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include <boost/config.hpp> struct base { virtual void first() = 0; virtual void second() { } }; struct derived : base { void first() BOOST_OVE...
370
140
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance w...
3,673
1,094
// 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 "net/cert/ev_root_ca_metadata.h" #include "build/build_config.h" #include "net/cert/x509_cert_types.h" #include "net/der/input.h" #include "...
8,404
3,655
#ifndef BASECELL_H #define BASECELL_H #include <memory> #include <vector> namespace FenestrationCommon { enum class Side; class CSeries; } namespace SingleLayerOptics { class CMaterial; class ICellDescription; class CBeamDirection; // Handles optical layer "cell". Base behavior is to calculate specular (di...
1,692
537
#ifndef CRAMER3_HPP_ #define CRAMER3_HPP_ #include "sarrus.hpp" template<class Real> void cramer3(Real *px,Real *py,Real *pz, Real a11,Real a12,Real a13, Real a21,Real a22,Real a23, Real a31,Real a32,Real a33, Real b1,Real b2, Real b3 ) { Real det; *px = sarrus(b1 ,a12,a13, b2 ,a22...
561
344
/* * 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...
2,446
822
#include "spectrum.h" #include <pybind11/pybind11.h> #include <pybind11/numpy.h> namespace py = pybind11; void sfs_mse_expectation(Spectrum::MSE & mse, const double * gamma, const double * h, const double F, const double * proportion, const int num_categories, const double theta, const double num_sites); py::array_t...
3,555
1,437
// // main.cpp // // This program implements the classic permutation function from // statistics: // // P(n, k) = n! / (n - k)! // // in such a way as to avoid overflow for potentially large factorials. // // -------------------------------------------------------------------------- // Attribution: "Programming Abst...
3,649
1,135
// // xctest_process.hpp // xctest // // Created by Daher Alfawares on 8/29/17. // Copyright © 2017 Daher Alfawares. All rights reserved. // #ifndef xctest_process_hpp #define xctest_process_hpp #include <string> #include <sstream> namespace xctest { class process { public: process(std::string pr...
444
167
#include <jni.h> #include <iostream> #include <typeinfo> #include "m3g/m3g.hpp" #include "java-Loader.hpp" #include "java-m3g-common.hpp" using namespace m3g; using namespace std; void* getNativePointer (JNIEnv* env, jobject obj) { if (obj == 0) { return NULL; } jclass clazz = env->GetObjectC...
5,759
1,947
void bug() { //theory //√w^2 + (l + h)^2 = minimum //3d pythagoras int length, width, height; std::cout << "Enter length: "; std::cin >> length; std::cout << "\nEnter width: "; std::cin >> width; std::cout << "\nEnter height: "; std::cin >> height; float ret = sqrt(...
443
161
#include "gtest/gtest.h" TEST(SW_World_Calculator_SpellboundCalculator, calc_pct_chance_spellbound) { CreaturePtr creature = std::make_shared<Creature>(); creature->set_willpower(3); creature->get_resistances().set_resistance_value(DamageType::DAMAGE_TYPE_ARCANE, 1.0); SpellboundCalculator sc; EXPECT_EQ...
611
258
#ifndef RIGIDBODYOBJECTCOMPONENT_H_ #define RIGIDBODYOBJECTCOMPONENT_H_ #include "physics/CollisionShapeHandle.hpp" #include "physics/RigidBodyObjectHandle.hpp" #include "serialization/Serialization.hpp" namespace ice_engine { namespace ecs { struct RigidBodyObjectComponent { RigidBodyObjectComponent() = default; ...
1,605
556
#include <node.h> #include <node_buffer.h> #include <v8.h> #include "node_sharedmemory.h" #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/sem.h> #include <stdexcept> using namespace v8; void NODE_SharedMemory::Init(Handle<Object> exports) { Local<FunctionTempl...
8,843
3,330
#include "gl30_texture.h" namespace octoon { namespace hal { OctoonImplementSubClass(GL30Texture, GraphicsTexture, "GL30Texture") GL30Texture::GL30Texture() noexcept : _texture(GL_NONE) , _target(GL_INVALID_ENUM) , _pbo(GL_NONE) , _pboSize(0) { } GL30Texture::~GL30Texture() noexcept { th...
6,591
3,190
/** * Copyright (c) 2016 Tiny Express Project. 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 condit...
23,128
7,579
#pragma once #include <algorithm> #include <atomic> #include <memory> #include "chunk.hpp" namespace opossum { // The ProxyChunk class wraps chunk objects and implements the RAII pattern // to track the time a particular chunk has been in scope. These times are // measured using the RDTSC instructions and are store...
865
277
class Solution { public: int rev(int num) { int ret = 0; while (num) { ret = ret * 10 + num % 10; num /= 10; } return ret; } int countNicePairs(vector<int>& nums) { int ret = 0; vector<int> v; map<int, int> m; for (int i = 0; i < nums.size(); i++) { int f = nums[i] - rev(nums[i]); if(m.count(f)) ret...
376
205
/* Copyright 2001, 2019 IBM Corporation * * 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 d...
2,088
822
#include "drake/multibody/fem/dev/linear_constitutive_model.h" #include "drake/common/unused.h" namespace drake { namespace multibody { namespace fem { template <typename T> LinearConstitutiveModel<T>::LinearConstitutiveModel(const T& youngs_modulus, const T& poisso...
4,014
1,628
/*========================================================================= * * Copyright NumFOCUS * * 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.or...
4,029
1,208
// Functions for the <see cref=Pib54Ame"/> class to handle 1954 pib-ame // conversion table. // // $Id: pib54ame.cpp 1.2 2011/08/08 08:45:12EDT 044579 Development $ #include "pibtable.h" #include "Resource.h" #include "PiaException.h" // <summary>The 1954 ame's.</summary> const double Pib54Ame::ame54[] = {...
2,083
1,553
#include "header.hpp" // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(nullptr) {} }; class Solution { public: ListNode* rotateRight(ListNode* head, int k) { if (!head || !head->next || k == 0) return head; int len = 1; ...
700
228
#include <Wire.h> #include <HX711.h> #define I2C_ADDRESS 0x08 #define OFFSET -102300 #define SCALE -822.0 #define P_DOUT PD5 #define P_SCK PD6 float current_value; HX711 scale; void requestEvent() { Serial.println("request event"); Wire.write((byte*)&current_value, sizeof(float)); } void setup() { Serial.be...
758
329
#ifndef SHIFT_SCENE_RENDERER_HPP #define SHIFT_SCENE_RENDERER_HPP #include <shift/core/abstract_factory.hpp> #include "shift/scene/entity.hpp" namespace shift { namespace scene { class renderer { public: }; } } #endif
229
100
class MedianFinder { public: void addNum(int num) { if (maxHeap.empty() || num <= maxHeap.top()) maxHeap.push(num); else minHeap.push(num); // balance two heaps s.t. // |maxHeap| >= |minHeap| and |maxHeap| - |minHeap| <= 1 if (maxHeap.size() < minHeap.size()) maxHeap.push(minHe...
699
284
#include <algorithm> #include <cassert> #include <functional> #include <iostream> #include <vector> static void PrintVec(std::vector<int> const& vec) { if (vec.empty()) { return; } auto cit = vec.cbegin(); std::cout << (*cit++); while(cit != vec.cend()) { std::cout <<...
4,202
1,319
#include "echo.pb.h" #include "args.pb.h" #include "Log.h" #include "rpc/RpcClient.h" #include <assert.h> #include <stdio.h> #include <memory> using namespace melon; using namespace melon::rpc; using namespace cherry; std::shared_ptr<RequestAppendArgs> constructAppendArgs() { std::shared_ptr<RequestAppendArgs> appe...
2,095
795
#include "Box.h" #include "doubleArray.h" #define INFINITY ((unsigned) ~0) bool Box::contains(const Vector2& point) const { return point.x >= left - EPSILON && point.x <= right + EPSILON && point.y >= bottom - EPSILON && point.y <= top + EPSILON; } Box::Intersection Box::getFirstIntersection(const Vec...
3,674
1,231
#include<bits/stdc++.h> using namespace std; int main() { int n,r,k,i,count; while(cin>>n) { k=count=0; if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%444==0 || n%447==0 || n%474==0) cout<<"YES"<<endl; else { while(n!=0) { r...
583
228
// DefaultPropertyControl.cpp: Default implementation of the IPropertyControl interface #include "stdafx.h" #include "DefaultPropertyControl.h" #ifdef INCLUDESUBITEMCALLBACKCODE DefaultPropertyControl::Properties::~Properties() { if(pOwnerExLvw) { pOwnerExLvw->Release(); } } ////////////////////////////...
4,212
1,613
#include "test.h" #include "readFromFile.h" #include <iostream> using namespace std; bool test() { set<int> noStateVertecies; vector<int> states; //Test1 Graph* graph1 = createGraph(); readFromFile("test1.txt", graph1, states, noStateVertecies); distributeCities(graph1, states, noStateVertecies); vector<int>...
1,502
601
/** * The Access Modes and Permissions * * SPDX-License-Identifier: MIT * * Copyright (C) 2022, Reto Achermann (The University of British Columbia) */ #ifndef _ACCESS_MODE_H_ #define _ACCESS_MODE_H_ 1 // access permissions #define ACCESS_PERMISSION_USER_READ (1 << 0) #define ACCESS_PERMISSION_USER_WRITE (1 ...
1,237
483
#include <iostream> using namespace std; void MoveTowers(int n, int tower1[52], int tower2[52], int tower3[52]) { if (n == 1) { int temp = tower1[--tower1[1]]; tower3[tower3[1]++] = temp; cout << "move disk " << temp << " from tower " << tower1[0] << " to tower " << tower3[0] << endl; ...
977
420