blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
b86998a619ce18966027bd411231050b05998697 | C++ | mettledrum/Dijkstra_vs_Bellman-Ford | /Dijkstra/unionFunctions.cpp | UTF-8 | 2,253 | 3.328125 | 3 | [] | no_license | //Andrew Hoyle 810-32-3651
//3412 Algorithms
//Dijkstra's Algorithm
//3/21/12
#include <limits>
#include "unionFunctions.h"
void greeting()
{
std::cout << "Dijkstra's algorithm using only positive, directed edges...\n"
"Also, nodes cannot be connected to themselves./n"
"The nodes will be ... | true |
3cd7086b9054782f4e9a3035bd5d6c1ee8ff4abe | C++ | ProfessionalLearner/c-plus-plus-red-belt | /Week 3/Programming Assignment 2/src/swap_sort_copy.cpp | UTF-8 | 1,016 | 3.53125 | 4 | [] | no_license | #include <vector>
#include <algorithm>
#include <memory>
#include <numeric>
using namespace std;
template <typename T>
void Swap(T* first, T* second) {
auto temp = *first;
*first = *second;
*second = temp;
}
template <typename T>
void SortPointers(vector<T*>& pointers) {
sort(begin(pointers), end(pointers), [](T*... | true |
e3856615254f480230c8820e836f9b51b2343446 | C++ | MOIPA/MyAlgorithm | /C++/斐波那契数列.cpp | UTF-8 | 240 | 3.40625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int Fibsequence(int n) {
if (n == 0)return 0;
if (n == 1)return 1;
if (n > 1) return Fibsequence(n - 1)+Fibsequence(n-2);
}
int main(void) {
int n;
cin >> n;
cout<<Fibsequence(n);
return 0;
} | true |
20648d69493e2d4a9c5b4de24a0f46f51ee707a6 | C++ | GhulamMustafaGM/C-Programming | /01-C++ Programing/33.cpp | UTF-8 | 497 | 4.15625 | 4 | [] | no_license | /*C++ program - calcuate area and circumference of circle */
#include <iostream>
using namespace std;
int main()
{
float r, area, circum;
cout << "\nEnter the radious of the circle:";
cin >> r;
area = 3.14 * r * r;
circum = 2 * 3.14 * r;
cout << "Area of the circle = " << area << "\nCircumfe... | true |
92a6bc04e771cd42849bd2e55c1c0b3f7d9274b6 | C++ | Gkx1995/BSON_doc_filter | /filter_generator.cpp | UTF-8 | 22,189 | 2.578125 | 3 | [] | no_license | //
// Created by kai on 8/3/18.
//
#include "filter_generator.h"
//////////////////////////////////////////////////////////
// Filter methods
//////////////////////////////////////////////////////////
using namespace CommonConstants;
// Constructor
Filter::Filter(std::string& query, const std::string& shard_keys) {
... | true |
7d9e01597ef8922808c1f64a15bfe03f5a913cb9 | C++ | mubai-victor/Algorithm | /线性规划网络流/线性规划/main.cpp | UTF-8 | 3,886 | 3.015625 | 3 | [] | no_license | //线性规划的单纯形算法
//author:mubai edition:1.0 time:2019年09月21日20:23:50
#include "iostream"
#include "iomanip"
#define MAXSIZE 100
#define INF 10e6
using namespace std;
double kernel[MAXSIZE][MAXSIZE];
int basicVar[MAXSIZE]={1,3,6,7},nonBasicVar[MAXSIZE]={2,4,5};
void print(int basic,int nonbasic);
void DCXA(int basic,in... | true |
df4e0d8929a4587a077779d15d97e4165d7abc00 | C++ | bvignesh/15-745_repo | /source_codes/hw3/junhanz/LICM/dataflow.cpp | UTF-8 | 10,205 | 2.78125 | 3 | [] | no_license | // 15-745 S16 Assignment 2: dataflow.cpp
// Group:
////////////////////////////////////////////////////////////////////////////////
#include "dataflow.h"
namespace llvm {
// Create the analysis object
DataFlowAnalysis::DataFlowAnalysis(char &ID) : FunctionPass(ID){
//Reset inner data elements
re... | true |
370c898b81e4a6d9630da14819e02e4a7680feff | C++ | gauravengine/CPP_Freak | /450_DSA/graph/struct.cpp | UTF-8 | 623 | 3.21875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct cell
{
int x,y,dis;
cell(){
cout<<"bonjour"<<endl;
x=1;
y=1;
dis=1;
}
cell(int x,int y,int dis) :x(x),y(y),dis(dis)
{
cout<<"intialization list constructor"<<endl;
}
};
int main(){
// cell t(2,3,4... | true |
d7c24b91702c53d1460c2518a5d40c8c9dfd298f | C++ | cmmakerclub/iotworkshop | /codes/basic-esp8266/esp8266_basic_httpget/esp8266_basic_httpget.ino | UTF-8 | 1,277 | 2.8125 | 3 | [] | no_license | /**
BasicHTTPClient.ino
Created on: 24.05.2015
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "........";
const char* password = "........";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connect... | true |
5e1a75ab49a6bc3b27150f5740719fb78ae8d6d2 | C++ | DahamChoi/Algorithm-Troubleshooting-Strategies | /모스 부호 사전/모스 부호 사전.cpp | UTF-8 | 1,520 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
void generate(int n, int m, string s) {
// 기저 사례 : n = m = 0
if (n == 0 && m == 0) {
return;
}
if (n > 0) generate(n - 1, m, s + "-");
if (m > 0) generate(n, m - 1, s + "o");
}
int skip;
void generate2(int n, int m, string s) {
// 기저 사례 : skip < 0
... | true |
6b36ba4a2922d7b3a3d48db64709976d31003fbd | C++ | LuyzThu/MyAccount | /MyAccount/SavingAccount.h | UTF-8 | 843 | 3 | 3 | [] | no_license | #ifndef _SAVING_ACCOUNT_H_
#define _SAVING_ACCOUNT_H_
#include <string>
#include "Date.h"
using namespace std;
class SavingAccount
{
public:
SavingAccount(Date date, string id, double rate);
string getId() const { return id; }
double getBalance() const{ return balance; }
double getRate() const { return rate; }
v... | true |
a5f8d8529f40c7a24c910c3ef78236f94a781245 | C++ | lalanne/UnitTestTalk | /src/code/allTests.cpp | UTF-8 | 674 | 3.5625 | 4 | [] | no_license | TEST(stack_tests, lifo_behaviour_with_1_element) {
Stack<float> stack;
stack.push(2.5);
EXPECT_EQ(2.5, stack.pop());
}
TEST(stack_tests, lifo_behaviour_with_3_element) {
Stack<int> stack;
stack.push(2);
stack.push(1);
stack.push(14);
EXPECT_EQ(14, stack.pop());
EXPECT_EQ(1, stack.po... | true |
244625f46af8d952081ad6950ef70188f3629213 | C++ | roborams256/MainRobotCode | /TriggerWheel.cpp | UTF-8 | 1,246 | 2.71875 | 3 | [] | no_license | #include "TriggerWheel.h"
TriggerWheel::TriggerWheel(int spikeChannel, double launchTime){
triggerRelay = new Relay(SPIKE_TRIGGER); // default should be both directions
// start in the hold direction
//Hold();
launchPeriod = launchTime;
semi = false;
pulse = false;
timer = new Timer();
timer->Reset(... | true |
b1480d2ca656b023353f74777421dbe7a41f138c | C++ | Paul199406/algorithm | /06_PrintListInReversedOrder/PrintListInReversedOrder.cpp | UTF-8 | 1,457 | 3.65625 | 4 | [] | no_license | //author:lijiwei
//date:2020/2/9
#include <iostream>
#include <stack>
using namespace std;
#define nullptr 0
struct ListNode
{
int m_nValue;
ListNode* m_pNext;
};
ListNode* CreateListNode(int value)
{
ListNode* pNode = new ListNode();
pNode->m_nValue = value;
pNode->m_pNext = nullptr;
... | true |
bcf1e426da1173edc6ebe8b5c88758360f9aec79 | C++ | baileyforrest/cxm | /cxm/lex/token.cc | UTF-8 | 2,119 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "cxm/lex/token.h"
std::string_view TokenTypeToString(TokenType token_type) {
#define CASE_STR(token) \
case TokenType::token: \
return #token
switch (token_type) {
CASE_STR(kEof);
CASE_STR(kLBrace);
CASE_STR(kRBrace);
CASE_STR(kLParen);
CASE_STR(kRParen);
CASE_STR(kSemi);
... | true |
db4583d7b2f9aa0aa1dd96119a33050c27213273 | C++ | Alexander-Golova/acousticsProblemDim3 | /directProblem/Inhomogeneity.cpp | UTF-8 | 2,048 | 2.59375 | 3 | [] | no_license | #include "stdafx.h"
#include "Inhomogeneity.h"
using namespace std;
void SetRefractionIndex(vector<float> & xi) noexcept
{
const float sigma = 16.0f;
size_t coord;
for (size_t i = 0; i < N; ++i)
{
for (size_t j = 0; j < N; ++j)
{
for (size_t k = 0; k < N; ++k)
{
coord = N_SQUARED * i + N * j + k;
... | true |
31557193fbfe31592f764bfde0decfef4543fe3b | C++ | renebarto/Simulate | /source/components/core/test/src/Test/DateTimeTest.cpp | UTF-8 | 84,206 | 3.109375 | 3 | [] | no_license | #include "unit-test-c++/UnitTestC++.h"
#include "core/DateTime.h"
#include "core/Exception.h"
#include "core/TimeSpan.h"
using namespace std;
namespace Core
{
namespace Test
{
class DateTimeTest : public UnitTestCpp::TestFixture
{
public:
virtual void SetUp();
virtual void TearDown();
};
void DateTimeTest:... | true |
660b0845095b9ef6f588b3f83c14723f1ab420d5 | C++ | mimseong/BaekJoon | /14717.cpp | UTF-8 | 1,432 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#define xx first
#define yy second
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = long long;
usi... | true |
8a2e51b4e4f59c9205707aa4fedf9430a869fe8e | C++ | junhyeon47/baekjoon-algorithm | /src/baekjoon_11655.cpp | UTF-8 | 649 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main(){
string input;
getline(cin, input);
for(int i=0; i<input.size(); ++i){
if('a' <= input[i] && 'z' >= input[i]){
if(input[i] + 13 > 'z'){
input[i] = (input[i]+13-'a')%26 + 'a';
}else{
... | true |
658b1a8f8d26947ec65385dee64495b1e4064713 | C++ | wuqingze/algorithm | /Heap/code/HeapSort.cc | UTF-8 | 1,222 | 3.1875 | 3 | [] | no_license | #include <algorithm>
template<typename T, class RandomIt, class Compare>
void sort(RandomIt first, RandomIt end, Compare less =
[](const T& o1, const T& o2){ return o1<o2;}){
int n = end - first;
if(n == 0) return;
auto arr = first;
auto fixup = [arr, less](int i){
while(i>0){
... | true |
a4931f5e9ebbd4b46b2bb9c873126e420088ed9d | C++ | JSlowgrove/LevelHEngine-GEP-Assignment-2 | /LevelHEngine/States/CannonGame/States/WinLose.h | UTF-8 | 996 | 2.90625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
#include "../../State.h"
#include "../../StateManager.h"
#include "../../../ResourceManagement/Text.h"
/**
@brief A State that contains and runs the Demo.
*/
class WinLose : public State
{
public:
/**
@brief Constructs the State object.
@param stateManager A pointer to the StateManag... | true |
c47aa9742819df2aa8656d408a1139cf01eedf95 | C++ | prachikush/oop-projects | /box.cpp | UTF-8 | 292 | 2.703125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int i,j,k,l,b;
cout <<" enter the number of rows and columns: "<<endl;
cin>>l>>b;
for(i=0;i<l;i++)
{
for(j=0;j<b;j++)
{
if(i==0||i==(l-1) ||j==0||j==(b-1))
{
cout<<"*";
}
else
{
cout<<" ";
}
}cout <<endl;
}
}
| true |
ea982509e721cc3661de7c01926ccb5cbb932d31 | C++ | DavidSaxon/Reverie | /src/omicron/rendering/shading/Texture.cpp | UTF-8 | 1,851 | 3.0625 | 3 | [] | no_license | #include "Texture.hpp"
namespace omi {
//------------------------------------------------------------------------------
// CONSTRUCTORS
//------------------------------------------------------------------------------
Texture::Texture() :
m_id (0),
m_visible(true... | true |
91098820a3d162a2e75208e996b3ddbb4a73cb93 | C++ | xxmen/ACMTraining | /2014-08-24&25/ural1277(最小割).cpp | UTF-8 | 2,766 | 2.515625 | 3 | [] | no_license | /*
求最小割,但是由于给出的是每个点的容量,所以需要将每个点拆为两个点,之间连边,容量为点的容量,
两个城市如果相连则容量置为无穷大。然后求最大流看是否大于已有警察数。拆点的时候将点i拆为i和i+n。
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long LL;
const int INF = 1<<30;
const int maxn = 210;
struct edge{
int v, c, n... | true |
9d654dba24035f43482119b3edb9cf5e0ff808cd | C++ | ghrua/KeepCoding | /leetcode/hard/329.cpp | UTF-8 | 1,526 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <set>
#include <utility>
#include <climits>
#include <vector>
#include <queue>
using namespace std;
#define LL long long
class Solution {
private:
struct node {
int x, y, val;
};
struct cmp {
bool operator() ... | true |
0d2c2b4b70169568cbe9be506fcd66d38f048073 | C++ | Lightene/boj | /cpp/10845.cpp | UTF-8 | 1,440 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MAX 100000
using namespace std;
int arr[MAX];
int f, b;
void push(int input) {
b++;
arr[b] = input;
}
void pop() {
if (f > b)
cout << "-1\n";
else {
cout << arr[f] << "\n";
f++;
}
}
vo... | true |
83201941f8e0f4e40ad0712168539ab57c2ab6f0 | C++ | AnnaBratucu/data-structures | /ex2/main.cpp | UTF-8 | 4,013 | 4.125 | 4 | [] | no_license | #include<iostream>
#include<cstdlib>
#include<string>
#include<cstdio>
using namespace std;
const int TABLE_SIZE = 128;
/*
* HashEntry Class Declaration
*/
class HashEntry
{
public:
int key;
int value;
HashEntry(int key, int value)
{
this->key = key;
this->... | true |
879e4a728c6a4f5c62bf2e377f001114e7b202bf | C++ | tangj1992/Data-Structure-and-Algorithms | /cpp/Sort.h | UTF-8 | 755 | 2.5625 | 3 | [] | no_license | #ifndef SINGLELIST_SORT_H
#define SINGLELIST_SORT_H
/**
* 各种排序算法
*/
class Sort{
public:
static void bubbleSort(int arr[], int size);
static void insertionSort(int arr[], int size);
static void selectionSort(int arr[], int size);
static void mergeSort(int arr[], int size);
static void quickSort(int... | true |
d67b8a50accb4bbd1800ff1bc83cb8da3cafc131 | C++ | wincentbalin/QMLPiano | /qmlpiano.cpp | UTF-8 | 1,878 | 2.625 | 3 | [] | no_license | #include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include "qmlpiano.hpp"
void Piano::noteOn(int keyIndex)
{
unsigned char noteOn = 144; // Note On, first channel
unsigned char velocity = 100;
sendNoteMessage(noteOn, keyIndex, velocity);
}
void Piano::noteOff(int keyIndex)
{
unsigned c... | true |
ed09375d3db9ece77fc1c9e1b51517fe9e45d507 | C++ | VSerain/bob-v-0 | /src/Manager.cpp | UTF-8 | 3,669 | 3.171875 | 3 | [] | no_license | #include "./Manager.h"
const int MAX_SPEED = 150;
const int BOT_LENGTH = 160;
const int BOT_WIDTH = 80;
const int WHEEL_RAY = 65;
Manager::Manager(Head head, AbstarctServo frontWheel, DCMotor leftMotor, DCMotor rightMotor, int debug): head(head), frontWheel(frontWheel), leftMotor(leftMotor), rightMotor(rightMotor) {
... | true |
0d8891fbbb167d622dc6da5962273871f15500bc | C++ | amnagrawal/Competetive-coding | /Codechef/NUKES.cpp | UTF-8 | 242 | 2.6875 | 3 | [] | no_license | //https://www.codechef.com/problems/NUKES
#include <iostream>
using namespace std;
int main() {
long int a;
int n, k;
cin>>a;
cin>>n>>k;
while(k--) {
cout<<a%(n+1)<<" ";
a = a/(n+1);
}
return 0;
}
| true |
282687e0c585a75836f27d0bc18e329cec799db9 | C++ | JaroslavUrbann/ICPC-library | /data-structures/interval_set.cpp | UTF-8 | 1,353 | 2.875 | 3 | [] | no_license | // quite slow
// inclusive, exclusive
struct iset{
typedef int T;
set<tuple<T,T,T>>longest; // len, l, r
set<pair<T,T>>ints;
set<pair<T,T>>::iterator insert(T l,T r){
auto it=ints.lower_bound({l,INT_MIN});
if(it!=ints.begin()){
auto[lp,rp]=*prev(it);
if(l<=rp){
it=erase(prev(it));
l=min(l,lp);
... | true |
78c33632f33787b5bca17c66ef75dd9b0d1a9c25 | C++ | Dot-H/random | /adaptative_struct/test.cpp | UTF-8 | 329 | 2.84375 | 3 | [] | no_license | #include <iostream>
template <std::size_t N>
constexpr uint8_t nBytes() {
return (sizeof(N) + 1) - x86_lzcnt(N);
}
template <std::size_t N>
struct Size {
constexpr std::size_t size() const { nBytes<N>(); }
};
int main(int argc, char* argv[])
{
Size<128> s;
std::cout << s.size() << std::endl;
ret... | true |
2d24bf409e360f7e963bbf99dfd14ba4e8eddfcc | C++ | jiwoo1218/Room-Escape-30806 | /RoomEscape.c.cpp | UTF-8 | 12,780 | 2.71875 | 3 | [] | no_license | /*
개발자: 박지우, 윤민혁, 정민태
개발일: 2021.09.07
문의: p0312181@naver.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#define TRUE 1
#define FALSE 0
void intro();
void room();
void frame(); //1. 액자
void bed(); //2. 침대
void fridge(); //3. 수정중
void safebox(); //4. 수정중
... | true |
de36ef304c741b68260044648df3e5efff375565 | C++ | Jabed27/C-datastructure-and-algorithm | /STL/vectorSort.cpp | UTF-8 | 863 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>
using namespace std;
int myfunc(int a,int b){
return (a>b);
}
int main(){
vector <int >vec;
vector <int >::iterator it;
vec.push_back(30);
vec.push_back(78);
vec.push_back(-9);
... | true |
a85c862ef9942c69c8bfe246f21523bb75a28502 | C++ | sunzhijuns/li_cl_algorithm | /MaxHeap.h | UTF-8 | 6,547 | 3.546875 | 4 | [] | no_license | //
// Created by sunzhijun on 18-2-3.
//
#ifndef SUANFA_MAXHEAP_H
#define SUANFA_MAXHEAP_H
#include <iostream>
#include <string.h>
#include <cassert>
#include<math.h>
#include<string>
#include <typeinfo>
template<typename Item>
class MaxHeap{
private:
Item* _data;
int _count;
int _capacity;
private:
... | true |
d64da670be4cad079ef53e4060a0e0cc514a8dfa | C++ | jianjiachenghub/CLanguageProgramming | /C++/重载运算符.cpp | UTF-8 | 391 | 3.359375 | 3 | [] | no_license | #include<iostream.h>
class complex
{
public:
complex(){real=0;imag=0;}
complex(double r,double i)
{
real=r;imag=i;
}
complex operator+(complex &c2)
{
return complex(real+c2.real,imag+c2.imag);
}
private:
double real,imag;
};
int m... | true |
df4606ed5a5564f3b4fa45067942086bfe4c23c9 | C++ | cavallo5/cpp_scripts | /src/Calcolo di un numero romano.cpp | UTF-8 | 909 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n,i,valore,risultato;
char x;
risultato=0;
cout<<"Programma per il calcolo di un numero romano"<<endl;
cout<<"Quante cifre? ";
cin>>n;
i=0;
while (i<n)
{
cout<<"Inserire il "<<i<<" valo... | true |
9d75e598f2eccc08ac2a42ffd03bd1c3826077b0 | C++ | raviswan/Elixir | /UCSD_DataStructures_Algorithms_Course/BinaryTree/binTree.cpp | UTF-8 | 9,781 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include "binTree.h"
using namespace std;
const int MAX_VALUE = 65535;
const int MIN_VALUE = 0;
/*--------------Binary Tree Node definition-------------------*/
int compareNodes(void* key1, void* key2){
BinTreeNode* node1 = (BinTreeNode*) key1;
BinTreeNod... | true |
6021aa4c41d589d61bc3cc40a9abd06265d00cdb | C++ | mwil/wifire | /src/wftable/host/src/parser/stringterminal.h | UTF-8 | 835 | 2.734375 | 3 | [] | no_license |
#pragma once
#include <string>
#include "terminal.h"
namespace Parser {
/** \brief String (Freetext) Terminal */
class StringTerminal : public Terminal {
public:
/// pointer type
typedef boost::shared_ptr<StringTerminal> ptr;
/// const pointer type
typedef boost::shared_ptr<const StringTerminal> cptr;
private:... | true |
620c46421a15c6f2da3501fa7193afd4d6cf74ca | C++ | CME211/notes | /lecture-12/src/extraction3.cpp | UTF-8 | 477 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <sstream>
int main(int argc, char *argv[]) {
// Setup a string stream to access the command line argument
std::string arg = argv[1];
std::stringstream ss;
ss << arg;
// Attempt to extract an integer from the string stream
unsigned n = 0;
if (ss >> n) { // Test for extract... | true |
3f8f05b6b806a0659c3234da67ef6b8898a10aad | C++ | Dmitry-1998/ROS | /src/laba_1/src/Laboratornaya_1.cpp | UTF-8 | 1,818 | 2.90625 | 3 | [] | no_license | #include "ros/ros.h"
#include <iostream>
#include "std_msgs/Int64.h"
#include "std_msgs/Int8.h"
using namespace std;
ros::Publisher g_value_pub;
std_msgs::Int64 factorial(std_msgs::Int8 input_number)
{
std_msgs::Int64 number_beetw_1;
std_msgs::Int64 number_beetw_2;
std_msgs::Int64 output_number;
numbe... | true |
fe43e9b3dfc071479771c35ba50272411fd9b953 | C++ | elesmera11/LED_Design | /2_Row_Multiplexing/swipe_control.cpp | UTF-8 | 2,491 | 3.109375 | 3 | [] | no_license | /*
swipe_control.cpp
Module for determining the swipe state of the device.
Depending on buffer data, will determine if device is waiting or
swiping left, right, up, or down.
Authors: Kate Chamberlin, Scott Davidsen, Fergus Duggan.
Date: 05 Sep 2018
*/
#include "swipe_control.h"
//Determines the state dep... | true |
7aa4337cbbbdc352622d7d763c742e54f4dcb2df | C++ | kevinqi34/HackerRank | /Algorithms/Warmup/Diagonal_Difference.cpp | UTF-8 | 662 | 3.046875 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
// Load Matrix
vector< vector<int> > a(n,vector<int>(n));
for(int a_i = 0;a_i < n;a_i++){
for(int a_j = 0;a_j < n;a_j++){
cin >> a[a_i][a... | true |
97ba39ec3caa3a538c6a50879cf89a2bbfc72f72 | C++ | doodoonovitch/GameTech | /CoreFx/Maths/DualQuaternion.cpp | UTF-8 | 2,365 | 2.734375 | 3 | [] | no_license | #include "stdafx.h"
#include "CoreFx.h"
namespace CoreFx
{
namespace Maths
{
// =======================================================================
// =======================================================================
DualQuaternion Conjugate(DualQuaternion const & a)
{
return DualQuaternion(glm::con... | true |
a4351af7330a3471cf3dbebd3765898250b42756 | C++ | sweetpand/LeetCode-1 | /solutions/cpp/0502.cpp | UTF-8 | 848 | 3.015625 | 3 | [] | no_license | struct Item {
int profit;
int capital;
};
class Solution {
public:
int findMaximizedCapital(int k, int W, vector<int>& Profits,
vector<int>& Capital) {
auto compareC = [](const Item& a, const Item& b) {
return a.capital > b.capital;
};
auto compareP = [](const Item& ... | true |
1bc4e2e50543a3245419431d7408fb55356bc3e0 | C++ | Shardic/ComputerGraphics2015 | /Cylinder.cpp | UTF-8 | 1,117 | 2.859375 | 3 | [] | no_license | #include <GL/gl.h>
#include "Cylinder.h"
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
Cylinder::Cylinder() {
}
Cylinder::~Cylinder(){
}
void Cylinder::drawCylinder() {
glTranslated(xPos,yPos,zPos);
double majorStep = height / numMajor;
double minorStep = 2.0 * M_PI / numMinor;
int... | true |
5538416bb64f606bd4bb82e904238c471b132000 | C++ | kriogenia/the-parting-of-sarah | /ThePartingOfSarah/Coin.h | UTF-8 | 426 | 2.53125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Item.h"
#include "Animation.h"
class Coin :
public Item
{
public:
Coin(float x, float y, Game* game);
/* Game cycle */
void draw(int scrollX = 0, int scrollY = 0, float rotation = 0.0) override;
/* Item */
Item* getCopy(float x, float y) override;
private:
/* Item */
void applyEffect(P... | true |
b40c6a407d16696490e5d51a6b824ef73d1439bb | C++ | TheIllusionistMirage/libKPEG | /include/Decoder.hpp | UTF-8 | 3,386 | 2.578125 | 3 | [] | no_license | /**
* @file Decoder.hpp
* @author Koushtav Chakrabarty (koushtav@fleptic.eu)
* @date 2000 B.C.
* @brief The implementation of a baseline, DCT JPEG decoder
*
* Decoder module is the implementation of a 8-bit Sequential
* Baseline DCT, grayscale/RGB encoder with no subsampling (4:4:4).
*/
#ifndef DECODER_HPP
#d... | true |
385aa741ac6ada550cf5010b81a22cc914f3a059 | C++ | jamesrcounts/CS537 | /HW3/src/dijkstra.cpp | UTF-8 | 687 | 3.046875 | 3 | [] | no_license | #include <utility> // for pair
#include <algorithm>
#include <iterator>
#include "Parser.h"
using namespace std;
int main( int argc, char const *argv[] )
{
int start = atoi( argv[1] );
int end = atoi( argv[2] );
string filename( argv[3] );
Parser p( filename );
Graph g = p.CreateGra... | true |
7371788ecb8ba7d2fa47deccec6b44ac5db79cc7 | C++ | ryogo108/PKU | /3669.cpp | UTF-8 | 1,206 | 2.96875 | 3 | [] | no_license | //蟻本初級練習問題No.6
// 14/7/13 accepted
#include<iostream>
#include<queue>
#include<cstdio>
#define INF 10000000
#define N 320 ////map_data配列は大きめに!! これにn時間も取られるなんてもったいない!!
using namespace std;
int data[N][N];
int ans_d[ N][ N];
typedef pair<int,int> P;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int bfs(){
an... | true |
e6f6589a32b503aefa6d4f106604090ff418aa3f | C++ | jenninglim/graphics-engine | /raytracer/Source/Scene/TestModelH.cpp | UTF-8 | 4,079 | 2.984375 | 3 | [] | no_license | #include "TestModelH.h"
#include "Object.h"
#include "Box.h"
#include "Sphere.h"
void push_box(vector<Object *> &objects,
vector<Triangle> &object_tri,
const float reflectance)
{
Object * object = new Box(object_tri, reflectance);
objects.push_back(object);
object_tri.clear();
}
void push_... | true |
470adb59ac21d4595730d2da2115930648624838 | C++ | isaurabhkr/Cpp-Practice | /palindrome.cpp | UTF-8 | 438 | 3.53125 | 4 | [] | no_license | #include <locale>
#include<iostream>
class Palindrome
{
public:
static bool isPalindrome(const std::string& word)
{
std::locale loc;
for (int i = 0; i < word.size(); i++)
if (std::tolower(word[i], loc) != std::tolower(word[word.size() - i - 1], loc))
return ... | true |
fabf3362b2acfa553d633f7fa18c4f6610b9f8c8 | C++ | sayedfraz/lab1part2.2 | /main/main.cpp | UTF-8 | 536 | 3.734375 | 4 | [] | no_license | #include <iostream>
using namespace std;
// Base class
class Shape
{
public:
// pure virtual function providing interface framework.
virtual int getArea() = 0;
void setPi(int p)
{
pi = p;
}
void setRaduis(int r)
{
radius = r;
}
protected:
int pi;
int radius;
};
class Circle: public Shape
{
public:
int getA... | true |
0cfd8d7a624801c249cc6888618eddd141374303 | C++ | rajnishgeek/DSandAlgorithmPracticeSolution | /Dynamic Programming/FlipArray.cpp | UTF-8 | 400 | 2.515625 | 3 | [] | no_license | int minFlip(vector<int> &A)
{
int sum = 0;
for (int i = 0; i < A.size(); i++)
sum += A[i];
sum /= 2;
vector<int> dp(sum + 1, INT_MAX);
dp[0] = 0;
for (int i = 0; i < A.size(); i++)
{
for (int j = sum; j >= A[i]; j--)
{
if (dp[j - A[i]] != INT_MAX)
dp[j] = min(dp[j], dp[j - A[i]] + 1);
}
}
for ... | true |
4d6a99d0dd6d782d58dc27694d944b205cc2e174 | C++ | yangzhaofeng/qp-H2S | /qpcall.h | UTF-8 | 2,986 | 2.578125 | 3 | [
"MIT"
] | permissive | #include<cmath>
#include"transfer.h"
const double _pi = 3.1415926535897932384626;
const double m_H = 1.0078250319; //amu, Pure and Applied Chemistry. 75 (6): 683–800
const double m_S = 31.97207073; //amu, Pure and Applied Chemistry. 75 (6): 683–800
const double De = 38667.2857; //cm^-1
const double alpha = 1.6627E10;... | true |
1302386a44c744b547c21c754e7de198d24503a3 | C++ | Mrhuangyi/leetcode-Solutions | /Cpp/Medium/208. 实现 Trie (前缀树).cpp | UTF-8 | 1,989 | 4.15625 | 4 | [] | no_license | /*
实现一个 Trie (前缀树),包含 insert, search, 和 startsWith 这三个操作。
示例:
Trie trie = new Trie();
trie.insert("apple");
trie.search("apple"); // 返回 true
trie.search("app"); // 返回 false
trie.startsWith("app"); // 返回 true
trie.insert("app");
trie.search("app"); // 返回 true
说明:
你可以假设所有的输入都是由小写字母 a-z 构成的。
保证所有输入均为非空字符串... | true |
3e3af41884ae510e6a3b4d4da6820661a630b1fd | C++ | tyagiakash926/Level-up-Dec | /GFG_contest/Array/l001.cpp | UTF-8 | 620 | 2.765625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
// Q - 2
//https://practice.geeksforgeeks.org/problems/find-immediate-smaller-than-x/1/?track=sp-arrays-and-searching&batchId=152#
int immediateSmaller(int arr[], int n, int x)
{
// your code here
int smaller = 0;
int imm=(int)1e9;
for(int i=0;i<n;i++){
... | true |
a75816b701f41bb716137f949274d4adf1b75fd9 | C++ | moshe31sh/Course_Bid_C-_Project | /CourseBid/bid10192015 FINAL MERGE/Shenkar_CourseBidSystem/CourseBid_Common/Formula.cpp | UTF-8 | 2,670 | 3.0625 | 3 | [] | no_license | /* ---------------------------------------------------------------------------
** This software is Shenkar College for Engineering and Design final submission
** for course "Tools of Software Engineering".
** Authors: <Ohad Sasson, Moshe Shimon, Yaron Israeli, Maor Toubian, Yossi Gleyzer>
**
** Formula.cpp
** For... | true |
2319446ed143667546ffd13d422e30160923764f | C++ | KazeLv/PAT-advanced-level | /1003Emergency.cpp | UTF-8 | 2,442 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Way {
int m_nLength;
int m_nRescues;
};
const int inf = 999999999;
int main() {
int nCities, nRoads;
int nStart, nEnd;
cin >> nCities >> nRoads >> nStart >> nEnd; //read the first line for information
int **ppnMap = ne... | true |
27b55e797f3becb5723a58f2a244913bc34a5c4d | C++ | paule32/radiovp | /ttimer.h | UTF-8 | 810 | 2.953125 | 3 | [] | no_license | #ifndef TTIMER_H
#define TTIMER_H
#include "SDL.h"
#include "SDL_timer.h"
class TTimer
{
public:
TTimer(int p_interval = 1000)
{
interval = p_interval;
accumulator = 0;
total = 0;
cur_time = last_time = SDL_GetTicks();
}
int ready()
{
return accumulator > in... | true |
bd3c5ec08e92dc7119740f9e10628231de068cf0 | C++ | weijingtao/snow | /test1.cpp | UTF-8 | 1,357 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by weitao on 3/5/16.
//
#include <cstdint>
#include <iostream>
#include <chrono>
#include <tuple>
#include <vector>
#include <boost/optional.hpp>
#include <string>
#include "snow.hpp"
class echo_session : public snow::session<uint32_t, uint32_t> {
public:
explicit echo_session(boost::asio::io_servic... | true |
c1bf2f55241ea53d0ad3bc60df37c502fb4d743c | C++ | GlebKirsan/coursera | /c++/3_red_belt/4_week/sportsmen/sportsmen.cpp | UTF-8 | 818 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <list>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
const int MAX_SP_MAN = 100'000;
list<int> sportsmen;
vector<list<int>::iterator> pos_in_list(MAX_SP_MAN, end(sportsmen));
int n, number, prev_sportsmen;
ci... | true |
10fef939853c0cb14e1fcedb52c4dc018cd84362 | C++ | StanfordAHA/Halide-to-Hardware | /test/correctness/memoize.cpp | UTF-8 | 18,400 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "Halide.h"
#include "HalideRuntime.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
using namespace Halide;
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
// External functions to track whether the cache is working.
int call_count = 0;
extern "C" DLLEXPOR... | true |
6b2b1f2089a25cbf150191503ddab51427aac04d | C++ | longkid/master-degree-thesis | /InternshipSRC/Nov.Tasks/Methods.cpp | UTF-8 | 2,232 | 3.109375 | 3 | [] | no_license | #include "Methods.hpp"
#define METHOD_COB 1
#define METHOD_COP 2
#define METHOD_FOB 3
/*
This method compute the value for each frame
*/
float
Methods::compute(const Mat &image, const AABBoxCollection &bboxes, int method)
{
float ret = 0;
int nbIntersectedBBox = 0; // used in method 1
int nbCountedPixel = 0; ... | true |
0f043c7a806c2990d561ef9bc3704c3f94d71d83 | C++ | Maksim-Bozhko/TicTacToe_minimax | /noughtsAndCrosses/negamax/bitBoard.h | UTF-8 | 2,208 | 3.234375 | 3 | [] | no_license | #pragma once
namespace ticTacToe
{
// supposed to store bitboard of size up to 16
class BitBoard
{
using storageType = uint16_t;
public:
BitBoard() noexcept = default;
BitBoard(storageType bits) noexcept;
BitBoard& operator=(storageType bits) noexcept;
bool test(int pos) const noexcept;
int count()... | true |
3acd626592547365a83274de2c7c6154a42999ff | C++ | wh01683/syssoft | /WorkingSet.cpp | UTF-8 | 4,438 | 3.609375 | 4 | [] | no_license | #include "WSPage.cpp"
/**
@author: Robert Howerton
@description: This program is designed to demonstrate the working set page replacement algorithm.
@function: The working set algorithm employs a timer, a "working set" (hence the name), and a moving time window of fixed size T
the time window moves across the working ... | true |
15847f48131f7b0b934eb69d90cae9e28fef0dea | C++ | yanleirex/cpp_concurrency | /1_thread_object/thread_object_main1.cpp | UTF-8 | 510 | 2.921875 | 3 | [] | no_license | //
// Created by yanlei on 16-9-20.
//
#include <boost/thread.hpp>
#include <unistd.h>
#include <sys/syscall.h>
#include <iostream>
using namespace std;
void show()
{
cout<<" Hello world "<<syscall(SYS_gettid)<<" "<<endl;;
}
int main()
{
boost::thread t(show);
cout<<"main pid "<<syscall(SYS_gettid)<<" "<... | true |
1211eb27c3e3a69ede5dfbbca6aa13aa548c76ba | C++ | yallawalla/H743 | /Cpp/Src/rtc.cpp | UTF-8 | 2,593 | 2.53125 | 3 | [] | no_license | /**
******************************************************************************
* @file spray.cpp
* @author Fotona d.d.
* @version
* @date
* @brief Timers initialization & ISR
*
*/
/** @addtogroup
* @{
*/
#include "rtc.h"
#include "misc.h"
#include "proc.h"
#include <string>
using namespace std;
/*****... | true |
73eaf588dddfa136bdd324e3a94eae61d5eb7c48 | C++ | taktaivan/ALL_THIS... | /funofstack.cpp | UTF-8 | 667 | 3.546875 | 4 | [] | no_license | #include "ClassStack.h"
#include <iostream>
using namespace std;
void Stack::push(int new_data) {
node_s* node = new node_s;
node->data = new_data;
node->prev = top;
top = node;
size++;
}
int Stack::pop() {
if (size == 0) {
cout << "The stack is empty" << endl;
return -1;
}
else {
in... | true |
3bb3486ecd4f77b071764da456db3b1d530f87be | C++ | bennbollay/Transport | /transport/Includes/CCVector.h | UTF-8 | 1,092 | 2.890625 | 3 | [] | no_license | #ifndef INCL_CCVECTOR
#define INCL_CCVECTOR
// This is an array of 32-bit integers
class CCVector : public ICCList
{
public:
CCVector (void);
CCVector (CCodeChain *pCC);
virtual ~CCVector (void);
int *GetArray (void);
BOOL SetElement (int iIndex, int iElement);
ICCItem *SetSize (CCodeChain *pCC, int iN... | true |
2e81b547f92a44dd8e823222865e3d66de3a4718 | C++ | sbremner/BigNSL | /IPCidr.h | UTF-8 | 1,473 | 2.984375 | 3 | [] | no_license | /*
Author: Steven Bremner
Date: June 3, 2014
Description:
Library for parsing IP addr from CIDR to IP + mask
*/
#ifndef IPCIDR_H
#define IPCIDR_H
#include "includes.h"
typedef struct _IPCidr{
unsigned int IPaddr;
unsigned int range;
_IPCidr() : IPaddr(0), range(0) { }
inline bool In... | true |
ea606c9df170b674257e57ff2a74bea05f8f09f2 | C++ | abutlerboudakian/future_wallet | /Application/Application/Requests.cpp | UTF-8 | 18,834 | 2.765625 | 3 | [] | no_license | #include "Requests.h"
Requests::Requests(QObject * parent, bool debug) : QObject(parent)
{
this->debug = debug;
if (debug)
{
Location = "http://127.0.0.1:5000";
}
}
// -----------------------------------------------------
// Inputs |
// ------------... | true |
52a05b1feaaa8940c80dde92902fc9166f6a4756 | C++ | mashavorob/lfds | /include/xtomic/aux/cppbasics.hpp | UTF-8 | 3,098 | 2.84375 | 3 | [
"ISC"
] | permissive | /*
* cppbasics.hpp
*
* Created on: Mar 31, 2015
* Author: masha
*/
///
/// @file cppbasics.hpp
///
/// @brief Basic C++ macros for compatibility with C++98.
///
/// The file implements helper macro definitions including ones to mimic such great thing from
/// C++11 like variadic template arguments in C++98.... | true |
ac3d9a365996a80a5759c50fa002b3f716496850 | C++ | Jmiller7023/Xenro-Engine | /Demo/Actor.h | UTF-8 | 1,689 | 2.609375 | 3 | [
"MIT"
] | permissive | #ifndef ACTOR_DEFINED
#define ACTOR_DEFINED
#include <vector>
#include <glm\glm.hpp>
#include <XenroEngine\SpriteBatch.h>
#include <string>
#include <XenroEngine\SpriteSheet.h>
#include <XenroEngine\GLTexture.h>
#include <XenroEngine\Globals.h>
#include <XenroEngine\Vertex.h>
#include <Box2D/Box2D.h>
enum class MoveD... | true |
1c28b6a06e4f0f6c9674d66124a8a28931b24d3b | C++ | lfdversluis/opendc-simulator | /Simulator/include/simulation/schedulers/Scheduler.h | UTF-8 | 404 | 2.671875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "modeling/machine/Machine.h"
#include <vector>
namespace Simulation
{
/*
Provides a strategy for load balancing.
*/
class Scheduler
{
public:
virtual ~Scheduler()
{
}
/*
Divides the workloads over the given machines.
*/
virtual void schedule(std::vector<std::reference_... | true |
2de91d2e6a7b3dc15e7c753a13b44b99f2bae00f | C++ | mmshaifur/Seeed_Learning_Space | /Seeed_Creator_Kit/3.Vibration Motor/1_vibration_motor/1_vibration_motor.ino | UTF-8 | 333 | 2.859375 | 3 | [
"MIT"
] | permissive |
int MoPin = 2; // vibrator Grove connected to digital pin 2
void setup() {
pinMode( MoPin, OUTPUT );
}
void loop() {
digitalWrite(MoPin, HIGH); //Turn on the vibration motor
delay(1000); //Delay for 1 second
digitalWrite(MoPin, LOW); //Turn off the vibration motor
delay(1000); //Delay fo... | true |
3d64727d90c1562b9b88c1932a3166776d580a97 | C++ | scripter01/common | /Common/Common/utils.cpp | UTF-8 | 724 | 2.8125 | 3 | [] | no_license | #include "stdafx.h"
#include "utils.h"
int hexToInt(uint8_t* p)
{
if (p[0] >= '0' && p[0] <= '9')
return int(p[0] - '0');
if (p[0] >= 'a' && p[0] <= 'f')
return int(p[0] - 'a') + 10;
if (p[0] >= 'A' && p[0] <= 'F')
return int(p[0] - 'A') + 10;
return 0;
}
vector4 strToVec4(const std::string& color)
{
asser... | true |
9bf13a3ea40f9781d1508778c8f59c4366edee80 | C++ | NickChapman/RuM | /Type.h | UTF-8 | 2,402 | 3.4375 | 3 | [] | no_license | //
// Created by Nick Chapman on 11/20/16.
//
#ifndef RUM_TYPE_H
#define RUM_TYPE_H
#include <string>
template<class T>
class Type {
std::string identifier;
std::string type;
T value;
public:
Type() {
identifier = "";
type = "";
};
Type(std::string type, T value) {
th... | true |
f877c97984a9c0736fb6e67f80ee18bdca39339e | C++ | balannarcis96/skylake-tools | /Crypt/Byte_Block.hpp | UTF-8 | 13,433 | 3.0625 | 3 | [
"MIT"
] | permissive | /*
* Copyright (C) 2014 Jens Thoms Toerring
*
* This file is part of AES256.
*
* AES256 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any l... | true |
e45de29b6d48894862cc6b360c580968f2d129b7 | C++ | alexandrepoulin/freezeout | /src/mainPaper.cpp | UTF-8 | 1,315 | 2.734375 | 3 | [] | no_license | #include "../include/NumericalCalculator.h"
#include <string>
#include <stdlib.h>
int main(int argc, char* argv[]){
//files for input and output
string in;
string out;
/*
* argv[1] = hardcoded smallest x
* argv[2] = file id
* argv[3] = single case
* argv[4] = ndm
* argv[n] ... | true |
05e5e2a4db758497dde9b4c2550e75f9a3eb1533 | C++ | qingshanLiu1998413/qingshanliu | /选择排序.cpp | GB18030 | 678 | 3.015625 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
struct node {
char name[20]; // ѧ
int score; // ѧɼ
} a[20];
int main() {
int n;
cin >> n;
for (int i=1; i<=n; i++) { // ѧͳɼ
cin>>a[i].name>>a[i].score;
}
for (int i=1; i<n; i++) { // ѡ
for (int j=i+1; j<=n; j++)... | true |
eff10b99ff1437360d5c465f3eda90ceb2d49931 | C++ | lonelam/LearnC | /shu1898/shu1898.cpp | UTF-8 | 1,717 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include<cstring>
class unit
{
public:
char u[4] = { 0 };
char source[3] = { 0 };
unit();
unit(char * p);
~unit() {}
void manip(char * p);
void manip();
void out(char * p);
};
unit::unit()
{
}
unit::unit(char *p)
{
for (int i = 0; i < 4; i++)
{
if (p[i] >= 'A'&&p[i] ... | true |
ba600d3a04ddddc88435c49246f53f258d0fcd1e | C++ | minus9d/programming_contest_archive | /arc/074/d/d.cpp | UTF-8 | 2,051 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <sstream>
#include <string>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
using namespace std;
typed... | true |
9cda9cdaa12f1c1bcfbaa103024bf923cbfe38c0 | C++ | alexandraback/datacollection | /solutions_5630113748090880_0/C++/prob22/main.cpp | UTF-8 | 1,000 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
int main() {
ifstream fin("B-small.in");
ofstream fout("B-small.txt");
int T;
fin >> T;
for(int i = 1; i<= T; i++) {
int N;
fin >> N;
int he... | true |
64cd60e3efacc5c44ce21d47d5c997cddad94e13 | C++ | PorterDalton1/SortingAlgorithms | /Selection.cpp | UTF-8 | 823 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int lyst[100000];
ifstream myFile;
string data;
int counter = 0;
int lowest[2];
int tmp;
myFile.open("input2.txt");
while (myFile >> data)
{
lyst[counter] = stoi(data);
c... | true |
ecc8959f4ce044df537896ca7289aaca2504e4fa | C++ | kbuzsaki/cse124-httpserver | /server.h | UTF-8 | 2,511 | 2.96875 | 3 | [] | no_license | #ifndef SERVER_H
#define SERVER_H
#include <memory>
#include "http.h"
#include "listener.h"
/*
* HttpConnection wraps a bytestream Connection object and provides higher level
* operations for processing http requests and responess.
* The `read_request` method reads and parses an HttpRequest from the connection.
... | true |
b08423fc437685f8469b3d69e3af602a8037c6ea | C++ | youoj/Algorithm | /Baekjoon/[10998]A×B.cpp | UTF-8 | 202 | 3.0625 | 3 | [] | no_license | /* 10998번 AxB(Input/Output)
* https://www.acmicpc.net/problem/10998
*/
#include <iostream>
using namespace std;
int main() {
int a = 0, b = 0;
std::cin >> a >> b;
std::cout << a*b;
return 0;
} | true |
27faa972ab2ca57cf606ad44191cecff6b5f3c08 | C++ | JifeiTune/ACM | /动态规划/棋盘dp 矩阵“前缀和”.cpp | GB18030 | 2,067 | 2.78125 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<memory.h>
#include<algorithm>
#include<cmath>
/*
whkӣң֪
̵иȣʹÿ鶼ǡһӣ
ɿ⣬dp[h1][h2][w1][w2]
ʾ߽߱Ϊh1h2߽Ϊw1w2ʱиȣұգ
ôͳӾӣҸ
ԤÿһϽǹ̶ΪԭϽǣ½ľӣҸ
ӾӣҸݳ㼴
*/
using namespace std;
bool che[21][21];//ijǷӣ
int Num[21][21];//(1,1)λϽǣ(i,j)Ϊ½ǵľӣҸ
int dp[21][21][21][21];
int w,h,k;
#define Sum(... | true |
d4e54df058f015ea695da05fc53b44a2e9329d06 | C++ | cjsatuforc/FrSky_SPORT_Arduino | /FrSkySportSensorFlvss.cpp | UTF-8 | 2,437 | 2.578125 | 3 | [] | no_license | /*
FrSky FLVSS LiPo voltage sensor class for Teensy 3.x and 328P based boards
(e.g. Pro Mini, Nano, Uno)
(c) Pawelsky 20150725
Not for commercial use
*/
#include "FrSkySportSensorFlvss.h"
FrSkySportSensorFlvss::FrSkySportSensorFlvss(SensorId id)
: FrSkySportSensor(id) {}
uint32_t FrSkySportSe... | true |
0f5345644f231ac537d0f4af16297a025b8da162 | C++ | ctyVegetableDog/leetcode | /helloLeet/0904.cpp | UTF-8 | 1,034 | 3.046875 | 3 | [] | no_license | // 水果成篮
/*
*刺鼻题让老子调了半小时,真是老了
* */
class Solution {
public:
int totalFruit(vector<int>& fruits) {
int n = fruits.size();
vector<int> last(n + 1); // 每种水果上一次出现的位置
int b1 = fruits[0], b2 =-1; // 记录当前的两种水果
int cur = 0, ans = 0, i = 0;
while (i < n && fruits[i] == b1) {
... | true |
e9c4cd4c8f45dd463cd18c5cd6beda1fc5e4f427 | C++ | zsh965866221/DataStructure-C | /calculateExpression.cpp | UTF-8 | 2,099 | 3.328125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include "Stack.h"
bool isDigit(char c)
{
if('9'-c>=0&&c-'0'>=0)
return true;
else
return false;
}
int charToDigit(char c)
{
return c-'0';
}
int operatorLevel(char c)
{
switch(c)
{
case '+': return 1;
case '-': return 1;
... | true |
e717ee5c77a2438b6adf37b508aa3c463738a5f4 | C++ | mrsempress/PAT | /1062.cpp | UTF-8 | 1,296 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
const int maxn=1e5+10;
int n,l,h,m;
struct ty{
string ID;
int vg;
int tg;
int kind;// 1:sages 2:nobleman 3:fool men 5:small man
bool operator<(const ty& o)const{
if(kind!=o.ki... | true |
d56f00c62884988c78130764daab549a7bad48e0 | C++ | JuliaHolk/Zaphod | /testintersection.cpp | UTF-8 | 464 | 2.875 | 3 | [] | no_license | //
// Created by julia on 06.07.18.
//
#include <cstdio>
#include <cmath>
#include "Vec.h"
#include "Colour.h"
#include "Sphere.h"
#include "Ray.h"
#include <iostream>
/*int main(){
Vec3D st(0.0,0.0,0.0);
Vec3D dir(0,1.0,0.0);
Ray ray(st, dir);
Vec3D cent(0,42.0,0);
Colour green(0.0,0.0,0.5);
do... | true |
d2a7d481a1ed633a658421d57dc802b47786e855 | C++ | samiqss/Software-Engineering | /csci265/lab07a/broken.cpp | UTF-8 | 4,845 | 3.609375 | 4 | [] | no_license | #include <cstdio>
#include <cmath>
#include <cstdlib>
// possible tower id values, for the source,
// destination, and auxilliary towers
enum ID { SRC, DEST, AUX };
// default size of the tower (number of disks)
const int DefaultSize = 3;
// value used to specify an empty tower
const int EMPTY = -1;
// each towe... | true |
39a7061b1f75ea7688f540ce50d7b7eb3e134923 | C++ | Tishkata/EGT | /Shop for T-shirts/Tshirt.cpp | UTF-8 | 2,101 | 3.640625 | 4 | [] | no_license | #include "Tshirt.h"
Tshirt::Tshirt()
{
this->brand = NULL;
this->price = 0;
this->sizeOfTshirt = 0;
this->sex = 0;
}
Tshirt::Tshirt(const char* brand, double price, int sizeOfTshirt, bool sex)
{
this->brand = new char[strlen(brand) + 1];
strcpy(this->brand, brand);
this->price = price;
... | true |
3df3c66a89897559826fd0e6369098868c55b61d | C++ | KongkaMozumderSUST/library | /String/Z-Function/sub_string_search.cpp | UTF-8 | 644 | 2.703125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
vector<int> z_function(string s)
{
int n = (int) s.length();
vector<int> z(n);
for(int i = 1, l = 0, r = 0; i < n; ++i) {
if (i <= r)
z[i] = min (r - i + 1, z[i - l]);
while (i + z[i] < n && s[z[i]] == s[i + z[i]])
++z[i];... | true |
c301fbafb9aa72557b1337bb50925abad25d57da | C++ | prabhhav/InterviewBit | /addonetonumber.cpp | UTF-8 | 614 | 3.265625 | 3 | [] | no_license | vector<int> Solution::plusOne(vector<int> &a) {
vector<int> result;
int n = a.size();
vector<int> temp;
int carry = 1;
for(int i = n-1; i>=0; i--){
int curr = carry + a[i];
carry = curr/10;
temp.push_back(curr % 10);
}
if (carry>0){
... | true |
b7b26d62036a8fb636cb2bc85d4ae37545c6c976 | C++ | rainbowhxch/daily-data-structure | /LinkedList/LinkedList.cpp | UTF-8 | 2,096 | 3.59375 | 4 | [] | no_license | #include "LinkedList.h"
#include <iostream>
using namespace std;
LinkedList::LinkedList()
{
head = new Node;
head->next = NULL;
length = 0;
}
int LinkedList::getLength()
{
return length;
}
int LinkedList::getElem(int pos)
{
listNode p = head->next;
int count = 1;
while... | true |
b5e02c1895512b10489ebe91c55cd6fb3c7dcfe9 | C++ | Seltzer/building-sketch | /Prototype/BuildingGeneration.cpp | UTF-8 | 9,986 | 2.640625 | 3 | [] | no_license | #include <algorithm>
#include "BuildingGeneration.h"
#include "Clip.h"
using namespace std;
void ExtrudeSketch(Building& building, vector<int2>& outline, vector<Stroke>& processedFeatureOutlines)
{
std::vector<float3> featurePolyFront;
std::vector<float3> featurePolyBack;
std::vector<float3> featurePolySide;
std... | true |