commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 4.24k | new_contents stringlengths 1 5.44k | subject stringlengths 14 778 | message stringlengths 15 9.92k | lang stringclasses 277
values | license stringclasses 13
values | repos stringlengths 5 127k |
|---|---|---|---|---|---|---|---|---|---|
993bed7f8257dcc8a72a1cf3e5a8cbe1094a337a | c++/problem_17.cpp | c++/problem_17.cpp | // 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
conste... | Solve problem 17 in C++ | Solve problem 17 in C++
| C++ | mit | mk12/euler,mk12/euler | |
2ffe15f963a8c23180b2f2a3800d4f5fdfbb4b45 | sort/merge_sort/c++/vivek_mergesort_singly_linked_list.cpp | sort/merge_sort/c++/vivek_mergesort_singly_linked_list.cpp | /**
* 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 implemented wi... | Add merge sort implementation for singly linked list | Add merge sort implementation for singly linked list | C++ | cc0-1.0 | ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/al-go-rithms,ZoranPandovsk... | |
bce23b57106e6e718544a57cedfc1895d5045a0b | tensorflow_io/kafka/ops/kafka_ops.cc | tensorflow_io/kafka/ops/kafka_ops.cc | /* 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 law or a... | Allow is_initialized and initializer to be called on MirroredVariables and TowerLocalVariables. | Allow is_initialized and initializer to be called on MirroredVariables and TowerLocalVariables.
PiperOrigin-RevId: 203520287
| C++ | apache-2.0 | tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io | |
44811ff9e223d1cb1a69f9ad7e7da51a45efcc05 | test/satoshi_words.cpp | test/satoshi_words.cpp | /*
* 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
* Fou... | Convert satoshiwords to test case. | Convert satoshiwords to test case.
| C++ | agpl-3.0 | libmetrocoin/libmetrocoin-consensus,libtetcoin/libtetcoin-consensus,libmetrocoin/libmetrocoin-consensus,swansontec/libbitcoin,libmetrocoin/libmetrocoin-consensus,GroestlCoin/libgroestlcoin,libtetcoin/libtetcoin-consensus,GroestlCoin/libgroestlcoin,libtetcoin/libtetcoin-consensus,libtetcoin/libtetcoin-consensus,libmetro... | |
d4fbdc7100adfb19aada96714dc8d4bf26ea1aa1 | test/SemaCXX/warn-member-not-needed.cpp | test/SemaCXX/warn-member-not-needed.cpp | // 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();
}
};
}
| Add missing test for -Wunneeded-member-functions. | Add missing test for -Wunneeded-member-functions.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@184371 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/cl... | |
394b8824544c2fab947cf0b36d4c19f526dea9ab | src/df_hi_res_time.cpp | src/df_hi_res_time.cpp | #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_tickInte... | #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_tickInte... | Make sure GetHighResTime() doesn't get inlined because it is a slow function anyway since it calls QueryPerformanceCounter(). Also, it is often used when profiling, and when it gets inlined, it makes the disassembly look confusing. | Make sure GetHighResTime() doesn't get inlined because it is a slow function anyway since it calls QueryPerformanceCounter(). Also, it is often used when profiling, and when it gets inlined, it makes the disassembly look confusing. | C++ | mit | abainbridge/deadfrog-lib,abainbridge/deadfrog-lib,abainbridge/deadfrog-lib |
76ab37ca7f9fa28098ebf11245d90df559b10b88 | test/correctness/gpu_multi_kernel.cpp | test/correctness/gpu_multi_kernel.cpp | #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 target = g... | Add a test for multiple Func's that are compute_root when compiling for a GPU target. | Add a test for multiple Func's that are compute_root when compiling
for a GPU target.
Former-commit-id: b81caa7f043020d0e6222abc0cbdea766fd79c45 | C++ | mit | Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide | |
0ef711b50cca6a82780b63916086a45591eafa24 | codeforces/576A.cpp | codeforces/576A.cpp | /*
* 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[0] = pr... | Add the second codeforces problem | Add the second codeforces problem
| C++ | mit | zer0main/problems,zer0main/problems,zer0main/problems | |
d72c24aaffcd60447114a397fb18e121a66f3741 | 208_implement_trie.cc | 208_implement_trie.cc | // 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 TrieNo... | Add a solution for problem 208: Implement Trie (Prefix Tree). | Add a solution for problem 208: Implement Trie (Prefix Tree).
| C++ | apache-2.0 | shen-yang/leetcode_solutions,shen-yang/leetcode_solutions,shen-yang/leetcode_solutions | |
7e797db545152f30ce1a2b96aa2c976f2ecd2b65 | ssh/ssh_algorithm_negotiation.cc | ssh/ssh_algorithm_negotiation.cc | #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
};
template<typen... | Add file missed in r884: initial sketching of algorithm negotiation initialization. | Add file missed in r884: initial sketching of algorithm negotiation initialization.
git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@885 4068ffdb-0463-0410-8185-8cc71e3bd399
| C++ | bsd-2-clause | splbio/wanproxy,splbio/wanproxy,diegows/wanproxy,diegows/wanproxy,splbio/wanproxy,diegows/wanproxy | |
f5796891ec99f4977eb1761166a33a6b22f459fd | ui/base/l10n/l10n_util_posix.cc | ui/base/l10n/l10n_util_posix.cc | // 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 true b... | // 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 true b... | Enable Kannada, Farsi and Telugu on CrOS | Enable Kannada, Farsi and Telugu on CrOS
BUG=chromium-os:21717
TEST=On login screen, Kannada, Telugu and Farsi can be selected.
Review URL: http://codereview.chromium.org/8301012
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@105835 0039d316-1c4b-4281-b951-d872f2087c98
| C++ | bsd-3-clause | ltilve/chromium,dushu1203/chromium.src,patrickm/chromium.src,crosswalk-project/chromium-crosswalk-efl,patrickm/chromium.src,timopulkkinen/BubbleFish,Chilledheart/chromium,mogoweb/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,Chilledheart/chromium,timopulk... |
82453cac185a8861a545898865a3201fc775b57c | c++/problem_20.cpp | c++/problem_20.cpp | // 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);
}
} // namespace probl... | Solve problem 20 in C++ | Solve problem 20 in C++
| C++ | mit | mk12/euler,mk12/euler | |
834b70e5cc7294727252515eb175a7a282cd2204 | C++/083_Remove_Duplicates_from_Sorted_List.cpp | C++/083_Remove_Duplicates_from_Sorted_List.cpp | //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 singly-... | Add solution for problem 083 Remove Duplicates from Sorted List | Add solution for problem 083 Remove Duplicates from Sorted List
| C++ | mit | bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res | |
9da856aeb41f4c635ec0f4245edbc0bc3f1792be | tests/test_experimental.cc | tests/test_experimental.cc | #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.size()... | Test to check how different variable implementations | Test to check how different variable implementations
Check between `variable' based, and `function' based variable.
| C++ | lgpl-2.1 | suvayu/sfcore | |
e853f64db8dda6a88292339691475958b4d3c177 | cpp/cv.cc | cpp/cv.cc | // 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>
#include <ios... | Document bug with condition variables and static linking (C++) | Document bug with condition variables and static linking (C++)
| C++ | bsd-3-clause | dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps | |
907c8a40ec95da48e0823f621df8e04b99892aea | cpp-inheritance/test.cpp | cpp-inheritance/test.cpp | #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() {
f(... | Add a c++ inheritance example | Add a c++ inheritance example
The example shows what is the difference between overriding a function
and hiding it.
| C++ | mit | smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground,smanilov/playground | |
5cbca4c602111b696a496ccc8fa60daae108effa | quicksort.cpp | quicksort.cpp | #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 = start... | Add the solution to "QuickSort". | Add the solution to "QuickSort".
| C++ | mit | clasnake/hackerrank,clasnake/hackerrank | |
24e6fa711e07701e2b00f9694907dc52b7d19632 | Leetcode/isValidBST.cpp | Leetcode/isValidBST.cpp | /**
* 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:
The lef... | Update Check BST or not | Update Check BST or not
| C++ | mit | anishacharya/Common-Interview-Questions,anishacharya/Common-Interview-Questions | |
3362e2ba48ab8595cc717b5f63f12e7c2df589b3 | test17_29_30.cpp | test17_29_30.cpp | #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);
}
in... | Add solution for chapter 17 test 29, test 30 | Add solution for chapter 17 test 29, test 30 | C++ | apache-2.0 | chenshiyang/CPP--Primer-5ed-solution | |
7bc943e88def704fd03a7ad03cf3f1270747a5eb | tests/test-io.cc | tests/test-io.cc | /*
* ============================================================================
*
* Filename: test-io.cc
* Description: Tests of the IO module.
* License: GPLv3+
* Author: Kevin Murray, spam@kdmurray.id.au
*
* ========================================================================... | Add tests of the Read struct | Add tests of the Read struct
| C++ | mpl-2.0 | kdmurray91/libqcpp,kdmurray91/libqcpp,kdmurray91/libqcpp,kdmurray91/libqcpp,kdmurray91/libqcpp | |
48800560a85059d0ea98b3a390b3bdb2bd815d29 | src/unique_ptr01.cpp | src/unique_ptr01.cpp | // 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.
#include ... | Add Ben Deane's unique_ptr guideline from his Twitter. | Add Ben Deane's unique_ptr guideline from his Twitter.
| C++ | mit | mpoullet/cpp-snippets,mpoullet/cpp-snippets | |
1741bcd6f8cf260be936babcb515c08a7354a691 | C++/031_Next_Permutation.cpp | C++/031_Next_Permutation.cpp | // 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, do no... | Add Solution for Problem 031 | Add Solution for Problem 031
| C++ | mit | FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res | |
b1e9c060c50464a29bea17343098cd8c6e004401 | C++/190_Reverse_Bits.cpp | C++/190_Reverse_Bits.cpp | //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 would ... | Add solution for 190 Reverse Bits | Add solution for 190 Reverse Bits
| C++ | mit | FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res | |
33104e8e0c9436c8472f6cf395719e34c3196811 | 82.cpp | 82.cpp | /**
* 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 val = he... | Remove Duplicates from Sorted List II | Remove Duplicates from Sorted List II | C++ | mit | zfang399/LeetCode-Problems | |
a454b2ea0e11078964d93253771202b64a93dfa3 | ClassPath/src/Utils/Dump.cpp | ClassPath/src/Utils/Dump.cpp | // 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)
{
uint... | Add missing file preventing compilation | Add missing file preventing compilation
| C++ | mit | X-Ryl669/Frost,X-Ryl669/Frost | |
3192ec3acfbf03a3b64a5aeb75e409db5adaaaf2 | src/tls/session_ticket.cpp | src/tls/session_ticket.cpp | /*
* 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 {
New_S... | Add missing source file for New_Session_Ticket msg | Add missing source file for New_Session_Ticket msg
| C++ | bsd-2-clause | Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,webmaster128/botan,webmaster128/botan,randombit/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,randombit/botan,webmaster128/... | |
1cddc71007f48cef69d07c32edd858f500695cdc | solution108.cpp | solution108.cpp | /**
* 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 {
publi... | Convert Sorted Array to Binary Search Tree. | Convert Sorted Array to Binary Search Tree.
| C++ | mit | cpselvis/leetcode | |
aa0e9317313da1248ca149b689d345bc74bea3b8 | test/vec2_test.cpp | test/vec2_test.cpp | #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(v1 + z... | Add simple vec2 addition test case | Add simple vec2 addition test case
Probably incomplete. Just there to get a foothold.
| C++ | unlicense | mkacz91/math | |
9c465fcd93ef29a7e16983a781d689440206d007 | 389_Find_the_Difference.cpp | 389_Find_the_Difference.cpp | /*
* 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 = "abcde"
Ou... | Add solution 389. Find the Difference | Add solution 389. Find the Difference | C++ | mit | wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode | |
3a3d968b06b22b9c3a59dca91a04ea525962651e | tester/main.cpp | tester/main.cpp | /**
* @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();
}
| Create gtest entry-point in tester project. | Create gtest entry-point in tester project.
| C++ | mit | osom8979/tbag,osom8979/tbag,osom8979/tbag,osom8979/tbag,osom8979/tbag | |
291d47bfdd3c0c0567bc7a675c0018fa9bcb07db | array/2164.cc | array/2164.cc | 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 {
odd.empl... | Sort Even and Odd Indices Independently | Sort Even and Odd Indices Independently
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
20e5042e9f868c0c56ce08571e0cc3344af9e8f4 | bitswap.cpp | bitswap.cpp | #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_noinline(un... | Tweak 4-way parallel output to work on pins 12-15 on esp8266 - keep blocked out for now, needs some more testing. | Tweak 4-way parallel output to work on pins 12-15 on esp8266 - keep blocked out for now, needs some more testing.
| C++ | mit | eshkrab/FastLED-esp32,FastLED/FastLED,PaulStoffregen/FastLED,tullo-x86/FastLED,PaulStoffregen/FastLED,remspoor/FastLED,FastLED/FastLED,tullo-x86/FastLED,kcouck/FastLED,FastLED/FastLED,kcouck/FastLED,eshkrab/FastLED-esp32,PaulStoffregen/FastLED,remspoor/FastLED,FastLED/FastLED | |
dbb5c2f47367e0a9673292aead55a518dcf131a2 | cpp/getfilename_test.cc | cpp/getfilename_test.cc | /** \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 General ... | Test for the new FileUtil::GetFileName() functions. | Test for the new FileUtil::GetFileName() functions.
| C++ | agpl-3.0 | ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools,ubtue/ub_tools | |
82a2cc19fec9923e714ff38504d95e6032a1ed80 | lib/AST/ProtocolConformance.cpp | lib/AST/ProtocolConformance.cpp | //===--- 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.org/LI... | Add missing file from prior commit. | Add missing file from prior commit.
Swift SVN r6866
| C++ | apache-2.0 | adrfer/swift,natecook1000/swift,MukeshKumarS/Swift,tardieu/swift,apple/swift,ken0nek/swift,devincoughlin/swift,shajrawi/swift,arvedviehweger/swift,djwbrown/swift,austinzheng/swift,sdulal/swift,allevato/swift,sdulal/swift,kusl/swift,return/swift,bitjammer/swift,gmilos/swift,allevato/swift,airspeedswift/swift,practicalsw... | |
3119c472e94a4ed9d3706b52ffaa7e6b3f1ae7a7 | src/entry.cc | src/entry.cc |
#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->GetDistanceFrom(Bu... | Add test file with main method | Add test file with main method
| C++ | mit | mexezero/traffic,mexezero/traffic | |
f4aeebb58d3515d4480b346b767ab0ceb038e999 | experiments/simple_opt.cpp | experiments/simple_opt.cpp | #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::atomic<... | Add a simple experiment to test one particular optimization | Add a simple experiment to test one particular optimization
| C++ | mit | msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler | |
d586248597ab75d99a56a61d23902de152ec47f7 | test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp | test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.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.
//
//===----------------------------------------... | Add test for self-referencing emplace test. | Add test for self-referencing emplace test.
git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@159921 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx,llvm-mirror/libcxx | |
2878fa325c7e34bbf82d8c91182534c2730538e4 | src/tests/shapes.cpp | src/tests/shapes.cpp |
#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 = 0; i <... | Add test for incorrect self-intersections w/Triangles. | Add test for incorrect self-intersections w/Triangles.
| C++ | bsd-2-clause | mmp/pbrt-v3,nispaur/pbrt-v3,nyue/pbrt-v3,shihchinw/pbrt-v3,mwkm/pbrt-v3,bssrdf/pbrt-v3,mmp/pbrt-v3,shihchinw/pbrt-v3,nyue/pbrt-v3,shihchinw/pbrt-v3,bssrdf/pbrt-v3,nyue/pbrt-v3,mwkm/pbrt-v3,mmp/pbrt-v3,ambakshi/pbrt-v3,ambakshi/pbrt-v3,nispaur/pbrt-v3,mmp/pbrt-v3,nyue/pbrt-v3,ambakshi/pbrt-v3,bssrdf/pbrt-v3,nispaur/pbrt... | |
02a77390cb7f81ea7a974bdfb7afa3c75874ef8b | Abstract-Data-Structures/binary_search_trees.cpp | Abstract-Data-Structures/binary_search_trees.cpp | #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(){
... | Add noilerplate code for Binary Search Trees. | Add noilerplate code for Binary Search Trees.
| C++ | mit | ankeshanand/interview-prep,ankeshanand/interview-prep | |
399e33c86398bb0735668f5f067ee7d51b825f4b | src/ports/SkDebug_android.cpp | src/ports/SkDebug_android.cpp |
/*
* 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[], ...) {
... |
/*
* 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 = false;
ext... | Enable Android executables (like skia_launcher) to redirect SkDebugf output to stdout as well as the system logs. | Enable Android executables (like skia_launcher) to redirect SkDebugf output to stdout as well as the system logs.
Review URL: https://codereview.appspot.com/6733065
git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@6059 2bbb7eff-a529-9590-31e7-b0007b416f81
| C++ | bsd-3-clause | mrobinson/skia,metajack/skia,mrobinson/skia,mrobinson/skia,metajack/skia,Cue/skia,mrobinson/skia,Cue/skia,Cue/skia,mrobinson/skia,metajack/skia,metajack/skia,Cue/skia |
57d22dac3343f14cae94fc03887904d13af02a5b | vm/capi/fixnum.cpp | vm/capi/fixnum.cpp | #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 big to ... | #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 big to... | Fix range check for rb_fix2uint | Fix range check for rb_fix2uint
Fixes #2770
| C++ | bsd-3-clause | Wirachmat/rubinius,sferik/rubinius,jemc/rubinius,dblock/rubinius,pH14/rubinius,jemc/rubinius,jsyeo/rubinius,digitalextremist/rubinius,pH14/rubinius,ruipserra/rubinius,ngpestelos/rubinius,ruipserra/rubinius,ruipserra/rubinius,sferik/rubinius,heftig/rubinius,kachick/rubinius,jemc/rubinius,mlarraz/rubinius,jsyeo/rubinius,... |
f29333f0b64cee2ef2ab26d7a5fa6a531631a447 | chapter20/chapter20_ex11.cpp | chapter20/chapter20_ex11.cpp | // 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 Iter>
vo... | Add Chapter 20, exercise 11 | Add Chapter 20, exercise 11
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
d5b8009214499c58cb83f3f39c59184d7e4da3e6 | solution024.cpp | solution024.cpp | /**
* 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 *dummy ... | Swap pairs in linked list. | Swap pairs in linked list.
| C++ | mit | cpselvis/leetcode | |
daecba1a04afdff044ea4915f0b945e1295fe1ef | NumberTheory/SimpleSieve.cpp | NumberTheory/SimpleSieve.cpp | /*
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(N * lo... | Add simple Sieve of Eratosthenes | Add simple Sieve of Eratosthenes
| C++ | mit | faheel/Algos,eskeype/Algos,faheel/Algos,varunjm/Algos | |
13d1daaf0b7251029e57e28c5f4af552d4ba171f | Sequences/utilities.cpp | Sequences/utilities.cpp | /*
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
}
| Add equations for some summatories. | Add equations for some summatories.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
6d4f3c84647c1d126bf07135811344a55b0a27c9 | string/583.cc | string/583.cc | 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 <= word1.size... | Delete Operation for Two Strings | Delete Operation for Two Strings
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
bc6299248a83c415329d63fbb77ed2930abfdce4 | graph/c++/Prims_MST.cpp | graph/c++/Prims_MST.cpp | #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++)
... | Add C++ solution for prims algorithm in graphs section | Add C++ solution for prims algorithm in graphs section
| C++ | cc0-1.0 | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | |
adda7fd31f3cf3b11277845d0d965b87f9b2dbac | Strings/anagram.cpp | Strings/anagram.cpp | #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] - 'a']--;... | Add the solution to "Anagram". | Add the solution to "Anagram".
| C++ | mit | clasnake/hackerrank,clasnake/hackerrank | |
b218790b96c59335ae9b154cd3afef54805ede6a | 675.cpp | 675.cpp | 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){
... | Cut Off Trees for Golf Event | Cut Off Trees for Golf Event | C++ | mit | zfang399/LeetCode-Problems | |
26374b06998b774b8c452ab577b119082aaa04a5 | chapter25/chapter25_ex06.cpp | chapter25/chapter25_ex06.cpp | // 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() << endl;
... | Add Chapter 25, exercise 6 | Add Chapter 25, exercise 6
| C++ | mit | bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp | |
39c043d756b2acc47e9c9b296879bf3238081de0 | array/2149.cc | array/2149.cc | 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));
}
}
... | Rearrange Array Elements by Sign | Rearrange Array Elements by Sign
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
6ea1c9c096cf7388ed7964ae5e62607e01d1ed96 | src/has_openmp.cpp | src/has_openmp.cpp | ///
/// @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 main()
{
... | Check if MSVC compiler supports OpenMP | Check if MSVC compiler supports OpenMP
| C++ | bsd-2-clause | kimwalisch/primecount,kimwalisch/primecount,kimwalisch/primecount | |
32ebb31d796d310c847ba3db632269d21ccc4108 | Data_Structures/LinkedLists/InsertNode/main.cc | Data_Structures/LinkedLists/InsertNode/main.cc | /*
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 (head == ... | Insert at tail of list | [task] Insert at tail of list
| C++ | mit | Johan37/Hackerrank,Johan37/Hackerrank | |
b53f2726a6d5c0d255856348d3d64617360268e9 | lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc | lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc | // 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: .section{{... | Add a test for __asan_gen_ globals labels on Darwin. | [ASan] Add a test for __asan_gen_ globals labels on Darwin.
Per Nick Kledzik (http://llvm.org/bugs/show_bug.cgi?id=17976):
"""
For MacOSX, the labels in __cstring section should be 'L' labels, and the labels
in the __const section should be non-L or 'l' labels. The later ('l') will cause
the linker to remove the labe... | C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
590d228ebb14b85940d68e2ce34eb7c5d67d7e73 | net_reader.cpp | net_reader.cpp | // 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 get_next(... | // 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 read();
p... | Change names of the interface on net part. | Change names of the interface on net part.
Change has_next() to can_read().
Change read_next() to read().
So it reads more natural.
| C++ | unlicense | WiSaGaN/diffusion |
2e76dcde1bf12e3c2c125d4139138c6eac0b0c2a | main.cpp | main.cpp | #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 < chain.si... | Test solver on the hardest sudoku | Test solver on the hardest sudoku
| C++ | mit | Diego999/Sudoku-Solver | |
846a3a1cd554488608f0024fb141e9d835235de1 | 1-common-tasks/memory-management/use-raii-classes.cpp | 1-common-tasks/memory-management/use-raii-classes.cpp | // 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<int> ptr2... | Add "use RAII classes" sample | Add "use RAII classes" sample
| C++ | cc0-1.0 | vjacquet/CppSamples-Samples,tmwoz/CppSamples-Samples,thatbrod/CppSamples-Samples,darongE/CppSamples-Samples,rollbear/CppSamples-Samples,brunotag/CppSamples-Samples,sftrabbit/CppSamples-Samples,mnpk/CppSamples-Samples | |
6e6049785dacd29bb5df27ce87ca5067fd152d8d | 156-Binary_Tree_Upside_Down.cpp | 156-Binary_Tree_Upside_Down.cpp | /**
* 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 (!root || !... | Use the DFS to solve the problem. | Use the DFS to solve the problem.
Signed-off-by: hwchiu <5d5bf96f0f7137bc5ec8b0b405b00e5a90f259c2@cs.nctu.edu.tw>
| C++ | apache-2.0 | HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode,HappyCompanions/LeetCode | |
559598ec62a210ccd9649515dc3291266c0e4dec | HackerRank/Domains/Data_Structures/Linked_List/delete_duplicate_sorted.cpp | HackerRank/Domains/Data_Structures/Linked_List/delete_duplicate_sorted.cpp | /*
* 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)
{
if(head... | Delete duplicate nodes from sorted list | Delete duplicate nodes from sorted list
| C++ | mit | onyb/cpp,onyb/cpp | |
6404d2a702f9ed3745516e3051e7482f89e66305 | tests/abort.cc | tests/abort.cc | //-----------------------------------------------------------------------
// $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. Please refer... | //-----------------------------------------------------------------------
// $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. Please refer... | Mark an external variable external. | Mark an external variable external.
git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@8841 0785d39b-7218-0410-832d-ea1e28bc413d
| C++ | lgpl-2.1 | lpolster/dealii,angelrca/dealii,shakirbsm/dealii,angelrca/dealii,mtezzele/dealii,johntfoster/dealii,andreamola/dealii,flow123d/dealii,nicolacavallini/dealii,maieneuro/dealii,JaeryunYim/dealii,mac-a/dealii,spco/dealii,lue/dealii,Arezou-gh/dealii,msteigemann/dealii,maieneuro/dealii,jperryhouts/dealii,msteigemann/dealii,m... |
6edb01679e929fb509db53d8fc4a1e6060ae989e | tests/test_types.cc | tests/test_types.cc | #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;
BOOS... | #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;
BOOS... | Add tests (copy constructor, virtual destructor) | Add tests (copy constructor, virtual destructor)
| C++ | lgpl-2.1 | suvayu/sfcore |
cf9d386b8c4cc2b91c49682bd54a1162cb7faa5c | alg/linked-lists-cpp/insert-node-at-tail.cpp | alg/linked-lists-cpp/insert-node-at-tail.cpp | /*
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 = data... | Insert node at tail (cpp) | Insert node at tail (cpp)
| C++ | mit | mgrebenets/hackerrank,mgrebenets/hackerrank,mgrebenets/hackerrank,mgrebenets/hackerrank,mgrebenets/hackerrank | |
c9012cb30c43e4db0dcc5c65eafef39d52ed7fc2 | test/unit/math/mix/prob/normal_ccdf_log_test.cpp | test/unit/math/mix/prob/normal_ccdf_log_test.cpp | #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_ad(f(0.... | Add mix test for normal_lccdf | Add mix test for normal_lccdf
| C++ | bsd-3-clause | stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math | |
4dece2b09acd491eebbf2e731a3fc319fe64db4b | src/main/cpp/source/cmdargs.cpp | src/main/cpp/source/cmdargs.cpp | /*
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, publish,... | Add Command Line Argument Tracker | Add Command Line Argument Tracker
| C++ | mit | ZetaChain/ZetaChain_Native,ZetaChain/ZetaChain_Native | |
ac76769186f29f2904c6aafdba4e38f1cea0df3f | programs/utils/bts_key_info.cpp | programs/utils/bts_key_info.cpp | #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.hpp>
#inc... | #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.hpp>
#inc... | Fix compile errors on win32, update Qt submodule to fix compile errors there | Fix compile errors on win32, update Qt submodule to fix compile errors there
| C++ | unlicense | bitshares/devshares,FollowMyVote/bitshares,bitsuperlab/cpp-play,bitshares/devshares,jakeporter/Bitshares,bitshares/devshares,FollowMyVote/bitshares,frrp/bitshares,bitshares/bitshares,RemitaBit/Remitabit,bitshares/bitshares-0.x,dacsunlimited/dac_play,jakeporter/Bitshares,bitshares/bitshares-0.x,jakeporter/Bitshares,camp... |
145966c79131dbdcdb395566213bea7bebb43f52 | src/client/DeprecatedGUI/Menu_FloatingOptions.cpp | src/client/DeprecatedGUI/Menu_FloatingOptions.cpp | /////////////////////////////////////////
//
// 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 | /////////////////////////////////////////
//
// 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.h"
#inc... | Update input keys in game, for Floating Options | Hackontest: Update input keys in game, for Floating Options
git-svn-id: 0634bf30b6d7a21f2003d4a9f34c102a3ffa6fda@2375 34602234-ff1f-0410-a465-ea8f3b77ab7f
| C++ | lgpl-2.1 | ProfessorKaos64/openlierox,ProfessorKaos64/openlierox,ProfessorKaos64/openlierox,ProfessorKaos64/openlierox,ProfessorKaos64/openlierox,ProfessorKaos64/openlierox,ProfessorKaos64/openlierox |
f51a427042191ed17e71bd9690c0c4709b9054e0 | AlgosDataStructs/test/t_template_polymorh.cc | AlgosDataStructs/test/t_template_polymorh.cc | #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); }
};
templa... | Test class for API conformance using templates instead of virtual functions. | Test class for API conformance using templates instead of virtual functions.
| C++ | mit | phoenix1584/techquest1984,phoenix1584/techquest1984 | |
000ee90bfe9a7eb82fd4eddf317e4be994b63f49 | TESTS/mbed_hal/minimum_requirements/main.cpp | TESTS/mbed_hal/minimum_requirements/main.cpp | /* 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 require... | Add a minimum requirements HAL test | Add a minimum requirements HAL test
Add a test to ensure that devices have at least 2K free ram
and 2K free heap. This test should be the first test that fails
due to running out of ram or heap.
| C++ | apache-2.0 | c1728p9/mbed-os,kjbracey-arm/mbed,andcor02/mbed-os,kjbracey-arm/mbed,andcor02/mbed-os,c1728p9/mbed-os,mbedmicro/mbed,andcor02/mbed-os,c1728p9/mbed-os,mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,c1728p9/mbed-os,c1728p9/mbed-os,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,c1728p9/mbed-os,andcor0... | |
8d1b6c9084d3c025353577460965dcdb0eefa09f | depth-first-search/testDfs.cpp | depth-first-search/testDfs.cpp | /*
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},
... | Add test program for depth first search | Add test program for depth first search
| C++ | mit | rohitkhilnani/cpp-And-Me | |
107b4cae9be7dc59315e28f65b555cb2bd5f4574 | test/Lexer/has_feature_rtti.cpp | test/Lexer/has_feature_rtti.cpp | // 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
| Add FileCheck test for '__has_feature(rtti)'. | Add FileCheck test for '__has_feature(rtti)'.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@90373 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/cl... | |
ccab34024918e3f0cd530349977f20ccd4dd1b31 | code/_ostream.cpp | code/_ostream.cpp | // 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...>) const
{ ... | Add an example of compile-time printf formatting | Add an example of compile-time printf formatting
| C++ | mit | ldionne/hana-cppnow-2015,ldionne/hana-cppnow-2015,ldionne/hana-cppnow-2015 | |
10d9069f490e394fe217e7c58a3b617ad583bcfc | 583.cpp | 583.cpp | 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;
... | Delete Operation for Two Strings | Delete Operation for Two Strings | C++ | mit | zfang399/LeetCode-Problems | |
43ae6487dc7211a6a3e4a446c09cba1835deed4c | tensorflow/lite/kernels/test_main.cc | tensorflow/lite/kernels/test_main.cc | /* 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 law or a... | /* 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 law or a... | Fix command-line parsing for --use_nnapi | Fix command-line parsing for --use_nnapi
PiperOrigin-RevId: 249506404
| C++ | apache-2.0 | cxxgtxy/tensorflow,ppwwyyxx/tensorflow,ghchinoy/tensorflow,alsrgv/tensorflow,Intel-Corporation/tensorflow,aam-at/tensorflow,jhseu/tensorflow,chemelnucfin/tensorflow,aldian/tensorflow,jhseu/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,annarev/tensorflow,Intel-Corporation/tensorflow,ghchinoy/tensorflow,gautam1858... |
66125ac00fef655467c7c60c0eccbf6565882040 | 226_invert_binary_tree.cc | 226_invert_binary_tree.cc | // 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;
* Tr... | Add a solution to problem 226: Invert Binary Tree. | Add a solution to problem 226: Invert Binary Tree.
| C++ | apache-2.0 | shen-yang/leetcode_solutions,shen-yang/leetcode_solutions,shen-yang/leetcode_solutions | |
54d85fe36634f3b47c830f341779b0e3ea8dd00d | test/asan/TestCases/Linux/init_fini_sections.cc | test/asan/TestCases/Linux/init_fini_sections.cc | // 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__((section(... | Add test for .preinit_array/.init_array/.fini_array sections. | [ASan] Add test for .preinit_array/.init_array/.fini_array sections.
git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@247737 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt,llvm-mirror/compiler-rt | |
e082c0a196bd2d8ef1c98edc6865349982dfbe93 | src/cry.cpp | src/cry.cpp | #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: " << _devName.c_s... | Add simple display class and constructor | Add simple display class and constructor
| C++ | mit | malensek/cryctl,malensek/cryctl | |
5dce19cfe331349f785a678fc4255ef3e4619f9e | leetcode/Remove_Duplicates_from_Sorted_Array.cpp | leetcode/Remove_Duplicates_from_Sorted_Array.cpp | //
// 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) {
... | Remove Duplicates from Sorted Array | Remove Duplicates from Sorted Array
| C++ | mit | John-Shaw/leetcode-solutions | |
c28512db9bc024e4c47b6ae5177f9637d60be917 | Structures/MaxFlow.cpp | Structures/MaxFlow.cpp | #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++){
if... | Add Ford Fulkerson algorithm to find the max flow. | Add Ford Fulkerson algorithm to find the max flow.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
e58ea992e9525f1e42b827c281177a491348b86d | test/CXX/drs/dr16xx.cpp | test/CXX/drs/dr16xx.cpp | // 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 -fexceptio... | Add missing testcase from r224388. | Add missing testcase from r224388.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@224401 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-cl... | |
8facc0b5261b11042b109e32d28c1b13fb38c74c | cpp/067_Add_Binary.cpp | cpp/067_Add_Binary.cpp | // 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>
#include <s... | Add Solution for 067 Add Binary | Add Solution for 067 Add Binary
| C++ | mit | kuangami/LeetCode,kuangami/LeetCode,kuangami/LeetCode | |
749da052e9fd2aeb6f5eae86906f8975609a6eb8 | try/cpp/binary_digit_count.cpp | try/cpp/binary_digit_count.cpp | #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;
Microseconds(&star... | Test code for an algorithm on StackOverflow. | Test code for an algorithm on StackOverflow.
| C++ | mit | sblom/sandbox,sblom/sandbox,sblom/sandbox,sblom/sandbox,sblom/sandbox,sblom/sandbox | |
7496e6253bb462c08529923f5236b5c3d30d80e6 | LIFI_RX.cpp | LIFI_RX.cpp | #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.2f);
... | Create LIFI receiver and output analog values | Create LIFI receiver and output analog values
| C++ | mit | ivanplex/Lifi_concept,ivanplex/Lifi_concept | |
24647f786af84eafb2b5c12c1629546bb7df911d | doc/examples/encrypt2.cpp | doc/examples/encrypt2.cpp | #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 outfile("r... | Add an example taken from the tutorial | Add an example taken from the tutorial
| C++ | bsd-2-clause | randombit/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,webmaster128/botan,webmaster128/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,Rohde-Sch... | |
65763e203d7cb3cb92d1e91c72fc208656bd2b91 | exams/Exam-zad1/main1.cpp | exams/Exam-zad1/main1.cpp | #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()) {
result[... | Add main file - remove main.cpp from .gitignore please | Add main file - remove main.cpp from .gitignore please
| C++ | mit | rgeorgiev583/dsp-practicum-2015-16,rgeorgiev583/dsp-practicum-2015-16,rgeorgiev583/dsp-practicum-2015-16 | |
a762d9c34686264445b7e9558344caccf5577617 | C++/147_Insertion_Sort_List.cpp | C++/147_Insertion_Sort_List.cpp | //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* insertion... | Add 147 Insertion Sort List | Add 147 Insertion Sort List | C++ | mit | FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res,FreeTymeKiyan/LeetCode-Sol-Res,bssrdf/LeetCode-Sol-Res | |
ddd77bde604a09b9da1eddf7539a5461655e988a | string/1704.cc | string/1704.cc | 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())
++co... | Determine if String Halves Are Alike | Determine if String Halves Are Alike
| C++ | apache-2.0 | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | |
4c4dddc1528a497f4682c2b03a5109f7a7ce3e22 | unit_test/operators_v2/squared_difference.cc | unit_test/operators_v2/squared_difference.cc | #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::from_vec... | Add unit test for squared difference op | Add unit test for squared difference op
| C++ | mit | shi510/mlfe,shi510/mlfe,shi510/mlfe,shi510/mlfe | |
fedae1136f59ea62846214be7557d561b0aa94e6 | modules/diffmain.cpp | modules/diffmain.cpp | #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;
}
| Add symposium server main file. | Add symposium server main file.
| C++ | bsd-3-clause | Submitty/Submitty,Submitty/Submitty,Submitty/Submitty,UuqV/HomeworkServerHack,RCOS-Grading-Server/HWserver,RCOS-Grading-Server/HWserver,UuqV/HomeworkServerHack,RCOS-Grading-Server/HWserver,RCOS-Grading-Server/HWserver,Submitty/Submitty,Submitty/Submitty,Submitty/Submitty,UuqV/HomeworkServerHack,UuqV/HomeworkServerHack,... | |
4fce70df5f0e049993d837cc24e79715685e9a9c | practice03/02.cpp | practice03/02.cpp | #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;
}
| Add a solution of prob 2 | Add a solution of prob 2
| C++ | mit | kdzlvaids/problem_solving-pknu-2016,kdzlvaids/problem_solving-pknu-2016 | |
ac8987ade671819f0e9d5ac7c359156c26ca49fe | Problem005/C++/solution_1.cpp | Problem005/C++/solution_1.cpp | #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 0;
}
| Add C++ solution to problem 005 | Add C++ solution to problem 005
Signed-off-by: Rafael Campos Nunes <42f0a9af43f2538fd3153aecc7c3ff958e89d724@engineer.com>
| C++ | mit | DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectE... | |
db9ed2d695aa975e06d0bc663212d219ad33b6f2 | test/utils/truth_table_cache.cpp | test/utils/truth_table_cache.cpp | #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::dynam... | Add test case for truth table cache. | Add test case for truth table cache.
| C++ | mit | lsils/mockturtle,lsils/mockturtle,lsils/mockturtle,lsils/mockturtle | |
8ec1acca745a5faa272f92bd4c78f9c54956d318 | Leetcode2/083.cpp | Leetcode2/083.cpp | /**
* 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 *prev = he... | Remove Duplicates from Sorted List | Remove Duplicates from Sorted List | C++ | mit | nolink/algorithm,nolink/algorithm | |
44e62c2eafb71e195a4aa75d04749ab9144735cc | Snippets/show.cpp | Snippets/show.cpp | #include <iostream>
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
int main(){
int e =32;
show(e);
}
| Implement useful macro for debug. | Implement useful macro for debug.
| C++ | mit | xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book | |
092f495c0db94891edd79a24589184b997087c9e | packages/Search/test/utf_main.cpp | packages/Search/test/utf_main.cpp | #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 )
MPI_Init... | Add main for unit tests using Boost UTF | Add main for unit tests using Boost UTF
| C++ | bsd-3-clause | Rombur/DataTransferKit,ORNL-CEES/DataTransferKit,ORNL-CEES/DataTransferKit,Rombur/DataTransferKit,ORNL-CEES/DataTransferKit,Rombur/DataTransferKit,Rombur/DataTransferKit,ORNL-CEES/DataTransferKit | |
1e194698012af61dff5bd7b1be229b5f4e1d8a79 | thread_lambda.cpp | thread_lambda.cpp | #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(); } );
for_... | 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. | 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.
Compile with:
g++ -std=c++11 thread_lambda.cpp -o thread_lambda -lpthread
| C++ | apache-2.0 | tisma/ctorious,tisma/ctorious | |
8d33f4cfb2382983bb49293c26ca336b8bdcfdd0 | excercise05/03.cpp | excercise05/03.cpp | #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;
}
| Add solution of prob 3 | Add solution of prob 3
| C++ | mit | kdzlvaids/algorithm_and_practice-pknu-2016,kdzlvaids/algorithm_and_practice-pknu-2016 | |
8c3a1e38d0cc738a06972387ee4d5b43193c1e70 | ini-diff/main.cpp | ini-diff/main.cpp | /*
* 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 mods ca... | Rename the repository, add an ini diff tool | Rename the repository, add an ini diff tool
| C++ | cc0-1.0 | haoNoQ/wztools2100,haoNoQ/wztools2100,haoNoQ/wztools2100 | |
3bfba4f85346721aa33cea58841060f01b759019 | test/opengl/inline_reduction.cpp | test/opengl/inline_reduction.cpp | #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 HL_JIT_... | Add failing opengl test using an inline reduction | Add failing opengl test using an inline reduction
| C++ | mit | kgnk/Halide,psuriana/Halide,ronen/Halide,psuriana/Halide,ronen/Halide,ronen/Halide,psuriana/Halide,psuriana/Halide,jiawen/Halide,kgnk/Halide,jiawen/Halide,jiawen/Halide,kgnk/Halide,jiawen/Halide,kgnk/Halide,kgnk/Halide,jiawen/Halide,ronen/Halide,kgnk/Halide,kgnk/Halide,ronen/Halide,jiawen/Halide,jiawen/Halide,ronen/Hal... | |
142b18500cdc254c58bd5da0002d421d5e4035e7 | chocolate_feast.cpp | chocolate_feast.cpp | #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;
while (T--... | Add the solution to "Chocolate feast". | Add the solution to "Chocolate feast".
| C++ | mit | clasnake/hackerrank,clasnake/hackerrank | |
3a4a602ac81e654458cc829fc3f46afe7f432732 | misc/VeryLargeRead.cc | misc/VeryLargeRead.cc | #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 long kWi... | Add a test case that performs a very large read. | Add a test case that performs a very large read.
| C++ | mit | fracting/winpty,fracting/winpty,rprichard/winpty,fracting/winpty,rprichard/winpty,rprichard/winpty,fracting/winpty,rprichard/winpty |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.