doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
1fc2f6eb-4cec-4b56-b670-1d8bcc0c699f | {
"language": "C++"
} | ```c++
```
Add some tests for tasks. | ```c++
#include <iostream>
#include <gtest/gtest.h>
#include "ell.hpp"
#include "exceptions/cancelled.hpp"
TEST(test_task, simple_yield)
{
using namespace ell;
EventLoop loop;
int count = 0;
bool has_run = false;
auto task2 = loop.call_soon([&]()
{
... |
ca0f1e74-24c0-4b68-ba1f-ea3edf03517e | {
"language": "C++"
} | ```c++
```
Add a test for resizing of a vector with copy-only elements | ```c++
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===--------------------... |
c57f9cc4-0cd2-4af1-a128-f6c595e13d7a | {
"language": "C++"
} | ```c++
```
Add empty board::lowLevelInitialization() for NUCLEO-F429ZI | ```c++
/**
* \file
* \brief board::lowLevelInitialization() implementation for NUCLEO-F429ZI
*
* \author Copyright (C) 2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
*
* \par License
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of t... |
9f38dc6d-8791-4c08-b922-db4153f81634 | {
"language": "C++"
} | ```c++
```
Check if strings are anagram | ```c++
# include <iostream>
# include <algorithm>
using namespace std;
bool isAnagram(string str1, string str2) {
if str1.size() != str2.size()
return false;
sort(str1.begin(), str1.end());
sort(str2.begin(), str2.end());
return str1 == str2;
}
int main() {
string str1, str2;
cout << "Enter first string" << ... |
db937de3-12c4-407f-b79f-fb91fdd76984 | {
"language": "C++"
} | ```c++
```
Test suite for global fakes from a cpp context | ```c++
extern "C"{
#include "global_fakes.h"
}
#include <gtest/gtest.h>
DEFINE_FFF_GLOBALS;
class FFFTestSuite: public testing::Test
{
public:
void SetUp()
{
RESET_FAKE(voidfunc1);
RESET_FAKE(voidfunc2);
RESET_FAKE(longfunc0);
RESET_HISTORY();
}
};
#include "test_case... |
f52850a8-aa7d-401f-a303-b44e1f07bde3 | {
"language": "C++"
} | ```c++
```
Add dfs implementation in c++ | ```c++
#include <bits/stdc++.h>
#define MAX ...
vector<int> G[MAX];
/* this array may be initialized with false
eg.: memset(visited, false, sizeof visited) */
bool visited[MAX];
void dfs(int at) {
if(visited[at])
return;
visited[at] = true;
for (int i= 0; i< (int)G[at].size(); i++)
d... |
9d13fcc6-8ea4-45b8-8c5f-73a7f4afb636 | {
"language": "C++"
} | ```c++
```
Fix wrong renames detected by git. | ```c++
// Copyright (c) 2014-2015 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/
#include "test.hh"
namespace pegtl
{
void unit_test()
{
verify_analyze< not_at< eof > >( __LINE__, __FILE__, false );
verify_analyze< not_at< any > >( __LINE... |
37cea5b2-e6e3-4b36-bf9c-f80492fa82a7 | {
"language": "C++"
} | ```c++
// 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/settings/cros_settings.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chromeos/settings... | ```c++
// 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/settings/cros_settings.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chromeos/settings... |
46b4bcbc-f9a3-43aa-9c70-8f48a7e2944c | {
"language": "C++"
} | ```c++
```
Add algorithm to find Longest Repeated substring withot overlapping. | ```c++
#include<bits/stdc++.h>
using namespace std;
// Returns the longest repeating non-overlapping substring
string longestRepeatedSubstring(string str){
int n = str.length();
int LCSRe[n+1][n+1];
// Setting all to 0
memset(LCSRe, 0, sizeof(LCSRe));
string res; // To store result
int res_len... |
5c696dba-8d57-4a57-89da-531bed44451f | {
"language": "C++"
} | ```c++
```
Print elements from the end of linked list | ```c++
#include<iostream>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(){}
Node(int d){
data=d;
next=NULL;
}
Node *insertElement(Node *head,... |
f58c0417-6f2a-4fb8-a666-c5fb0fe8367b | {
"language": "C++"
} | ```c++
```
Add tests of skip() function. | ```c++
#include <test.hpp>
TEST_CASE("skip") {
SECTION("check that skip skips the right amount of bytes") {
std::vector<std::string> filenames = {
"boolean/data-true",
"boolean/data-false",
"bytes/data-one",
"bytes/data-string",
"bytes/data-bin... |
de407343-7083-4910-a3e3-c331bc70007b | {
"language": "C++"
} | ```c++
```
Add test case to check that implicit downcasting when a Func returns float (32 bits) but the buffer has type float16_t (16 bits) is an error. | ```c++
#include "Halide.h"
#include <stdio.h>
#include <cmath>
using namespace Halide;
// FIXME: We should use a proper framework for this. See issue #898
void h_assert(bool condition, const char *msg) {
if (!condition) {
printf("FAIL: %s\n", msg);
abort();
}
}
int main() {
Halide::Func f... |
73458f08-fc0d-47af-9c35-5cb5b9e4e4b8 | {
"language": "C++"
} | ```c++
```
Add cross-call example (case 2) | ```c++
#include <iostream>
using std::cin;
using std::cout;
int *A;
int sum;
void f(int i) {
A[i] = i * 3;
}
void g(int i) {
sum += A[i];
}
int main() {
unsigned n;
cin >> n;
A = new int[n];
sum = 0;
for (unsigned i = 0; i < n; ++i) {
f(i);
g(i);
}
cout << sum << '\n';
return 0;
}
``` |
86aea0ed-7301-43f8-b244-eedb67df6221 | {
"language": "C++"
} | ```c++
```
Add test for current AST dump behavior | ```c++
// RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck -strict-whitespace %s
// CHECK: TranslationUnitDecl 0x{{.+}} <<invalid sloc>> <invalid sloc>
// CHECK: `-<undeserialized declarations>
``` |
72e0dc01-2f1b-4ce7-b685-7ab0e8aa9e2e | {
"language": "C++"
} | ```c++
```
Add solution for chapter 18, test 28 | ```c++
#include <iostream>
using namespace std;
struct Base {
void bar(int i) {
cout << "Base::bar(int)" << endl;
}
protected:
int ival = 0;
};
struct Derived1 : virtual public Base {
void bar(char c) {
cout << "Derived1::bar(char)" << endl;
}
void foo(char c) ... |
9def1ce1-d9a1-4ea8-87c1-120faa60aa22 | {
"language": "C++"
} | ```c++
// Copyright (c) 2013 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 "ui/message_center/message_center_util.h"
#include "base/command_line.h"
#include "ui/message_center/message_center_switches.h"
name... | ```c++
// Copyright (c) 2013 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 "ui/message_center/message_center_util.h"
#include "base/command_line.h"
#include "ui/message_center/message_center_switches.h"
name... |
8f46dff2-74c1-4d90-a0ed-60c9930ac786 | {
"language": "C++"
} | ```c++
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
struct GrGLInterface;
const GrGLInterface* GrGLDefaultInterface() {
return NULL;
}
```
Include GrGLInterface.h instead of forward declaring, since we have to get... | ```c++
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GrGLInterface.h"
const GrGLInterface* GrGLDefaultInterface() {
return NULL;
}
``` |
e0356b20-7d13-480f-a72c-607f54c73db1 | {
"language": "C++"
} | ```c++
```
Add missing source for DTLS hello verify | ```c++
/*
* DTLS Hello Verify Request
* (C) 2012 Jack Lloyd
*
* Released under the terms of the Botan license
*/
#include <botan/internal/tls_messages.h>
#include <botan/lookup.h>
#include <memory>
namespace Botan {
namespace TLS {
Hello_Verify_Request::Hello_Verify_Request(const MemoryRegion<byte>& buf)
{
if... |
9f475aaa-810e-456b-b342-261be9007d90 | {
"language": "C++"
} | ```c++
```
Add gpio interrupt plus signal wait | ```c++
extern "C" {
#include <wiringPi.h>
}
#include <signal.h>
#include <errno.h>
#include <iostream>
#include <thread>
#include <chrono>
void gpio4Callback(void) {
std::cout << "Hello" << std::endl;
}
int main(){
sigset_t set;
int sig;
int *sigptr = &sig;
int ret_val;
sigemptyset(&set);... |
36cb7847-78c0-4f6d-8ac6-589873ee0233 | {
"language": "C++"
} | ```c++
```
Add solution for chapter 16 test 41 | ```c++
#include <iostream>
#include <limits>
using namespace std;
template <typename T1, typename T2>
auto sum(T1 a, T2 b) -> decltype(a + b) {
return a + b;
}
int main() {
char c1 = 127;
char c2 = 127;
long lng = numeric_limits<long>::max() - 200;
cout << sum(c1, c2) << endl;
... |
c460ec81-154f-48f4-a390-c0e851efb419 | {
"language": "C++"
} | ```c++
```
Implement For Loop Using Sizeof Example | ```c++
#include <iostream>
using namespace std;
int main(){
string animals[][3] = {
{"fox", "dog", "cat"},
{"mouse", "squirrel", "parrot"}
};
for(int i = 0; i < sizeof(animals)/sizeof(animals[0]); i++){
for(int j = 0; j < sizeof(animals[0])/sizeof(string); j++){
cout << animals[i][j] << " " <... |
eeb52a53-18a2-4398-a23c-489999410588 | {
"language": "C++"
} | ```c++
```
Append K Integers With Minimal Sum | ```c++
class Solution {
public:
long long minimalKSum(vector<int>& nums, int k) {
auto cmp = [](int left, int right){
return left > right;
};
std::priority_queue<int, std::vector<int>, decltype(cmp)> q(cmp);
for (const auto& num : nums) {
q.emplace(std::move(n... |
ebb30fce-9483-45a3-9c61-3343dbddc859 | {
"language": "C++"
} | ```c++
// Copyright (c) 2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "wallet/test/wallet_test_fixture.h"
#include "rpc/server.h"
#include "wallet/db.h"
#include "wallet/wallet.h"
CW... | ```c++
// Copyright (c) 2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "wallet/test/wallet_test_fixture.h"
#include "rpc/server.h"
#include "wallet/db.h"
#include "wallet/wallet.h"
st... |
4ecf6b4a-d5ee-457d-ac31-cc685bac6fef | {
"language": "C++"
} | ```c++
```
Create dumb test for better coverage | ```c++
#include <sstream>
#include <gtest/gtest.h>
#include "portsocket.h"
#define TEST_CLASS PortSocketTest
class TEST_CLASS : public testing::Test {
protected:
class DummySocket : PortSocket {
public:
DummySocket(bool *sentinel) : sentinel(sentinel) { *sentinel = true; }
int read(PortType po... |
a7870cda-585c-4526-a770-c6ec33d0e4cc | {
"language": "C++"
} | ```c++
```
Add a test that we emit copy-ctors for captures in generic lambdas. | ```c++
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s -std=c++14 | FileCheck %s
template<typename> struct custom_copy_ctor {
custom_copy_ctor() = default;
custom_copy_ctor(custom_copy_ctor const &) {}
};
// CHECK: define {{.*}} @_ZN16custom_copy_ctorIvEC2ERKS0_(
void pr22354() {
custom_copy_ctor... |
e33ce89e-7531-4f33-8f8c-24ea6fcae45b | {
"language": "C++"
} | ```c++
```
Add an input file that includes all standard C++ headers | ```c++
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cs... |
05d20b6b-b492-4e42-9480-d390c927f610 | {
"language": "C++"
} | ```c++
```
Add binary tree live implementation | ```c++
#include <iostream>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node(int data, Node* left = nullptr, Node* right = nullptr)
: data(data), left(left), right(right) {}
};
class BinaryTree {
Node* root;
BinaryTree(Node* node) {
root = copyNode(node);
}
Node* ... |
4c4437cb-cb95-4ee3-a2d9-70fc8772aa7a | {
"language": "C++"
} | ```c++
```
Add c++ code for printing the side view of a binary tree | ```c++
#include <iostream>
#include <queue>
using namespace std;
class Node {
public:
int data;
Node *left;
Node *right;
Node(int x) {
data = x;
left = NULL;
right = NULL;
}
};
vector<Node *> rightView(Node *root) {
vector<Node *> rightView;
if (root == NULL) return rightView;
queue<Node ... |
5f2f0129-d5d4-4297-92c2-494ff7321222 | {
"language": "C++"
} | ```c++
```
Add EH test case checking that handlers in noexcept functions can still unwind | ```c++
//===---------------------- catch_in_noexcept.cpp--------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------... |
9ac9d1f3-b0fa-41fa-9efe-6d8ce84ac853 | {
"language": "C++"
} | ```c++
```
Add test forgotten in r314262. | ```c++
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu | FileCheck %s
extern int aa __attribute__((section(".sdata")));
// CHECK-DAG: @aa = external global i32, section ".sdata", align 4
extern int bb __attribute__((section(".sdata"))) = 1;
// CHECK-DAG: @bb = global i32 1, section ".sdata", align 4... |
f5b5b902-246f-4487-8eb9-9db9319b7513 | {
"language": "C++"
} | ```c++
```
Add the solution to "Cached Calculations". | ```c++
#include <iostream>
using namespace std;
long long solve(int n)
{
long long *res = new long long[n + 1];
switch (n) {
case 1: return 1;
case 2: return 2;
case 3: return 3;
case 4: return 6;
}
res[1] = 1;
res[2] = 2;
res[3] = 3;
res[4] = 6;
for (int i = 5; i <= n; ... |
99cf8baa-8bf8-4a39-b5b0-e2a5323b0c66 | {
"language": "C++"
} | ```c++
```
Add a test for i64sqrt | ```c++
/*
Copyright Eli Dupree and Isaac Dupree, 2011, 2012
This file is part of Lasercake.
Lasercake 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
... |
fe866471-09da-4a5f-8d06-eb725b59fb35 | {
"language": "C++"
} | ```c++
```
Add tests for glow implementation | ```c++
#include <gtest/gtest.h>
#include "photoeffects.hpp"
using namespace cv;
TEST(photoeffects, GlowTest) {
Mat image(10, 10, CV_8UC1);
EXPECT_EQ(10, glow(image));
}``` |
024531e3-2ed1-41c3-9ac2-49bda577875c | {
"language": "C++"
} | ```c++
// 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/net/async_dns_field_trial.h"
#include "base/metrics/field_trial.h"
#include "build/build_config.h"
#include "chrome/c... | ```c++
// 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/net/async_dns_field_trial.h"
#include "base/metrics/field_trial.h"
#include "build/build_config.h"
#include "chrome/c... |
3639f056-4739-4013-baa1-1f812e25b0dc | {
"language": "C++"
} | ```c++
```
Test for C++11 [class]p6 (trivial classes). | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
class Trivial { int n; void f(); };
class NonTrivial1 { NonTrivial1(const NonTrivial1 &); };
class NonTrivial2 { NonTrivial2(NonTrivial2 &&); };
class NonTrivial3 { NonTrivial3 operator=(const NonTrivial3 &); };
class NonTrivial4 { NonTrivial4 operator=(Non... |
e5cd4159-b214-4e5e-9b80-8429a4e30ed0 | {
"language": "C++"
} | ```c++
```
Add Window Message Class (Continued) | ```c++
#include "LanguageEasy.h"
//Windows
WindowMessage::WindowMessage()
{
MessageName = "";
Message = "";
}
WindowMessage::WindowMessage(string NewMessageName, string NewMessage)
{
MessageName = NewMessageName;
Message = NewMessage;
}
void WindowMessage::OutputWindow()
{
char MessageBuffer[9999];
char Messag... |
3db7600d-1287-4b01-a970-125c41f29f30 | {
"language": "C++"
} | ```c++
```
Add basic skeleton for object pool | ```c++
#include "logic.h"
#define ARBITRARY_SIZE 20
block* blockAlloc( void );
void blockFree( block * );
//Object pool:
static int mem_size {0};
static int mem_used {0};
static block* mem_array[BOARD_HEIGHT * BOARD_WIDTH / PIECES_PER_BLOCK];
block* blockAlloc( void )
{
//check if enough space exists
if( mem_u... |
44865055-8f50-43e3-be04-21ffdd5f1122 | {
"language": "C++"
} | ```c++
```
Implement queue using only stack | ```c++
#include <iostream>
#include <stack>
using namespace std;
struct Queue {
stack<int> s1, s2;
};
void enqueue(Queue *Q, int data) {
Q->s1.push(data);
}
int dequeue(Queue *Q) {
int top;
if (!Q->s2.empty()) {
top = Q->s2.top();
Q->s2.pop();
} else {
while (!Q->s1.empty(... |
a1c5d732-9366-44d4-89a8-e88c91c1b099 | {
"language": "C++"
} | ```c++
```
Add test coverage for cc1's trigraph option handling. | ```c++
// RUN: %clang_cc1 -DSTDCPP11 -std=c++11 -verify -fsyntax-only %s
// RUN: %clang_cc1 -DSTDGNU11 -std=gnu++11 -verify -fsyntax-only %s
// RUN: %clang_cc1 -DSTDGNU11TRI -trigraphs -std=gnu++11 -verify -fsyntax-only %s
// RUN: %clang_cc1 -DSTDCPP17 -std=c++1z -verify -fsyntax-only %s
// RUN: %clang_cc1 -DSTDCPP17TR... |
32353829-51ba-40bd-a10a-5090444b486d | {
"language": "C++"
} | ```c++
// 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 "ui/compositor/test/test_suite.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "ui/compositor/... | ```c++
// 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 "ui/compositor/test/test_suite.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "ui/compositor/... |
f423b923-221d-4b37-9910-83719061a673 | {
"language": "C++"
} | ```c++
```
Add CPP hello world example | ```c++
#include <cstdio> // Libreria estandar de IO C++
int main( int argc, char *argv[] ) {
/*
Usamos el operador de resolucion :: para acceder a los elementos
dentro de la libreria estandar std
*/
std::cout << "Hola mundo!" << std::endl;
}
``` |
4356dd5f-d688-47c1-872f-1b9cc8cd50cc | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 043 | ```c++
// 043. Multiply Strings
/**
* Given two numbers represented as strings, return multiplication of the numbers as a string.
*
* Note: The numbers can be arbitrarily large and are non-negative
*
* Tags: Math, String
*
* Similar Problems: (M) Add Two Numbers, (E) Plus One, (E) Add Binary
*
* Author: Kuang ... |
9ff96deb-72f5-486f-97ae-b235f61d817c | {
"language": "C++"
} | ```c++
```
Add arg for show mode | ```c++
#include "stdafx.h"
#include "ShowModeConverter.h"
WORD ShowModeConverter::ToShowWindowFlag(const ShowMode& showMode)
{
if (showMode == SHOW_MODE_HIDE)
{
return SW_HIDE;
}
if (showMode == SHOW_MODE_NORMAL)
{
return SW_NORMAL;
}
if (showMode == SHOW_MODE_SHOW)
{
return SW_SHOW;
}
return 0;
}
`... |
e60d3082-bc94-4eb8-b12c-484b64db9711 | {
"language": "C++"
} | ```c++
```
Add Linux event handler export function. | ```c++
#include "LinuxEventHandler.h"
#include "OSEventHandlerExport.h"
std::shared_ptr<ni::EventHandler> GetOSEventHandler(ni::DeviceType devices) {
return std::make_shared<ni::LinuxEventHandler>(devices);
}``` |
0c47b6af-4a6d-42ce-a672-33ec367cf2f5 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted Array II | ```c++
//
// Remove_Duplicates_from_Sorted_Array_2.cpp
// leetcode
//
// Created by 邵建勇 on 15/5/11.
// Copyright (c) 2015年 John Shaw. All rights reserved.
//
#include <stdio.h>
#include <vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.size() ==... |
3f00ae2d-9744-4412-806e-0ad803234f97 | {
"language": "C++"
} | ```c++
```
Add file missed in r574. | ```c++
#include <common/buffer.h>
#include <event/action.h>
#include <event/callback.h>
#include <event/event.h>
#include <event/event_system.h>
Action *
Callback::schedule(void)
{
return (EventSystem::instance()->schedule(this));
}
``` |
f361c5d4-cb6a-42cc-9978-a6f15ca95130 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from sorted list (Made general case for unsorted list). | ```c++
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
/*
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
*/
class Solution {
public:
L... |
878da135-aa2c-4405-bb31-2cb221782214 | {
"language": "C++"
} | ```c++
```
Add a streamed tcp conn unit test | ```c++
#include "unittest/gtest.hpp"
#include "arch/streamed_tcp.hpp"
namespace unittest {
namespace {
/* `run_in_thread_pool()` starts a RethinkDB IO layer thread pool and calls the
given function within a coroutine inside of it. */
struct starter_t : public thread_message_t {
thread_pool_t *tp;
boost::fu... |
a5aa3029-5e10-4e13-ac96-8c0785370acb | {
"language": "C++"
} | ```c++
```
Add a proper test for -Wsystem-headers | ```c++
// Test that -Wsystem-headers works with default and custom mappings like -Werror.
// Keep run lines at the bottom for line number stability.
#ifdef IS_SYSHEADER
#pragma clang system_header
int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of tes... |
5525e85f-9ee9-4f92-baf4-1be98a27d298 | {
"language": "C++"
} | ```c++
```
Add Chapter 24, exercise 10 | ```c++
// Chapter 24, exercise 10: test rand(); write a program that takes two integers
// n and d and calls randint(n) d times; output the number of draws for each
// [0:n) and see if there are any obvious biases
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<map>
using namespace std... |
6087257b-4379-4cab-8374-6ab463b5c12d | {
"language": "C++"
} | ```c++
```
Add Maximum consecutive sum in c++ | ```c++
#include <bits/stdc++.h>
using namespace std;
int main()
{
int sum = 0;
int max_sum = array[0];
for (int i = 0; i < length; ++i)
{
sum += array[i];
sum = max(0, sum);
max_sum = max(sum, max_sum);
}
return max_sum;
}
``` |
fc711528-6b3f-4b8b-8569-a101e5672bab | {
"language": "C++"
} | ```c++
```
Add an example of JSON generation | ```c++
// Copyright Louis Dionne 2015
// Distributed under the Boost Software License, Version 1.0.
#include <boost/hana.hpp>
#include <boost/hana/struct_macros.hpp>
#include <iostream>
#include <string>
#include <type_traits>
#include <utility>
using namespace boost::hana;
using namespace std::literals;
std::strin... |
300cd841-479b-42b5-a11d-21caa4158a73 | {
"language": "C++"
} | ```c++
```
Disable gvn non-local speculative loads under asan. | ```c++
// Verifies that speculative loads from unions do not happen under asan.
// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=detect_leaks=0 %run %t 2>&1
// RUN: %clangxx_asan -O1 %s -o %t && ASAN_OPTIONS=detect_leaks=0 %run %t 2>&1
// RUN: %clangxx_asan -O2 %s -o %t && ASAN_OPTIONS=detect_leaks=0 %run %t 2>&1
// ... |
b9a851ca-ec17-49f9-a310-9251974eed6d | {
"language": "C++"
} | ```c++
// Copyright 2014 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 "config.h"
#include "core/dom/RemoteSecurityContext.h"
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "platform/weborigin/Sec... | ```c++
// Copyright 2014 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 "config.h"
#include "core/dom/RemoteSecurityContext.h"
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "platform/weborigin/Sec... |
00e35d08-9923-4717-9a38-d8acf34a8da2 | {
"language": "C++"
} | ```c++
```
Implement initial selectiondag printing support. This gets us a nice graph with no labels! :) | ```c++
//===-- SelectionDAGPrinter.cpp - Implement SelectionDAG::viewGraph() -----===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===-... |
3703c3f9-a007-488e-925f-e2679fd57e9c | {
"language": "C++"
} | ```c++
```
Add use-after-scope test which fails because of bug in clang | ```c++
// RUN: %clangxx_asan -O0 -fsanitize-address-use-after-scope %s -o %t
// RUN: not %run %t 'A' 2>&1 | FileCheck %s
// RUN: not %run %t 'B' 2>&1 | FileCheck %s
// Missing lifetime markers in test_a
// https://bugs.llvm.org/show_bug.cgi?id=34353
// XFAIL: *
struct B {
B() : p('B') {}
char p;
};
struct C {
... |
f482e299-962f-4ceb-b194-a40d014ad92c | {
"language": "C++"
} | ```c++
// Copyright 2013 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/apps/app_browsertest_util.h"
#include "extensions/test/extension_test_message_listener.h"
// This class of BrowserTests i... | ```c++
// Copyright 2013 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/apps/app_browsertest_util.h"
#include "extensions/test/extension_test_message_listener.h"
// This class of BrowserTests i... |
8a541baf-c7ad-4843-80da-d791f4488c96 | {
"language": "C++"
} | ```c++
```
Add custom inliner that handles only functions that are marked as always_inline. | ```c++
//===- InlineAlways.cpp - Code to perform simple function inlining --------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===------------------------------------------------... |
3306dd9c-dce4-44f2-84ec-5b8befed6dc1 | {
"language": "C++"
} | ```c++
```
Add test case for r287758. | ```c++
#include "Inputs/HeaderWithSymbol.h"
#define FOO int bar;
FOO
int foo;
// RUN: not clang-rename -new-name=qux -offset=259 %s -- 2>&1 | FileCheck %s
// CHECK-NOT: CHECK
// CHECK: error: SourceLocation in file {{.*}}InvalidOffset.cpp at offset 259 is invalid
``` |
44e12b60-358b-4ce5-aabf-eb87be69344e | {
"language": "C++"
} | ```c++
```
Clean up tmp files when deleting Compilation objects | ```c++
// REQUIRES: shell
// RUN: rm -rf %t
// RUN: mkdir -p %t
// This is a reproducer for PR37091.
//
// Verify that no temporary files are left behind by the clang-tidy invocation.
// RUN: env TMPDIR=%t TEMP=%t TMP=%t clang-tidy %s -- --target=mips64
// RUN: rmdir %t
``` |
ac245c31-e0d8-468d-bd43-32dd59eddb7a | {
"language": "C++"
} | ```c++
```
Add test for the treenode. | ```c++
#include "tree_node.h"
#include "gtest\gtest.h"
/*
This file will include all the test for the TreeNode class.
*/
TEST(TreeNodeTest, AddChild) {
//Initialize a node with some children.
TreeNode<int> focusNode;
TreeNode<int> child1;
TreeNode<int> child2;
focusNode.addChild(&child1);
focusN... |
13456feb-c450-4c16-8412-e52c5dd1cfc8 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 5 | ```c++
// Chapter 25, exercise 5: write an infinite loop and execute it
#include<iostream>
#include<exception>
using namespace std;
int main()
try
{
while (true)
cout << "Looping!\n";
}
catch (exception& e) {
cerr << "exception: " << e.what() << endl;
}
catch (...) {
cerr << "exception\n";
re... |
5916072d-b524-47a6-97ee-702d290c8bfe | {
"language": "C++"
} | ```c++
```
Add a solution of prob 3 | ```c++
#include <stdio.h>
int main(void)
{
int N;
printf("Enter N= ");
scanf("%d", &N);
/* Get the largest number in the power of two, which satisfies less than or equal to N */
int v = 1;
while(v <= N) v = v << 1;
v = v >> 1;
/* Calculate and print to screen */
while(v > 0)
... |
8bb8a7f3-d7cf-4e05-a260-8fa3eda3bbbf | {
"language": "C++"
} | ```c++
```
Add "read lines from stream" sample | ```c++
// Read lines from a stream
#include <sstream>
#include <string>
int main()
{
std::istringstream stream{"This stream\n"
"contains many\n"
"lines.\n"};
std::string line;
while (std::getline(stream, line)) {
// Process line
}
}
// Process the contents... |
8bc55bd9-9ec5-402f-8525-bd78af5037c4 | {
"language": "C++"
} | ```c++
```
Allow specific files and multiple inputs for picture testing tools. | ```c++
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Test.h"
#include "picture_utils.h"
#include "SkString.h"
static void test_filepath_creation(skiatest::Reporter* reporter) {
SkString result;
SkString ... |
b99337d8-5612-4046-bb38-a2b44b054c6b | {
"language": "C++"
} | ```c++
```
Verify Preorder Serialization of a Binary Tree | ```c++
class Solution {
public:
bool isValidSerialization(string preorder) {
int diff = 1;
std::string temp = "";
for (const auto &c : preorder) {
if (c == ',') {
--diff;
if (diff < 0)
return false;
if (temp != "... |
95e1ac77-c0e2-4a46-8621-0ac6a7e5e050 | {
"language": "C++"
} | ```c++
```
Solve SRM 144, Div 2, Problem BinaryCode | ```c++
#include <vector>
#include <iostream>
#include <string>
using namespace std;
class BinaryCode {
public:
vector <string> decode(string message) {
vector <string> result;
unsigned len = message.length() + 2;
int P[len];
int Q[len];
Q[0] = Q[len-1] = 0;
for (unsigned i = 0; i < message.le... |
b09653a5-345b-437f-90fa-8ce45480dba0 | {
"language": "C++"
} | ```c++
```
Add PIP (point in polygon) problem | ```c++
/*
* Copyright (C) 2015-2016 Pavel Dolgov
*
* See the LICENSE file for terms of use.
*/
#include <bits/stdc++.h>
typedef std::pair<int, int> IntPair;
typedef std::vector<IntPair> IntPairs;
int vectorMul(IntPair a, IntPair b) {
return a.first * b.second - b.first * a.second;
}
int scalarMul(IntPair a,... |
610abe6b-c000-44bd-b126-17ace344511e | {
"language": "C++"
} | ```c++
```
Add "compile-time decorator pattern" sample | ```c++
// Decorator (compile-time)
class foo_concrete
{
public:
void do_work()
{ }
};
template <typename Foo>
class foo_decorator
{
public:
foo_decorator(Foo& f)
: f{f}
{ }
void do_work() {
// Do something else here to decorate
// the do_work function
f.do_work();
}
private:
Foo& f;
};
... |
cccc18eb-de8d-4116-902f-b4958d37ffde | {
"language": "C++"
} | ```c++
```
Add test for memory leak to be run with valgrind | ```c++
#include "../../test.h"
#include "../../func/func-common.h"
#include <iostream>
TEST_CASE( "sensor get_option memory leak", "[live]" )
{
// running this test with the following command:
// `valgrind --leak-check=yes --show-leak-kinds=all --track-origins=yes ./unit-tests/build/utilities/memory/t... |
65780366-5508-4eaa-b29f-72e06d0c20fd | {
"language": "C++"
} | ```c++
```
Add empty chip::lowLevelInitialization() for STM32F7 | ```c++
/**
* \file
* \brief chip::lowLevelInitialization() implementation for STM32F7
*
* \author Copyright (C) 2017 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
*
* \par License
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL ... |
bfc53406-12c1-4973-9ebb-0c01a90ed427 | {
"language": "C++"
} | ```c++
```
Add test file template (to create a new test) | ```c++
// Copyright © 2012 Lénaïc Bagnères, hnc@singularity.fr
// 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 appl... |
a5bb36dc-be9f-435d-b8c7-8f755d96f36f | {
"language": "C++"
} | ```c++
```
Add solution for the minimum number of coins problem. | ```c++
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
void print(std::vector<int> &solutions) {
std::for_each(solutions.begin(), solutions.end(), [](auto item) {
std::cout << item << " ";
});
std::cout << "\n";
}
class MinNumberOfCoints {
public:
int min(const int val) {
... |
fc730396-700d-4a60-9261-692673793f67 | {
"language": "C++"
} | ```c++
```
Add solution for 21. Merge Two Sorted Lists. | ```c++
/**
* link: https://leetcode.com/problems/merge-two-sorted-lists/
* Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNod... |
478a4ae9-5d99-4a64-b933-89ccb600b438 | {
"language": "C++"
} | ```c++
```
Add test for event.cc changes to name_spec parsing | ```c++
#include "wtf/event.h"
#include <fstream>
#include "testing/base/public/gunit.h"
namespace wtf {
namespace {
class EventTest : public ::testing::Test {
protected:
void TearDown() override {}
EventDefinition CreateEventDefinition(const char *name_spec) {
return EventDefinition::Create<int, const cha... |
25804f6e-98af-49fa-b70f-c0107ee8a7f8 | {
"language": "C++"
} | ```c++
```
Add a regression test for merging anon decls in extern C contexts. | ```c++
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -verify %s
// expected-no-diagnostics
#pragma clang module build sys_types
module sys_types {}
#pragma clang module contents
#pragma clang module begin sys_types
extern "C" {
typedef union { bool b; } pthread_mutex_t;
}
#pragma clang modul... |
d79f6e29-57e0-4c0c-9a15-483d92145db3 | {
"language": "C++"
} | ```c++
// Shared ownership
#include <memory>
#include <utility>
struct foo {};
void func(std::shared_ptr<foo> obj)
{ }
int main()
{
std::shared_ptr<foo> obj = std::make_shared<foo>();
pass_shared_ownership(obj);
}
// Share ownership of a dynamically allocated object with another
// unit of code.
//
// On [13], ... | ```c++
// Shared ownership
#include <memory>
#include <utility>
struct foo {};
void func(std::shared_ptr<foo> obj)
{ }
int main()
{
std::shared_ptr<foo> obj = std::make_shared<foo>();
func(obj);
}
// Share ownership of a dynamically allocated object with another
// unit of code.
//
// On [13], we create a [`std... |
506fd522-15ea-4071-917a-9433818efbe1 | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 003 | ```c++
// 3. Longest Substring Without Repeating Characters
/**
* Given a string, find the length of the longest substring without repeating characters.
* For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3.
* For "bbbbb" the longest substring is "b", with th... |
49e4dac5-7c0e-4bc6-8f80-868e8a604b52 | {
"language": "C++"
} | ```c++
```
Add a solution for task 8b | ```c++
#include <cstdio>
#include <vector>
using namespace std;
const int N = 1 << 10;
vector <int> graph[N];
bool visited[N];
int m;
void input()
{
scanf("%d\n", &m);
for (int i = 0; i < m; i++)
{
int u, v;
scanf("%d%d", &u, &v);
graph[u].push_back(v);
}
}
void dfs(int u)
{
visited[u] = 1;
... |
d014305b-c70f-4bef-b625-22a3816ed5a5 | {
"language": "C++"
} | ```c++
```
Add fixed time step sample | ```c++
// Fixed time step
// C++11, C++14
#include <chrono>
#include <thread>
using namespace std::literals::chrono_literals;
void some_complex_work();
int main()
{
using clock = std::chrono::steady_clock;
clock::time_point next_time_point = clock::now() + 5s;
some_complex_work();
std::this_thread::sleep_unti... |
9a0109f8-32e7-43b3-8c6b-b5d66c9e968a | {
"language": "C++"
} | ```c++
```
Add c++11 thread creation with function pointer. It generates random vector of 1024 integers and creates two threads to summarize bottom and top half respectfully. | ```c++
#include <iostream>
#include <vector>
#include <thread>
#include <algorithm>
#include <cstdlib>
void accumulator_function2(const std::vector<int> &v, unsigned long long &acm, unsigned int beginIndex, unsigned int endIndex) {
acm = 0;
for (unsigned int i = beginIndex; i < endIndex; ++i) {
acm += ... |
124eb350-a48e-4110-9f8f-73ac5ebe9d81 | {
"language": "C++"
} | ```c++
```
Put example code in repo | ```c++
#include "Software/NeuralNet.h"
#include "Software/Backpropagation.h"
#include <iostream>
/*
This is example code which runs a Backpropagating neural network.
It is supposed to double any input number.
This is the example code from the readme of https://github.com/FidoProject/Fido
To compile, run in termin... |
8ff17c26-1f34-4640-961f-629e61e4b823 | {
"language": "C++"
} | ```c++
```
Create new GM to target translations problems in GrAtlasTextContext | ```c++
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkCanvas.h"
#include "SkTextBlob.h"
namespace skiagm {
class TextBlobBlockReordering : public GM {
public:
// This gm tests that textblo... |
864ed155-66e7-428f-b3df-d34dec2f7fcb | {
"language": "C++"
} | ```c++
```
Add check of B+Tree / Set | ```c++
/*
* Copyright (c) 2021-2022-2022, Patrick Pelissier
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* + Redistributions of source code must retain the above copyright
* notice, this ... |
5415e065-de1b-423c-888d-bb165075c0d0 | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 034 | ```c++
// 034. Search for a Range
/**
* Given a sorted array of integers, find the starting and ending position of a given target value.
*
* Your algorithm's runtime complexity must be in the order of O(log n).
*
* If the target is not found in the array, return [-1, -1].
*
* For example,
* Given [5, 7, 7, 8, 8... |
7886f693-3f13-4b93-b981-48262363c374 | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 124 | ```c++
// 124. Binary Tree Maximum Path Sum
/**
* Given a binary tree, find the maximum path sum.
*
* For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path does not need to go through the root.
*
* For example:
* G... |
514f7b0e-dec9-4077-b360-d9df2ac0694d | {
"language": "C++"
} | ```c++
```
Add forgotten to commit file. | ```c++
//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Baozeng Ding <sploving1@gmail.com>
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//-----------------------------------------------------------... |
686c41ba-cb6f-49c4-ad18-627b5ad670b2 | {
"language": "C++"
} | ```c++
```
Implement longest common subsequence length | ```c++
/**
* Longest Common Subsequence:
* Given two strings, find longest common subsequence between them.
* https://www.youtube.com/watch?v=NnD96abizww&index=2&list=PLrmLmBdmIlpsHaNTPP_jHHDx_os9ItYXr
*/
#include <iostream>
using namespace std;
void print(unsigned int **T, int M, int N) {
for (int i = 0; i <=... |
a23bde40-f9c8-42b2-bd3c-4590aaf486ae | {
"language": "C++"
} | ```c++
// 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/ui/crypto_module_password_dialog.h"
#include "base/logging.h"
namespace chrome {
void UnlockSlotsIfNecessary(const ... | ```c++
// 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/ui/crypto_module_password_dialog.h"
#include "base/logging.h"
namespace chrome {
void UnlockSlotsIfNecessary(const ... |
164e811a-f026-4818-b3de-24297eb864df | {
"language": "C++"
} | ```c++
```
Add unit test for timer implementation. | ```c++
/*
* Copyright 2014-2015 CyberVision, 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 applicabl... |
8cb112c3-473f-44c3-a843-61317c29551f | {
"language": "C++"
} | ```c++
```
Add missing C++ source file. | ```c++
#include <Rcpp.h>
#include "s2/s2latlng.h"
#include "s2/s2cellid.h"
//' @title
//' cell_center
//' @description
//' Get center of S2 cell containing a specified point
//'
//' @param lat latitude of interest (between -90 and +90)
//'
//' @param lng longitude of interest (between -180 and +180)
//'
//' @detail... |
9cd4044e-d79d-4192-bc83-7c28dcac0ef1 | {
"language": "C++"
} | ```c++
```
Add test for a bad fold. | ```c++
#include <stdio.h>
#include "Halide.h"
using namespace Halide;
int main(int argc, char **argv) {
Var x, y, c;
Func f, g;
f(x, y) = x;
g(x, y) = f(x-1, y+1) + f(x, y-1);
f.store_root().compute_at(g, y).fold_storage(y, 2);
Image<int> im = g.realize(100, 1000);
printf("Should have ... |
11abe782-c175-4aa9-b5a1-4f714bce6755 | {
"language": "C++"
} | ```c++
```
Add Chapter 25, Try This 3 | ```c++
// Chapter 25, Try This 3: get bits example to work, try a few values
#include<iostream>
#include<iomanip>
#include<bitset>
using namespace std;
int main()
{
int i;
while (cin>>i)
cout << dec << i << " == "
<< hex << "0x" << setw(8) << setfill('0') << i << " == "
<< bitset<8*si... |
1092e9a4-8147-4c9b-9f2a-fe563aeee04e | {
"language": "C++"
} | ```c++
// 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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
// Debugger... | ```c++
// 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 "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"
// Debugger... |
cd3a7c31-ba61-43ef-a880-3d3bbda74ded | {
"language": "C++"
} | ```c++
```
Add Factory method design pattern. | ```c++
#include <stdio.h>
#include <string>
class Shape {
public:
virtual void draw() = 0;
};
class Rectangle : public Shape {
public:
void draw() override { printf("Drawing Rectangle \n"); }
};
class Square : public Shape {
public:
void draw() override { printf("Drawing Square \n"); }
};
class Circle : pu... |
c5ed8129-fb1b-4ede-ac5f-49af41b4931d | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted Array | ```c++
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int nlen = 1, n = nums.size();;
if(n <= 1) return n;
for(int i=1; i < nums.size();i++){
if(nums[i] != nums[i-1]){
nums[nlen++] = nums[i];
}
}
return nlen;
}
}... |
d7589fd3-1573-4278-a1fb-79213cf07ab6 | {
"language": "C++"
} | ```c++
```
Add Bellman Ford Algorithm to graph search in c++ | ```c++
//
// main.cpp
// backToProblemSolving
//
// Created by Khaled Abdelfattah on 6/27/17.
// Copyright © 2017 Khaled Abdelfattah. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 1000000000
#define BASE1 23
#define BASE2 31
#define MOD1 1000000007
#defin... |
65b197c8-aa18-4d0d-a523-e16b0821f3e9 | {
"language": "C++"
} | ```c++
```
Add merging of two Binary Search Trees | ```c++
#include <iostream>
using namespace std;
/*
This represents the structure of the node of the Binary Search Tree.
*/
struct node
{
node * left;
node * right;
int data;
};
/*
This function adds new data into binary search tree (BST).
It takes root of the tree as parameter along with the new data... |
7be3dd30-f37f-4e93-9e15-5b6486102c9d | {
"language": "C++"
} | ```c++
#include "ec_gen.h"
Handle<ScopedEVP_PKEY> EC_generate(int &nidEc) {
LOG_FUNC();
Handle<ScopedEVP_PKEY> pkey;
ScopedEC_KEY eckey(EC_KEY_new_by_curve_name(nidEc));
if (eckey.isEmpty()) {
THROW_OPENSSL("EC_KEY_new_by_curve_name");
}
if (!EC_KEY_generate_key(eckey.Get())) {
THROW_OPENSSL(... | ```c++
#include "ec_gen.h"
Handle<ScopedEVP_PKEY> EC_generate(int &nidEc) {
LOG_FUNC();
Handle<ScopedEVP_PKEY> pkey;
ScopedEC_KEY eckey(EC_KEY_new_by_curve_name(nidEc));
if (eckey.isEmpty()) {
THROW_OPENSSL("EC_KEY_new_by_curve_name");
}
if (!EC_KEY_generate_key(eckey.Get())) {
THROW_OPENSSL(... |
742fe08a-993b-4e34-bab9-4bdf29d9d4c2 | {
"language": "C++"
} | ```c++
```
Check if All A's Appears Before All B's | ```c++
class Solution {
public:
bool checkString(string s) {
bool b_found = false;
for (const auto& c : s) {
if (c == 'a' && b_found)
return false;
if (c == 'b')
b_found = true;
}
return true;
}
};
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.