doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
36986802-2f8a-41d6-a7cf-68c7ccc76a64 | {
"language": "C++"
} | ```c++
```
Solve problem 17 in C++ | ```c++
// Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 17
// Number letter counts
namespace problem_17 {
long solve() {
constexpr long and_word = 3;
constexpr long hundred = 7;
constexpr long one_thousand = 3 + 8;
constexpr long a = 0+3+3+5+4+4+3+5+5+4; // 0, 1, ..., 9
... |
64e58e09-cdcf-403c-8b08-67b0c00461ea | {
"language": "C++"
} | ```c++
```
Add merge sort implementation for singly linked list | ```c++
/**
* Merge sort algorithm. One of the efficient sorting algorithm. Works
* on the principle of divide and conquer strategy.
*
* Very well suited especially for linked lists. Unlike array, in linked
* lists, we can insert items in the middle in O(1) space and O(1) time.
* So, merge operation can be impleme... |
edc02638-a7da-4e85-8878-fd67634dfe47 | {
"language": "C++"
} | ```c++
```
Allow is_initialized and initializer to be called on MirroredVariables and TowerLocalVariables. | ```c++
/* Copyright 2017 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 l... |
df3daec6-7a8f-4af9-86f7-5ff57bd610cf | {
"language": "C++"
} | ```c++
```
Convert satoshiwords to test case. | ```c++
/*
* Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* libbitcoin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License with
* additional permissions to the one published by the Free Software... |
89dc5c13-0f30-4ae4-b030-1468830814c4 | {
"language": "C++"
} | ```c++
```
Add missing test for -Wunneeded-member-functions. | ```c++
// RUN: %clang_cc1 -fsyntax-only -verify -Wunneeded-member-function %s
namespace {
class A {
void g() {} // expected-warning {{is not needed and will not be emitted}}
template <typename T>
void foo() {
g();
}
};
}
``` |
ec5dae37-74e1-453d-bd70-21a00010513d | {
"language": "C++"
} | ```c++
#include "df_hi_res_time.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
static double g_tickInterval = -1.0;
static double g_timeShift = 0.0;
inline double GetLowLevelTime();
static void InitialiseHighResTime()
{
LARGE_INTEGER count;
QueryPerformanceFrequency(&count);
g_t... | ```c++
#include "df_hi_res_time.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
static double g_tickInterval = -1.0;
static double g_timeShift = 0.0;
inline double GetLowLevelTime();
static void InitialiseHighResTime()
{
LARGE_INTEGER count;
QueryPerformanceFrequency(&count);
g_t... |
9094ebb3-1207-4e77-b5f3-6f1ca6b3fa63 | {
"language": "C++"
} | ```c++
```
Add a test for multiple Func's that are compute_root when compiling for a GPU target. | ```c++
#include <Halide.h>
#include <iostream>
using namespace Halide;
int main(int argc, char *argv[]) {
Var x;
Func kernel1;
kernel1(x) = floor(x / 3.0f);
Func kernel2;
kernel2(x) = sqrt(4 * x * x) + kernel1(x);
Func kernel3;
kernel3(x) = cast<int32_t>(x + kernel2(x));
Target tar... |
737ad851-9288-4a3d-8a9c-f35ca78b8558 | {
"language": "C++"
} | ```c++
```
Add the second codeforces problem | ```c++
/*
* Copyright (C) 2015 Pavel Dolgov
*
* See the LICENSE file for terms of use.
*/
/* http://codeforces.com/contest/527/submission/13054549 */
#include <iostream>
#include <vector>
int main() {
int n;
std::cin >> n;
/* Sieve of Eratosthenes */
std::vector<char> prime(n+1, true);
prime[... |
d935a8e7-0190-4e2e-8a53-20d4c03971d4 | {
"language": "C++"
} | ```c++
```
Add a solution for problem 208: Implement Trie (Prefix Tree). | ```c++
// Common implementation. Note below I add a NodeAfterPrefix to remove duplicate code
// in search and startsWith. I also add a ~Trie() destructor to prevent memory leak.
// Since the interface of Trie doesn't need to expose TrieNode, it's actually better
// to implement TrieNode as a inner class of Trie.
class... |
04ed7aa0-d29c-4b9f-8d5e-72b9671511f9 | {
"language": "C++"
} | ```c++
```
Add file missed in r884: initial sketching of algorithm negotiation initialization. | ```c++
#include <map>
#include <common/buffer.h>
#include <common/endian.h>
#include <ssh/ssh_algorithm_negotiation.h>
#include <ssh/ssh_protocol.h>
namespace {
static uint8_t constant_cookie[16] = {
0x00, 0x10, 0x20, 0x30,
0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xa0, 0xb0,
0xc0, 0xd0, 0xe0, 0xf0
};
templat... |
9c5dd96e-355d-4de4-ac9e-62ee1331cc1e | {
"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 <string>
#if defined(OS_CHROMEOS)
#include "base/basictypes.h"
#include "base/string_util.h"
#endif
namespace l10n_util {
// Return... | ```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 <string>
#if defined(OS_CHROMEOS)
#include "base/basictypes.h"
#include "base/string_util.h"
#endif
namespace l10n_util {
// Return... |
57e334c8-282b-4764-8150-4d61c502d186 | {
"language": "C++"
} | ```c++
```
Solve problem 20 in C++ | ```c++
// Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 20
// Factorial digit sum
#include "common.hpp"
#include <gmpxx.h>
namespace problem_20 {
long solve() {
mpz_class n(1);
for (long i = 2; i <= 100; ++i) {
n *= i;
}
return common::sum_of_digits(n);
}
} // namespac... |
ae25b94d-79a3-49b1-8201-aec1b2666f61 | {
"language": "C++"
} | ```c++
```
Add solution for problem 083 Remove Duplicates from Sorted List | ```c++
//083 Remove Duplicates from Sorted List
/*
*Given a sorted linked list, delete all duplicates such that each element appear only once.
*
*For example,
*Given 1->1->2, return 1->2.
*Given 1->1->2->3->3, return 1->2->3.
*
*Tag: Linked List
*
*Author: Linsen Wu
*/
#include "stdafx.h"
//Definition for ... |
bc2bf82e-b3fb-48e6-b4fa-0da10e58bc7e | {
"language": "C++"
} | ```c++
```
Test to check how different variable implementations | ```c++
#define BOOST_TEST_MODULE test_experimental
#include <stdexcept>
#include <memory>
#include <boost/test/included/unit_test.hpp>
#include "variable.hxx"
#include "function.hxx"
BOOST_AUTO_TEST_SUITE(test_experimental)
double sum(std::vector<double> & args)
{
double res(0.);
for (unsigned i = 0; i < args... |
51b5be0e-8495-41df-af5b-d49c5c55abfe | {
"language": "C++"
} | ```c++
```
Document bug with condition variables and static linking (C++) | ```c++
// Bug in clang/gcc or perhaps libc/nptl around static linking and condition
// variables.
//
// Fails: clang++ -std=c++11 -static -o cv cv.cc -lpthread
//
// Workaround:
// clang++ -std=c++11 -static -o cv cv.cc -Wl,--whole-archive -lpthread \
// -Wl,--no-whole-archive
//
#include <condition_variable>
#inclu... |
e46fd66c-2dc4-4301-b8d5-d837d7a8a1a5 | {
"language": "C++"
} | ```c++
```
Add a c++ inheritance example | ```c++
#include <iostream>
class A {
public:
void f();
void g();
};
class B : public A {
public:
void f();
};
class C {
public:
virtual void f();
void g();
};
class D : public C {
public:
void f();
};
void A::f() {
std::cout << "A\n";
}
void A::g() {
... |
1813dbbd-1138-434d-9f4b-4ae5b2695029 | {
"language": "C++"
} | ```c++
```
Add the solution to "QuickSort". | ```c++
#include <iostream>
#include <cstring>
using namespace std;
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void reverse(int *a, int start, int end)
{
for (int i = 0; i < (end - start + 1) / 2; i++) {
swap(a[start + i], a[end - i]);
}
}
void print(int *a, int start, int end)
{
for (int i ... |
54c4806f-c105-41fa-bd40-37ee9d9be3b4 | {
"language": "C++"
} | ```c++
```
Update Check BST or not | ```c++
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
/*
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
... |
5841cf74-c4e3-494b-8a4a-9f76d7ee20bb | {
"language": "C++"
} | ```c++
```
Add solution for chapter 17 test 29, test 30 | ```c++
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
int generate_random_number(unsigned long long seed = time(0), const int a = 0, const int b = 9) {
static default_random_engine e;
static uniform_int_distribution<unsigned> u(a, b);
e.seed(seed);
return u(e);
... |
7c3e377b-7a57-415a-97ae-fabd99589548 | {
"language": "C++"
} | ```c++
```
Add tests of the Read struct | ```c++
/*
* ============================================================================
*
* Filename: test-io.cc
* Description: Tests of the IO module.
* License: GPLv3+
* Author: Kevin Murray, spam@kdmurray.id.au
*
* =================================================================... |
c462f3f1-477c-484d-a478-8a8a610819e0 | {
"language": "C++"
} | ```c++
```
Add Ben Deane's unique_ptr guideline from his Twitter. | ```c++
// Ben Deane:
// https://twitter.com/ben_deane/status/964549956437606400
// https://t.co/mkOX0mf8jt
// When giving unique_ptr a custom deleter, prefer a stateless functor type over
// a function pointer type. The implementation won't have to store the pointer
// or call through it, and EBO means no overhead.
#i... |
d79d03b7-28c4-4b0d-ba07-72b6e95e4d8a | {
"language": "C++"
} | ```c++
```
Add Solution for Problem 031 | ```c++
// 031. Next Permutation
/**
* Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
*
* If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
*
* The replacement must be in-place... |
b5e5405e-63f6-452a-bfad-3dccdb61acc0 | {
"language": "C++"
} | ```c++
```
Add solution for 190 Reverse Bits | ```c++
//190. Reverse Bits
/*
*Reverse bits of a given 32 bits unsigned integer.
*
*For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
*
*Follow up:
*If this function is called many times, how... |
4a701538-4a3d-4012-8d4f-eeac712705e6 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted List II | ```c++
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if (!head) return 0;
if (!head->next) return head;
int v... |
d3264800-aa5d-4af1-95ce-5ee3b29d8bf0 | {
"language": "C++"
} | ```c++
```
Add missing file preventing compilation | ```c++
// We need our declaration
#include "../../include/Utils/Dump.hpp"
namespace Utils
{
// Produce a nice hexdump of the given byte array
void hexDump(Strings::FastString & out, const uint8 * const array, const uint32 length, const uint32 colSize, const bool withAddress, const bool withCharVal)
{
... |
7982651a-d6d2-4495-a4dc-de7bab7ad3bb | {
"language": "C++"
} | ```c++
```
Add missing source file for New_Session_Ticket msg | ```c++
/*
* Session Tickets
* (C) 2012 Jack Lloyd
*
* Released under the terms of the Botan license
*/
#include <botan/internal/tls_messages.h>
#include <botan/internal/tls_extensions.h>
#include <botan/internal/tls_reader.h>
#include <botan/tls_record.h>
#include <botan/loadstor.h>
namespace Botan {
namespace TLS {... |
3d780f2e-c949-47c4-ba8a-e329e0246f72 | {
"language": "C++"
} | ```c++
```
Convert Sorted Array to Binary Search Tree. | ```c++
/**
* Convert Sorted Array to Binary Search Tree
*
* cpselvis(cpselvis@gmail.com)
* September 25th, 2016
*/
#include<iostream>
#include<vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {... |
ddbc9dc0-230d-4d23-83f9-729970bf7fdb | {
"language": "C++"
} | ```c++
```
Add simple vec2 addition test case | ```c++
#include "test.h"
#include "../src/vec2.h"
using namespace jogurt;
NUMERIC_TEST_CASE("2D vector addition", "[vec2]")
{
vec2<T> v0 = { 1, 10 };
vec2<T> v1 = { 20, 2 };
vec2<T> v2 = { 4, 40 };
SECTION("Zero is the neutral element")
{
REQUIRE(v0 + zero2<T>() == v0);
REQUIRE... |
7e486662-ab79-421c-a552-7c7f78bf15ee | {
"language": "C++"
} | ```c++
```
Add solution 389. Find the Difference | ```c++
/*
* https://leetcode.com/problems/find-the-difference/
* Given two strings s and t which consist of only lowercase letters.
* String t is generated by random shuffling string s and then add one more letter at a random position.
* Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abc... |
1d4fdf13-819f-437d-b6f9-a2a6b70d1441 | {
"language": "C++"
} | ```c++
```
Create gtest entry-point in tester project. | ```c++
/**
* @file main.cpp
* @brief Tester project entry-point.
* @author zer0
* @date 2016-11-01
*/
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
``` |
402459b7-cab9-4934-8995-d99ce277ab82 | {
"language": "C++"
} | ```c++
```
Sort Even and Odd Indices Independently | ```c++
class Solution {
public:
vector<int> sortEvenOdd(vector<int>& nums) {
if (nums.empty()) return nums;
std::vector<int> odd, even;
for (int i = 0; i < nums.size(); ++i) {
if (i % 2 == 0) {
even.emplace_back(nums[i]);
} else {
o... |
c172311c-e230-4250-9e4c-e16c05fcb9a4 | {
"language": "C++"
} | ```c++
```
Tweak 4-way parallel output to work on pins 12-15 on esp8266 - keep blocked out for now, needs some more testing. | ```c++
#define FASTLED_INTERNAL
#include "FastLED.h"
/// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating
/// data into LSB for a faster write (the code using this data can happily walk the array backwards)
void transpose8x1_noin... |
6c27ab38-8488-4014-8fdb-3983807f1bd7 | {
"language": "C++"
} | ```c++
```
Test for the new FileUtil::GetFileName() functions. | ```c++
/** \file xml_parser_test.cc
* \brief Tests the FileUtil::GetFileName() function.
* \author Dr. Johannes Ruscheinski
*/
/*
Copyright (C) 2015, Library of the University of Tübingen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero G... |
79265cad-cb02-444c-85be-6ec12b615953 | {
"language": "C++"
} | ```c++
```
Add missing file from prior commit. | ```c++
//===--- ProtocolConformance.cpp - AST Protocol Conformance -----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift... |
1a0bd1e1-72cf-461e-ac4e-009a95bad57d | {
"language": "C++"
} | ```c++
```
Add test file with main method | ```c++
#include <iostream>
#include "node.h"
#include "car.h"
using namespace traffic;
int main(int argc, char* argv[])
{
std::shared_ptr<Node> Rochester (new Node);
std::shared_ptr<Node> Buffalo (new Node);
Node::LinkNeighbors(Rochester, Buffalo, 60.0);
std::cout << Rochester->GetDistance... |
c72c7f12-0e93-4335-b81b-e86a159204b2 | {
"language": "C++"
} | ```c++
```
Add a simple experiment to test one particular optimization | ```c++
#include <atomic>
extern "C" {
#if 0
}
#endif
const std::memory_order mo_rlx = std::memory_order_relaxed;
const std::memory_order mo_rel = std::memory_order_release;
const std::memory_order mo_acq = std::memory_order_acquire;
const std::memory_order mo_acq_rel = std::memory_order_acq_rel;
int load_store(std::... |
fcc53078-1dd7-44c2-8bb7-a14f894ca831 | {
"language": "C++"
} | ```c++
```
Add test for self-referencing emplace test. | ```c++
//===----------------------------------------------------------------------===//
//
// 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.
//
//===---------------------------------... |
82973f8c-3df1-4894-b338-bb37010233c8 | {
"language": "C++"
} | ```c++
```
Add test for incorrect self-intersections w/Triangles. | ```c++
#include "tests/gtest/gtest.h"
#include <cmath>
#include "pbrt.h"
#include "rng.h"
#include "shape.h"
#include "sampling.h"
#include "shapes/triangle.h"
static Float p(RNG &rng) {
Float logu = Lerp(rng.UniformFloat(), -8., 8);
return std::pow(10, logu);
}
TEST(Triangle, Reintersect) {
for (int i =... |
35697931-eb18-486c-acc3-371ed57300c5 | {
"language": "C++"
} | ```c++
```
Add noilerplate code for Binary Search Trees. | ```c++
#include <bits/stdc++.h>
using namespace std;
typedef struct node node;
struct Node{
int data;
Node *left;
Node *right;
Node(const int & value, Node *lt = NULL, Node *rt = NULL):
data(value), left(lt), right(rt) {}
};
class BST{
public:
BST(): root(NULL) {}
~BST(){... |
fca6c7ad-4d53-4140-b448-a9d11542358c | {
"language": "C++"
} | ```c++
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
static const size_t kBufferSize = 256;
#define LOG_TAG "skia"
#include <android/log.h>
void SkDebugf(const char format[], ... | ```c++
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
static const size_t kBufferSize = 256;
#define LOG_TAG "skia"
#include <android/log.h>
static bool gSkDebugToStdOut = fals... |
01ac9cfe-b31f-4300-9f96-959888df0b0e | {
"language": "C++"
} | ```c++
#include "capi/ruby.h"
extern "C" {
unsigned long rb_fix2uint(VALUE obj) {
unsigned long num = rb_num2ulong(obj);
if((int)num < 0) {
rb_raise(rb_eRangeError, "integer too small to convert into unsigned int");
}
if((unsigned int)num != num) {
rb_raise(rb_eRangeError, "integer too ... | ```c++
#include "capi/ruby.h"
extern "C" {
unsigned long rb_fix2uint(VALUE obj) {
unsigned long num = rb_num2ulong(obj);
if((long)num < 0) {
rb_raise(rb_eRangeError, "integer too small to convert into unsigned int");
}
if((unsigned int)num != num) {
rb_raise(rb_eRangeError, "integer too... |
3e1ea209-7268-4be0-a33a-dfdaf652fae3 | {
"language": "C++"
} | ```c++
```
Add Chapter 20, exercise 11 | ```c++
// Chapter 20, Exercise 11: Given a list<int> as a by-reference parameter, make
// a vector<double> and copy the elements of the list into it. Verify that the
// copy was complete and correct, then print the elements in order of increasing
// value.
#include "../lib_files/std_lib_facilities.h"
template<class I... |
fa891435-8bf2-4238-a0de-ef8228ad2dfa | {
"language": "C++"
} | ```c++
```
Swap pairs in linked list. | ```c++
/**
* Swap Nodes in Pairs
* Dummy head.
* cpselvis (cpselvis@gmail.com)
* August 22th, 2016
*/
#include<iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* swapPairs(ListNode* head) {
ListNode ... |
e4be429d-9811-4850-8b9c-462d6b140fbb | {
"language": "C++"
} | ```c++
```
Add simple Sieve of Eratosthenes | ```c++
/*
Prime numbers using simple Sieve of Eratosthenes:
Given a number N, find all prime numbers upto N (inclusive) using the simple
Sieve of Eratosthenes method, which efficiently finds primes in the order of
10^7. (The efficiency limit is due to poor cache utilisation.)
Time complexity:
O... |
da0bff23-0f93-425c-9f9d-fa7ac8ee4b34 | {
"language": "C++"
} | ```c++
```
Add equations for some summatories. | ```c++
/*
Summatories
*/
int main(){
sum(i) from 1 to n = n(n+1)/2
sum(i^2) from 1 to n = n(n+1)(2n+1)/6
sum(i^3) from 1 to n = (n^2(n+1)^2)/4
}
``` |
57c504fc-7570-45a1-b3d2-27a94c03ba68 | {
"language": "C++"
} | ```c++
```
Delete Operation for Two Strings | ```c++
class Solution {
public:
int minDistance(string word1, string word2) {
int dp[word1.size()+1][word2.size()+1];
for (int i = 0; i <= word1.size(); ++i) {
for (int j = 0; j <= word2.size(); ++j) {
dp[i][j] = 0;
}
}
for (int i = 0; i <= wor... |
cc4460df-6b99-4308-aa36-70e040e4bc10 | {
"language": "C++"
} | ```c++
```
Add C++ solution for prims algorithm in graphs section | ```c++
#include <bits/stdc++.h>
#define NO_OF_NODES 8
using namespace std;
struct node
{
int fr, to, cost;
}p[6];
int c = 0, temp1 = 0, temp = 0;
void prims(int *a, int b[][NO_OF_NODES], int i, int j)
{
a[i] = 1;
while (c < 6)
{
int min = 999;
for (int i = 0; i < NO_OF_NODES; i++)
... |
2d6988fa-5f5b-4f42-b0ff-5b25c51fee80 | {
"language": "C++"
} | ```c++
```
Add the solution to "Anagram". | ```c++
#include <iostream>
#include <string>
using namespace std;
int anagram(string s)
{
int len = s.size();
if (len & 1) return -1;
int flag[26] = {0};
for (int i = len / 2; i < len; i++) {
flag[s[i] - 'a']++;
}
int res = len / 2;
for (int i = 0; i < len / 2; i++) {
if (flag[s[i] - 'a']) {
flag[s[i] - ... |
0d697bfc-ecf4-4409-9d99-e87a60207fed | {
"language": "C++"
} | ```c++
```
Cut Off Trees for Golf Event | ```c++
class Solution {
public:
int cutOffTree(vector<vector<int>>& forest) {
if(forest.empty()) return 0;
if(forest[0].empty()) return 0;
vector<vector<int>> t;
for(int i=0;i<forest.size();i++){
for(int j=0;j<forest[0].size();j++){
if(forest[i][j]>1){
... |
164ae37d-64a1-4f13-abd8-b98e372c575c | {
"language": "C++"
} | ```c++
```
Add Chapter 25, exercise 6 | ```c++
// Chapter 25, exercise 6: write an infinite loop that is hard to recognize as
// an infinite loop
#include<iostream>
#include<exception>
using namespace std;
int main()
try
{
for (char ch = 0; ch<250; ++ch)
cout << int(ch) << '\n';
}
catch (exception& e) {
cerr << "exception: " << e.what() <<... |
5355a82d-1f3a-4e23-9fc0-b6066de0661e | {
"language": "C++"
} | ```c++
```
Rearrange Array Elements by Sign | ```c++
class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
std::vector<int> pos, neg, ret;
for (const auto& i : nums) {
if (i > 0) {
pos.emplace_back(std::move(i));
} else {
neg.emplace_back(std::move(i));
}
... |
c86e279c-8cc9-4e86-88f1-4f65742a819b | {
"language": "C++"
} | ```c++
```
Check if MSVC compiler supports OpenMP | ```c++
///
/// @file has_openmp.cpp
/// @brief Used to check if MSVC compiler supports OpenMP.
///
/// Copyright (C) 2014 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///
#include <omp.h>
#include <iostream>
int ma... |
416d4777-f5af-4c56-ae24-004f250086df | {
"language": "C++"
} | ```c++
```
Insert at tail of list | ```c++
/*
Insert Node at the end of a linked list
head pointer input could be NULL as well for empty list
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
Node* Insert(Node *head,int data)
{
Node* tmp = new Node();
tmp->data = data;
tmp->next = NULL;
if (h... |
9400ab5b-0234-4392-ae26-9c3def140639 | {
"language": "C++"
} | ```c++
```
Add a test for __asan_gen_ globals labels on Darwin. | ```c++
// Make sure __asan_gen_* strings have the correct prefixes on Darwin
// ("L" in __TEXT,__cstring, "l" in __TEXT,__const
// RUN: %clang_asan %s -S -o %t.s
// RUN: cat %t.s | FileCheck %s || exit 1
int x, y, z;
int main() { return 0; }
// CHECK: .section{{.*}}__TEXT,__const
// CHECK: l___asan_gen_
// CHECK: .se... |
8ba84031-dbe4-4220-9e4d-66412c1ca347 | {
"language": "C++"
} | ```c++
// Created on November 19, 2013 by Lu, Wangshan.
#include <boost/asio.hpp>
#include <diffusion/factory.hpp>
namespace diffusion {
class NetReader : public Reader {
public:
NetReader(std::string const & listening_ip_address, std::uint16_t listening_port);
virtual bool has_next();
virtual ByteBuffer ge... | ```c++
// Created on November 19, 2013 by Lu, Wangshan.
#include <boost/asio.hpp>
#include <diffusion/factory.hpp>
namespace diffusion {
class NetReader : public Reader {
public:
NetReader(std::string const & listening_ip_address, std::uint16_t listening_port);
virtual bool can_read();
virtual ByteBuffer re... |
76bae867-e635-47a1-96bd-5751f8ac4f94 | {
"language": "C++"
} | ```c++
```
Test solver on the hardest sudoku | ```c++
#include <iostream>
#include "sudoku.h"
int main(int argc, char* argv[])
{
//Hardest sudoku : http://www.mirror.co.uk/news/weird-news/worlds-hardest-sudoku-can-you-242294
std::string chain = "005300000800000020070010500400005300010070006003200080060500009004000030000009700";
Sudoku s;
for(int i = 0; i < c... |
3e3f5c7f-6939-490e-aa24-bb1e07ee67ae | {
"language": "C++"
} | ```c++
```
Add "use RAII classes" sample | ```c++
// Use RAII classes
#include <map>
#include <memory>
#include <string>
#include <vector>
int main()
{
std::vector<int> vec = {1, 2, 3, 4, 5};
std::map<std::string, int> map = {{"Foo", 10}, {"Bar", 20}};
std::string str = "Some text";
std::unique_ptr<int> ptr1 = std::make_unique<int>(8);
std::shared_ptr<in... |
c74d05f9-8cb5-47ec-ac7b-6dc6d0a92de8 | {
"language": "C++"
} | ```c++
```
Use the DFS to solve the problem. | ```c++
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode * flipTree(TreeNode *root) {
TreeNode* new_node = root;
if (!ro... |
bbc3cb32-1105-41e5-a9b8-f25d41addb9b | {
"language": "C++"
} | ```c++
```
Delete duplicate nodes from sorted list | ```c++
/*
* Problem: Delete duplicate-value nodes from a sorted linked list
* Author: Anirudha Bose <ani07nov@gmail.com>
Remove all duplicate elements from a sorted linked list
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
Node* RemoveDuplicates(Node *head)
{
... |
335d9bb2-e4da-42d0-bab1-3ac3346e56ef | {
"language": "C++"
} | ```c++
//-----------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Pleas... | ```c++
//-----------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Pleas... |
ea54df2f-088b-4e75-afe3-b008c226b1f1 | {
"language": "C++"
} | ```c++
#define BOOST_TEST_MODULE test_types
#include <type_traits>
#include <boost/test/included/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>
#include "variable.hxx"
#include "boolean.hxx"
#include "function.hxx"
typedef boost::mpl::list<variable,boolean,function> types... | ```c++
#define BOOST_TEST_MODULE test_types
#include <type_traits>
#include <boost/test/included/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>
#include "variable.hxx"
#include "boolean.hxx"
#include "function.hxx"
typedef boost::mpl::list<variable,boolean,function> types... |
df7f128b-8acb-4b7e-a628-42888000900f | {
"language": "C++"
} | ```c++
```
Insert node at tail (cpp) | ```c++
/*
Insert Node at the end of a linked list
head pointer input could be NULL as well for empty list
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
Node* Insert(Node *head,int data)
{
// Complete this method
Node *newNode = (Node *)malloc(sizeof(Node));
newNode->data... |
6de92fc2-68db-417f-aa92-fd9a3b83f158 | {
"language": "C++"
} | ```c++
```
Add mix test for normal_lccdf | ```c++
#include <test/unit/math/test_ad.hpp>
#include <limits>
TEST(mathMixScalFun, lccdf_derivatives) {
auto f = [](const double mu, const double sigma) {
return
[=](const auto& y) { return stan::math::normal_lccdf(y, mu, sigma); };
};
stan::test::expect_ad(f(0.0, 1.0), -50.0);
stan::test::expect_... |
ba0fea4f-9c07-44a4-960e-77dddf7d20a1 | {
"language": "C++"
} | ```c++
```
Add Command Line Argument Tracker | ```c++
/*
MIT License
Copyright (c) 2017 Blockchain-VCS
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, merge, p... |
0bcc1de0-898d-45ba-b0a2-ae1518be8c0b | {
"language": "C++"
} | ```c++
#include <bts/blockchain/address.hpp>
#include <bts/blockchain/pts_address.hpp>
#include <bts/blockchain/types.hpp>
#include <bts/utilities/key_conversion.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/io/json.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/filesystem.hpp>
#include <fc/variant_object.hp... | ```c++
#include <bts/blockchain/address.hpp>
#include <bts/blockchain/pts_address.hpp>
#include <bts/blockchain/types.hpp>
#include <bts/utilities/key_conversion.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/io/json.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/filesystem.hpp>
#include <fc/variant_object.hp... |
5e62e770-63b7-4a0b-9de5-8029f6645f1c | {
"language": "C++"
} | ```c++
/////////////////////////////////////////
//
// OpenLieroX
//
// code under LGPL, based on JasonBs work,
// enhanced by Dark Charlie and Albert Zeyer
//
//
/////////////////////////////////////////
// Floating options window file
// Created 24/9/08
// Karel Petranek```
Update input ke... | ```c++
/////////////////////////////////////////
//
// OpenLieroX
//
// code under LGPL, based on JasonBs work,
// enhanced by Dark Charlie and Albert Zeyer
//
//
/////////////////////////////////////////
// Floating options window file
// Created 24/9/08
// Karel Petranek
#include "Options.... |
0b6daf51-07d6-40c9-a7e9-4688aa2163c5 | {
"language": "C++"
} | ```c++
```
Test class for API conformance using templates instead of virtual functions. | ```c++
#include <iostream>
#include <vector>
template <template <typename>class Impl, class Param_list>
class APIExector{
private:
Impl<Param_list> m_impl;
public:
APIExector(Param_list p)
:m_impl(p)
{}
void Execute()
{ m_impl.Run(); }
void Reload(const Param_list& p)
{ m_impl.Configure(p); }
};
... |
d6a0fca1-3b57-4b8f-a467-9acce5ab6c8c | {
"language": "C++"
} | ```c++
```
Add a minimum requirements HAL test | ```c++
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* 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 ... |
6e35aae9-7fd5-4b71-a207-0fa69dfda9a8 | {
"language": "C++"
} | ```c++
```
Add test program for depth first search | ```c++
/*
Program to test Depth First Search
*/
#include<iostream>
#include<vector>
#include "dfs.h" // My implementation of Depth First Search
// tests Dfs (acyclic)
void testDfsA(){
int n = 10;
int m = 10;
std::vector<std::vector<int>> edges = {
{1,2},
{2,3},
{2,4},
... |
ff4b0821-3682-441b-b489-d1cb3c9c25a4 | {
"language": "C++"
} | ```c++
```
Add FileCheck test for '__has_feature(rtti)'. | ```c++
// RUN: clang -E -frtti %s -o - | FileCheck --check-prefix=CHECK-RTTI %s
// RUN: clang -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
#if __has_feature(rtti)
int foo();
#else
int bar();
#endif
// CHECK-RTTI: foo
// CHECK-NO-RTTI: bar
``` |
91cbbca3-659f-43ff-a211-81229a1ae6b9 | {
"language": "C++"
} | ```c++
```
Add an example of compile-time printf formatting | ```c++
// Copyright Louis Dionne 2015
// Distributed under the Boost Software License, Version 1.0.
#include <boost/hana.hpp>
#include <iostream>
#include <string>
using namespace boost::hana;
struct concat_strings {
template <char ...s1, char ...s2>
constexpr auto operator()(_string<s1...>, _string<s2...>) con... |
5cf16678-8912-4837-b5b9-8b5d6b1f0cde | {
"language": "C++"
} | ```c++
```
Delete Operation for Two Strings | ```c++
class Solution {
public:
int minDistance(string word1, string word2) {
int l1=word1.length(),l2=word2.length();
vector<vector<int>> dp(l1+1,vector<int>(l2+1));
for(int i=0;i<=l1;i++){
for(int j=0;j<=l2;j++){
if(i==0 || j==0){
dp[i][j]=0;... |
617f4036-975a-4519-9247-638f0db621ea | {
"language": "C++"
} | ```c++
/* Copyright 2019 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 l... | ```c++
/* Copyright 2019 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 l... |
f52cf287-11d2-4cd5-ba00-0712105f0024 | {
"language": "C++"
} | ```c++
```
Add a solution to problem 226: Invert Binary Tree. | ```c++
// https://leetcode.com/problems/invert-binary-tree/
// We could do a depth first traversal. Reverse left subtree and right subtree first,
// then reverse left and right link of root.
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
*... |
8aa234ef-27d9-4758-b171-468ca0e9f4c0 | {
"language": "C++"
} | ```c++
```
Add test for .preinit_array/.init_array/.fini_array sections. | ```c++
// RUN: %clangxx_asan %s -o %t && %run %t | FileCheck %s
#include <stdio.h>
static void foo() {
printf("foo\n");
}
int main() {
return 0;
}
__attribute__((section(".preinit_array")))
void (*call_foo)(void) = &foo;
__attribute__((section(".init_array")))
void (*call_foo_2)(void) = &foo;
__attribute__((s... |
c0384146-b516-4c8a-91e3-983f805db572 | {
"language": "C++"
} | ```c++
```
Add simple display class and constructor | ```c++
#include <cstdio>
#include <fcntl.h>
#include <iostream>
#include <vector>
#include <string>
#include <termios.h>
class Display {
public:
Display(std::string devName, speed_t baud = B115200) {
_devName = devName;
_baud = baud;
std::cout << "Init device: " << _devN... |
f9520c32-39d8-4563-8b21-429294cbb0c8 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted Array | ```c++
//
// Remove_Duplicates_from_Sorted_Array.cpp
// leetcode
//
// Created by 邵建勇 on 15/5/10.
// 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() == 0... |
9a9195cb-d715-4206-acde-9942d84f2856 | {
"language": "C++"
} | ```c++
```
Add Ford Fulkerson algorithm to find the max flow. | ```c++
#include <bits/stdc++.h>
using namespace std;
#define V 6
bool bfs(int rGraph[V][V], int s, int t, int parent[]){
bool visited[V];
memset(visited, 0, sizeof(visited));
queue <int> q;
q.push(s);
visited[s] = true;
parent[s] = -1;
while (!q.empty()){
int u = q.front();
q.pop();
for (int v=0; v<V; v++)... |
7911a19c-d82c-4af9-ab9c-bb3832ff38c0 | {
"language": "C++"
} | ```c++
```
Add missing testcase from r224388. | ```c++
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fe... |
712e31cf-45ec-4fcd-bb50-f23baddade31 | {
"language": "C++"
} | ```c++
```
Add Solution for 067 Add Binary | ```c++
// 67. Add Binary
/**
* Given two binary strings, return their sum (also a binary string).
*
* For example,
* a = "11"
* b = "1"
* Return "100".
*
* Tags: Math, String
*
* Similar Problems: (M) Add Two Numbers, (M) Multiply Strings, (E) Plus One
*
* Author: Kuang Qin
*/
#include <iostream>
#inc... |
2075dce9-7976-4486-a282-209e552166be | {
"language": "C++"
} | ```c++
```
Test code for an algorithm on StackOverflow. | ```c++
#include <iostream>
#include <cmath>
#include <Carbon/Carbon.h>
using namespace std;
// This code was written to test the performance of an algorithm I suggested on StackOverflow.
// http://stackoverflow.com/a/8991238/63225
int main (void) {
UnsignedWide startTime, endTime;
double result;
Microsecond... |
d31f05d2-0581-4239-a54e-9e7c2d4fa5b3 | {
"language": "C++"
} | ```c++
```
Create LIFI receiver and output analog values | ```c++
#include "mbed.h"
Serial pc(USBTX, USBRX);
DigitalOut gpo(D0);
DigitalOut led(LED_RED);
DigitalOut power(D2);
AnalogIn sensor(A0);
int main()
{
power = 1;
pc.baud(9600);
while (true) {
if(sensor.read() > 0){
led = 1;
}else{
led = 0;
}
wait(0.2... |
c9311bc9-3fd4-4af4-b405-5c7c792b586f | {
"language": "C++"
} | ```c++
```
Add an example taken from the tutorial | ```c++
#include <botan/botan.h>
#include <botan/pbkdf2.h>
#include <botan/hmac.h>
#include <botan/sha160.h>
#include <fstream>
using namespace Botan;
int main()
{
LibraryInitializer init;
AutoSeeded_RNG rng;
std::string passphrase = "secret";
std::ifstream infile("readme.txt");
std::ofstream out... |
50a6eedc-6765-42bc-9c81-1551d72f8447 | {
"language": "C++"
} | ```c++
```
Add main file - remove main.cpp from .gitignore please | ```c++
#include<iostream>
#include<vector>
#include<ctime>
#include<map>
#include"node.h"
using namespace std;
const int MaxElements = 100;
map<int, int> countingSort(vector<int> list) {
map<int, int> result;
for (int i = 0; i < MaxElements; i++) {
auto it = result.find(list[i]);
if (it != result.end()) {
... |
a0ca44e1-3c94-4b24-b222-1d3a50fd371d | {
"language": "C++"
} | ```c++
```
Add 147 Insertion Sort List | ```c++
//147. Insertion Sort List
/*
Sort a linked list using insertion sort.
Author: Xinyu Liu
*/
#include <iostream>
using namespace std;
//Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution{
public:
ListNode* in... |
c8549bb8-463e-42ef-b8c0-ee9699495816 | {
"language": "C++"
} | ```c++
```
Determine if String Halves Are Alike | ```c++
class Solution {
public:
bool halvesAreAlike(string s) {
int count = 0;
std::unordered_set vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'};
for (int i = 0; i < s.size()/2; ++i) {
auto iter = vowels.find(s[i]);
if (iter != vowels.end())
... |
281696d5-09b8-4eb4-ac62-aa1a7b3c7cb6 | {
"language": "C++"
} | ```c++
```
Add unit test for squared difference op | ```c++
#include <gtest/gtest.h>
#include <mlfe/operators_v2/squared_difference.h>
#include <mlfe/utils/gradient_checker.h>
#include <random>
using namespace mlfe;
using namespace mlfe::operators_v2;
namespace fn = mlfe::functional;
TEST(operator_v2, squared_difference_fwd){
using T = float;
auto a = Tensor::f... |
b7bff404-aab2-4fb5-9a33-9c451a760ad3 | {
"language": "C++"
} | ```c++
```
Add symposium server main file. | ```c++
#include <string>
#include <"runDiff.h">
int main(int argc, const char * argv[])
{
if (argc != 2)
{
std::cerr << "Usage: " << argv[0] << " input file name"<<std::endl;
return 1;
}
runFiles(string(argv[1]));
return 0;
}
``` |
c97c0818-b3ef-4fb4-8a73-a2bead9a6c04 | {
"language": "C++"
} | ```c++
```
Add a solution of prob 2 | ```c++
#include <stdio.h>
#include <math.h>
int main(void)
{
int num;
printf("Enter num= ");
scanf("%d", &num);
printf("Result: %d\n", (int)sqrt(num) * (int)sqrt(num));
return 0;
}
``` |
f865dc0a-ea2d-49b2-a538-7f1c016b6487 | {
"language": "C++"
} | ```c++
```
Add C++ solution to problem 005 | ```c++
#include <iostream>
int main(int argc, char **argv)
{
int number = 2520;
// naive solution
while (true) {
for (int i = 2; i <= 20; i++) {
if (number % i != 0) {
break;
}
else if (i == 20 && number % i == 0) {
std::cout << number << std::endl;
return 0;
}
}
number++;
}
return... |
41235b13-c913-4001-8bec-8000e3a38c1f | {
"language": "C++"
} | ```c++
```
Add test case for truth table cache. | ```c++
#include <catch.hpp>
#include <mockturtle/utils/truth_table_cache.hpp>
#include <kitty/constructors.hpp>
#include <kitty/dynamic_truth_table.hpp>
using namespace mockturtle;
TEST_CASE( "working with a truth table cache", "[truth_table_cache]" )
{
truth_table_cache<kitty::dynamic_truth_table> cache;
kitty... |
ccf5134b-2758-4c7a-9a56-7bf35b3de1f3 | {
"language": "C++"
} | ```c++
```
Remove Duplicates from Sorted List | ```c++
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(NULL == head || NULL == head->next) return head;
ListNode *pr... |
7b94fe36-e9df-4fdb-8fd5-716222d3019c | {
"language": "C++"
} | ```c++
```
Implement useful macro for debug. | ```c++
#include <iostream>
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
int main(){
int e =32;
show(e);
}
``` |
dea46c85-cd92-4679-9d09-06e54d1e06b9 | {
"language": "C++"
} | ```c++
```
Add main for unit tests using Boost UTF | ```c++
#include <Kokkos_Core.hpp>
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#if defined( DTK_SEARCH_MPI_UNIT_TEST )
#include <mpi.h>
#endif
struct ExecutionEnvironmentScopeGuard
{
ExecutionEnvironmentScopeGuard( int argc, char *argv[] )
{
#if defined( DTK_SEARCH_MPI_UNIT_TEST )
M... |
e11f76c9-361a-464a-bc67-47dac1a24f52 | {
"language": "C++"
} | ```c++
```
Add c++11 thread creation with lambda function. 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>
int main() {
unsigned long long acm1 = 0;
unsigned long long acm2 = 0;
std::vector<int> v(1024);
srand(time(nullptr));
std::generate(v.begin(), v.end(), [&v]() { return rand() % v.size(); } );
... |
42c67389-b3aa-4c3a-aa56-3f9c64114aa2 | {
"language": "C++"
} | ```c++
```
Add solution of prob 3 | ```c++
#include <stdio.h>
#include "../excercise04/make_random_data/make_random_data.hpp"
#include "../excercise04/sort/quick.hpp"
int main(void)
{
int k;
printf("Enter k= ");
scanf("%d", &k);
{
}
return 0;
}
``` |
bddff7c2-dec9-49c4-b8dd-bebb2152766d | {
"language": "C++"
} | ```c++
```
Rename the repository, add an ini diff tool | ```c++
/*
* compiling:
* qmake -project
* qmake
* make
*
* usage:
* ini-diff first.ini second.ini output.ini
*
* Outputs an INI diff that will be usable as a diff file in a WZ diff mod.
* Doesn't look at fields that were present in first.ini but are not present
* in second.ini, as diff ... |
744b3b8d-5730-4f9b-9dec-0dfa26e9166d | {
"language": "C++"
} | ```c++
```
Add failing opengl test using an inline reduction | ```c++
#include "Halide.h"
using namespace Halide;
int main() {
// This test must be run with an OpenGL target
const Target &target = get_jit_target_from_environment();
if (!target.has_feature(Target::OpenGL)) {
fprintf(stderr, "ERROR: This test must be run with an OpenGL target, e.g. by setting ... |
d984dce9-eff2-45ae-81d5-32066a218134 | {
"language": "C++"
} | ```c++
```
Add the solution to "Chocolate feast". | ```c++
#include <iostream>
using namespace std;
int chocolates(int n, int c, int m)
{
int sum = n / c;
int wrapper = sum;
while(wrapper / m) {
int added = wrapper / m;
wrapper = wrapper % m + added;
sum += added;
}
return sum;
}
int main()
{
int T;
cin >> T;
whi... |
a00f778a-e501-400a-88f4-7b8895afbd4e | {
"language": "C++"
} | ```c++
```
Add a test case that performs a very large read. | ```c++
#include <windows.h>
#include <assert.h>
#include <vector>
#include "TestUtil.cc"
#include "../shared/DebugClient.cc"
int main(int argc, char *argv[]) {
if (argc == 1) {
startChildProcess(L"CHILD");
return 0;
}
const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE);
const long l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.