text stringlengths 8 6.88M |
|---|
#pragma once
#include "config.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <vector>
namespace octotiger {
struct fx_args
{
std::int64_t opts_eos;
std::int64_t opts_problem;
double opts_dual_energy_sw1;
double opts_dual_energy_sw2;
double physcon... |
//
// Created by zlc on 2021/5/26.
//
#include "../include/part_slam/gridfastslam/gridslamprocessor.h"
namespace GMapping
{
using namespace std;
// const double ScanMatcher::nullLikelihood = -.5;
// 单个节点的构造函数: 树的节点,一个树存了以整条轨迹,一个节点表示这条轨迹中的其中一个点。存储激光雷达的整条轨迹
GridSlamProcessor::TNode::TNode(const OrientedPoint& p, TN... |
#ifndef _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_ANALYTICAL_JACOBIAN_MATRIX_CALCULATOR_HPP_
#define _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_ANALYTICAL_JACOBIAN_MATRIX_CALCULATOR_HPP_
#include "hs_sfm/bundle_adjustment/camera_shared_jacobian_matrix.hpp"
namespace hs
{
namespace sfm
{
namespace ba
{
template <typename... |
#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<int> intersect(vector<int> &nums1, vector<int> &nums2)
{
map<int, int> m;
for (int i = 0; i < nums1.size(); i++)
{
auto itr = m.find(nums1[i]);
if (itr != m.end())
itr->second++;
else
... |
#ifndef FASTCG_CONSTANT_BUFFER_H
#define FASTCG_CONSTANT_BUFFER_H
#include <glm/glm.hpp>
#include <vector>
#include <string>
#include <memory>
#include <initializer_list>
#include <cstring>
#include <cstdint>
#include <cassert>
#ifdef max
#undef max
#endif
namespace FastCG
{
class ConstantBuffer
{
publi... |
/*
* URITable.cpp
*
* Created on: Apr 17, 2010
* Author: root
*/
#include "URITable.h"
#include "StringIDSegment.h"
#include <string.h>
URITable::URITable() {
SINGLE.assign("single");
prefix_segment = NULL;
suffix_segment = NULL;
}
URITable::URITable(const string dir) : SINGLE("single") {
// TODO Auto... |
#include<stdlib.h>
#include<stdio.h>
struct tree
{
int data;
struct tree* left;
struct tree* right;
};
struct tree* root=NULL;
struct tree* tnn(int data)
{
struct tree* ptr=(struct tree*)malloc(sizeof(struct tree));
ptr->data=data;
ptr->left=NULL;
ptr->right=NULL;
return ptr;
}
struct tree* insert(struct tree ... |
//
// Copyright (c) 2003--2009
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// 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)
//
// THIS FILE IS AUTOMATICALLY GENERATED
... |
//
// Copyright Jason Rice 2020
// 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 NBDL_CONCEPT_PATH_HPP
#define NBDL_CONCEPT_PATH_HPP
#include <boost/hana/concept/sequence.hpp>
#include <boost/hana/is_e... |
// we should find gcd of (a,b)
// a can be massive 0 <= a <= 10 power of 250
// for b 0<= b <=10 power of some 4
// wkt gcd(a,b) = gcd(b,a%b) our main objective is to make a%b to be within integer range
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);... |
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode*... |
#include "ovpCAlgorithmMatrixMaximum.h"
#include <assert.h>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
using namespace OpenViBEPlugins;
using namespace OpenViBEPlugins::SignalProcessing;
boolean CAlgorithmMatrixMaximum::initialize(void)
{
//bind input ... |
#pragma once
#include <iostream>
#define SIMD_NONE 0
#define SIMD_SSE 10
#define SIMD_SSE2 20
#define SIMD_SSE3 30
#define SIMD_SSSE3 31
#define SIMD_SSE4_1 41
#define SIMD_SSE4_2 42
#define SIMD_AVX 50
#define SIMD_FMA3 51
#define SIMD_AVX2 60
#ifdef _MSC_VER
#include <intrin.h>
#if defined(__AVX2__)
#define SIMD_... |
//
// Created by Amelia Chady on 11/27/2018.
// An implementation of ArraySoundMap
//
#include "ArraySoundMap.h"
#include "ArrayList.h"
#include "LinkedList.h"
#include "Util.h"
#include <fstream>
ArraySoundMap::ArraySoundMap() {
fileName = "defaultSounds.txt";
}
ArraySoundMap::ArraySoundMap(std::string fileName... |
#include "ros/ros.h"
#include "oroca_ros_tutorials/msgTutorial.h"
#include "ceSerial.h"
#include "parser_vercpp.hpp"
#include <iostream>
#include <string>
#include <signal.h>
typedef unsigned char BYTE;
/*
volatile int j=0;
void handler(int sig){
j=1;
return;
}
*/
int main(int argc, char** argv){
... |
#include <iostream>
#include <queue>
using namespace std;
int m,n;
int tmp;
int cnt=0;
int visit[1001][1001]={0,};
int G[1001][1001] ={0,};
queue<pair<int, int> > q;
int dir[4][2] = {{0, 1}, {1,0}, {-1,0}, {0,-1}};
int generate(){
if(cnt==0) return 0;
int day=1;
while(!q.empty()){
int s = q.size();
for(i... |
#include <iostream>
using namespace std;
struct Array
{
int *A;
int size;
int length;
};
void Display(struct Array arr)
{
for(int i=0; i<arr.length; i++){
cout << arr.A[i] << " ";
}
}
void Insert(struct Array *arr, int index, int x)
{
if(index >=0 && index <= arr->length){
for... |
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
#include "UserInterface.h"
#include "SimulatorLogic.h"
#include "Consola.h"
#define DEFAULT_BACKGROUND_COLOR Consola::PRETO
#define BORDER_COLOR Consola::BRANCO
#define TRACK_BORDER_COLOR Consola::VERDE
#define PRINT_LOG_... |
/* Data Structure: Arrays and Strings
*
* Implement an algorithm to determine if a string has all unique chracters
* Additionally: Implement this without using additional data structures or memory space.
* -- basic use for arrays and strings
* -- brute force : O(n^2) complexity and O(1) space complexity
* ... |
// Copyright 2018 Global Phasing Ltd.
//
// Selections.
#ifndef GEMMI_SELECT_HPP_
#define GEMMI_SELECT_HPP_
#include <string>
#include <cstdlib> // for strtol
#include <cctype> // for isalpha
#include <climits> // for INT_MIN, INT_MAX
#include "util.hpp" // for fail
#include "model.hpp" // for Model, Chain, e... |
#ifndef PERF_TOOL_H
#define PERF_TOOL_H
#include <string>
#include "Base.h"
class PerfTool
{
public:
// 开始性能检测
static std::string RTSP_EXPORT startCPUProfiler();
// 停止性能检测
static std::string RTSP_EXPORT stopCPUProfiler();
// 开始分析堆栈
static std::string RTSP_EXPORT startHeapPro... |
// MemoryManager.h
// Handles memory pages. Yay!
//
#ifndef MEMORYMANAGER_H
#define MEMORYMANAGER_H
#include "copyright.h"
#include "bitmap.h"
#include "synch.h"
class MemoryManager {
public:
MemoryManager();
~MemoryManager();
int getPage();
void clearPage(int i);
int freePages();
private:
BitMap* ... |
#pragma once
#include <memory>
#include <string>
#include "drake/common/drake_copyable.h"
#include "drake/common/drake_deprecated.h"
#include "drake/multibody/multibody_tree/multibody_plant/multibody_plant.h"
#include "drake/systems/controllers/inverse_dynamics.h"
#include "drake/systems/controllers/pid_controller.h"... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxN 100001
int ar[maxN],st[4*maxN];
void buildtree(int si,int ss,int se)
{
if(ss==se)
{
st[si]=ar[ss];
return;
}
int mid=(ss+se)/2;
buildtree(2*si,ss,mid);
buildtree(2*si+1,mid+1,se);
st[si]=st[2*si]... |
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
vector<int > v(a+1);
v[a] = 1;
for(int i = c ; i < b ; i++){
v[i] = 1;
}
int num = 0;
for(int i = 0 ; i < v.size() ; i++)if(v[i]==1)num++;
cout << num;
return... |
#ifndef MATH_Vec2d_3562362386348_HEADER
#define MATH_Vec2d_3562362386348_HEADER
#include "Common.h"
namespace solar
{
//Two dimensional vector of doubles
template<typename T>
class Vec2
{
public:
T x, y;
Vec2() { x = y = T(); }
constexpr explicit Vec2(T x, T y = T()) :x(x), y(y) {}
Vec2(const Vec2<T>&) =... |
/**
* Date: 2019-11-08 21:59:30
* LastEditors: Aliver
* LastEditTime: 2019-11-08 23:59:27
*/
#include <iostream>
#include <unistd.h>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <sys/types.h> // mkfifo
#include <sys/stat.h>
#include <sys/wait.h>
using namespace std;
void exitWithError(const ... |
#include <string>
typedef std::string SStr;
typedef std::wstring WStr;
typedef std::string String;
|
#pragma once
#include "Types.hpp"
namespace engine
{
Int64 StringToInt64(const char* str, const char** endPtr = nullptr);
Uint32 StringLen(const char* str);
} // namespace engine
|
/**
* Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* ... |
#include "kernel.hh"
#include <bscheduler/base/error.hh>
#include <unistdx/base/make_object>
namespace {
inline bsc::kernel::id_type
get_id(const bsc::kernel* rhs) {
return !rhs ? bsc::mobile_kernel::no_id() : rhs->id();
}
}
void
bsc::kernel::read(sys::pstream& in) {
base_kernel::read(in);
bool b = false;
... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n;
cin>>n;
string s;cin>>s;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("op.txt","w",stdout);
#endif
int t=1;
//cin>>t;
while(t--){
solve();
}
} |
/***********************************************************************
created: 27/7/2015
author: Yaron Cohen-Tal
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2015 Paul D ... |
#include "rectangle.hpp"
#include <cmath>
#include "color.hpp"
#include "mat2.hpp"
#include "vec2.hpp"
#include "window.hpp"
Rectangle::Rectangle() :
min_{ 0.0,0.0 },
max_{ 1.0,1.0 },
color_{ 0,0,0 }
{}
Rectangle::Rectangle(Vec2 const& min, Vec2 const& max) :
min_{ min },
max_{ max }
{}
Rectangle::Rectangle(Vec... |
//
// Compiler/AST/StatementIf.cpp
//
// Brian T. Kelley <brian@briantkelley.com>
// Copyright (c) 2007, 2008, 2011, 2012, 2014 Brian T. Kelley
//
// Chris Leahy <leahycm@gmail.com>
// Copyright (c) 2007 Chris Leahy
//
// This software is licensed as described in the file LICENSE, which you should have received as part... |
/* map.h -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 20 Apr 2014
FreeBSD-style copyright and disclaimer apply
std::map reflection.
*/
#pragma once
#include "reflect.h"
#include "dsl/basics.h"
#include "dsl/template.h"
#include "dsl/function.h"
#include "dsl/operators.h"
#... |
#ifndef MATHTOOLBOX_CONSTANTS_HPP
#define MATHTOOLBOX_CONSTANTS_HPP
namespace mathtoolbox
{
namespace constants
{
constexpr double pi = 3.14159265358979323846264338327950288;
}
} // namespace mathtoolbox
#endif // MATHTOOLBOX_CONSTANTS_HPP
|
/*
* wmcgui.h
* created by WMCoolmon
*
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*
*/
#pragma once
#include "globalincs/alphacolors.h"
#include "globalincs/linklist.h"
#include "globalincs/pstypes.h"
#include "io/mouse.h"
#include "ship/ship.h"
... |
/*
# Copyright 2018 Daniel Selsam. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
/*************************************************************
* > File Name : P4525.cpp
* > Author : Tony
* > Created Time : 2019/06/02 12:29:38
* > Algorithm : [Math]SimpsonIntegral
**************************************************************/
#include <bits/stdc++.h>
using name... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string s;
cin >> s;
int n = s.size();
if(s[n-2] == 'p' && s[n-1] == 'o') {
cout << "FILIPINO" << endl;
}
else if(s[n-4] == 'm' && s[n-3] == 'a' && s[n-2] == 's' &... |
#include <iostream>
#include <stdlib.h>
#include <string>
#include <fstream>
#include <map>
#include <list>
#include <sstream>
#include <vector>
#include "map_list.hpp"
#include "map_signals.hpp"
#include "component.hpp"
#include "wire.hpp"
# define TRUE 1
# define FALSE 0
#define CONSERVATIVE FALSE
#define PRECISE TRU... |
#include<bits/stdc++.h>
using namespace std;
vector<int> FindNumbersWithSum(vector<int> array,int sum) {
int n = array.size();
vector<int> res(2,0);
vector<int> nu;
int resmin = INT_MAX,flag = 0;
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
if(array[j] == sum - a... |
//
//
// gamma and related functions from Cephes library
// see: http://www.netlib.org/cephes
//
// Copyright 1985, 1987, 2000 by Stephen L. Moshier
//
//
#include "SpecFuncCephes.h"
//#include "math.h"
#include <cmath>
#include <limits>
//#include <stdlib.h>
//namespace ROOT {
//namespace Math {
//namespace Ce... |
#pragma once
#include "Elevator.h"
#include <fstream>
#define RUN Scheduling::getInstance()
class Scheduling {
public:
static Scheduling* getInstance();
void assignment(); // 进行乘客分配
void execute(); // 执行分配的结果
Indicator schedulingMaking(const Elevator*); // 进行电梯调度
void clear();
void clearElevator();
void clearP... |
#pragma once
#include <vector>
#include <iostream>
/*!
* \brief The Interpolation class
* stores the polynomial interpolation methods
* \author Łukasz Dyraga
* \version 1.0
*/
class Interpolation//Lagrange
{
public:
Interpolation();
double calculate(const double &arg, const std::vector<double> &valueX, const st... |
#include<stdio.h>
#include<iostream>
#include<vector>
#include<list>
class Global_Clock
{
int counter;
};
class JobGen_PJS : public Job
{
public:
JobGen_PJS() : Job(){}
};
class Node_PJS
{
};
class CCU_Node
{
int memory_usage;
};
class PJS_Node
{
};
class CCU_PJS
{
};
class communication : Global_Clo... |
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
int main()
{
int n,a,k;
cin>>n>>k;
vector<int>v,v1;
unordered_map<int,int>mp;
long long sum=0;
for(int i=0;i<n;i++)
{
cin>>a;
v.push_back(a);
mp[a]=i+1;
}
long long ans=1;
sort(v.... |
#ifndef TETRA_MESH_HELPER_H
#define TETRA_MESH_HELPER_H
#include "MeshHash.h"
#include <max.h>
#include <vector>
#include <iostream>
//------------------------------------------------------------------------------------
struct TetraMeshTriangle
{
public:
void init() {
vertexNr[0] = -1; vertexNr[1] = -... |
/*
To Include in the Description.ext:
#include "Sounds\_Sounds.hpp"
*/
tracks[] = {};
class emp_phase
{
name = "EMP_Phase_M";
sound[] = {"saef_therift\Sounds\emp\emp_phase.ogg", 1, 1.0};
};
class emp_rift
{
name = "EMP_Rift_M";
sound[] = {"saef_therift\Sounds\emp\emp_rift.wss", 1, 1.0};
};
class emp_rift_... |
#ifndef DeviceSensor_h
#define DeviceSensor_h
#include "vector"
#include "tuple"
#include "../OneWire/OneWire.h"
#include "../DallasTemperature/DallasTemperature.h"
#include "Arduino.h"
#include "../ArduinoJson/ArduinoJson.h"
#include "SensorDatasheet.h"
#include "SensorInDevice.h"
// Data wire is plugged into por... |
#define _CRT_SECURE_NO_WARNINGS
//연산자 오버로딩
//+ - * / -> 기본 자료형에만 유효한 연산자, 클래스나 다른 자료형은 유효하지 않다.
#include <cstdio>
#include <cstring>
class Vector {
public:
float X;
float Y;
Vector() {
X = 0.0f;
Y = 0.0f;
}
Vector(float x, float y) {
this->X = x;
this->Y = y;
}
void printInfo(float x, float y) {
... |
/***************************************************************************
* Filename : LayerStack.h
* Name : Ori Lazar
* Date : 29/10/2019
* Description : Declaration of a layer vector wrapper, contains all active application
* which are iterated over every frame.
.---.
.'_:___".
... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 1000;
int i = 0;
unsigned long long sum = 0;
while( ++i < n){
sum += ( (i%3 == 0 || i%5 == 0) ? i : 0 );
}
printf("%llu\n", sum);
}
|
#pragma one
#ifndef __OUTPUT_H_ICLUDED__
#define __OUTPUT_H_ICLUDED__
#include <3ds.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include "../includes/utils.h"
class Output
{
private:
std::vector<std::string> messageLog;
bool inReverse;
public:
... |
// -*- C++ -*-
//
// Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory,
// Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC
//
// This file is part of FreePOOMA.
//
// FreePOOMA is free software; you can redistribute it and/or modify it
// under the terms of the Expat license.
//
// This progr... |
#ifndef BSCHEDULER_DAEMON_MASTER_DISCOVERER_HH
#define BSCHEDULER_DAEMON_MASTER_DISCOVERER_HH
#include <chrono>
#include <iosfwd>
#include <unistdx/base/log_message>
#include <unistdx/net/interface_address>
#include <unistdx/net/ipv4_address>
#include <bscheduler/api.hh>
#include <bscheduler/ppl/socket_pipeline_even... |
/*
used to caculate the sin fuc
@ amaswz superwenzg@gmail.com
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <sstream>
#include <fstream>
#include <iostream>
using namespace std;
typedef pair <double,double> Point;
class Newdon_it
{
public:
Newdon_it(const int num_of_inter_point)
:_noi... |
#ifndef SPRITE_H
#define SPRITE_H
#include <assert.h>
#include <d3d9.h> // core direct3d
#include <d3dx9.h> // aux libs
#define SPRITE_READ_FROM_FILE -5925499 /* read the property from the file */
// Why is it -5925499? It was too likely
// someone would WANT TO SCALE by -1.
// So we chose a lar... |
//
// Created by hw730 on 2020/6/12.
//
#ifndef DEFENCE_GAME_BULLETLINKLIST_H
#define DEFENCE_GAME_BULLETLINKLIST_H
class BulletLinkList {
};
#endif //DEFENCE_GAME_BULLETLINKLIST_H
|
/*
* Copyright (C) 2012-2016 Open Source Robotics Foundation
*
* 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 a... |
#include <iostream>
void reset(int &);
int main()
{
int i = 4;
std::cout << "initial value i = " << i << std::endl;
reset(i);
std::cout << "after reset: i = " << i << std::endl;
std::cout << "Bye!\n";
return 0;
}
void reset(int & i)
{
i = 0;
}
|
// Copyright (c) 2020 gladcow
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BTC_UTILS_CHAINPARAMS_H__
#define BTC_UTILS_CHAINPARAMS_H__
#include <vector>
#include <string>
namespace btc_utils
{
enum network_t
{
m... |
/*====================================================================*
- Copyright (C) 2001 Leptonica. 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 c... |
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#include <flux/File>
#include <flux/Dir>
#include <flux/Singleton>
#include <flux/Arguments>
#include "NodeConfigProtocol.h"
#include "ServiceRegistry.h"
#include "E... |
#ifndef FASTCG_IMGUI_SYSTEM_H
#define FASTCG_IMGUI_SYSTEM_H
#include <FastCG/Input/InputSystem.h>
#include <FastCG/Core/System.h>
#include <cstdint>
namespace FastCG
{
struct ImGuiSystemArgs
{
const uint32_t &rScreenWidth;
const uint32_t &rScreenHeight;
};
class ImGuiSystem
{
... |
#include "LLQueue.h"
template <class T>
LLQueue<T>::LLQueue()
{
Front = Rear = nullptr;
count = 0;
}
template <class T>
LLQueue<T>::LLQueue(const LLQueue<T> &other)
{
if (count == 0)
{
this->LLQueue<T>::LLQueue();
}
else
{
count = other.count;
Node *cur = other.Front;
Front = new Node(cur->data);
Rea... |
#pragma once
#include "Polygon.hpp"
class Circulo : public Polygon {
private:
float raio;
const float pi;
public:
Circulo(float raio, bool boo);
double getArea() override;
double getPerimetro() override;
};
|
#pragma once
#include "Sensor.h"
class Speed :
public Sensor
{
public:
Speed() {};
Speed(float value)
: Sensor(value) {};
void update();
~Speed();
};
|
#include "AdditionalParsing.h"
Position AdditionalParsing::parseCoords(std::string coord)
{
char delimiter = ',';
int lineDelim = coord.find(delimiter);
std::string x, y;
x = coord.substr(0, lineDelim);
y = coord.substr(lineDelim + 1, coord.size());
return Position(atoi(x.c_str()), atoi(y.c_str()));
}
|
#pragma once
#include "Node.h"
class LinkedList
{
private:
Node * Head;
Node* CreateNode(int val);
// Returns the last node.
Node* GetLastNode();
void DeleteAtStart();
public:
LinkedList();
~LinkedList();
// Inserts a value at the end.
void Insert(int val);
// Inserts the element at the start.
void I... |
#pragma once
#include <vector>
#include <string_view>
#include <string>
extern const size_t kStringReserve;
class AkinatorTree {
public:
struct Node {
size_t left_bound = 0;
size_t right_bound = 0;
size_t left = 0; // true subtree
size_t right = 0; // false subtree
size_t parent = 0;
};
... |
#include <iostream>
#include <exception>
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/dynamic_message.h>
#include "codec.h"
void test_read_proto()
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
//muduo::Query query;
//query.set_id(1);
//query.set_questioner("Chen Shuo");
//query.add_question("Ru... |
// it's same for both directed and undirected graph
#include<bits/stdc++.h>
using namespace std;
bool solve(vector<int>* edges,int v)
{
if(v==0)
{
return true;
}
set<int> s[2];
queue<int> Q;
// we will start from 0;
Q.push(0);
// we will insert 0 in first set
s[0].insert(0);
while(Q.size()!=0)
{
int cu... |
// 9. Palindrome Number
// Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
// Example 1:
// Input: 121
// Output: true
// Example 2:
// Input: -121
// Output: false
// Explanation: From left to right, it reads -121. From right to left, it becomes ... |
/* NO WARRANTY
*
* BECAUSE THE PROGRAM IS IN THE PUBLIC DOMAIN, THERE IS NO
* WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
* LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE AUTHORS
* AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
* WARRANTY OF ANY KIND, EITHER E... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Devices.1.h"
WINRT_EXPORT namespace winrt {
namespace Windows::Devices {
struct ILowLevelDevicesAggregateProvider :
Windows::Foundation::IInspectable,
impl::consume... |
#include "io.hpp"
#include <vector>
#include <fstream>
#include <landstalker-lib/model/map.hpp>
#include <landstalker-lib/model/map_connection.hpp>
#include <landstalker-lib/tools/stringtools.hpp>
#include <landstalker-lib/tools/json.hpp>
#include "../logic_model/data/world_path.json.hxx"
#include "../logic_model/wo... |
#include<stdio.h>
#include<malloc.h>
int fib(int);
int main(){
int n=999;
fib(n);
return 0;
}
int fib(int n){
long long f[n+1];
long long i;
f[0]=0;
f[1]=1;
printf(" %d %d ", f[0],f[1]);
for(i=2;i<n;i++){
f[i]=f[i-1]+f[i-2];
printf(" %d ", f[i]);
}
return f[n];
}
|
#pragma once
#include <random>
// Util Random is a singleton class that allows us to generate a random number within a fixed range
// it uses elements from the C++11 update to replace the use of rand().
class UtilRandom
{
public:
UtilRandom();
~UtilRandom();
// GetRange returns a random number between min and max... |
#pragma once
#include <landstalker-lib/patches/game_patch.hpp>
#include "../../logic_model/randomizer_world.hpp"
#include "../../logic_model/world_teleport_tree.hpp"
/**
* This patch updates the map connections between the teleport tree maps to reflect potential changes that have
* been made to the teleport tree p... |
#ifndef PISTOL_BULLET_H_INCLUDED
#define PISTOL_BULLET_H_INCLUDED
#include "gameobjects/weapons/bullet.h"
#include <iostream>
class PistolBullet : public Bullet {
public:
virtual bool on_wall_collision(const std::vector<Rectangle>& player_positions, std::function<void(int, double)> damage_player) override;
... |
#include <iostream>
#include "mystring.h"
using namespace std;
MyString::MyString(){
str = nullptr;
strLength=0;
}
//------------------------
MyString::MyString(const char * str1)
{
int si=0;
while (str1[si] != '\0'){
si++;
}
str = new char [si+1];
for(int i=0; i< si; i++) str[i] = str1[i]... |
#ifndef SCALEDEV_H
#define SCALEDEV_H
#include <QtCore>
#include "iodev.h"
class ScaledIoDev: public IoDev
{
public:
ScaledIoDev() {}
virtual ~ScaledIoDev()=0;
protected: // наступні функції потрібні тільки на сервері, можливо їх варто винести в окремий клас і класам-нащадкам, які спілкуються із реальними при... |
#include "returncommand.h"
#include "store.h"
ReturnCommand::ReturnCommand():searchCustomer(0,"","")
{
}
ReturnCommand::ReturnCommand(int customerID, char type, char subtype,
std::string data): searchCustomer(customerID, "", "")
{
searchRentable = buildRentable(type, subtype, data);... |
#include "wizDocumentTransitionView.h"
#include <QtGui>
CWizDocumentTransitionView::CWizDocumentTransitionView(QWidget *parent) :
QWidget(parent)
{
m_labelHint = new QLabel(this);
QVBoxLayout* layout = new QVBoxLayout();
layout->addStretch(1);
layout->addWidget(m_labelHint);
layout->addStretc... |
//
// TonalityEncoder.h
// PianoPlayer
//
// Created by Ben Smith on 11/2/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include "SpatialEncoder.h"
class TonalityEncoder : public SpatialEncoder
{
public:
TonalityEncoder(int tokenCount);
// void DoEncoding(int token);
void AddTok... |
#include "compute_weighted_add.h"
int main(int argc, char *argv[]) {
if (auto error = initialize()) {
return -1;
}
auto create_name = "compute_weighted_add";
SDL_Window *window;
vkb::Instance instance;
VkSurfaceKHR surface;
if (auto error = create_window_instance_surface(create_name... |
#pragma once
//DownArrowKey.h
#ifndef _DOWNARROWKEY_H
#define _DOWNARROWKEY_H
#include "KeyAction.h"
class DownArrowKey :public KeyAction {
public:
DownArrowKey(Form *form = 0);
DownArrowKey(const DownArrowKey& source);
~DownArrowKey();
DownArrowKey& operator=(const DownArrowKey& source);
virtual void OnKeyDown... |
#include "Bishop.h"
Bishop::Bishop(int color, int row, int col) : ChessPiece(color, row, col)
{
if (color == 0)
{
this->symbol = 'B';
}
else
{
this->symbol = 'b';
}
this->name = "Bishop";
};
// Function to return Piece Name
std::string Bishop::getName() const
{
return name;
}
// Function to get Piece sym... |
#pragma once
#include <string>
#include <map>
#include <list>
#include "Game.h"
#include "Command.h"
using namespace std;
class CommandFactory
{
private:
map<string, Command*> mapping;
public:
CommandFactory();
~CommandFactory();
void CreateCommand(string commandString, list<string>* parameters, Game* game);
};
... |
/*
Author: Nayeemul Islam Swad
Idea:
- Let S = floor(sqrt(1)) + floor(sqrt(1)) + ... + floor(sqrt(n))
Notice that, for a fixed integer x, if floor(sqrt(y)) = x then
x ^ 2 <= y < (x + 1) ^ 2. So, if f(x) is the number of times x
appears into the sum S, f(x) is simply equal to the number of
odd num... |
/**
MIT License
Copyright (c) 2019 mpomaranski at gmail
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... |
// // Bootscreen.cpp
// // Copyright(c) 2013 - The Foreseeable Future, zhiayang@gmail.com
// // Licensed under the Apache License Version 2.0.
// #include <Kernel.hpp>
// #include <Console.hpp>
// #include <HardwareAbstraction/VideoOutput.hpp>
// #include <Bootscreen.hpp>
// #include <BitmapLibrary/BitmapLibrary.hpp>
... |
#include <iostream>
enum class PolicyType {Default, Greedy, NotImplemented};
template<PolicyType T> struct priority {
enum {val = 99};
};
template<> struct priority<PolicyType::Default> {
enum {val = 0};
};
template<PolicyType T>class Policy {
public:
Policy() = default;
~Policy() = default;
con... |
/*
* LineHashIndex.cpp
*
* Created on: Nov 15, 2010
* Author: root
*/
#include "LineHashIndex.h"
#include "MMapBuffer.h"
#include "MemoryBuffer.h"
#include "BitmapBuffer.h"
#include <math.h>
/**
* linear fit;
* f(x)=kx + b;
* used to calculate the parameter k and b;
*/
static bool calculateLineKB(vect... |
#include <iostream>
#include <memory>
#include <vector>
using namespace std;
// void fun
int main(int argc, char *argv[])
{
unique_ptr<int> p(new int(100));
// p.reset();
// p.release();
cout << *p << endl;
unique_ptr<vector<int>> p2(new vector<int>());
p2->push_back(1000);
cout << "siz... |
void getData()
{
h = dht.readHumidity();
t = dht.readTemperature();
f = dht.readTemperature(true);
soilMoist = analogRead(A0);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f) || isnan(soilMoist)) {
Serial.println("Failed to read from DHT sensor!");
s... |
#ifndef Fader_h
#define Fader_h
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#include "WConstants.h"
#endif
class Fader
{
public:
Fader(int button, int led, int initial = 0);
void init();
void c... |
// NeoPixel Demo minimum
// By the sons of the gun
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.