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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
118f8e4c181938b2742df38e78560d8a2e351429 | C++ | rogalski/adventofcode-2017 | /day06/day06.cpp | UTF-8 | 2,894 | 3.40625 | 3 | [] | no_license | #include <set>
#include <vector>
#include <iostream>
#include <algorithm>
int findBanksWithMostBlocks(const std::vector<unsigned int> &banks)
{
return std::distance(banks.begin(), std::max_element(banks.begin(), banks.end()));
}
unsigned int countRedistributionCycles(std::vector<unsigned int> banks)
{
// TODO: us... | true |
68091782d6e55489fe37b6b03254e786ab7f4801 | C++ | KarlaSalamun/ECF | /ECF/cartesian/Xor.h | UTF-8 | 1,229 | 3.140625 | 3 | [
"MIT"
] | permissive | #ifndef Xor_h
#define Xor_h
#include "Function.h"
namespace cart
{
template <class T>
class Xor : public Function
{
public:
Xor();
Xor(uint numArgs);
~Xor();
void evaluate(voidP inputs, void* result);
};
typedef Xor<uint> XorUint;
template <class T>
Xor<T>::Xor()
{
name_ = "XOR";
numOfArgs_ = 2... | true |
6e56a73738fe20770acb4083aeb96d05439f7077 | C++ | sidharth2189/CPP | /Concurrency/Multiple_Threads/Lambda_prevents_thread_interleaving.cpp | UTF-8 | 1,103 | 4.125 | 4 | [] | no_license | /*
Let's adjust the program code from Fork_Join_Parallelism.cpp and use a Lambda
instead of the function printHello(). Also, let's pass the loop counter i
into the Lambda to enforce an individual wait time for each thread. The idea
is to prevent the interleaving of text on the command line which we s... | true |
54c638f74e7f22a968232662d97e14487bfc5fc7 | C++ | fastlinemedia/arduino-utilities | /RgbLed.h | UTF-8 | 501 | 2.609375 | 3 | [] | no_license | #ifndef RgbLed_h
#define RgbLed_h
#include <Arduino.h>
class RgbLed {
public:
RgbLed(int redPin, int greenPin, int bluePin);
void begin();
void on();
void off();
void write(int red, int green, int blue);
void writeSpectrum(int from, int to);
private:
int... | true |
d64a53241a4830ad69af86155289c02803fe911d | C++ | HamedMasafi/QHtmlParser | /src/string_helper.cpp | UTF-8 | 1,765 | 3.3125 | 3 | [] | no_license | #include "string_helper.h"
#include <sstream>
#include <iostream>
#include <algorithm>
#include <wctype.h>
string_helper::string_helper()
{
}
void string_helper::ltrim(std::wstring &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
return !std::isspace(ch);
}));
}
void string_he... | true |
e8bf14b113840d69d3f0e408fe8005b39d34c247 | C++ | ctorralba/C-Programming | /lab15/lab15.cpp | UTF-8 | 1,775 | 3.578125 | 4 | [] | no_license | /* Programmer: Christopher Torralba Date: 12/9/15
Section: F
Purpose: Create a Hang Man game.
*/
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string.h>
using namespace std;
bool inWord (const char chosenWord[], const char guess);
int main ()
{
const short COLORNUM = 10;
const short COL... | true |
e1d0d58677e7d303b6ae9769477b5a225d77a65f | C++ | max-crow/config | /xml_dom_safe_element_reference.h | UTF-8 | 2,341 | 2.65625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <list>
#include "config.h"
#include "xml_dom_reader.h"
XERCES_CPP_NAMESPACE_USE
namespace config {
struct element_description {
std::wstring name;
int number;
};
class xd_safe_element_reference
:public safe_element_reference
{
typedef std::list<element_description> xd_path... | true |
22757d38461a0f3f787f52775f977adcd078b6f8 | C++ | Coomman/ITMO-HW | /ADS/Lab 2.4/Path.cpp | UTF-8 | 1,629 | 3.09375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
struct Edge {
int from, to;
long long w;
Edge(int a, int b, long long c) {
from = a;
to = b;
w = c;
}
};
struct Vertex {
bool checked = false;
long double dist = (long doub... | true |
8c70f6b03ee557d1230e5352f70eeb0734342a58 | C++ | robotil/robil | /C31_PathPlanner/src/MapFileReader.hpp | UTF-8 | 2,473 | 2.8125 | 3 | [] | no_license | /*
* MapFileReader.hpp
*
* Created on: Mar 3, 2013
* Author: dan
*/
#ifndef MAPFILEREADER_HPP_
#define MAPFILEREADER_HPP_
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
namespace map_file_reader{
using namespace std;
struct CanNotOpenFile{};
struct CanNotFind... | true |
426f8fc731b5465d449edb38fded2cb8c40a859b | C++ | rhythm-3099/Basic-Algorithms | /StackQueue/maximum_area_histogram.cpp | UTF-8 | 2,244 | 2.546875 | 3 | [] | no_license | // WOOF!!
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define str string
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FILL(a,b) memset((a),(b),sizeof((a)))
#define precision(x,d... | true |
403ed6edf288c01316e16ecd3bcb4275b5ec6c66 | C++ | AlcoDreamer/myOpenGlProject | /Headers/Keyboard.h | UTF-8 | 1,333 | 2.59375 | 3 | [] | no_license | //
// Keyboard.h
// MyProject
//
// Created by dchernyshev on 07.11.17.
// Copyright © 2017 dchernyshev. All rights reserved.
//
#ifndef Keyboard_h
#define Keyboard_h
#include <Glut/glut.h>
#include <map>
void keyDown(unsigned char key, int x, int y);
void keyUp(unsigned char key, int x, int y);
void specialKe... | true |
31b9d957d2e5a5a7e63127e5f975e10bf06472cc | C++ | VanshRuhela/DSA-Practice | /Adv Trees/AVL Trees/insertion.cpp | UTF-8 | 750 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
int s, r , c;
cin>>s>>r>>c;
vector< vector<int>> m;
int k = s;
for(int i=0; i<r; i++){
vector<int> col (c);
for(int j =0; j<c; j++){
col[j] = k;
k++;
}
m.push_back(col);
}
// tra... | true |
157f2dc7fb1c705d42afed49b2c3ae2667161173 | C++ | AKavrani7/CP-for-Fun | /InterviewBit/Math/Rearrange Array.cpp | UTF-8 | 574 | 2.875 | 3 | [] | no_license | void Solution::arrange(vector<int> &arr) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details
... | true |
53f2732103ff952530bde2ce7b03a031302ecd98 | C++ | muhamdasim/CPP | /Basic C++ Concepts/paper/3.cpp | UTF-8 | 345 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
void arraya(int *ptr,int n)
{
for (int i=0 ; i<n ; i++)
{
cout<<*(ptr+i);
}
}
int main()
{
int size=100;
int n;
cout <<"Enter size of array"<<endl;
cin>>n;
int array[size];
int *pt
ptr=array;
for (int i=0 ; i<n ; i++)
{
cin>>array[i];
}
arraya(ptr , n... | true |
c759ac7d9cfe7cffb1df44edb1b777072299cb7f | C++ | MatTerra/simuladorCamadaFisica | /src/BinaryUtils.cpp | UTF-8 | 442 | 3 | 3 | [] | no_license | //
// Created by mateusberardo on 31/03/2021.
//
#include "BinaryUtils.h"
bitStream toBinary(std::string input) {
bitStream output;
for (char &_char : input)
output.insert(output.end(), std::bitset<8>(_char));
return output;
}
std::string fromBinary(bitStream bits) {
std::string output;
... | true |
b1040ec0e35ae076fca4c9afb80c20f16cefcd0b | C++ | zeos/signalflow | /source/src/node/operators/sum.cpp | UTF-8 | 1,782 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "signalflow/core/core.h"
#include "signalflow/node/operators/sum.h"
#include "signalflow/node/oscillators/constant.h"
namespace signalflow
{
Sum::Sum()
{
this->name = "sum";
this->has_variable_inputs = true;
}
Sum::Sum(std::initializer_list<NodeRef> inputs)
: Sum()
{
for (NodeRef input : inp... | true |
814b9f2d20b31b7ebdf211a8c7142f035c7f4601 | C++ | kakashibo/SPOJ-CODECHEF | /Elections/main.cpp | UTF-8 | 898 | 2.59375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int ar[1000];
long long int total[1000]={0};
int main()
{
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
//total[i]=0;
for(int j=0;j<n;j++){
cin>>ar[j];
//total[j]+=ar[i][j];
// cout<<to... | true |
6386e812bec9ff23205731427d5f718bfba9ae77 | C++ | LYoGA/ACM | /Graph theory/CC/POJ3694.cpp | UTF-8 | 2,392 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
const int MAXN = 100005;
struct Edge{
int to, next;
}edge[MAXN * 5];
int head[MAXN], tot;
int Low[MAXN], DFN[MAXN];
int Index, top;
int bridge;
int n, m;
int f[MAXN], ancestor[M... | true |
00ef07997c1830a41d34a847b5299e26e19aadf0 | C++ | CollegeComputing/USTC-Compilers-Principles | /labs/HW6/repo/src/SyntaxTreePrinter.cpp | UTF-8 | 3,470 | 3.296875 | 3 | [
"MIT"
] | permissive | #include "SyntaxTreePrinter.h"
#include <map>
#include <string>
#include <iostream>
using namespace SyntaxTree;
std::map<Type, std::string> type2str = {
{Type::INT, "int"},
{Type::FLOAT, "float"},
{Type::VOID, "void"}
};
std::map<BinOp, std::string> binop2str = {
{BinOp::PLUS, "+"},
{BinOp::MINUS... | true |
15685ec6dda8416b8f1fcc75cc690f925c539eeb | C++ | wallacewolv/ClickHeart | /cadastroMedico.h | ISO-8859-1 | 12,364 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <fstream>
#include <locale.h>
#include <vector>
#include <time.h>
using namespace std;
// Contador pra Id de Mdicos
int idMedico()
{
static int idM = 1;
return idM++;
}
int cadastroMedico()
{
system("clear");
int opco... | true |
2ccd5ce0c5126440f5b50a497d195ee5240af8eb | C++ | PLurka/ProceduresVsObjects | /ObjectOriented/triangle.cpp | UTF-8 | 339 | 2.921875 | 3 | [] | no_license | #include "triangle.h"
using namespace TriangleN;
Triangle::Triangle(int base, int legA, int legB, int height)
: base(base), legA(legA), legB(legB), height(height){}
Triangle::~Triangle() = default;
double Triangle::circumference() {
return base + legA + legB;
}
double Triangle::area() {
return (bas... | true |
8f4c2e8581410401456a9c2e18cf2b2e74af7138 | C++ | anikait1/InterviewPrep | /LeetCode/Trees/postorderSachin.cpp | UTF-8 | 857 | 3 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
vector<int> postord... | true |
37aaaef85646ce766d5b3679084d1c64e891428d | C++ | martong/nng_competition_2015 | /dns/rltest.cpp | UTF-8 | 1,658 | 3.34375 | 3 | [] | no_license | #include "rl.hpp"
#include <iostream>
#include <algorithm>
#include <stdexcept>
std::string string_to_hex(const std::string& input)
{
static const char* const lut = "0123456789ABCDEF";
size_t len = input.length();
std::string output;
output.reserve(2 * len);
for (size_t i = 0; i < len; ++i)
{... | true |
2bcb3cff91c08181c92e592a734d1d7e87fdfa26 | C++ | Dawidos2780/Grafy | /src/BellFord.cpp | UTF-8 | 1,448 | 3.171875 | 3 | [] | no_license | #include "BellFord.hh"
#include "functions.hh"
#include <iostream>
#include <limits.h>
void printArr(int dist[], int n)
{
printf("Vertex Distance from Source\n");
for (int i = 0; i < n; ++i)
printf("%d \t\t %d\n", i, dist[i]);
} // Wyświetlenie rozwiązania
void BellmanFord(int A[1000][1000], int sr... | true |
f3c507879dfc57b83453ccf60e73ad50aa921949 | C++ | a65796731/position-based-dynamics | /src/xpbd/edge_length_constraint.cpp | UTF-8 | 1,305 | 2.515625 | 3 | [
"BSL-1.0"
] | permissive | #include "xpbd/edge_length_constraint.h"
namespace xpbd {
edge_length_constraint_t::scalar_type
edge_length_constraint_t::evaluate(positions_type const& p, masses_type const& M) const
{
auto const v0 = indices().at(0);
auto const v1 = indices().at(1);
auto const p0 = p.row(v0);
auto const p1 = p.row(v... | true |
4f1a7c092d6fa08f8b27507a41c6a1ecc98cc192 | C++ | LadyRadia/381Proj4 | /Agent.cpp | UTF-8 | 4,955 | 3.28125 | 3 | [] | no_license | #include "Agent.h"
#include "Model.h"
#include "Utility.h"
#include <iostream>//cout, endl
#include <iomanip>//changing output settings(precision)
#include <cassert>//assert
using std::cout;
using std::endl;
using std::string;
using std::ios;
const int default_health_c = 5;
const double default_speed_c = 5.;
const in... | true |
1a57e337419321d3e8992a35fabf7a8668c26266 | C++ | cool1314520dog/ACM | /.local/share/Trash/files/c3.2.cpp | UTF-8 | 753 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cmp(const void *a, const void *b)
{
return(*(char *)a-*(char *)b);
}
int main()
{
char input_ch1[ 1001 ] , input_ch2[ 1001 ] ;
while( gets(input_ch1) )
{
gets(input_ch2);
int len1 , len2 ;
len1 = strlen( input_ch1 );
len2 = strlen( inp... | true |
ebb78d1e9e05bcc7f968a09907d2ca54842abb3f | C++ | maheshvele/Boggle | /boggle/Dictionary.cpp | UTF-8 | 758 | 2.859375 | 3 | [] | no_license | #define DICTIONARY_CPP
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "types.h"
#include "List.h"
#include "Dictionary.h"
#include "Boggle.h"
#include "game.h"
#include "dice.h"
#include "Trie.h"
extern TrieNode *rootNode;
//This Function reads the input characters and populates them in a Trie ... | true |
c003ab6026232f53d82c5ac67610c77983faaa20 | C++ | deandt100/Expert-System | /src/makeVars.cpp | UTF-8 | 1,001 | 3.015625 | 3 | [] | no_license | #include <expert.h>
bool isVar(vector<Var*> vars, char varName)
{
for (int i = 0; i < vars.size(); i++)
{
if (vars.at(i)->getName() == varName)
return (true);
}
return (false);
}
vector<Var*> makeVars(vector<string> data)
{
char *line;
char varName;
int k;
bool isTruth;
Var *temp;
vector<... | true |
b8bbab122b5e3e22994e100685c8294e2577c860 | C++ | siriS88/Cpp_coding | /TheGame.cpp | UTF-8 | 5,501 | 3.140625 | 3 | [] | no_license | // TheGame.cpp
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <sstream>
#include <list>
#include <algorithm>
struct person {
int parent;
unsigned int score;
unsigned int rank;
unsigned int max_score;
std::list<int>my_children;
};
voi... | true |
422de88078868c34ef6659ce782ae6b5439522f0 | C++ | alejgh/HeadFirstDesignPatterns | /Singleton/src/main.cpp | UTF-8 | 540 | 3.3125 | 3 | [] | no_license | #include "ChocolateBoiler.h"
#include <iostream>
int main()
{
ChocolateBoiler& uniqueInstance = ChocolateBoiler::getInstance();
ChocolateBoiler& sameUniqueInstance = ChocolateBoiler::getInstance();
std::cout << "Is the boiler empty? " << (uniqueInstance.isEmpty() ? "Yes." : "No.") << std::endl;
std... | true |
527ac34d76fc82c6e8f38ddb0be5ce9be7dddf50 | C++ | jiffybaba/Baba | /BABA/Cc/factorial1.cpp | UTF-8 | 193 | 2.90625 | 3 | [] | no_license | #include "iostream"
using namespace std;
int factorial(int x)
{
int t = *x;
if (t>=1)
return t*factorial(&t-1);
else
return 1;
}
int main()
{
int x;
cin>> x;
factorial(x);
}
| true |
98440ad569ff9abf0b4ab2bdafd85ef7e62aac26 | C++ | Fengyee/HKUST_CG | /CircleBrush.cpp | UTF-8 | 1,263 | 2.8125 | 3 | [] | no_license | //
// CircleBrush.cpp
//
// The implementation of Point Brush. It is a kind of ImpBrush. All your brush implementations
// will look like the file with the different GL primitive calls.
//
#include "impressionistDoc.h"
#include "impressionistUI.h"
#include "CircleBrush.h"
#include <math.h>
extern float frand();
Circ... | true |
6fe86f9eed6b6b071aed73e8e0eb152a44118a76 | C++ | ryoegawa/test | /kasokuyomitori2/kasokuyomitori2.ino | UTF-8 | 2,636 | 3.046875 | 3 | [] | no_license | #include <SPI.h> //spi通信のライブラリを呼び出す。
#define cs 10 //cs(チップセレクト)を10ピンに定義する
void setup() {
pinMode(cs,OUTPUT); //spiライブラリの関数を使いspi通信の仕様を決定する
SPI.setBitOrder(MSBFIRST); //最上位ビットから転送する
SPI.setClockDivider(SPI_CLOCK_DIV4); //クロ... | true |
ccf30aee8069d1bb1fad3c8c9913c3689e29f883 | C++ | ianperez/x-com-reloaded | /cursor.cpp | UTF-8 | 562 | 2.828125 | 3 | [] | no_license | #include "cursor.h"
namespace ufo
{
Cursor::Cursor(Uint8 color)
: UIElement(0, 0, 320, 200), m_color(color)
{
m_alwaysOnTop = true;
}
bool Cursor::onMouseMove(Sint16 _x, Sint16 _y)
{
m_mousex = _x;
m_mousey = _y;
return false;
}
void Cursor::draw(Surface& surface)
{
for (Uint8 ... | true |
8ccc9d15ff89ce3494bb823399bf70f4b2d0bd46 | C++ | rohandk18/Data-Structures | /LinkedList2.cpp | UTF-8 | 1,115 | 3.421875 | 3 | [] | no_license | //============================================================================
// Name : LinkedList2.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#inclu... | true |
bb2eabb99d3149849fc9251c723c69c37ce485e6 | C++ | okiwi/triple-dojo-association-mots-dictionnaire | /performance.cpp | UTF-8 | 2,171 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <chrono>
#include <vector>
#include <unordered_set>
#include <thread>
#define BUFFER_SIZE (4*6 + 2)
#define RUN_COUNT 64
using namespace std;
using namespace std::chrono;
typedef unordered_set<string> Dictionary;
inline bool is_cod... | true |
440230f2fa95db93d792f00b4e654e59bdfe1527 | C++ | uniqueimaginate/Cpp | /Chapter11/Chapter11_5/Chapter11_5.cpp | UTF-8 | 558 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Base
{
public:
int m_public;
protected:
int m_protected;
private:
int m_private;
};
class Derived : private Base
{
public:
Derived()
{
Base::m_public = 123; // same as this->m_public, m_public
Base::m_protected = 123;
//m_private = 123;
}
};
class GrandChild... | true |
1b011baf2d378004fcf14802a85045ba6262f3a1 | C++ | IMCG/LeetCode-1 | /160.cpp | UTF-8 | 2,846 | 3.484375 | 3 | [] | no_license | class Solution1
{
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB)
{
if (headA == nullptr || headB == nullptr)
return nullptr;
ListNode* tmpA = headA;
ListNode* tmpB = headB;
while (tmpA != nullptr || tmpB != nullptr) {
if (tmpA == tmpB... | true |
90338c1969b28f1dc18f1b6b9cdcf3d353b334fe | C++ | ZhelnovIlyaNikolaevich23/mp2-lab-tables | /mp2-lab-tables/mp2-lab-tables/src/tarrayhash.cpp | UTF-8 | 2,148 | 2.765625 | 3 | [] | no_license | #include "tarrayhash.h"
TArrayHash::TArrayHash(int Size, int Step) {
pRecs = new PTTabRecord[Size];
TabSize = Size;
HashStep = Step;
pMark = new TTabRecord("", nullptr);
for (int i = 0; i < TabSize; ++i)
pRecs[i] = pMark;
}
TArrayHash::~TArrayHash() {
for (int i = 0; i < TabSize; ++i) ... | true |
2e3bf3948b7660121307d35ef867dcbcd6e4c42b | C++ | presscad/ToolKits-1 | /ToolCode/ldsptr_list.h | GB18030 | 3,754 | 2.703125 | 3 | [] | no_license | #ifndef __TOWER_PTR_LIST_H_
#define __TOWER_PTR_LIST_H_
#include "f_ent_list.h"
template <class TYPE> class CXhPtrList : public ATOM_LIST<TYPE*>
{
public:
void (*DeleteObjectFunc)(TYPE* pObj);
CXhPtrList(){DeleteObjectFunc=NULL;}
~CXhPtrList(){Empty();}
public:
TYPE* append(TYPE* pType)//ڽڵĩβӽڵ
{
TYPE **ppTypeO... | true |
ab3709abb77a8867a8e979f8c4a554b3c061a1e4 | C++ | dipty13/Competitive-Programming-Codes | /LeetCode/biweeklycontes1.cpp | UTF-8 | 1,227 | 3.09375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
vector<int> transformArray(vector<int>& arr) {
if(arr.size() <= 2){
return arr;
}
vector<int> a;
while(1){
bool x = true;
a = vector<int> (arr);
for(int i = 1; i <= arr.size() - 2; i++){
if(a[i] > arr[i - 1] ... | true |
003b688facd6ab14d469fcbfef206b38da065fac | C++ | wrzimm/ProjectEuler | /204-forum.cpp | UTF-8 | 619 | 2.6875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
double dtime=clock();
int pr[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
int *A,i,j,p,x,ct,ct2;
int limit,bound=1000000000;
A=(int*)(malloc)(3000000*sizeof(int));
A[0]=1;
ct=1;
for(... | true |
862f316326c81dcd98131e1033f8360babe8a80e | C++ | Shubham915Arora/C- | /sainik.cpp | UTF-8 | 3,402 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
void employee();
void customer();
void staff_member(){
int ch;
cout<<"\n Hello Would you Please Tell that which staff you are in ";
cout<<"\n 1. Matthi ";
cout<<"\n 2. Fain";
cout<<"\n 3. Rusk";
cout<<"\n 4. Biscuit";
cin>>ch;
}
void owner_menu(){
int... | true |
4635179d5c30a25dd638deed42bb63d88c6c5a75 | C++ | rubot813/wsp_solver | /src/color.cpp | UTF-8 | 318 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #include "color.h"
std::string color_to_string( color_e c ) {
std::string str;
switch ( c ) {
case empty:
str = "empty";
break;
case red:
str = "red";
break;
case green:
str = "green";
break;
case blue:
str = "blue";
break;
default:
str = "unknown. add to color_to_string";
}
return str;
}
| true |
2a070f710915fbdbb7eae02eaae33567811850b9 | C++ | Marco-Schneider/URI-Iniciantes---Cpp | /1064.cpp | UTF-8 | 610 | 3.171875 | 3 | [] | no_license | //URI Online Judge - Iniciantes - 1064
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main()
{
vector <float> vetor(6); //Declarando um vetor do tipo float com 6 elementos
float Soma_Positivos = 0;
int positivos = 0, i;
for(i=0; i<6; i++)
{
cin >> vetor... | true |
ab695b41df3ef15b991baeacd59960970d2917cc | C++ | saseb80/EstructuraDeDatos | /EstructurasDeDatos14005/StackT.h | ISO-8859-1 | 2,201 | 3.875 | 4 | [] | no_license | #pragma once
#include "NodoT.h"
#include <cstddef>
#include <iostream>
template<class T>
class StackT {
public:
NodoT<T>* first;
NodoT<T>* last;
NodoT<T>* tmp;
int size;
StackT();
void pop();
T top();
void push(T val);
void print();
int sizeu();
bool empty();
void updateIndex();
~StackT();
};
template... | true |
bb9cc148ab5dcf6769decfad741a0dfae465a9d4 | C++ | qibebt-bioinfo/microbiomenetwork | /code/mst/main.cpp | UTF-8 | 3,033 | 2.578125 | 3 | [] | no_license | #include"Dijkstra.cpp"
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <omp.h>
bool check(int Vexnum, int edge) {
if (Vexnum <= 0 || edge <= 0 || ((Vexnum*(Vexnum - 1)) / 2) < edge)
return false;
return true;
}
vector <int> find_vex_edge(string infilename){
ifstre... | true |
01a96a36e405904a0305d78f64079be9b6c9b567 | C++ | GeNicram/MarciEngine | /MarciEngine/manager/ControlManager.cpp | UTF-8 | 1,701 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "ControlManager.h"
#include "../entity/Entity.h"
#include <SFML/Window.hpp>
ControlManager::ControlManager()
{
}
ControlManager::~ControlManager()
{
}
void ControlManager::HandleEvents(sf::Window& event_source)
{
sf::Event event;
while (event_source.pollEvent(event))
{
if (event.... | true |
18d9dad242da564d3f2104159919f71dabdd4a94 | C++ | haolee21/Exoskeleton | /Exo/ExoMain/ExoMain/Script/include/Recorder.hpp | UTF-8 | 3,647 | 2.90625 | 3 | [] | no_license | #ifndef RECORDER_HPP
#define RECORDER_HPP
#include "RecData.hpp"
#define CHECK_TH_SLEEP (MAX_REC_LEN) //based on 1k Hz, check every half filled time
#include <array>
#include <fstream>
#include <sstream>
#include <string>
#include <queue>
#include <memory>
#include <thread>
//timer
#include <unistd.h>
#include <iostrea... | true |
962a061a90310c21bc973d5478db0ad0341fe267 | C++ | kk-katayama/com_pro | /DP/Exp_DP/yuki_108.cpp | UTF-8 | 873 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
#define rep(i,n) for(int i = 0 ; i < n ; ++i)
#define rep1(i,n) for(int i = 1 ; i <= n ; ++i)
using namespace std;
int n;
int a[110];
double dp[110][110][110];
double rec(int i,int j,int k){
if(dp[i][j][k] >= 0) return dp[i][j][k];
int sum = i + j + k;
do... | true |
e8d54796d3cbf942061536c613e5448749e9d4c8 | C++ | beerda/lfl | /src/search/DummyExtension.h | UTF-8 | 2,636 | 2.8125 | 3 | [] | no_license | /*
* File name: DummyExtension.h
* Date: 2014/02/04 13:07
*/
#ifndef __LFL__SEARCH__DUMMYEXTENSION_H__
#define __LFL__SEARCH__DUMMYEXTENSION_H__
#include <common.h>
#include "Task.h"
#include "SearchConfig.h"
namespace lfl { namespace search {
class DummyExtension : public AbstractExtension {
protected:
... | true |
3a96f0210f04c01eb110a9ae907a9b36354572ca | C++ | Sikurity/StudyAlgorithm | /Normal/1289_WeightOfTree.cpp | UTF-8 | 1,532 | 2.734375 | 3 | [] | no_license | /**
* @link https://www.acmicpc.net/problem/1289
* @date 2017. 03. 17
* @author Sikurity
* @method DFS And Use STL Map
*/
#include <stdio.h>
#include <vector>
#include <map>
#define MOD 1000000007LL
using namespace std;
long long result;
map<int, map<int, int> > tree;
long long dfs(int prev, int cur)
{
in... | true |
4b7f6e27b85541e7071b07f90d1c7f612e599978 | C++ | FredericCanaud/AlgorithmesC-CPP | /MoyenneClasse/affichageClasse.cpp | ISO-8859-1 | 927 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
///////////////////////////////////////////////////////
//
// Procdure permettant l'affichage de la classe, les eleves sont affichs un par un, d'abord leur numero puis leurs 6 notes
// Entree : nb_eleves de type int, le nombre d'eleves dans la classe,... | true |
ab5d86a8dc540753153a23b144e299247d1143c9 | C++ | nNbSzxx/ACM | /图/白书4.3/2-sat/poj2723 二分求合取范式最多可以满足前几个子句.cpp | UTF-8 | 2,441 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
const int MAXN = 3010;
const int MAXM = 5010;
struct edge {
int v, nt;
} e[MAXM];
int head[MAXN], cnte;
int dfn[MAXN], low[MAXN], idx, color[MAXN], cntc;
stack<int> s;
int n, m;
int u[MAXM], v[MAXM]... | true |
0228c5f247097ad2a165e6159797befdcd388e68 | C++ | adamap/code-test2 | /92reverselinkedlistII.cpp | UTF-8 | 1,434 | 3.671875 | 4 | [] | no_license | //Reverse a linked list from position m to n. Do it in-place and in one-pass.
//
//For example:
// Given 1->2->3->4->5->NULL, m = 2 and n = 4,
//
// return 1->4->3->2->5->NULL.
//
// Note:
// Given m, n satisfy the following condition:
// 1 <= m <= n <= length of list.
//
//
void reverse(ListNode*node1, ListNo... | true |
e3e2cddcb4c22e4e65feafc3ae55c13ba7ff836c | C++ | Avon11/Cpp-basic-programs | /Class to basic type conversion.cpp | UTF-8 | 557 | 3.6875 | 4 | [] | no_license | #include<iostream>
using namespace std;
class time
{
public:
int min,hr,sec,minutes;
public:
time(int x,int y,int z)
{
hr=x;
min=y;
sec=z;
}
operator double()
{
minutes=hr*60+min;
for(;sec>59;sec=sec-60)
{
minutes+=1;
}
return (minutes);
}
void show()
... | true |
ff48046d8feb9bcc8b00a47e00029a487bdc4ade | C++ | jiexray/clink | /src/core/util/LoggerFactory.hpp | UTF-8 | 1,400 | 2.78125 | 3 | [] | no_license | /**
* Factory of loggers.
*/
#pragma once
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
#include "Constant.hpp"
class LoggerFactory
{
public:
LoggerFactory();
~LoggerFactory();
static std::shared_ptr<spdlog::logger> get_logger(const std::str... | true |
e739fdbd9842b600602a6ebad296b6417b323d4e | C++ | Maulin-sjsu/DataStructuresPractise | /LeetCodeProblem/LinkedLists/SortingAlist.cpp | UTF-8 | 1,070 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <queue>
using namespace std;
/* Link list node */
struct Node {
int data;
struct Node* next;
Node(int data)
{
this->data = data;
next = NULL;
}
};
void printLinkedList(Node *head)
{
if(head == NULL){
return;
}
while(head ... | true |
9e00b3a91afb3b53b1530c9ba46d78221d04f601 | C++ | PribaNosati/MRMS | /UltrasonicAsyncPWM/UltrasonicAsyncPWM.cpp | UTF-8 | 7,006 | 2.8125 | 3 | [] | no_license | #include "UltrasonicAsyncPWM.h"
//Singleton, not important for a user
UltrasonicAsyncPWM *UltrasonicAsyncPWM::_instance(NULL);
/**Constructor
@param hardwareSerial - Serial, Serial1, Serial2,... - an optional serial port, for example for Bluetooth communication
*/
UltrasonicAsyncPWM::UltrasonicAsyncPWM(HardwareSerial... | true |
c716f428760650b18a771aa37b8b57a10a202c38 | C++ | ooooo-youwillsee/leetcode | /0501-1000/0888-Fair-Candy-Swap/cpp_0888/Solution1.h | UTF-8 | 632 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* @author ooooo
* @date 2020/9/30 15:42
*/
#ifndef CPP_0888__SOLUTION1_H_
#define CPP_0888__SOLUTION1_H_
#include <iostream>
#include <vector>
#include <unordered_set>
#include <numeric>
using namespace std;
class Solution {
public:
vector<int> fairCandySwap(vector<int> &A, vector<int> &B) {
int sum_a =... | true |
d3c5e2622a7e659ef0ca977df9804bb6ac7d8452 | C++ | Dagomsa/AdventOfCode2020 | /Day18/Day18.cpp | UTF-8 | 5,232 | 3.15625 | 3 | [] | no_license | // Day18.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
uint64_t Part(int i);
uint64_t Solve1(std::string& str);
uint64_t Solve2(std::string& str);
void operate(std::string& str);
void SolveSums(std:... | true |
9e5440e4514df16273c9cc5ec7e4010f25daf7d4 | C++ | walkccc/LeetCode | /solutions/0926. Flip String to Monotone Increasing/0926.cpp | UTF-8 | 380 | 3.078125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int minFlipsMonoIncr(string s) {
// # of chars to be flilpped to make substring so far monotone increasing
int dp = 0;
int count1 = 0;
for (const char c : s)
if (c == '0')
// 1. Flip '0'.
// 2. Keep '0' and flip previous '1's.
dp = min(dp + 1, c... | true |
e8b1eab0cec0d6b8fb20e555980e18bfe3f53718 | C++ | dazotaro/defender | /graphics/GLSLProgram.hpp | UTF-8 | 2,326 | 2.609375 | 3 | [] | no_license | #ifndef GLSLPROGRAM_H
#define GLSLPROGRAM_H
// Local Includes
#include "../graphics/gl_core_4_2.hpp" // glLoadGen generated header file
#include "../core/Defs.hpp" // JU::uint32
// Global Includes
#include <string> // std::string
#include <glm/glm.hpp> // glm::vecX
namesp... | true |
20537cb36291bd6136653eb516a1d9d5822ea194 | C++ | muneerkhann13/Tree | /isSumTree.cpp | UTF-8 | 589 | 3.046875 | 3 | [] | no_license | bool isSumTree1(node *root){
if(root==NULL || (root->left==NULL &&root->right==NULL) )
return true;
int l,r;
if(isSumTree1(root->left)&&isSumTree1(root->right)){
if(root->left==NULL)
l=0;
else if (root->left->left==NULL && root->left->right==NULL)
l=root->left->data;
else... | true |
2d0dbf5bee833178c6a50c1c3c4b473dcbe21775 | C++ | Gh05ts/DS-Algo | /Problems/DP/EggDrop.cpp | UTF-8 | 847 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int eggDrop(int n, int h) {
if(n == 1) return h;
if(h == 0 || h == 1) return h;
int res = INT_MAX;
for(int i = 1; i <= h; i++) {
res = min(res, (1 + max(eggDrop(n - 1, i - 1), eggDrop(n, h - i))));
} return res;
}
int eggDr... | true |
44dae602e8bfa61832a1b1654d848e02b2bf67bb | C++ | arquolo/kerasify | /src/layers/activation.cpp | UTF-8 | 2,018 | 2.671875 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2016 Robert W. Rose
* Copyright (c) 2018 Paul Maevskikh
*
* MIT License, see LICENSE file.
*/
#include "keras/layers/activation.h"
namespace keras {
namespace layers {
Activation::Activation(Stream& file) : type_(file) {
switch (type_) {
case Linear:
case Relu:
case Elu:
c... | true |
1236091e469cfe83362db62a6c3ca541d70fee65 | C++ | zhuwenboa/Cpp-practice | /c++/practice/overload.cpp | UTF-8 | 370 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<vector>
void func(int a)
{
std::cout << "func1" << "\n";
}
//int func(int a);
//void func(int a, int b);
void func(const int a, int b)
{
std::cout << "func2" << "\n";
}
class test
{
public:
test(int b) : a(b) {}
private:
static int count;
int a;
};
int test::coun... | true |
1d406c0498b2f0637d92995db558a7dc880555cf | C++ | Palette25/Computer-Vision | /Week6/16340023+陈明亮+Ex6/src/ImageStitching.h | UTF-8 | 826 | 2.5625 | 3 | [] | no_license | /*
* Program: ImageStitching.cpp
* Usage: Start image stitching
*/
#ifndef IMAGE_STITCHING_H
#define IMAGE_STITCHING_H
#include <vector>
#include <queue>
#include "SIFT.h"
#include "Utils.h"
#include "Matching.h"
#include "Warping.h"
#include "Blending.h"
class Stitcher{
public:
Stitcher(vector<CImg<unsigned char>> ... | true |
45dfb76ce47356712ce34da6288475ad0098a0a8 | C++ | hansenms/gadgetron | /gadgets/bart/bart_helpers.cpp | UTF-8 | 6,382 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "bart_helpers.h"
#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <boost/tokenizer.hpp>
#include <random>
// =============================================================================
namespace fs = Gadgetron::fs;
fs::path internal::generate_unique_folder(const fs::path& working_d... | true |
634e80d2d93a3610498ce954b675c55fa70495a9 | C++ | alexandraback/datacollection | /solutions_2749486_0/C++/HubertJ/pogo2.cpp | UTF-8 | 2,180 | 2.703125 | 3 | [] | no_license | #include <cstdio>
#include <math.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <bitset>
#include <cassert>
#include <queue>
#include <tuple>
#include <cmath>
using namespace std;
int main(int argc, char *argv[])
{
int c, cases;
cin >> cases;
... | true |
fe15456a25dbcd25d2f15a5f03143d907d0beafe | C++ | Jrice170/Vector- | /MyVector.hpp | UTF-8 | 4,159 | 3.515625 | 4 | [] | no_license | /* Define all your MyVector-related functions here.
* Also, define the swap function here.
* You do not need to include the h file.
* It included this file at the bottom.
*/
#include<cstdlib>
void get_identity(string &my_id)
{
my_id = "jmr3by";
}
template<typename T>
void swap(T & a,T &b)
{
T temp ... | true |
8efddef2eda3b7a4434ed49c06f35436b797ee6d | C++ | BryanBrouwer/OldRayTracer | /Renderer/Tracer.cpp | UTF-8 | 9,010 | 2.890625 | 3 | [] | no_license | #include "Tracer.h"
#include <iostream>
#include <algorithm>
Tracer::Tracer(int width, int height, float aspectratio, vec3 background)
{
ScreenWidth = width;
ScreenHeight = height;
AspectRatio = aspectratio;
ReflectDepth = 5;
Background = background;
//CameraPosition = vec3(0.f, 0.f, -10.f);
}
Tracer::~Tracer()... | true |
579521661ad44bbe02ac4e9ffaca397366bcef29 | C++ | Benjamin-Berger/Junior_Year | /cs375/Proj01/Driver.cpp | UTF-8 | 1,613 | 2.96875 | 3 | [] | no_license | //Benjamin Berger
#include <iostream>
#include <stdexcept>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[]){
if(argc == 3){
string line, word;
ifstream myFile (argv[1]);
ofstream outFile (argv[2]);
stringstr... | true |
a5e8c75ad02b59f70f3f61216dc6934006e0ae68 | C++ | SamuelMeilleur/Project-Euler | /Projects/Project 33/Project 33/Source.cpp | UTF-8 | 807 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "Fraction.h"
using namespace std;
int main() {
vector<Fraction> fractions;
for (double n = 10; n < 100; ++n) {
for (double d = n + 1; d < 100; ++d) {
double numerator[2] = { int(n) % 10, int(n / 10) };
double denominator[2] = { int(d) % 10, int(d / 10) };
do... | true |
3f0843c97a478834ee0111524d7bf2da08b10d17 | C++ | HemensonDavid/Estudando-C | /2017/APP6/Q.1.cpp | UTF-8 | 299 | 3.1875 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main(){
int num;
for(;;){
cout<<"Digite um numero: ";
cin>>num;
if(num==0){
return 0;
}
else if(num%3==0 && num%2==0){
cout<<"O numero eh divisivel por 6! "<<endl;
}else{
cout<<"Nao eh divisivel por 6! "<<endl;
}
}
}
| true |
17a42cb47edc319fb52060ace3288fb5f2fa7ed0 | C++ | joaodasilva/cpp-base | /src/base/dns.cc | UTF-8 | 3,782 | 2.65625 | 3 | [] | no_license | #include "base/dns.h"
#include <sstream>
#include <arpa/inet.h>
#include <string.h>
#include "base/bind.h"
#include "base/event_loop.h"
#include "base/logging.h"
namespace {
void Jump(const DNS::Callback& callback, addrinfo* ptr) {
DNS::unique_addrinfo unique(ptr);
callback(std::move(unique));
}
} // namespa... | true |
9610fb9195a8451900e9cd380050ea0902431895 | C++ | dsfb/topicosProgramacao | /aula05/TabelaSalarial.h | UTF-8 | 672 | 2.96875 | 3 | [] | no_license | /**
PCS2478 - Tópicos de Programação
TabelaSalarial.h
@author 8586861 - Luiz Eduardo Sol (luizedusol@gmail.com)
@author 7576829 - Augusto Ruy Machado (augustormachado@gmail.com)
@version 1.0 2017-08-30
*/
#pragma once
#include <string>
#include <vector>
using namespace std;
class TabelaSalarial{... | true |
d12542ee2aea47372e6f1439cb4e3ad21ffb380a | C++ | redwingsdan/cpp-schoolwork | /082814ClassesTest/082814ClassesTest/Main.cpp | UTF-8 | 173 | 3.0625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
Point p1(1.5, 2.7);
cout << "The values or p1 are " << p1.xCoord << " and " <<
p1.yCoord << endl;
return 0;
} | true |
b5609d081aac295c271501866de7be33560fd014 | C++ | maoxiezhao/Cjing3D | /Cjing3D/input/gamepad.cpp | UTF-8 | 639 | 2.65625 | 3 | [
"MIT",
"Zlib"
] | permissive | #include "gamepad.h"
namespace Cjing3D
{
U32 Gamepad::GetMaxGamepadController() const
{
return mGamepadControllers.size();
}
bool Gamepad::IsConnected(U32 index) const
{
if (index >= mGamepadControllers.size()) {
return false;
}
return mGamepadControllers[index].mIsConnected;
}
bool Gamepad::IsKey... | true |
a702917a3a3765c89c41e975c70b54aaafbc183d | C++ | shashikarsiddharth/dev-cpp | /io.cpp | UTF-8 | 189 | 3.28125 | 3 | [] | no_license | // Getting around I/O using cin and cout
#include <iostream>
using namespace std;
int main()
{
int num;
cin >> num;
cout << "entered num is: " << num << endl;
return 0;
} | true |
c017581b56cccb4c6912679ff00395cfa5363f9b | C++ | leonardoAnjos16/Competitive-Programming | /Codeforces/bun_lover.cpp | UTF-8 | 529 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define llong long long int
llong sum(int l, int r) {
if (l > r) return 0LL;
int n = r - l + 1;
return n * (n - 1LL) / 2LL + 1LL * n * l;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin >> t;
while (t--) {
... | true |
b4b664201acf3dc7d5b665c891d3ac76ce24d292 | C++ | tranvankhue1996/time-and-calendar-CPP | /Calendar/Date.h | UTF-8 | 348 | 2.5625 | 3 | [] | no_license | #pragma once
#include "Graphics.h"
class CDate : public CGraphics
{
private:
int m_Day, m_Month, m_Year;
int m_wDay;
static int DayinMonth[];
public:
CDate();
CDate(int d, int m, int y);
~CDate();
void setTime();
int wDay();
void output(ostream& os);
bool InspectLeapYear();
void Paint(int x, int y);
int re... | true |
f0961bbd3aa97259e36dfbb00a0cebfa00530c42 | C++ | Adityathakur3029/LeetCode | /Sliding Window/longestSubstringWithoutRepeatingCharacters.cpp | UTF-8 | 506 | 2.890625 | 3 | [] | no_license | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int result=0;
if(s.length()==0)
return 0;
unordered_map<char,int> mp;
int right=0;
int left=0;
while(left<s.length() && right<s.length()){
if(!mp[s[right]]){
mp[s... | true |
21478c374601e2cef0367e5ede775811977a59ef | C++ | MikeFernandez-Pro/CPP-Pool | /Module08/ex02/mutantstack.hpp | UTF-8 | 2,779 | 2.9375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mutantstack.hpp :+: :+: :+: ... | true |
3f802ea90426db549afdd6b4c8d1ac4f521db1f9 | C++ | prutskov/DateConverter | /DateConverterLib/DateConverter.cpp | WINDOWS-1251 | 4,066 | 3.171875 | 3 | [] | no_license | #include "stdafx.h"
#include "DateConverter.h"
int DateConverter::ConvertDate(std::string &dateIn, std::string& dateOut)
{
if (dateIn.size() != 5)
{
//
return 1;
}
int j = 0;
int dd = 0;
int mm = 0;
for (std::string::iterator it = dateIn.begin(); it != dateIn.end(); ++it)
{
if (*it != '.')
{
sw... | true |
3cf77f1190d9eb8b3fc4434d62aa3f3012a4c9d4 | C++ | nayantharar/cs142-lab4 | /lab4_q3.cpp | UTF-8 | 3,787 | 3.921875 | 4 | [] | no_license | #include <iostream>
using namespace std;
class node{
//type
public:
// Data
int data;
// Pointer to the next Node
node * next;
// Construct
node(){
next = NULL;
}
};
class LinkedList{
//type
public:
// Head -> Node type ptr
... | true |
be0dbfc35f1029df6c4a9a69abb2393499240463 | C++ | OTTFFYZY/StandardCodeLibrary | /Mathematics/CombinatorialMathematics/HighDimensionalPrefixSum_0.cpp | UTF-8 | 930 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int dp[10];
vector<int>G[10];
void trans(int x) {
int a = x % 2; x /= 2;
int b = x % 2; x /= 2;
int c = x % 2; x /= 2;
cout << c << b << a ;
}
void print(int x) {
for (int s = 0; s < (int)G[x].size(); s++) {
trans(G[x][s]); cout << " ";
}
}
int main() {
for (int s =... | true |
b78fa7cb92e4cff335b8f0557bd990aa6caba078 | C++ | stoneheart93/Leetcode | /[152]Maximum Product Subarray.cpp | UTF-8 | 1,397 | 3.40625 | 3 | [] | no_license | //Given an integer array nums, find a contiguous non-empty subarray within the a
//rray that has the largest product, and return the product.
//
// It is guaranteed that the answer will fit in a 32-bit integer.
//
// A subarray is a contiguous subsequence of the array.
//
//
// Example 1:
//
//
//Input: nums = [2... | true |
7d664d3fa9dd7691e1ce533c578f657b68bcbee1 | C++ | BenjaminSchulte/fma | /libfma/include/fma/Error.hpp | UTF-8 | 446 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef __FMA_ERROR_H__
#define __FMA_ERROR_H__
#include <string>
#include "Reference.hpp"
namespace FMA {
struct Error {
/**
* Different error types
*/
enum ErrorType {
INFO,
NOTICE,
WARNING,
ERROR
};
Error(ErrorType type, const CodeReference &file, const std::string &message)
: f... | true |
6d50c08fd1cb5e49d7f5faf7ab983b24bc146254 | C++ | Alpha303/qPaint | /qPaint/shapefactory.cpp | UTF-8 | 869 | 2.90625 | 3 | [] | no_license | #include "shapefactory.h"
ShapeFactory::ShapeFactory()
{
}
BaseShape* ShapeFactory::createNewShape(const QPen& pen, const QBrush& brush, const QString& name,
const QPoint& initialPos, const DrawMode& shapeType)
{
switch (shapeType)
{
case Type_Freehand:
... | true |
2c6ae7fc6e38f271592df426d3a58e835227efe7 | C++ | rensselaer-rocket-society/TelemetryUnit | /Firmware/MainSketch/libs/Packet.h | UTF-8 | 804 | 2.703125 | 3 | [] | no_license | #pragma once
#include "Arduino.h"
#include "CRC8.h"
#include "COBS.h"
class Packet
{
public:
enum PacketContent : uint8_t { GPS=0x01, ALTITUDE=0x02, ACCEL=0x03, BATTERY=0x04 };
Packet(HardwareSerial *serial);
void sendBattery(uint32_t time, uint16_t voltage);
void sendAltitude(uint32_t time, int32_... | true |
4a47180299c612fbdab528b82abf419e96ea1454 | C++ | JoKeR-VIKING/Competitive-Programming | /Dynamic Programming - 2/knapSack.cpp | UTF-8 | 1,708 | 3.59375 | 4 | [] | no_license | // Knapsnack - Problem
// A thief robbing a store and can carry a maximal weight of W into his knapsack. There are N items and ith item weigh wi and is of value vi. What is the maximum value V, that thief can take ?
// Note: Space complexity should be O(W).
// Input Format :
// Line 1 : N i.e. number of items
// Line ... | true |
d939326c24ec4ecc495fa0bc3f2ca1945068d6c2 | C++ | xiazhiyiyun/C-Primer | /Unit15/Exercise15.3/Quote.h | UTF-8 | 341 | 3.328125 | 3 | [] | no_license | #include <string>
class Quote
{
public:
Quote():price(0.0) {}
Quote(const std::string &book,double _price):isbn(book),price(_price) {}
virtual ~Quote() {}
public:
std::string ISBN() const { return isbn; }
virtual double net_price(std::size_t n) const
{
return n*price;
}
protected:
double price;
private:
... | true |
24c9eed35a48bff28ecbbb8b721198b0353df4cd | C++ | datoad4510/My-Projects | /Old/personal projects/Numerical analysis library/Sets (work in progress, old, didn't know trees existed).cpp | UTF-8 | 1,992 | 3.5 | 4 | [] | no_license | #include <vector>
#include <iostream>
using namespace std; //assuming there are no duplicates in the sets. normalize deletes duplicates
template<typename A>//fix the functions
void normalize(vector<A>& v);
template<typename A>
vector<A> set_intersection(vector<A>&, vector<A>&);
template<typename A>
vector<A> set_uni... | true |
99ef4dd1d2d24ec6fd452e7058b1d1ba189d338b | C++ | Haowie/PAUL-E | /Shop.h | UTF-8 | 867 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
#ifndef SHOP_H
#define SHOP_H
class Order;
class RobotModels;
class SalesAssoc;
class Boss;
class Customers;
class Model;
class Shop
{
public:
Shop();
void addModel(Model* ID);
void addOrder(Order* orderID);
void ... | true |
15c2155cc666c6f267993114934021e7c90cd71e | C++ | ash/cpp-tut | /150.cpp | UTF-8 | 586 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << setw(10) << 42 << "\n";
cout << setw(10) << 13242 << "\n";
cout << setw(10) << setfill('0') << 546 << "\n";
cout << 78 << "\n";
cout << setprecision(4) << 3.1415926 << "\n";
cout << setbase(16) << 95 << "\n";
... | true |
276908d6535731c7f4ecb6ff70704f94b1e7e211 | C++ | HoYoung1/backjoon-Level | /backjoon_level_c/backjoon_level_c/15954.cpp | UHC | 846 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int N, K;
cin >> N >> K; // 1<=N<=500 , 1<=K<=N
vector<int> vDolls;
for (int i = 0; i < N; i++) {
int temp;
cin >> temp;
vDolls.push_back(temp);
}
long double minst = 98765432... | true |
2a1f9771791272886798352e5fdbd0cf2f2db555 | C++ | rgrahamh/muse | /src/client/musewindow.cpp | UTF-8 | 36,981 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "musewindow.h"
#include "ui_musewindow.h"
/**
* @brief MuseWindow::MuseWindow Constructor for the main window of the client UI
* @param parent The parent to attach to
*/
MuseWindow::MuseWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MuseWindow)
{
// ui initialization
ui->setupUi... | true |
a0d29dc962547f69d081ea983a5b7c402a15cdae | C++ | as-iF-30/C-Programs | /simple/vowel.cpp | UTF-8 | 220 | 2.734375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
main()
{
char s;
printf("enter the value of s");
scanf("%s",&s);
if(s=='a,e,i,o,u,A,E,I,O,U')
{
printf("this is a vowel");
}
else
{
printf("this is not vowel");
}
getch();
}
| true |