text string | size int64 | token_count int64 |
|---|---|---|
class Solution {
public:
int maxArea(vector<int>& height) {
int res = 0;
int area = 0;
int left = 0, right = height.size() - 1;
while(left < right) {
area = (right - left) * min(height[right], height[left]);
res = max(res, area);
if (heig... | 460 | 137 |
#include <fstream>
#include <iostream>
#include "AvTrajectoryPlanner.hpp"
#include "IterativeLQR.hpp"
using namespace av_structs;
using namespace iterative_lqr;
namespace av_trajectory_planner
{
Planner::Planner() {}
Planner::Planner(
AvState init, AvState goal, AvParams config, Boundary av_outline, SolverParams s... | 4,691 | 1,753 |
#include "class_8.h"
#include "class_6.h"
#include "class_8.h"
#include "class_4.h"
#include "class_0.h"
#include "class_5.h"
#include <lib_27/class_9.h>
#include <lib_47/class_1.h>
#include <lib_46/class_3.h>
#include <lib_30/class_4.h>
#include <lib_40/class_2.h>
class_8::class_8() {}
class_8::~class_8() {}
| 312 | 158 |
// r_interface.cpp
// (c) 2020 David Merrell
//
#include "trial_mdp.h"
#include <string>
#include <iostream>
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::depends(BH)]]
// [[Rcpp::plugins("cpp11")]]
//' Use TrialMDP to compute an optimal trial design
//'
//' Given the number of patients, failure cost, and sta... | 3,711 | 1,167 |
// https://leetcode-cn.com/problems/gas-station/
#include "extern.h"
class S0134 {
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
if (gas.empty()) return -1;
for (int i = 0; i < gas.size(); ++i) {
gas[i] -= cost[i];
}
int total = 0;
int cn... | 1,495 | 540 |
#include "testing/testing.hpp"
#include "drape/binding_info.hpp"
using namespace dp;
UNIT_TEST(BindingInfoIDTest)
{
{
BindingInfo info(1, 1);
TEST_EQUAL(info.GetID(), 1, ());
}
{
BindingInfo info(1);
TEST_EQUAL(info.GetID(), 0, ());
}
}
UNIT_TEST(DynamicHandlingTest)
{
{
BindingInfo i... | 460 | 202 |
//*******************************************************
/*Lamina Project: Graphic Visualization of Particles
I would like to give credit to the tutorials found in the following webpages:
http://www.lighthouse3d.com/tutorials/glut-tutorial/
http://lazyfoo.net/tutorials/OpenGL/index.php#Hello OpenGL
https://www3.ntu.e... | 2,242 | 742 |
#ifndef VOP_HPP
#define VOP_HPP
#include <cstddef>
namespace vop {
/**
* Vector add two containers, putting the result into a third container.
*
* \tparam itr_l Iterator type of the left-hand-side addition operand container.
* \tparam itr_r Iterator type of the right-hand-side addition o... | 4,239 | 1,264 |
/// @file
///
/// Copyright Matus Chochlik.
/// 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 EAGINE_INTEGER_RANGE_HPP
#define EAGINE_INTEGER_RANGE_HPP
#include "iterator.hpp"
namespace eagine {
/... | 2,226 | 701 |
#include "collision.h"
#include <prism/blitz.h>
static struct {
CollisionListData* mPlayerCollisionList;
CollisionListData* mObstacleCollisionList;
} gCollisionData;
void initCollisions()
{
gCollisionData.mPlayerCollisionList = addCollisionListToHandler();
gCollisionData.mObstacleCollisionList = addCollisionList... | 629 | 213 |
//
// Created by sokol on 23.01.20.
//
#include "path_finder/storage/HubLabelStore.h"
#include <cstring>
#include <execution>
#include <memory>
#include <path_finder/helper/Static.h>
#include <sstream>
#include <utility>
namespace pathFinder {
HubLabelStore::HubLabelStore(size_t numberOfLabels) {
m_forwardOffset = ... | 7,158 | 2,366 |
#pragma once
#include <algorithm>
#include <memory>
#include <string_view>
#include <utils/assert.hpp>
#include <vector>
namespace gal::toolbox::string
{
template<typename CharType, bool isNullTerminate = true, typename CharTrait = std::char_traits<CharType>>
class string_block
{
public:
constexpr static bool i... | 4,717 | 1,924 |
/*
* 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 ... | 3,871 | 1,363 |
/****************************************************************************
** Meta object code from reading C++ file 'UnivariateRunEditor.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.1)
**
** WARNING! All changes made in this file will be lost!
*************************************************... | 3,522 | 1,330 |
// Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
#include "nnti/nnti_pch.hpp"
#include <mpi.h>
#include "gtest/gtest.h"
#include "faodel-common/Common.hh"
#i... | 3,173 | 1,231 |
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | 975 | 330 |
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
using namespace std;
template <typename T>
void push_verts(vector<vector<T>> vec, ofstream &os)
{
int i = 1;
for (auto vf : vec)
{
for (auto f : vf)
{
os << f << endl;
os << (i < vec.size() *... | 3,774 | 984 |
#include <stdlib.h> /* exit, EXIT_FAILURE */
#include "track_nullptr.h"
void deref_null(int argc) {
int *p = nullptr;
if (argc == 1) {
p = &argc;
}
*p = 42;
}
int main(int argc, char** argv) {
//escape(&nullp);
deref_null(argc);
return 0;
}
| 283 | 128 |
#pragma once
#include "../../../JObject.hpp"
namespace android::icu::text
{
class DateIntervalInfo_PatternInfo;
}
namespace android::icu::util
{
class ULocale;
}
class JObject;
class JString;
namespace java::util
{
class Locale;
}
namespace android::icu::text
{
class DateIntervalInfo : public JObject
{
public:... | 1,275 | 447 |
#include "atom.h"
Atom::Atom()
{
delete_flag = false;
bondNum = 0;
bondID = std::vector<bigint>(MAX_BONDS_PER_ATOM);
bonds = std::vector<Bond*>(MAX_BONDS_PER_ATOM);
angleNum = 0;
}
Atom::~Atom()
{
}
bool operator==(const Atom& lhs, const Atom& rhs) {
return (lhs.id == rhs.id);
}
bool operator!=(const Atom & l... | 850 | 441 |
#include "ThreadPool.hpp"
#include <assert.h>
#define LOCK(MUTEX) std::unique_lock<std::mutex> lock
/********************************************************************
* TaskBacket
********************************************************************/
TaskBacket::TaskBacket()
{
bComplitted = true;
}
TaskBa... | 6,099 | 2,496 |
#include<bits/stdc++.h>
#define mp make_pair
#define pu push_back
#define mt make_tuple
#define INF 1000000001
using namespace std;
int check(string s)
{
if(s[0]!='R') return 0;
int boo = 0;
for(int i=0;i<s.size();i++)
{
if(65<=s[i] && s[i]<=90 && boo == 1) return 1;
else if(s[i]-'0'<11) boo = 1;
}
... | 1,381 | 642 |
/*
* Copyright (c) 2015, 2016, Yutaka Tsutano
*
* Permission to use, copy, modify, and/or 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 "AS IS" AND THE AUTH... | 4,028 | 1,263 |
//#include "romos_ProcessingStatus.h"
//using namespace romos;
ProcessingStatus processingStatus; // definition of the global object
//-----------------------------------------------------------------------------------------------------------------------------------------
// construction/destruction:
ProcessingStat... | 1,100 | 293 |
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
class Solution {
void helper(string &S, int l, int r, vector<string> &vec) {
if (l == r) {
vec.push_back(S);
return;
}
for (int i = l; i <= r; i++) {
swap(S[i], S[l]);
... | 636 | 227 |
//
// Created by rhodges on 09/11/2020.
//
#pragma once
#include "async_condition_variable.hpp"
#include "basic_distributor.hpp"
#include "config.hpp"
#include <memory>
struct message_service_impl
{
using executor_type = net::strand<net::io_context::executor_type>;
message_service_impl(net::io_context::execu... | 1,627 | 533 |
#include "../src/meshoptimizer.h"
#include <stdint.h>
#include <stdlib.h>
void fuzzDecoder(const uint8_t* data, size_t size, size_t stride, int (*decode)(void*, size_t, size_t, const unsigned char*, size_t))
{
size_t count = 66; // must be divisible by 3 for decodeIndexBuffer; should be >=64 to cover large vertex bl... | 1,414 | 511 |
#include <iostream>
#include <string>
using namespace std;
template<class ItemType>
void merge(ItemType theArray[], int first, int mid, int last, ItemType tempArray[])
{
int first1 = first;
int last1 = mid;
int first2 = mid + 1;
int last2 = last; ... | 1,600 | 539 |
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* following copyright and licenses apply:
*
* Copyright 2017 RDK Management
*
* 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 ... | 2,761 | 890 |
#ifndef VECL_BROADCAST_H
#define VECL_BROADCAST_H
#include "config/config.h"
#include <memory>
#include <functional>
#include <vector>
#include <memory_resource>
namespace vecl
{
/**
* @brief A Broadcast is a smart event-handler that models a
* broadcast design pattern.
*
* The container allows functions t... | 5,179 | 1,879 |
#pragma once
#include <cstdint>
#include <cstdlib>
#include <string_view>
namespace base64::detail::decoder
{
auto static const inline alphabet = std::string_view{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"};
struct invalid_input final
{
size_t const offset;
uint8_t const byte;
};
}
| 320 | 131 |
#define DLL
#include "ACOpenCL.hpp"
Anime4KCPP::OpenCL::GPUList::GPUList(
const int platforms,
std::vector<int> devices,
std::string message
) :platforms(platforms), devices(std::move(devices)), message(std::move(message)) {}
int Anime4KCPP::OpenCL::GPUList::operator[](int pID) const
{
return devices... | 6,918 | 2,169 |
#include <cstdio>
char in [ 65536 ];
char const* o;
int a[ 1024 ];
int b[ 1024 ];
bool visit[1024] ;
int que [ 1024 ] ;
int dist[ 1024 ] ;
int prv [ 1024 ];
int n; // number of bus
int n_q;
int nxt[ 2048 ] ;
//int dst[ 2028 ] ;
int head[2048 ] ;
static int readInt()
{
int u = 0;
while(*o && *o <= 32)+... | 3,124 | 1,345 |
#pragma once
#include "../util.hpp"
template<typename T>
class Vec {
protected:
using iterator = typename vector<T>::iterator;
using const_iterator = typename vector<T>::const_iterator;
using reference = T&;
using const_reference = const T&;
vector<T> v;
template<typename Unop> Vec<T> unop_new(Unop op) co... | 5,123 | 2,153 |
#include "Player.h"
#include "Game.h"
Player::Player()
{
_width = 5;
_height = 10;
Game::getInstance()->registerInputNotification( CC_CALLBACK_1(Player::processInput, this) );
}
Player::~Player() {}
void Player::moveUp()
{
int y = getPositionY();
y -= 1;
setPositionY( y );
}
void Player::moveDown()
{
int y... | 1,585 | 637 |
#include "binary_ofstream.h"
#include <cstdio>
#include <iostream>
struct binary_ofstream_error {};
binary_ofstream::binary_ofstream(const char* name) : file_(nullptr) { init(name); }
binary_ofstream::binary_ofstream(const std::string& name) : file_(nullptr) { init(name.c_str()); }
void binary_ofstream::init(const... | 2,125 | 788 |
#ifndef SNAPPLOT_MAPVIEW_HPP
#define SNAPPLOT_MAPVIEW_HPP
#include "snapplot_event.hpp"
#include "snapplot_dragger.hpp"
#include "wxmapwindow.hpp"
DECLARE_EVENT_TYPE( WX_MAPVIEW_DISPLAY_COORDS, -1 )
class SnapplotMapView : public wxMapWindow
{
public:
SnapplotMapView( wxWindow *parent );
~SnapplotMapView()... | 1,708 | 565 |
#include <map>
#include <set>
#include <sstream>
#include <memory>
#include <utility>
#include <tuple>
#include <boost/program_options.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
#include "network/dmp_cs.hpp"
#include "platforms/platforms.hpp"
#include "utils/others.hpp"
#include "utils/rw_lock... | 7,262 | 2,366 |
/**
* Copyright 2018 <David Corbin, Mitchell Harvey>
*/
#include <include/api/JavaIntegration.hpp>
#include <include/FileNotFound.hpp>
#include <QDesktopServices>
#include <QUrl>
#include <QFileInfo>
#include <QTextStream>
#include <QDebug>
#include <QSettings>
#include <QApplication>
#include <string>
#include <alg... | 7,386 | 2,581 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int INF=2e9;
void buildTree(int v, int tl, int tr,vector<int>&st,vector<int>&a){
if (tl==tr){
st[v]=a[tl];
return;
}
int mid = (tl+tr)>>1;
buildTree(v*2,tl,mid,st,a);
buildTree(v*2+1,mid+1,tr,st,a);
st[v]=min(st[v*2],st[v*2+1]);
}
int ... | 1,435 | 850 |
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <UnitTestHelper.h>
#include <AzCore/Interface/Interface.h>
#include <TriangleInputHelper.... | 6,871 | 2,624 |
//------------------------------------------------------------
// snakeoil (c) Alexis Constantin Link
// Distributed under the MIT license
//------------------------------------------------------------
#include "serial_node_walker.h"
using namespace so_flow ;
//********************************************************... | 2,439 | 658 |
// @HEADER
// ***********************************************************************
//
// Teuchos: Common Tools Package
// Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of... | 14,962 | 5,309 |
/*
Copyright 2021 creatorlxd
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 writing, software
distrib... | 3,279 | 1,225 |
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: HMUI.NavigationController
#include "HMUI/NavigationCont... | 16,151 | 4,379 |
//
// Copyright Copyright 2009-2022, AMT – The Association For Manufacturing Technology (“AMT”)
// 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
//
// ... | 3,967 | 1,154 |
/*
State Key Lab of CAD&CG Zhejiang Unv.
Author:
Yicun Zheng (3130104113@zju.edu.cn)
Haoran Sun (hrsun@zju.edu.cn)
Jin Huang (hj@cad.zju.edu.cn)
Copyright (c) 2004-2021 <Jin Huang>
All rights reserved.
Licensed under the MIT License.
*/
#include "adjacent_table.hpp"
using namesp... | 2,439 | 937 |
#include "../header/VM.h"
#include "../header/Instruction.h"
#include "../header/Parser.h"
#include "../header/AST.h"
#include "../header/DLLFile.h"
#include <assert.h>
#include <iostream>
//#include <dlfcn.h>
using std::cout; using std::endl;
int main(int argc, char** argv){
#if TESTING
VM x;
bool allPass = tr... | 1,601 | 662 |
#include "Application.h"
#include "Render.h"
#include "Textures.h"
#include "Audio.h"
#include "Map.h"
#include "Pathfinding.h"
#include "Player.h"
#include "GuiManager.h"
#include "GuiElement.h"
#include "GuiHealthbar.h"
#include "GuiCreationBar.h"
#include "FowManager.h"
#include "EntityManager.h"
#include "Wall.h"
... | 5,894 | 2,504 |
#include "SpiFlash.h"
#include "esp_spi_flash.h"
#include "esp_partition.h"
#include "esp_err.h"
#include "rom/spi_flash.h"
static SpiFlash spiflash = SpiFlash();
esp_rom_spiflash_chip_t g_rom_flashchip;
extern "C" void _spi_flash_init(size_t chip_size, size_t block_size, size_t sector_size, size_t page_size, cons... | 1,760 | 778 |
#include "charstream.h"
#include <iomanip>
#include "notimplemented.h"
using namespace std;
charbuf::charbuf(char* s, size_t n, size_t offset) : offset(offset) {
auto begin = s;
auto c = s;
auto end = s + n;
// set begin, current, and end states for reading
setg(begin, c, end);
setp(begin, end);
}
strea... | 3,171 | 1,186 |
#include <cstdlib>
#include <string>
#include <map>
#include <iostream>
using namespace std;
class UserProfile
{
public:
enum uLevel { Beginner, Intermediate, Advanced, Guru };
UserProfile(string login, uLevel = Beginner);
UserProfile();
bool operator==(const UserProfile&);
bool operator!=(const U... | 4,007 | 1,502 |
#include "toolbar_dock.h"
#include "editor/editor_application.h"
#include "framework/scene_loader.h"
#include "framework/system.h"
#include "editor/editor_system.h"
#include "vendor/ImGUI/imgui.h"
#include "vendor/ImGUI/imgui_stdlib.h"
#include "vendor/ImGUI/imgui_impl_dx11.h"
#include "vendor/ImGUI/imgui_impl_win32... | 4,286 | 1,869 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne... | 7,737 | 2,793 |
#include "PolylineValidator.h"
#include "glm.hpp"
#include <algorithm>
namespace triangulator {
const float epsilon = 0.00001f;
bool CompareEvent ( const Event & a, const Event & b );
bool CompareEdge ( p2t::Edge * leftEdge, p2t::Edge * rightEdge, double sweepY );
doub... | 30,694 | 10,195 |
#include "config_manager.h"
#include "paddles.h"
#include "display.h"
#include "keying.h"
#include "memories.h"
#include "wpm.h"
#include <EEPROM.h>
#include <ctype.h>
config_manager system_config_manager;
#define MAGIC 0x5a0d
#define PADDLES_REVERSE_FLAG 0x01
#define SIDETONE_OFF_FLAG 0x02
#... | 5,188 | 2,132 |
#include "../includes/includes.h"
namespace g_mini_crt::memory {
wchar_t get_bits(char x) {
return g_mini_crt::string::is_digit(x) ? (x - '0') : ((x - 'A') + 0xA);
}
BYTE get_byts(const char* x) {
return ((BYTE)(get_bits(x[0]) << 4 | get_bits(x[1])));
}
int mem_cmp(const void* str1, const void* str2, ... | 1,317 | 613 |
/*
* global game stuff
*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later versi... | 6,648 | 1,944 |
/* Sirikata
* StandardLocationService.cpp
*
* Copyright (c) 2009, Ewen Cheslack-Postava
* 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 r... | 24,947 | 7,409 |
#include <iostream>
using namespace std;
// typedef int age;
int main() {
cout << "Hello world\n";
/* in comment */
cout << "Size of char : " << sizeof(char) << endl;
cout << "Size of int : " << sizeof(int) << endl;
cout << "Size of short int : " << sizeof(short int) << endl;
cout << "Size... | 1,062 | 375 |
#include "VTable.h"
// VTables
void test1::Simple::run() {}
void test2::Simple::run() {}
void test4::Sub::run() {}
void test5::Sub::run() {}
void test6::Sub::run() {}
void test11::Sub::run3() {}
template class test12::Simple<int>;
// Weak-Defined RTTI
__attribute__((visibility("hidden"))) test7::Sub a;
| 307 | 116 |
#include "gtest/gtest.h"
TEST(SimpleTest2, Test1)
{
EXPECT_EQ(3, 2);
}
| 76 | 41 |
#include <iostream>
#include "option_handler.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fstream>
using namespace std;
void add_options(OptionHandler::Handler & h)
{
try
{
... | 2,743 | 1,092 |
template <class T>
T max(const T& left, const T& right)
{
return left > right ? left : right;
}
| 99 | 38 |
// arith12.cpp Copyright (C) 1990-2020 Codemist
//
// Arithmetic functions... specials for Reduce (esp. factoriser)
//
//
/**************************************************************************
* Copyright (C) 2020, Codemist. A C Norman *
* ... | 28,735 | 11,209 |
#include <vector>
#include <c4/enum.hpp>
#include <c4/test.hpp>
#include "./enum_common.hpp"
#include "c4/libtest/supprwarn_push.hpp"
TEST(eoffs, simple_enum)
{
using namespace c4;
EXPECT_EQ(eoffs_cls<MyEnum>(), 0);
EXPECT_EQ(eoffs_pfx<MyEnum>(), 0);
}
TEST(eoffs, scoped_enum)
{
using namespace c4;... | 3,121 | 1,236 |
/*
* This file is part of
* llreve - Automatic regression verification for LLVM programs
*
* Copyright (C) 2016 Karlsruhe Institute of Technology
*
* The system is published under a BSD license.
* See LICENSE (distributed with this file) for details.
*/
#include "Assignment.h"
#include "Helper.h"
#include ... | 28,405 | 8,140 |
#ifndef KINEMATIC_H_
#define KINEMATIC_H_
#include <Eigen/Core>
#include <cmath>
using Eigen::VectorXd;
constexpr double Lf = 2;
//
// Helper functions
//
constexpr double pi() { return M_PI; }
double deg2rad(double x) { return x * pi() / 180.0; }
double rad2deg(double x) { return x * 180.0 / pi(); }... | 470 | 177 |
#ifndef _invite_metadata_hpp_
#define _invite_metadata_hpp_
#include <disccord/models/entity.hpp>
#include <disccord/models/user.hpp>
namespace disccord
{
namespace models
{
class invite_metadata : public model
{
public:
invite_metadata();
virtual ~i... | 1,121 | 309 |
// Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the
// License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless req... | 2,069 | 708 |
#include <iostream>
using namespace std;
void passByValue(int a){
a++;
}
void passByPointer(int *ptr){
//this will give same address as that stored in b (ptr and b are pointing to the same location)
cout << "address stored in ptr " << ptr << endl;
*ptr = *ptr + 1; // this is the same as: (*ptr)++
}
int main(... | 1,707 | 513 |
#include <iostream>
#include "terrain.hpp"
#define PI 3.14159265
std::vector<glm::vec3> terrain;
int length;
int width;
//Set terrain height here
float height ( float x, float z ){
if ( x > 60 && x < 70 && z<5 && z>-5 ){
return 1.2f*( x - 60 );
}
else if ( x >= 70 && x < 80 && z<5 && z>-5 ){
retu... | 4,065 | 1,953 |
// Copyright (c) 2014 Ollix. 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 ... | 4,499 | 1,506 |
#ifndef DUNE_AX1_ACME2_SETUP_HH
#define DUNE_AX1_ACME2_SETUP_HH
#include <dune/common/array.hh>
#include <dune/pdelab/backend/istlvectorbackend.hh>
//#include<dune/pdelab/finiteelementmap/q12dfem.hh>
//#include<dune/pdelab/finiteelementmap/q22dfem.hh>
#include <dune/pdelab/common/clock.hh>
#include <dune/pdelab/finit... | 29,733 | 10,152 |
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
using namespace sqlite_orm;
TEST_CASE("statement_serializator arithmetic operators") {
internal::serializator_context_base context;
SECTION("add") {
std::string value;
SECTION("func") {
value = serialize(add(3, 5), cont... | 1,573 | 518 |
/*bai 1146A*/
#include<stdio.h>
#include<string.h>
int main(){
char c[100];
scanf("%s",c);
int i,cnt=0;
int len=strlen(c);
for(i=0; i<len;i++){
if((c[i]-'a')==0) cnt++;
}
if(cnt>(len/2)){
printf("%d",len);
return 0;
}
else printf("%d",2*cnt-1);
}
| 263 | 150 |
/// THIS IS GRAFT COMMAND
#include <cstdio>
#include <cstdlib>
#include <string>
#include <string_view>
#include <argv.hpp>
#include <git.hpp>
#include <optional>
#include <console.hpp>
#include <os.hpp>
struct graft_info_t {
std::string gitdir{"."};
std::string branch;
std::string commitid;
std::string messag... | 5,186 | 1,924 |
// monitor.cpp
#include <arduino.h>
#include "monitor.h"
Monitor::Monitor(Trigger *trigger, unsigned int timeout)
: _trigger(trigger)
, _timeout(timeout)
, _state(MONITOR_GREEN)
, _stateStartMs(millis())
{
}
bool Monitor::begin()
{
return _trigger->begin();
}
MONITOR_STATE Monitor::getState()... | 1,315 | 468 |
// OJ: https://leetcode.com/problems/backspace-string-compare/
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(1)
class Solution {
private:
int normalize(string &S) {
int length = 0;
for (char c : S) {
if (c == '#') {
if (length) --length;
} else S[... | 633 | 227 |
/*
* Client.cpp
*
* Created on: Apr 28, 2015
* Author: opiske
*/
#include "Client.h"
using namespace dtests::common;
using namespace dtests::common::log;
Logger Client::logger = LoggerWrapper::getLogger();
Client::Client()
{
// TODO Auto-generated constructor stub
}
Client::~Client()
{
// TODO ... | 354 | 120 |
// Copyright (C) 2014 Dmitry Yakimenko (detunized@gmail.com).
// Licensed under the terms of the MIT license. See LICENCE for details.
#include "test.h"
namespace
{
using namespace lastpass;
using namespace test;
auto const BLOB_BYTES = "\x4c\x50\x41\x56\x00\x00\x00\x03\x31\x31\x38"_s;
int const KEY_ITERATION_COUNT... | 642 | 290 |
/*==============================================================================
Copyright (c) 2017, 2018 Matt Calabrese
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)
=============================================... | 4,904 | 1,743 |
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'DBLocal.pas' rev: 6.00
#ifndef DBLocalHPP
#define DBLocalHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Provider.... | 5,794 | 1,772 |
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkDiffusionTensor3DReconstructionImageFilterTest.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights r... | 6,713 | 2,198 |
// Mono Native Fixture
// Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Namespace: System
// Name: IDisposable
// C++ Typed Name: mscorlib::System::IDisposable
#include <gtest/gtest.h>
#include <mscorlib/System/mscorlib_System_IDisposable.h>
namespace mscorlib
{
namespac... | 479 | 218 |
#ifndef ENTT_CONTAINER_FWD_HPP
#define ENTT_CONTAINER_FWD_HPP
#include <functional>
#include <memory>
namespace entt {
template<
typename Key, typename Type,
typename = std::hash<Key>,
typename = std::equal_to<Key>,
typename = std::allocator<std::pair<const Key, Type>>>
class dense_hash_map;
templat... | 498 | 186 |
#include <catch2/catch.hpp>
#include <SI/electric_current.h>
#include <SI/inductance.h>
#include <SI/magnetic_flux.h>
#include <SI/stream.h>
#include <sstream>
using namespace SI::literals;
TEST_CASE("GIVEN a value WHEN constructed with literal _aH THEN result is a "
"inductance type AND ratio 1 to 10^15") ... | 15,004 | 5,911 |
#include "vixen.h"
#include "vxutil.h"
namespace Vixen {
VX_IMPLEMENT_CLASSID(Navigator, MouseEngine, VX_Navigator);
VX_IMPLEMENT_CLASSID(NavRecorder, Engine, VX_NavRecorder);
Navigator::Navigator() : MouseEngine()
{
m_kForward = m_kBack = m_kLeft = m_kRight = m_kCtrl = m_kUp = m_kDown = false;
m_TurnSpeed = 0.05... | 8,042 | 3,629 |
#ifndef TIRO_COMPILER_IR_PASSES_CONSTRUCT_CSSA_HPP
#define TIRO_COMPILER_IR_PASSES_CONSTRUCT_CSSA_HPP
#include "compiler/ir/fwd.hpp"
namespace tiro::ir {
/// Ensures that the function is in CSSA form (no phi function arguments
/// with interfering lifetime).
///
/// Returns true if the cfg was modified.
///
/// Refe... | 900 | 309 |
/* Copyright 2020 The TensorFlow Authors. 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 law or a... | 1,556 | 511 |
/****************************************************************
relative_branching.cpp
****************************************************************/
#include "u3shell/relative_branching.h"
#include "am/wigner_gsl.h"
#include "cppformat/format.h"
extern double zero_threshold;
namespace u3shell
{
void Branch... | 6,129 | 2,208 |
#include "dummy.h"
#include "app.h"
int CDummy::cnt=0;
CDummy::CDummy()
{
cnt++;
std::string tmp("dummy created (total: ");
tmp+=std::to_string(cnt)+")";
simAddLog("Sync",sim_verbosity_debug,tmp.c_str());
}
CDummy::~CDummy()
{
cnt--;
std::string tmp("dummy destroyed (total: ");
tmp+=std::... | 398 | 165 |
#ifndef XMLNYA_H
#define XMLNYA_H
/*
Usage:
while( ss.ReadNextChild() )
{
QStringRef s = ss.name();
if( s == "a1" ) a1 = ss.ReadElement().toLatin1();
else if( s == "a2" ) a2 = ss.ReadElement().toDouble();
// ...
else ss.SkipElement();
}
*/
#include <QXmlStreamReader>
#include <QHash>
typedef QXmlStream... | 1,006 | 376 |
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE... | 10,181 | 3,161 |
/* acm.timus.ru 1103. Pencils and Circles
*
* Strategy:
* Pick two points on the convex hull of the point set. If we form a circle with some other point,
* the largest such circle will encompass all points, the second largest will encompass all points
* except for one, etc. The angle formed by the two static poin... | 3,802 | 1,471 |
#pragma once
#include <list>
#include <tuple>
#include <cmath>
#include <limits>
#include <vector>
#include <cstddef>
#include <utility>
#include <algorithm>
template<typename T>
class delaunay_triangulation {
private:
class edge;
class point;
class triangle;
template<typename V>
class data_valu... | 17,569 | 6,423 |
#include "FE_GPU_Info.h"
FE_GPU_Info::FE_GPU_Info()
{
//ctor
}
FE_GPU_Info::~FE_GPU_Info()
{
//dtor
}
// find GPU objects by name easily
size_t FE_GPU_Info::findVBO(string a_name){
//cout << vbos.size() << endl;
for(size_t x =0; x < vbos.size(); x++)
if(vbos[x].name == a_name){
return x;
... | 881 | 381 |
/****************************************************************************
*
* Copyright (c) 2020 Vivante Corporation
*
* 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 ... | 6,643 | 2,255 |
/* Copyright 2018 Kristofer Björnson
*
* 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... | 7,022 | 2,552 |
#include "taco/io/tns_file_format.h"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cmath>
#include <limits.h>
#include "taco/tensor.h"
#include "taco/format.h"
#include "taco/error.h"
#include "taco/util/strings.h"
using namespace std;
namespace taco {
na... | 2,459 | 867 |