text string | size int64 | token_count int64 |
|---|---|---|
/*
#面试刷题# 第0113期
#Leetcode# Q0102 按层次顺序遍历二叉树
难度:中
给定一个二叉树,返回其节点值的级别顺序遍历。即,从左到右,逐级递进)。
示例:
Input: [3,9,20,null,null,15,7]
Output: [[3],[9,20],[15,7]]
*/
#include "leetcode.h"
namespace q0102
{
template<typename T>
bool run_testcases() {
T slt;
}
// Runtime: 4 ms, faster than 94.38%
// Memory Usage: 12.5 MB, less... | 1,139 | 481 |
/******************************************************************************/
/* @TITLE : GasValue.cpp */
/* @VERSION : 1.0 */
/* @CREATION : dec 27, 2017 ... | 1,528 | 523 |
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#define assert(x)
#define STB_LEAKCHECK_IMPLEMENTATION
#include "stb_leakcheck.h"
#include "dd_array.cpp"
#define min(a, b) (a < b ? a:b)
#define max(a, b) (a > b ? a:b)
#include "Memory.h"
#include "Array.cpp"
#include "... | 25,050 | 7,564 |
/* 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... | 3,062 | 1,006 |
// Copyright 2019 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 <cmath>
#include "chrome/browser/ash/power/auto_screen_brightness/model_config.h"
namespace ash {
namespace power {
namespace auto_screen_brigh... | 1,854 | 664 |
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QDesktopServices>
#include <QUrl>
#include <QDir>
#include <QMessageBox>
// Конструктор:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), // вызов родительского конструктора.
ui(new Ui::MainWindow)
{
... | 12,330 | 4,208 |
/*===========================================================================
*
* File: TestClot.CPP
* Author: Dave Humphrey (uesp@sympatico.ca)
* Created On: April 17, 2006
*
* Description
*
*=========================================================================*/
/* Include Files */
#include "... | 15,736 | 6,625 |
#line 2 "flex_lexer.cpp"
#line 4 "flex_lexer.cpp"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
#ifdef yy_c... | 189,255 | 123,799 |
/**=--- ripple/utility/memory.hpp -------------------------- -*- C++ -*- ---==**
*
* Ripple
*
* Copyright (c) 2019 - 2021 Rob Clucas.
*
* This file is distributed under the MIT License. See LICENSE for details.
*
*==-----------------------------------------... | 10,880 | 3,386 |
// Copyright 2012 Google Inc. 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 ap... | 7,477 | 2,712 |
#pragma once
#include "raylib.h"
#include "main.hpp"
#include "Division.hpp"
const int SCREEN_WIDTH = 1280*1.5;
const int SCREEN_HEIGHT = 960*1.2;
Texture2D natoTest;
Texture2D natoInf;
Texture2D natoArmor;
Texture2D natoMechInf;
Texture2D hostileInf;
Texture2D hostileArmor;
Texture2D hostileMechInf;
void initRL()... | 5,911 | 2,481 |
#pragma once
#include <cmath>
#include <limits>
#include <memory>
#include <random>
// 保存Ray Tracing in One Weekend项目所需的基本常量和函数
using std::shared_ptr;
using std::make_shared;
using std::sqrt;
const double infinity = std::numeric_limits<double>::infinity();
const double pi = 3.1415926535897932385;
// 角度转弧度
inline ... | 997 | 465 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double DB;
const int maxn = 500001, INF = 0x3f3f3f3f;
int rad, n, totL, totR;
struct Query {
int typ, x, y;
} que[maxn];
struct Fraction {
LL x, y;
Fraction() {}
Fraction(LL _x, LL _y) { // _y > 0
LL r = __gcd(abs(_x), _y);
x = _x ... | 3,645 | 2,027 |
// Copyright (C) 2011 - 2014 David Reid. See included LICENCE.
#ifndef GT_ParticleEditor
#define GT_ParticleEditor
#include "../SubEditor.hpp"
#include "../Editor3DViewportEventHandler.hpp"
#include "../EditorGrid.hpp"
#include "../EditorAxisArrows.hpp"
#include "../../ParticleSystem.hpp"
#include "../../Scene.hpp"
... | 5,340 | 1,360 |
///
/// UniqueId.hpp
/// galaxy
///
/// Refer to LICENSE.txt for more details.
///
#ifndef GALAXY_META_UNIQUEID_HPP_
#define GALAXY_META_UNIQUEID_HPP_
#include "galaxy/meta/Concepts.hpp"
namespace galaxy
{
namespace meta
{
///
/// Generates a unique id for a type for each type of specialization.
/// And the ... | 1,586 | 632 |
//
// Maya Calendar.cpp
// laboratory
//
// Created by 徐子珊 on 16/4/4.
// Copyright (c) 2016年 xu_zishan. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <hash_map>
using namespace std;
pair<string, int> a[]={make_pair("pop... | 1,837 | 811 |
// :copyright: (c) 2017 Alex Huszagh.
// :license: MIT, see LICENSE.md for more details.
#include <pycpp/lattice/parameter.h>
#include <gtest/gtest.h>
PYCPP_USING_NAMESPACE
// TESTS
// -----
TEST(parameters_t, get)
{
parameters_t parameters = {
{"name", "value"},
};
EXPECT_EQ(parameters.get()... | 549 | 218 |
class Solution {
public:
vector<string> findRepeatedDnaSequences(string s) {
map<char, int> charToBit;
charToBit['A'] = 0b00;
charToBit['C'] = 0b01;
charToBit['G'] = 0b10;
charToBit['T'] = 0b11;
map<int, char> bitToChar;
bitToChar[0b00] = 'A';
... | 1,254 | 445 |
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Assistant of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid co... | 3,081 | 954 |
/*---------------------------------------------------------------------------*\
Copyright (C) 2011-2012 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of CAELUS.
CAELUS is free software: you can redistribute it and/or modify it
... | 37,455 | 10,598 |
// Copyright (c) 2020 Matthew J. Smith and Overkit contributors
// License: MIT (http://opensource.org/licenses/MIT)
#ifndef OVK_CORE_ARRAY_TRAITS_HPP_INCLUDED
#define OVK_CORE_ARRAY_TRAITS_HPP_INCLUDED
#include <ovk/core/ArrayTraitsBase.hpp>
#include <ovk/core/Elem.hpp>
#include <ovk/core/Global.hpp>
#include <ovk/c... | 10,696 | 3,582 |
#include "template.hpp"
int main() {
int n, m, a, b;
cin >> n >> m >> a >> b;
cout << min(n * a, min(n / m * b + n % m * a, n / m * b + b)) << endl;
}
| 158 | 75 |
#ifndef BLOCKING_RING_BUFFER_H
#define BLOCKING_RING_BUFFER_H
#include <thread>
#include <mutex>
#include <condition_variable>
#include "globals.hh"
class BlockingRingBuffer {
private:
std::uint32_t read_idx, write_idx, capacity, available;
std::uint8_t *buff;
bool allow_writes;
std::mutex m;
std:... | 1,208 | 500 |
/*
*
* PURPOSE: To define the class Basis representing a
* basis set.
*
* class Basis:
* owns: bfs - a set of BFs
* data: name - the name of the basis set, needed for file io
* charges - a list of atomic numbers corresponding to
* ... | 4,246 | 1,258 |
#include <iostream>
#include <vector>
using namespace std;
#define MEMORY_SIZE 1000
#define REGISTER_NUM 10
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i, cnt = 0, idx = 0;
vector<int> registers(REGISTER_NUM), ram(MEMORY_SIZE);
while (cin >> i) {
ram[idx++] ... | 1,348 | 519 |
#include "multiPage.h"
#include "../Defines.h"
#ifdef WINBUILD
#include <windows.h>
#endif // WINBUILD
unsigned long int multiPage::_size()
{
if(!bankList.size()){return 0;}
return bankList[_bankNum]->_size();
}
bool multiPage::_is_free()
{
if(!bankList.size()){return 0;}
return bankList[_bankNum]->_... | 1,966 | 672 |
#include <bits/stdc++.h>
#define MEM(a, b) memset(a, b, sizeof(a))
using namespace std;
void solve(){
char a[105][13];
MEM(a,'@');
int j, w, h;
cin>> j >> w >> h;
string s;
int x = 0,y = h - 2;
for(int i = 0; i < h; i++)
{
cin >> s;
for(int j = 0; j < w; j++)
... | 2,049 | 735 |
#include <EBV_Triangulator.h>
#include <EBV_Benchmarking.h>
void Triangulator::switchMode()
{
m_mode = static_cast<Triangulator::StereoPair>((m_mode+1)%3);
std::cout << "Switch triangulation mode to: " << stereoPairNames[m_mode] << "\n\r";
}
void Triangulator::resetCalibration()
{
for (auto &k : m_K) { k ... | 11,114 | 4,270 |
#include "Timer.h"
#include "Atomic.h"
#include "Thread.h"
#include "TestUtil.h"
#include <gtest/gtest.h>
using namespace tpool;
using namespace tpool::unittest;
namespace {
class TimerTestSuite : public ::testing::Test
{
protected:
Atomic<int> counter;
TimerTestSuite()
: counter(0)
{}
vi... | 9,058 | 3,677 |
/**
* File : E.cpp
* Author : Kazune Takahashi
* Created : 2018-8-4 22:09:58
* Powered by Visual Studio Code
*/
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) ... | 3,040 | 1,368 |
#ifndef ISOLATOR_EMP_DIST
#define ISOLATOR_EMP_DIST
#include <climits>
#include <vector>
class EmpDist
{
public:
EmpDist(EmpDist&);
/* Construct a emperical distribution from n observations stored in xs.
*
* Input in run-length encoded samples, which must be in sorted order.
... | 1,032 | 310 |
#include "toolbar.hpp"
#include "game_scene.hpp"
#include "globals.hpp"
#include <SDL_ttf.h>
#include <SDL.h>
#include <cassert>
constexpr auto TOOLBAR_HEIGHT = 23;
constexpr auto TOOLBAR_ITEM_VPADDING = 3;
constexpr auto TOOLBAR_ITEM_HPADDING = 13;
//const SDL_Color WHITE { 255, 255, 255, SDL_ALPHA_OPAQUE };
// const... | 7,897 | 2,973 |
#ifdef _MSC_VER
#pragma warning(disable:4996)
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "cvaux.lib")
#pragma comment(lib, "highgui.lib")
#endif
#include <stdio.h>
#include <stdlib.h>
#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "highgui.h"
#include "cvcre... | 1,104 | 511 |
#ifndef TAINTHLP_H
#define TAINTHLP_H
#include <map>
#include <unordered_map>
#include <capstone/x86.h>
class tainthlp{
public:
/**
* Adds taint to a specified address and (len - 1) subsequent addresses
* @param base base address to taint
* @param len length of the area to taint
* @param ref the taint... | 1,604 | 610 |
#include <bits/stdc++.h>
using namespace std;
#define MAX(a,b,c) max(a,max(b,c))
#define MIN(a,b,c) min(a,min(b,c))
typedef pair<int, int> pii;
//0xACCE97ED
int main()
{
int t, a, b, c, d;
scanf("%d", &t);
while(t--) {
scanf("%d %d %d %d", &a, &b, &c, &d);
printf("%d %d %d\n", b, c, c);
}
return 0;
} | 312 | 177 |
//----------------------------------------------------------------------------------
// File: NvGLUtils/NvUIGL.cpp
// SDK Version: v3.00
// Email: gameworks@nvidia.com
// Site: http://developer.nvidia.com/
//
// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
//
// Redistribution ... | 7,384 | 2,547 |
/*
* nest_time.cpp
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST 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 ... | 5,986 | 2,451 |
#include "execution/util/fast_double_parser.h"
namespace terrier::execution::util {
const double FastDoubleParser::POWER_OF_TEN[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11,
1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22... | 63,947 | 29,981 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/epoll.h>
#include <sys/time.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netdb.h>
#include <pthread.h>
#include <time.h>... | 17,332 | 9,057 |
/*------------------------------------------------------------------------------*/
/**
* \file GW_SmartCounter.inl
* \brief Inlined methods for \c GW_SmartCounter
* \author Gabriel Peyr?2001-09-12
*/
/*------------------------------------------------------------------------------*/
#include "GW_SmartCounter.h... | 4,703 | 1,315 |
//-[
#include "type.h"
//-]
namespace licf {
namespace emm_1064b {
// placeholder
}
}
using namespace licf::emm_1064b;
int emm_1064b(const _in_t & in_, _out_t & out_)
{
int n;
while (in_.read(&n))
{
LL res = 1;
for (; n > 0; n >>= 1)
{
if (n & 1)
{
... | 415 | 180 |
/*
* (C) 2007 FlexSecure GmbH
* 2008-2010 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include <botan/cvc_req.h>
#include <botan/cvc_cert.h>
#include <botan/ber_dec.h>
namespace Botan {
bool EAC1_1_Req::operator==(EAC1_1_Req const& rhs) const
{
return (this->tbs_d... | 1,093 | 493 |
#include"parser.hpp"
#include"essentials.hpp"
#include<iostream>
using std::cout, std::endl;
using namespace facilities;
int main(int argc, char** argv){
PARSE(argc,argv);
if( SANITYCHECK(a,b) ){
print("yes, a and b are present");
}
if( !SANITYCHECK(c) ){
print("no, c isn't present... | 560 | 223 |
#ifndef TESTS_FAKELOGGER_HPP
#define TESTS_FAKELOGGER_HPP
#include "utils/log.hpp"
#include <algorithm>
#include <vector>
class FakeLogger
{
public:
enum class Level
{
DEBUG,
INFO,
WARNING,
ERROR,
FATAL
};
struct LogLine
{
Level lvl;
std::string tag;
st... | 2,592 | 887 |
/*===========================================================================
Video Capture Thread
Dominik Deak
===========================================================================*/
#ifndef ___THREAD_CAPTURE_CPP___
#define ___THREAD_CAPTURE_CPP___
/*----------------------------------------... | 6,048 | 1,624 |
/*
Excited States software: KGS
Contributors: See CONTRIBUTORS.txt
Contact: kgs-contact@simtk.org
Copyright (C) 2009-2017 Stanford University
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 with... | 5,276 | 1,919 |
#include <gdf/gdf.h>
gdf_size_type gdf_column_sizeof() {
return sizeof(gdf_column);
}
gdf_error gdf_column_view(gdf_column *column, void *data, gdf_valid_type *valid,
gdf_size_type size, gdf_dtype dtype) {
column->data = data;
column->valid = valid;
column->size = size;
column... | 364 | 139 |
#include "tanktextures.h"
#include "exceptions/invalidstateexception.h"
#include "utils/utils.h"
#include "utils/ioutils.h"
#include "graphics/textureloadoperation.h"
namespace TankGame
{
static std::unique_ptr<TankTextures> instance;
class TankTexturesLoadOperation : public IASyncOperation
{
public:
TankTextu... | 4,119 | 1,447 |
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <iomanip>
#include <boost/... | 46,483 | 13,654 |
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include "../../common/person.h"
void print_person(const person_t &person,
std::ostream &out,
person_t::output_format_t format)
{
if (format == person_t::name_... | 2,228 | 668 |
#include "smmr_pagedbuffer.h"
#include "smmr_categories.h"
#include "smmr_memory.h"
#include "smmr_database.h"
#include "smmr_tree.h"
#include <sys/types.h>
#include <sys/wait.h>
#define UNUSED(x) (void)(x)
const char *SERVER_MSGKEY = "from_server_to_client";
char SERVER_HELLOW[] = "hellow client.";
const char *CLI... | 4,803 | 2,021 |
/***
* @Date: 2021-11-27 17:36:41
* @LastEditors: zjulhl
* @LastEditTime: 2021-11-28 13:25:47
* @Description:
* @FilePath: /CodingInterviewChinese2/09_QueueWithTwoStacks/main09.cpp
*/
#include <stack>
using namespace std;
class CQueue
{
stack<int> stack1, stack2;
public:
CQueue()
{
while (... | 985 | 352 |
#ifndef FIND_THE_DIFFERENCE_HPP_
#define FIND_THE_DIFFERENCE_HPP_
#include <string>
using namespace std;
class FindTheDifference {
public:
char findTheDifference(string s, string t);
};
#endif // FIND_THE_DIFFERENCE_HPP_ | 228 | 92 |
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int longestValidParentheses(string s) {
int s_size = s.size();
if (s_size <= 1) {
return 0;
}
int *dp = new int [s_size];
for(int i = 0; i < s_size; i++) {
dp[i] = 0;... | 1,218 | 479 |
/*
See LICENSE file in root folder
*/
#ifndef ___C3D_SHADOW_MAP_PASS_POINT_H___
#define ___C3D_SHADOW_MAP_PASS_POINT_H___
#include "ShadowMapModule.hpp"
#include "Castor3D/Render/ShadowMap/ShadowMapPass.hpp"
#include "Castor3D/Render/Viewport.hpp"
#include <ashespp/Buffer/UniformBuffer.hpp>
namespace castor3d
{
cl... | 2,271 | 919 |
#include <iostream>
using namespace std;
int main()
{
int year;
cout << "Enter a year: " << endl;
cin >> year;
if ((year % 4) == 0)
{
cout << " Leap Year ";
}
else
{
cout << " Not a Leap Year" << endl;
}
return 0;
}
/*
Enter a year: 2016
Leap Year
*/ | 309 | 121 |
// $Id$
// Author: John Wu <John.Wu at ACM.org> Lawrence Berkeley National Laboratory
// Copyright (c) 2008-2017 the Regents of the University of California
/** @file rara.cpp
This is meant to be the simplest test program for the querying
functions of ibis::query and ibis::part. It accepts the following
f... | 3,318 | 1,025 |
// Copyright (c) Prevail Verifier contributors.
// SPDX-License-Identifier: MIT
#pragma once
EbpfHelperPrototype get_helper_prototype_linux(int32_t n);
bool is_helper_usable_linux(int32_t n);
| 193 | 74 |
enum Color
{
COLOR_BLACK, // assigned 0
COLOR_RED, // assigned 1
COLOR_BLUE, // assigned 2
COLOR_GREEN, // assigned 3
COLOR_WHITE, // assigned 4
COLOR_CYAN, // assigned 5
COLOR_YELLOW, // assigned 6
COLOR_MAGENTA // assigned 7
};
Color eColor = COLOR_WHITE;
cout << eColor; | 306 | 125 |
#pragma once
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "util.hpp"
#include "conversions.hpp"
class Shuffler : public Converter
{
private:
struct work_t {
Shuffler *shuffler;
int nchunks;
std::vector<edge_t> chunk_buf;
void opera... | 1,236 | 433 |
/*
* Copyright (C) 2005 IXA Research Group / IXA Ikerkuntza Taldea.
*
* 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 ... | 31,587 | 11,831 |
#include "CommonHeader.h"
MainMenuScene::MainMenuScene()
{
}
MainMenuScene::~MainMenuScene()
{
}
void MainMenuScene::OnSurfaceChanged(unsigned int aWidth, unsigned int aHeight)
{
Scene::OnSurfaceChanged(aWidth, aHeight);
}
void MainMenuScene::LoadContent()
{
Scene::LoadContent();
CreateCameraObject(); ... | 1,858 | 761 |
#include <iostream>
using namespace std;
/* Steps:
- Create linked list node which stores value(data), next(pointer), min(current min element)
- while pushing elements :
- if stack is empty store current val in min
- if current element is less than min than store (2*x – minEle) in min
- wh... | 3,076 | 959 |
#include <iostream>
//#include "AbstractGeometricObject.h"
#include "DerivedCircle2.h"
#include "Rectangle2.h"
using namespace std;
bool equalArea(GeometricObject &object1, GeometricObject &object2)
{
return object1.getArea() == object2.getArea();
}
void displayGeometricObject(GeometricObject &object)
{
cout << "Th... | 756 | 263 |
#include <type_traits>
using namespace std;
template <typename Base, typename Derived>
using extends = enable_if_t<is_base_of_v<Base, Derived>>;
struct cat{};
struct dog{};
template <typename T, typename = extends<cat, T>>
void only_cats(T) noexcept;
int main() noexcept {
only_cats(cat{});
only_dogs(dog{});
}... | 321 | 120 |
/**
* @file
* @copyright This code is licensed under the 3-clause BSD license.\n
* Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.\n
* See LICENSE.txt for details.
*/
#include "SKPair.h"
#include "SKAtom.h"
#include <Utils/IO/Regex.h>
#include <Utils/Scf/MethodException... | 12,108 | 4,710 |
#include "gtest/gtest.h"
#include "appc/util/option.h"
TEST(Option, none_is_false) {
auto none = None<int>();
ASSERT_FALSE(none);
}
TEST(Option, some_is_true) {
auto some = Some(std::string{""});
ASSERT_TRUE(some);
}
TEST(Option, some_is_shared_ptr) {
auto some = Some(std::string(""));
std::shared_ptr<... | 605 | 250 |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/page_info/permission_selector_row.h"
#include "base/i18n/rtl.h"
#include "base/macros.h"
#include "base/strings/utf... | 14,400 | 4,202 |
#ifndef BIA_MEMORY_GC_ROOT_HPP_
#define BIA_MEMORY_GC_ROOT_HPP_
#include <bia/util/gsl.hpp>
#include <cstddef>
#include <memory>
#include <mutex>
namespace bia {
namespace memory {
namespace gc {
class GC;
/// Defines the root for the search tree for the marking phase during garbage collection. This class is not
//... | 757 | 286 |
#ifndef STAN_MODEL_STANDALONE_FUNCTIONS_HEADER_HPP
#define STAN_MODEL_STANDALONE_FUNCTIONS_HEADER_HPP
#include <stan/math.hpp>
#include <boost/random/additive_combine.hpp>
#include <stan/io/program_reader.hpp>
#include <stan/lang/rethrow_located.hpp>
#include <stan/model/indexing.hpp>
#include <cmath>
#in... | 469 | 187 |
/*
* H.265 video codec.
* Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
*
* Authors: struktur AG, Dirk Farin <farin@struktur.de>
*
* This file is part of libde265.
*
* libde265 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Li... | 1,762 | 564 |
#include <iostream>
#include <vector>
using namespace std;
vector<int> twoSum(vector<int>& nums, int target) {
for (int i = 0; i < nums.size(); i++) {
for (int j = 0; j < i; j++) {
if (nums[i] + nums[j] == target) {
return vector<int> {j, i};
}
}
}
... | 738 | 338 |
/*
Copyright 2017 Google Inc. 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 agreed to in ... | 74,059 | 24,240 |
// Copyright 2021 Denis <denis.gorbachev2002@yandex.ru>
//#include <stdexcept>
//#include <shared_ptr.hpp>
| 109 | 52 |
/**
* MIT License
*
* Copyright (c) 2019 Yoram
*
* 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, m... | 3,703 | 1,290 |
// 範囲内のmodごとの数
// [l, r] 閉区間
std::vector<long long> mod_count_in_range(long long left, long long right, int mod) {
const long long range = (right - left + 1);
std::vector<long long> mod_count(mod, range / mod);
if (range % mod > 0) {
const int add_of_rest_left = left % mod;
int add_of_rest_right;
if (... | 578 | 236 |
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
string root(string s) {
if (s.size() == 1) return s;
int m;
for (int i = 0; i < s.size(); i ++) m += s[i] - 48;
stringstream st;
st << m;
string t;
st >> t;
return root(t);
}
int main() {
string s;
c... | 366 | 150 |
//
// DrawPan.cpp
// P2
//
// Created by Nicholas Zounis on 27/2/20.
//
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/button.h>
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/... | 23,640 | 7,983 |
/* Copyright(c) Sophist Solutions Inc. 1990-1992. All rights reserved */
/*
* $Header: /fuji/lewis/RCS/Shape.cc,v 1.7 1992/09/11 18:41:55 sterling Exp $
*
* TODO:
*
* - Desperately need the ability to scale shapes - probably shouyld add general
* transform capabilty - at least scale, etc..
*
* Changes:
... | 19,513 | 6,472 |
// Copyright 2021 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 "ash/quick_pair/common/account_key_failure.h"
namespace ash {
namespace quick_pair {
std::ostream& operator<<(std::ostream& stream, AccountKeyF... | 730 | 214 |
/*
* Copyright (c) 2016 by Nick Bertoldi, Ben Heckathorn, Ryan O'Keefe,
* Adrian Padin, Timothy Schumacher
*
* 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 withou... | 5,949 | 2,435 |
#pragma once
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "symbol_type.hpp"
#include "tsl/htrie_map.h"
namespace mizcore {
class Symbol;
class SymbolTable
{
public:
// ctor, dtor
SymbolTable();
virtual ~SymbolTable() = default;
SymbolTable(... | 1,607 | 502 |
/*
Copyright (c) 2020, Electrux
All rights reserved.
Using the BSD 3-Clause license for the project,
main LICENSE file resides in project's root directory.
Please read that file and understand the license terms
before using or altering the project.
*/
#include "Internal.hpp"
bool stmt_for_t::gen_code( bcode_t &... | 1,312 | 588 |
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstdint>
#include <utility>
#include <cassert>
#include <sysexits.h>
#include <grpc/grpc.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include... | 4,611 | 1,415 |
#include "../../includes.hpp"
#include "features.hpp"
void Features::Defuse::createMoveStart(Command *cmd) {
auto autoDefuse = CONFIGBOOL("Misc>Misc>Misc>Auto Defuse");
auto silentDefuse = CONFIGBOOL("Misc>Misc>Misc>Silent Defuse");
auto antiAiming = CONFIGINT("Rage>AntiAim>Type") != 0;
if (!(autoDefu... | 2,169 | 773 |
//---------------------------------------------------------------------------//
//!
//! \file MonteCarlo_AdjointPhotonProbeState.hpp
//! \author Alex Robinson
//! \brief Adjoint photon probe state class declaration
//!
//---------------------------------------------------------------------------//
#ifndef MONTE_CAR... | 3,159 | 1,015 |
#include <iostream>
using namespace std;
extern void agregarProducto(string descripcion, int cantidad, double precio);
void productos(int opcion)
{
system("cls");
int opcionProducto = 0;
switch (opcion)
{
case 1:
{
cout << "BEBIDAS CALIENTES" << endl;
cout << "******************" << endl;
... | 3,015 | 1,054 |
#include <iostream>
#include <vector>
#ifndef _MAKE_LIB
#include "../core.hpp"
#else
#include <bint.hpp>
#endif
#include "mini-test.hpp"
int main() { START_TEST;
// test variables
apa::bint ONE = 1, ZERO = 0;
apa::bint NUM1(
"0x19cf0546f6a3fc1e93d8dbda5ea2889551cb7248d21125fbf60... | 5,504 | 3,169 |
/*
Battery SMBus PX4 driver
*/
/*
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 3 of the License, or
(at your option) any later version.
This program is distributed ... | 2,850 | 1,044 |
#ifndef UTILS_HPP
#define UTILS_HPP
#include "jansson.h"
#define BIG2LE_16(x) (((x) & 0x00FF) << 8) | (((x) >> 8) & 0x00FF)
#define BIG2LE_32(x) (BIG2LE_16((x) & 0x0000FFFF) << 16) | \
BIG2LE_16(((x) >> 16) & 0x0000FFFF)
#endif /* !UTILS_HPP */
| 276 | 165 |
/*
** Copyright 2009-2013,2021 Centreon
**
** 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 agr... | 10,242 | 3,326 |
#include "factory.cpp"
int main(int argc, char* argv[])
{
signal(SIGINT, sig_handler);
struct session session;
int ret = parse_arguments(argc, argv, &session);
if (ret == EXIT_SUCCESS || ret == EXIT_FAILURE)
{
return ret;
}
return run_session(&session);
}
| 296 | 107 |
// Prošlu strukturu i funkcije implementirajte u zasebnoj datoteci zaglavlja i implementacije(kompleksniBroj.hpp i KompleksniBroj.cpp)
// U glavnoj datoteci includajte vašu datoteku i prikažite korištenje strukture i pripadnih funkcija.
#include <iostream>
#include "KompleksniBroj.hpp"
int main(){
prikaziKompleks... | 401 | 177 |
#pragma once
#include "JsonLoader/JsonLoader.hpp"
| 50 | 17 |
#include <fstream>
#include <utest/utest.h>
#include "fixture/enum.h"
#include <nano/core/stream.h>
#include <nano/core/estimator.h>
using namespace nano;
static auto to_string(const estimator_t& estimator)
{
std::ostringstream stream;
UTEST_REQUIRE_NOTHROW(estimator.write(stream));
UTEST_REQUIRE(stream);... | 9,396 | 3,673 |
#include "stable.h"
void xfBeep(int freq, int duration)
{
std::printf ("beeping!!!");
}
bool xfBetween(double val, double val1, double val2)
{
if (val1<val2)
{
if ((val >= val1) && (val <= val2))
return true;
return false;
}
else
{
if ((v... | 718 | 255 |
/*
Shnak's Baby-Step-giant-Step Algorithm
a^x = b (mod m)
return the power x where a , b , m given
*/
#define mod 100000007
ll solve (ll a, ll b, ll m)
{
ll n = (ll) sqrt (m + .0) + 1 , an = 1 , curr ;
rep(i,n) an = (an * a) % m;
map<ll,ll> vals;
curr = an ;
For(i,n){
if ( !vals.count(curr) ) vals[ curr ... | 663 | 304 |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/status/clock_menu_button.h"
#include "base/i18n/time_formatting.h"
#include "base/string_util.h"
#include "base/tim... | 6,590 | 2,038 |
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/platform/default/logging.h"
#include "tensorflow/core/framework/shape_inference.h"
#include<cmath>
// Signatures for GPU kernels here
using namespace tensorflow;
#include "ComputeFemMassMat... | 4,133 | 1,491 |
#include "Parser.h"
Pulsar::Parser::Parser(std::string sourceCode) {
this->sourceCode = sourceCode;
}
void Pulsar::Parser::parse() {
Pulsar::Lexer lexer = Lexer(this->sourceCode);
this->tokens = lexer.tokenize();
this->errors = lexer.getErrors();
if (this->errors->hasError()) return;
Pulsar:... | 364 | 130 |