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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1b0bde8213f11ee478549718cb224c89be6890fd | C++ | Zaladim/Tek2_OOP | /OOP_arcade/lib/sdl/SDL.cpp | UTF-8 | 6,750 | 2.578125 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2019
** ARCADE
** File description:
** SDL lib
*/
#include "SDL.hpp"
extern "C" ILib *start()
{
return new SDL;
}
SDL::SDL() :
ALib(),
_run(false),
_textColor({0, 255, 0}),
_playerName("")
{
}
SDL::~SDL()
{
}
int SDL::run(std::vector<std::string> libs, std::vector<std::vector<int>> boa... | true |
b97241a252d1e675fcf374531bc54b4d062485f5 | C++ | woosungkim/Memgorithm | /MEMGORITHM/331_Gseries.cpp | UHC | 656 | 2.859375 | 3 | [] | no_license | ///*
//
//VCPP, GPP
//
//*/
//
//#include <iostream>
//using namespace std;
//int main()
//{
//
// int nCount; /* Ʈ ̽ */
//
// cin >> nCount; /* Ʈ ̽ Է */
//
// for (int itr = 0; itr<nCount; itr++)
// {
//
// cout << "#testcase" << (itr + 1) << endl;
//
// /*
//
// ˰ κ
//
// */
// int n;
// cin >> n;
//
// ... | true |
9064fcc0576e8ff942a622ba77c2064b3710aeb8 | C++ | garrettbolen/CPSC350_A3 | /GenStack.h | UTF-8 | 550 | 3.171875 | 3 | [] | no_license | #include <iostream>
using namespace std;
//ensures that the header file is only included once at runtime
#pragma once
template <typename type> class GenStack{
public:
GenStack(); // default constructor
GenStack(int maxSize); // overloaded constructor
~GenStack(); // destructor
//core funtions
void push(typ... | true |
27bfee2a246d4cfd2ed008bb1c69f45ceee37261 | C++ | takata-daiki/algorithms | /monoids/affine.hpp | UTF-8 | 358 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct affine_monoid {
using P = pair<T, T>;
using value_type = P;
P identity() { return make_pair(T(1), T(0)); }
P merge(P a, P b) {
T fst = a.first * b.first;
T snd = a.second * b.first + b.second;
... | true |
9daf3cc438bd14854d688189ef52f89dfe0a32a8 | C++ | pilgujeong10/Programmers | /DFS1.cpp | UTF-8 | 465 | 2.6875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int map[30][30];
int ch[30];
int cnt=0,n;
void DFS(int v) {
int i;
if (v == n) {
cnt++;
}
else {
for (i = 1; i <= n; i++) {
if (map[v][i] == 1 && ch[i] == 0) {
ch[i] = 1;
DFS(i);
ch[i] = 0;
}
}
}
}
int main() {
int m, i, ... | true |
5396174ca68e933c3560d029caed308adcc057fd | C++ | olga-kuriatnyk/CSS342 | /Exercises/MyCasino/CardDeck.h | UTF-8 | 400 | 2.671875 | 3 | [] | no_license | #pragma once
#include "Card.h"
const int kCardsInDeck = 52;
class CardDeck
{
public:
CardDeck();
void Shuffle();
bool Cut(int num_cards);
int CardsRemaing() const;
Card Deal();
bool ReturnCard(const Card& the_card);
bool Contains(const Card& the_card) const; // cost because no change
bool Re... | true |
258ddc568034024c64c736537f05030603a62ded | C++ | sksingh55/code | /algorithms/largest_power.cpp | UTF-8 | 1,298 | 2.984375 | 3 | [] | no_license | //largest power of number with is greater than n
#include <bits/stdc++.h>
#define vec vector< long long int>
#define vecp vector < pair< long long int ,long long int> >
#define pb push_back
#define f(i,a,b) for(long long int i=a;i<b;i++)
#define tc long long int t; cin>>t; while(t--)
#define mp make_pair
using namespa... | true |
c28e4c844e83297826e199caa4d6424ce4cbbcd3 | C++ | dchudik/GuapPractice2019 | /Lab1/Task1/mainwindow.cpp | UTF-8 | 775 | 2.59375 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_printResult_clicked()
{
QString distance = ui->distance->text();
QString... | true |
ba367060a1d7c4620e91a7b269b82c39000e10d4 | C++ | qiminglu/s2-mini | /src/synergia/foundation/reference_particle.h | UTF-8 | 4,167 | 3.140625 | 3 | [] | no_license | #ifndef REFERENCE_PARTICLE_H_
#define REFERENCE_PARTICLE_H_
#include "synergia/utils/multi_array_typedefs.h"
#include "synergia/foundation/four_momentum.h"
/// Reference_particle stores the four momentum of the reference frame
/// with respect to the lab frame (defined to be along the axis of the
/// accelerator) as... | true |
bfbc11ebe7cb522fece60e655c3bc3b0f4646b4b | C++ | TheSilverCrow/Face_Recogintion_Arduino | /feb9.ino | UTF-8 | 443 | 2.6875 | 3 | [] | no_license |
void setup() {
Serial.begin(9600); //initialize serial COM at 9600 baudrate
pinMode(13, OUTPUT); //make the LED pin (13) as output
digitalWrite (13, HIGH);
}
void loop() {
if (Serial.available())
{
Serial.print(Serial.read());
switch( Serial.read())
{
case 0 : digitalWrite(1... | true |
e2a6f1fa056df96a7fca6b9d27606dc22221742a | C++ | vaddya/operating-systems | /lab4/src/task5/task5.cpp | UTF-8 | 1,473 | 2.921875 | 3 | [] | no_license | #include <windows.h>
#include <iostream>
using std::cout;
using std::endl;
DWORD WINAPI threadHandler(LPVOID);
struct Params {
int num;
bool *runFlag;
};
void printTime() {
SYSTEMTIME now;
GetSystemTime(&now);
cout << "System Time " << now.wHour << ":" << now.wMinute << ":" << now.wSecond << end... | true |
bc50d56c3700a4c7feda629f803bd9db7794526b | C++ | olvap/cellphone_alarm | /cellphone.ino | UTF-8 | 1,174 | 2.703125 | 3 | [] | no_license | #include <SoftwareSerial.h>
#define RX 8
#define TX 9
#define LED 13
#define SENSOR 12
const char* cellphone_number = "543425091329";
SoftwareSerial mySerial(RX, TX);
void EnviaSMS(const char* message){
mySerial.println("AT+CMGF=1"); // Activamos la funcion de envio de SMS
delay(100);
mySerial... | true |
96bd89ecb388b6810cccec6183b2c4f6e0382fa8 | C++ | lizhengdao/Eliminate_Pests | /Classes/QSprite.cpp | GB18030 | 572 | 2.5625 | 3 | [] | no_license | #include "QSprite.h"
QE_SINGLETON_CPP(QSprite);
Sprite* QSprite::createBgSprite()
{
return createBgSprite("bg.png");
}
Sprite* QSprite::createBgSprite(const std::string& filename)
{
//ȡڴС
Size size = Director::getInstance()->getWinSize();
//
Sprite* bg = Sprite::create(filename);
//
float scaleX = size.widt... | true |
88eb2e3a8d00bcfecd0c8cd9eba78603b425687b | C++ | sym233/leetcode_problems | /41. First Missing Positive/41. First Missing Positive.cpp | UTF-8 | 877 | 2.9375 | 3 | [] | no_license | auto indexOf = [](vector<int>& v, int val, int from = 0) -> int {
for (int i = from; i < v.size(); i++) {
if (v[i] == val) {
return i;
}
}
return -1;
};
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
int l = nums.size();
int comp = 0;
... | true |
0b804b3cfd54e2192d36ffb3c67108b59066da39 | C++ | nesjett/TheEricsJourney | /src/private/Actor.cpp | UTF-8 | 4,354 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "Actor.h"
#include <game.h>
Actor::Actor() {
//std::cout << "New actor created" << std::endl;
setActorLocation(Vector2f(0.f,0.f));
//setBoundingBox( sf::IntRect( 0, 0, 0, 0 ) ); // Init bounding box to 0
oType = worldstatic;
asleep = false;
debug = false;
if(debug){
font.loadFromFile("./r... | true |
96dfa661464b3f32ec940ed227ff9f03a6d98f4c | C++ | NickLennonLiu/cpp | /qt/snake/snake.h | UTF-8 | 936 | 2.65625 | 3 | [] | no_license | #ifndef SNAKE_H
#define SNAKE_H
#include <QObject>
#include "utils.h"
class SnakePart
{
public:
SnakePart();
SnakePart(coord pos, SnakePart *next = 0);
//int getX() const {return pos.x;}
//int getY() const {return pos.y;}
coord getPos() const { return pos; }
SnakePart *nextPart() const { ret... | true |
065494b7ccb6034e1d9fc03a80cc748e42073de9 | C++ | evga7/Practice_Algorithm_01 | /BOJ_5430.cpp | UTF-8 | 1,295 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stack>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include<deque>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin >> T;
int i, N;
while (T--)
{
string p;
cin >> p >> N;
... | true |
b4760dcd1e66a11751ee53cc8ff5202ebd9ab2f2 | C++ | catboost/catboost | /util/generic/serialized_enum_ut.cpp | UTF-8 | 4,960 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #include "serialized_enum.h"
#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/deque.h>
#include <util/generic/map.h>
#include <util/generic/typelist.h>
#include <util/generic/vector.h>
Y_UNIT_TEST_SUITE(TestSerializedEnum) {
Y_UNIT_TEST(RepresentationTypes) {
using namespace NEnu... | true |
477926489d42afbd34cd87be8496a0b294a07c67 | C++ | hisyamsk/tlx-toki | /pemrogaman-dasar/11 Pendalaman String/11_f.cpp | UTF-8 | 390 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if ((int) s[i] == 95) {
s.erase(i, 1);
s[i] = (char) ((int) s[i] - 32);
} else if ((int) s[i] > 64 && (int) s[i] < 91) {
s[i] = (char) ((int... | true |
2299e711e2a35faa1677761e7578fcb001833237 | C++ | WIEQLI/stratton-chu-cpp | /cpp/stratton-chu-library/src/distorted-surface.cpp | UTF-8 | 3,738 | 2.9375 | 3 | [
"BSD-2-Clause"
] | permissive | #include "stratton-chu/distorted-surface.hpp"
#include <boost/math/special_functions/legendre.hpp>
using namespace boost::math;
double legendre(int num, double arg)
{
if (arg > 1.0)
return legendre_p(num, 1.0);
if (arg < -1.0)
return legendre_p(num, -1.0);
return legendre_p(num, arg);
}
... | true |
626110d9d8eb77fed20cae6745aa15c0958e3ff0 | C++ | kammitama5/AdvancedCpp | /Midterm_V2/Midterm_v2/Semester.h | UTF-8 | 636 | 2.5625 | 3 | [] | no_license | #ifndef SEMESTER_
#define SEMESTER_
#include "Date.h"
#include "Course.h"
#include "CourseSchedule.h"
#include "Semester.h"
using std::ostream;
using std::istream;
class Semester{
friend istream &operator>>(istream &, const Semester &); // overload >>
private:
std::string semesterName;
Date start... | true |
5face6c3f87d211bbb2a9f047e336c1dff974e04 | C++ | Spicy-Noodles-Studio/Ultimate-Ghost-Punch | /UltimateGhostPunch/Src/CameraEffects.h | UTF-8 | 820 | 2.578125 | 3 | [
"CC-BY-4.0"
] | permissive | #pragma once
#ifndef CAMERA_EFFECTS_H
#define CAMERA_EFFECTS_H
#include <UserComponent.h>
class Transform;
class CameraEffects : public UserComponent
{
private:
float max, min, current;
enum State { IDLE, FADEIN, FADEOUT, SHAKE };
State state;
Transform* mainCameraTransform;
Vector3 shakeDir;
Vector3 rotati... | true |
bda76e39fa75812aa37c56a2063bf6494bc0fab3 | C++ | MaximeEmonnot/TCP_Project | /ServeurChatRoom/TicTacToe/TicTacToe/MinMax.h | UTF-8 | 508 | 2.625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <iostream>
#define HIGHNUMBER 1000000000
class Node {
public:
Node();
~Node();
void UpdateBoard(int board[3][3]);
bool CheckVictory();
bool CheckDefeat();
public:
int value;
int coordonates[2];
int board[3][3];
bool finishingNode;
std::vector<Node> children;
};
clas... | true |
ca7caa5308735ccb95708cbba6b5c0035ef82817 | C++ | FaizBShah/Mission-Coding | /Rishika/695. Max Area of Island.cpp | UTF-8 | 1,014 | 3.328125 | 3 | [] | no_license | /*You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
The area of an island is the number of cells with a value 1 in the island.
Return the maximum area of an i... | true |
915829871c0b7ecdf922adccd4a65d2f24d336dd | C++ | antonxuanquang/ShellLab_OS | /tcush.cpp | UTF-8 | 1,837 | 3.28125 | 3 | [] | no_license | //*********************************************************
//
// PUT YOUR NAME HERE!!!!
// Operating Systems
// Project #1: Writing Your Own Shell: tcush
//
//*********************************************************
//*********************************************************
//
// Includes and Defines
//
//********... | true |
2d35ff504cfde3941f07befd710c92d229502e91 | C++ | Eunno-An/acmicpc.net | /1181 단어 정렬.cpp | UTF-8 | 891 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<queue>
#include<functional>
using namespace std;
struct forQ {
int stringSize;
string word;
};
bool operator<(const forQ& a, const forQ& b) {
if (a.stringSize == b.stringSize) {
return a.word > b.word;
}
return a.stringSize > b.stringSize;
}
int main() ... | true |
87e3a4cdc1d3c7abf6b03ef6485b7ddbd1586964 | C++ | AnTAVR/Kleos | /src/renderer/vulkan/instance.cpp | UTF-8 | 888 | 2.53125 | 3 | [] | no_license | void VulkanSetInstance(
VkInstance *inst,
VkInstanceCreateInfo *instInfo)
{
VkResult err;
err = vkCreateInstance(instInfo, nullptr, inst);
if (err == VK_ERROR_INCOMPATIBLE_DRIVER)
{
PAUSE_HERE("Cannot find a compatible Vulkan installable client driver "
"(ICD).\n\nPlease look at the Gett... | true |
02f80a393c554d5716644031c4eae41e01faffdb | C++ | KhanAjmal007/Data-Structures-and-Algorithms-Specialization-Coursera | /Course_1-Algorithmic_Toolbox/Week-1/Excercise_Challenges/1_sum_of_two_digits/APlusB.cpp | UTF-8 | 255 | 3.609375 | 4 | [] | no_license | #include <iostream>
using namespace std;
int sum_of_two_digits(int first_digit, int second_digit)
{
return first_digit + second_digit;
}
int main(void)
{
int a, b;
cin >> a >> b;
cout << sum_of_two_digits(a, b) << "\n";
return 0;
} | true |
9093999aa41d2154f93a22ffbec035159406a2df | C++ | Augustinetharakan12/My-Interview-Preps | /competitive-programming/arrays/2_find_missing_element_in_array_containing_numbers_from_1_to_n-1.cpp | UTF-8 | 1,007 | 3.421875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main() {
int limit, arr[100], i, front, half, end, loc, max, sum;
cout << "Enter the limit";
cin >> limit;
cout << "Enter "<<limit<<" numbers";
// Input the elements
for(i=0; i<limit-1; i++) {
cin >> arr[i];
}
//Method 1 - O(n)
for(i=1; i<=limit; i++) {... | true |
843bec59b46241394dd63224a6d2cfc15beb7525 | C++ | vjacquet/praxis | /xp/algebra.h | UTF-8 | 2,223 | 3.15625 | 3 | [
"MIT"
] | permissive | #ifndef __ALGEBRA_H__
#define __ALGEBRA_H__
#include "functional.h"
#include "fakeconcepts.h"
namespace xp {
template<typename T, BinaryOperation Plus, BinaryOperation Multiplies>
struct semiring {
typedef T value_type;
T value;
// conversion
semiring(const T& v) : value(v) {}
// Semiregular
semiri... | true |
e4456a4f08f997f7f06be24ed684bbd63910fd4e | C++ | xehoth/OnlineJudgeCodes | /BZOJ/BZOJ1137-Wsp岛屿-单调栈.cpp | UTF-8 | 3,599 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright (c) 2016-2018, xehoth
* 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 appl... | true |
f2323cef7456bad477220b3347569c30ecae57c0 | C++ | SilverHL/Leetcode | /376.摆动序列.cpp | UTF-8 | 831 | 2.90625 | 3 | [] | no_license | #include <vector>
using namespace std;
/*
* @lc app=leetcode.cn id=376 lang=cpp
*
* [376] 摆动序列
*/
// @lc code=start
class Solution {
public:
int wiggleMaxLength(vector<int>& nums) {
vector<int> vec;
if (nums.empty()) return 0;
vec.push_back(nums[0]);
for (int i = 1; i < nums... | true |
1470762d579c1f6e7a7e5b6e6537cbf3361480f9 | C++ | danielmonr/Estructura-de-datos | /EjercicioOrdenamiento1/EjercicioOrdenamiento1/main.cpp | UTF-8 | 2,121 | 3.4375 | 3 | [] | no_license | //
// main.cpp
// EjercicioOrdenamiento1
//
// Created by Daniel on 04/09/14.
// Copyright (c) 2014 Gotomo. All rights reserved.
//
#include <iostream>
#define N 10000
void print(int []);
void ordenamientoBurbuja(int v[], int n);
void ordenamientoInsercion(int numbers[], int n);
void ordenamientoSeleccion(int x[]... | true |
518accf1142de4104a7dec93520e87b47011148f | C++ | comexdll/skrt-skrt-kr | /skrrt-rust-external-main/classes/game_object_manager.hpp | UTF-8 | 2,006 | 2.875 | 3 | [] | no_license | #ifndef _GOM_HPP
#define _GOM_HPP
// includes for this header
#include "../utils/memory/memory.hpp"
// class for interacting with the gameobjectmanager
class GameObjectManager
{
public:
// constructor for this cssssslass
GameObjectManager()
{
if (!rust->mem) return;
this->gom_addr = rust->mem... | true |
d799d18e4592c96d05647b39ce8582f21ef6cba5 | C++ | Dyachuk2023/CPP-Learn | /Smart Pointers/Smart Pointers/Smart Pointer.cpp | ISO-8859-15 | 317 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
template<typename T>
class SmartPointr
{
public:
SmartPointr(T *ptr) { this->ptr = ptr; }
~SmartPointr() { delete ptr; }
T& operator*() { return *ptr; }
private:
T *ptr;
};
int main(void)
{
SmartPointr<int> pointer = new int(5);
return 0;
} | true |
4bfe290e46a0e0afec6271f81893b357de1eb1ae | C++ | Jack-Punter/Learning-OpenGL | /Learning OpenGL/src/test/Test.cpp | UTF-8 | 399 | 2.734375 | 3 | [] | no_license | #include "Test.h"
#include "imgui/imgui.h"
namespace test
{
Test::Test(Renderer* renderer)
: renderer(renderer)
{}
TestMenu::TestMenu(Test*& currentTestPtr, Renderer* renderer)
: CurrentTest(currentTestPtr), renderer(renderer)
{}
void TestMenu::OnImGuiRender()
{
for (auto& test : Tests)
{
if (ImGui... | true |
d1f73278b1416d02c925ca5162450d2decf4f0dc | C++ | Karunika/Taxi_Agency_OODB | /include/Shift.hpp | UTF-8 | 1,673 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
#include <cmath>
using namespace std;
class Shift{
private:
string customer_uuid;
string driver_in_charge_uuid;
string car_id;
int taxi_fare_amount;
int waiting_charges;
unordered_map<string, int> history_stats = {
{"ru... | true |
322a52e9274b3875581ebbb95afb1620002855aa | C++ | blockspacer/CIS505PennCloud | /PennCloud/FE_server/SMTP_external_to_bigtables.cc | UTF-8 | 27,202 | 2.65625 | 3 | [] | no_license | //-----------------------------------------------------------------------
// SMTP_EXTERNAL_TO_BIGTABLE
#include "SMTP_external_to_bigtables.h"
// global variables
vector<int> Client_fds;
//vector<FILE *> Read_Write_fds;
vector<pthread_t> Threads;
// vector<BigTable *> BIGTABLE_pts; // something wrong with string
char ... | true |
d69cadd07aaa865c5803dcaa56c38ccd17a4daf1 | C++ | ivchenko094/sse-math-lib | /math/src/Matrix.cpp | UTF-8 | 5,402 | 2.703125 | 3 | [] | no_license | #include "Matrix.h"
#include <stdio.h>
mathLib::Matrix3x3::Matrix3x3()
{
mmval[0] = _mm_setzero_ps();
mmval[1] = _mm_setzero_ps();
mmval[2] = _mm_setzero_ps();
}
mathLib::Matrix3x3::Matrix3x3(const __m128& _row0, const __m128& _row1, const __m128& _row2)
{
mmval[0] = _row0;
mmval[1] = _row1;
mmval[2] = _ro... | true |
950a1f1875da6f49014d3a84e2ddef39f4b64467 | C++ | dtn9797/myCourses | /Spring 2018/CSE1315/Lectures/lecture_06/06/month.h | UTF-8 | 378 | 2.84375 | 3 | [] | no_license | #ifndef __MONTH_H
#define __MONTH_H
#include <iostream>
using namespace std;
enum class Month {jan, feb, mar,
apr, may, jun,
jul, aug, sep,
oct, nov, dec};
std::string month_to_string(Month m);
Month& operator++(Month& m);
Month operator++(Month& m, int);
ostr... | true |
3f7a5314b5831fe7f80177e58c3cea95b52a9e69 | C++ | SwiftlyAside/JustC | /200317/Quiz.cpp | UTF-8 | 9,064 | 3.5625 | 4 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <conio.h>
// 두 수중 최댓값반환.
int evaluate(int su1, int su2) {
int max = su2;
if (su1 > su2)
max = su1;
return max;
}
// 두 수중 최솟값반환.
int min_evaluate(int su1, int su2) {
int min = su1;
if (su1 > su2)
min = su2;
return min;
}
void show_absolute_value(int su) {
if (... | true |
d48f28c8857f956357169771edddd5e0f6fab56b | C++ | Seretsi/Pencil_Rigger | /src/radiosity.cpp | UTF-8 | 13,517 | 2.703125 | 3 | [] | no_license | #include "glCanvas.h"
#include "radiosity.h"
#include "mesh.h"
#include "face.h"
#include "glCanvas.h"
#include "sphere.h"
#include "raytree.h"
#include "raytracer.h"
#include "utils.h"
// ================================================================
// CONSTRUCTOR & DESTRUCTOR
// =================================... | true |
4df7a6f5594792488693730da08b0d3e00cfcb53 | C++ | timothywangdev/Programming-Contests | /notebook/Math/Number Theory/ModularExponentiation.cpp | UTF-8 | 545 | 3.765625 | 4 | [] | no_license | /*
Modular Exponentiation
Computes (base^exp)MOD mod
*/
// O(log2(N))
LL pow_mod_base2(LL base, LL exp, LL mod){
LL rv=1;
base=base%mod;
while(exp>0){
if(exp&1){
rv=(rv*base)%mod;
}
exp>>=1;
base=(base*base)%mod;
}
return rv;
}
// O(log10(N))
// Useful when 'exp' is a big number
L... | true |
c66b5f42358dada51b613e093146ebd0428bb996 | C++ | BlinkingStar7/Problem_Solving | /Study/JongMan_Book/JON1/jlis.cc | UTF-8 | 945 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <limits>
using namespace std;
int C, N, M, Memo[102][102];
long long A[101], B[101];
int Solve (int a, int b) {
int &ret =... | true |
a298037ebdf2dadd8af0e56b371a900fa5178b3f | C++ | MichalRuminski/jippCw | /Cwiczenie2/tablica.cpp | UTF-8 | 2,270 | 2.96875 | 3 | [] | no_license | #include <cstdlib>
#include <ctime>
#include <iostream>
#include <cmath>
#include "tablica.h"
Tablica::Tablica() : Tablica::Tablica(10){
/*
this->n = 10;
this->wsk = new int[10];
if(this->wsk){
int i = 0;
while(i < this->n){
this->wsk[i] = 0;
i++;
}
... | true |
37a23e1548078e9e33cc424f0ec8024aa6b03144 | C++ | ziyuhuang/BankingSystem | /CheckingAccount.cpp | UTF-8 | 994 | 2.96875 | 3 | [] | no_license | //
// CheckingAccount.cpp
// BankingSystem
//
// Created by ZIYU HUANG on 11/27/16.
// Copyright © 2016 ZIYU HUANG. All rights reserved.
//
#include <stdio.h>
#include "CheckingAccount.h"
using namespace InvalidInput;
using namespace NotEnoughBalance;
CheckingAccount::CheckingAccount(int theId, float theBalance, ... | true |
e7152eb281b3b753985cde9f33ac9b8e798a86c6 | C++ | TheLastGimbus/cpu-fan-driver-arduino | /src/main.cpp | UTF-8 | 734 | 2.96875 | 3 | [] | no_license | #include <Arduino.h>
#define FAN_PIN 13
#define CYCLE_MS 1000
byte currentVal = 127;
void slowPWM(byte pin, byte value) {
int on = float(CYCLE_MS) * (value / 255.0);
int off = CYCLE_MS - on;
if (on > 0) {
digitalWrite(pin, 1);
delay(on);
}
if (off > 0) {
digitalWrite(pin, ... | true |
9419c6f3d0e8444898483a444bc3258191c53cff | C++ | ttrebuchon/BareBonesOS | /Utils/detail/BinaryTree.hh | UTF-8 | 3,151 | 2.96875 | 3 | [] | no_license | #ifndef INCLUDED_BINARYTREE_HH
#define INCLUDED_BINARYTREE_HH
namespace Utils { namespace detail
{
namespace binary_tree
{
template <class = void>
class _NodeBase
{
public:
size_t size;
mutable _NodeBase *left, *right, *parent;
_NodeBase();
};
typedef _NodeBase<void> NodeBase;
template ... | true |
e8b637e549e47d03b1224923a3b2432aa78cd556 | C++ | PLaceBos/Lab3.2 | /Journal.cpp | UTF-8 | 639 | 3.53125 | 4 | [] | no_license | #include "Journal.h"
Journal::Journal(string name1, int year1, int number1):Edition(name1, year1){
if(!SetNumber(number1))
number = 0;
}
Journal::Journal(){
number = 0;
}
Journal::Journal(const Journal &b){
name = b.name;
year = b.year;
number = b.number;
}
bool Journal::Set... | true |
77cdbfbfb83ffeead0851dcd837cc423bef981fe | C++ | nreynoldson/Text-Based-Survival-Game | /Beach.cpp | UTF-8 | 2,576 | 3.359375 | 3 | [] | no_license | /******************************************************************************
* Program Name: Final Project - Marooned - Beach Class Implementation File
* Date: 8/13/19
* Name: Nicole Reynoldson
* Description: Beach class allows strings to be passed in as parameters so
* that each beach space can be initialized... | true |
318466618f6ba1fd304add2e5e54c490813a30c7 | C++ | felixb/ardor | /ardor.ino | UTF-8 | 2,286 | 2.859375 | 3 | [
"MIT"
] | permissive | // inputs
const int BUTTON = 10;
const int GATE = 11;
const int GATE_OPEN = HIGH;
// outputs
const int LED_BUTTON = 13;
const int RELAY_CTRL = 8;
const int RELAY_OFF = HIGH;
const int RELAY_ON = LOW;
// consts
const int STATE_OFF = 0;
const int STATE_INIT = 1;
const int STATE_READY = 2;
const int STATE_OPEN = 3;
con... | true |
63ab55f7bf365e9e957fd609d710084939e99af5 | C++ | ChristopherBric/PROYECTO-01_Programaci-n_Orientada_a_Objetos_I | /main.cpp | UTF-8 | 1,524 | 2.578125 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <ctime>
#include <cstdlib>
#include <typeinfo>
#include "Funciones.h"
using namespace std;
int main() {
int Selec;
char M_ingles[7][7] = { {' ',' ','O','O','O'... | true |
749bae957cb09f24a944d2b6aa2a52c775ace9e3 | C++ | kimgibaam/Algorithm | /Baekjoon Online Judge/브루트 포스(n과m)/15666. n과m(12).cpp | UTF-8 | 656 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
int N, M;
vector<int> v;
vector<int> picked;
map<int, int> m;
void solve(int cnt, int idx) {
if (cnt == M) {
for (int i = 0; i < M; i++) {
cout << picked[i] << " ";
}
cout << "\n";
return;
}
for... | true |
9d2bbc65d8e8eb024744ff479663a05da42a1cff | C++ | xuyouchun/skyever | /SkyJs/DBLLIST.CPP | UTF-8 | 3,462 | 3.09375 | 3 | [] | no_license | #include "DblList.h"
DblList::DblList()
{
this->Begin = NULL;
this->Point = NULL;
this->Count = 0;
}
DblList::~DblList()
{
ListItem *p = Begin;
while(p!=NULL)
{
ListItem *p0 = p->next;
delete p;
p = p0;
}
}
void DblList::Delete(void *ptr)
{
ListItem *p = this->Begin;
whil... | true |
a39c61ec8a566a383a5844ea7ea893fed5bf5b0a | C++ | Falcons-Robocup/code | /tools/multiCamCalibrate/src/optiCalMain.cpp | UTF-8 | 2,086 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | /*
* optiCalMain.cpp
*
* Optical Calibration.
* Command-line utility to calibrate a multiCam assembly (camera 0,1,2,3 in sequence).
* Result is a set of binary calibration files in the data repo, which should then be configured to load from multiCam at init time.
*
* Created on: May 2018
* Author: Jan F... | true |
8d0aab7bd7c98da0584aa2db2ca5fd3b70065f6d | C++ | finnff/se | /week4/match.hpp | UTF-8 | 519 | 3.15625 | 3 | [] | no_license | #ifndef _MATCH_HPP
#define _MATCH_HPP
#include <iostream>
// a match found in the previously processed characters:
// the start offset (negative), and the number of characters
struct match {
int offset;
int length;
match(int offset = 0, int length = 0) : offset(offset), length(length) {}
friend std::ostream... | true |
f121f8b5c3397593624a1bcff05aac8d4386097e | C++ | waynehpc/SWCompiler | /src/codegen/utils/image.h | UTF-8 | 2,988 | 3.21875 | 3 | [] | no_license | /*************************************************************************
> File Name: image.h
> Author: wayne
> Mail:
> Created Time: 四 1/24 15:15:53 2019
************************************************************************/
#include <algorithm>
#include <fstream>
#include <iostream>
#include <... | true |
80ae7ae71e02e7f51da914d3e8b0b13e19da2a0c | C++ | Alburgerto/ECS | /CCollider.h | UTF-8 | 1,238 | 2.765625 | 3 | [] | no_license | #pragma once
#include "Component.h"
class SystemManager;
enum class Direction { Left, Right, Up, Down };
// Holds information about AABB (collision box) of entity to have collision with other entities with collider components.
// Intersection checking happens @ SCollider
class CCollider : public Component {
... | true |
6af1d62caafa5c3584132bba30e39b9727b3af3e | C++ | pnyennhi/arduino | /wifi_station.ino | UTF-8 | 2,644 | 2.625 | 3 | [] | no_license | #include "FirebaseESP8266.h"
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#define FIREBASE_HOST "arduino-8c50c.firebaseio.com"
#define FIREBASE_AUTH "J7zkUrrpTavPoK2JohrHWx2x6YGdOqeSOpNn0q5j"
#define WIFI_SSID "Dong123"
#define WIFI_PASSWORD "123456777"
SoftwareSerial NodeMCU(D2,D3);
//Define Firebase... | true |
86b6d157271c59bd8f3fa0b007c3a605031812a7 | C++ | CGSkill/workbook | /TestV4L2/videodevice.cpp | UTF-8 | 7,256 | 2.859375 | 3 | [] | no_license | #include "videodevice.h"
videodevice::videodevice()
{
this->fd = -1;
this->iCount = 4;
this->iIndex = -1;
this->buffers = nullptr;
}
videodevice::~videodevice()
{
}
int videodevice::open_device()
{
this->fd = open(DEVICE_NAME,O_RDWR,0);
if (-1 == this->fd){
perror("open error");
... | true |
14ec9da0a20f3b352c654ff1af9d05fc564b2f84 | C++ | Life75/DSA2-Project2-AWashington | /main.cpp | UTF-8 | 4,616 | 3.140625 | 3 | [] | no_license | #include "Customer.hpp"
#include "Heap.hpp"
#include "Statistics.hpp"
#include<sstream>
#include<ctime>
#include <queue>
#include <cstdlib>
#include <cmath>
double getNextRandomInterval(double avg);
/*************************************************************************************
Main is the combin... | true |
e2bf5379892a50d364b5213b98768c0bae0bc695 | C++ | bergendenton/MyFirstCplus | /While-HW3.cpp | UTF-8 | 190 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
main(){
int x=1;
int z=0;
while (x<41){
z=z+x;
x++;
}
cout << "count the sum of numbers from 1 to 40 is " << z << endl;
return 0;
}
| true |
2581809efc622f4e0168e706530671e8982132a7 | C++ | Izidorf/EMBEDDED-Projects | /Mouse/src/main.cpp | UTF-8 | 2,381 | 2.65625 | 3 | [] | no_license | #include "USBDevice.h"
#include "USBMouse.h"
#include "MMA8451Q.h"
#include "TSISensor.h"
PinName const SDA = PTE25;
PinName const SCL = PTE24;
#define MMA8451_I2C_ADDRESS (0x1d<<1)
DigitalOut led_red(LED_RED);
DigitalOut led_green(LED_GREEN);
DigitalIn left(SW1);
DigitalIn right(SW3);
Serial pc(USBTX, U... | true |
07dfb805f5149253284b360f154f380f40d42fa1 | C++ | hackerxj007/Confidential-Laboratory | /Virtualization/zjc/code/MacDetect.cpp | GB18030 | 2,563 | 2.5625 | 3 | [] | no_license | #include "stdafx.h"
#include<wtypes.h>
#include<nb30.h>
#include<wincon.h>
#pragma comment(lib,"netapi32.lib")
using namespace std;
typedef struct _ASTAT_ //ϢĽṹ
{
ADAPTER_STATUS adapt; //״̬
NAME_BUFFER NameBuff[30]; //ֱ
} ASTAT, *PASTAT;
void get_3part_mac(string &mac)
{
NCB Ncb; //һNCBƿ飩͵ĽṹNcb
ASTAT Adapter;
UCHA... | true |
16d5aab1794f799e1c0123d89a0bf556ba0bed52 | C++ | ongxx107/FlashPhoto | /PROJ/src/imagetools/convolution_filter_edge.h | UTF-8 | 1,053 | 2.625 | 3 | [] | no_license | /**
This file is part of the CSCI-3081W Project Support Code, which was developed
at the University of Minnesota.
This code is to be used for student coursework. It is not an open source
project.
Copyright (c) 2015-2018 Daniel Keefe, TAs, & Regents of the University of
Minnesota.
Original Author(s) of this File:
S... | true |
463463d8e7a5595a07bebcfaafb375e4d5c96aea | C++ | paulgraydon/Qt2048 | /game.h | UTF-8 | 584 | 2.921875 | 3 | [] | no_license | #ifndef GAME_H
#define GAME_H
#define WIN_VALUE 2048 // Define macro for winning value
#include "board.h"
class Game
{
public:
Game(int rowCount = 4, int colCount = 4);
~Game();
void restartGame(); // Reset the whole game
Board* getGameBoard() const {return gameBoard;}
void move(Direction dir); ... | true |
8c79487eada32096c13234383489ab3e02f53a04 | C++ | exced/dataStructures | /channel_test2.cc | UTF-8 | 942 | 2.890625 | 3 | [] | no_license | //
// channel_test.cc
// channel
//
// Created by Thomas BARRAS on 17-05-04.
// Copyright © 2017 Exced. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <iostream>
#include <string>
#include <future>
#include <thread>
#include "channel.h"
static const int kQuit = 0;
... | true |
b6ab1502258b5691267649935288175094cf18a2 | C++ | edelkas/opengl | /src/Texture.cpp | UTF-8 | 2,624 | 3.109375 | 3 | [] | no_license | #include "Texture.h"
#include "stb_image/stb_image.h"
Texture::Texture(const std::string& filepath)
: m_FilePath(filepath), m_LocalBuffer(nullptr), m_Height(0), m_Width(0), m_BPP(0)
{
/**
* Load image.
*
* - Flip because OpenGL expects origin to be at the bottom.
* - stbi_load will also set the member ... | true |
f03d9517e65c3c17fb6b62f352ffb43a32f8a892 | C++ | inql/OnePass | /src/field.cpp | UTF-8 | 3,013 | 3.125 | 3 | [
"Unlicense"
] | permissive | #include "onepass/field.hpp"
#include <iostream>
#include "onepass/no_property_set_exception.hpp"
namespace onepass
{
namespace core
{
std::ostream &operator<<(std::ostream &os, const Field &field)
{
if (field.history_.empty())
throw no_property_set_exception();
os << field.history_.b... | true |
e4a1ef55a3a131a89d327195ef428649c1f3efee | C++ | wrxcode/primer | /16.6.cpp | UTF-8 | 688 | 3.1875 | 3 | [] | no_license | /*************************************************************************
> File Name: 16.6.cpp
> Author:
> Mail:
> Created Time: 2016年03月11日 星期五 19时33分18秒
************************************************************************/
#include<iostream>
#include<vector>
#include<list>
#include<string>
using namespa... | true |
1f53bf8d2b56c46c38b54f86c6ab64e3d4d54661 | C++ | WhalesAreNice/IGME309-2196 | /E05_TranslationAndScale/AppClass.cpp | UTF-8 | 3,262 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "AppClass.h"
void Application::InitVariables(void)
{
//init the mesh
m_pMesh = new MyMesh();
m_pMesh->GenerateCube(1.0f, C_YELLOW);
//m_pMesh->GenerateSphere(1.0f, 5, C_WHITE);
}
void Application::Update(void)
{
//Update the system so it knows how much time has passed since the last call
m_pSystem->Updat... | true |
3397e4b2e9f9fe57dcfea70ce33fada09a738857 | C++ | capcaz99/EncuentroANUIES | /funcionesEnviar/funcionesEnviar.ino | UTF-8 | 1,704 | 2.53125 | 3 | [] | no_license | //Función que envía datos al OCB
void enviarDatos(int magnitud){
Process p;
p.begin("curl");
p.addParameter("-H");
p.addParameter("\"Content-Type: application/json\"");
p.addParameter("-X");
p.addParameter("PUT");
p.addParameter("-d");
json = "\"{\"v... | true |
ffb95c603bd805cf36683bec2043c55cc4b3becd | C++ | maniSHarma7575/Code_Mystery | /codeforces/894a.cpp | UTF-8 | 375 | 2.640625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
string str;
cin>>str;
int n=str.length();
int dp[n];
if(str[0]=='Q')dp[0]=1;
else dp[0]=0;
for(int i=1;i<n;i++){
if(str[i]=='Q'){
dp[i]=dp[i-1]+1;
}
else{
dp[i]=dp[i-1];
}
}
int count=0;
for(int i=1;i<n-1;i++){
if(str[i]=='A'){
count+=d... | true |
98de0cfdd909a3b2f508869270634f82979c062f | C++ | huangwei0/20_cs325 | /hw1/mergesort.cpp | UTF-8 | 1,676 | 3.328125 | 3 | [] | no_license | /************************************
Project: mergesort.cpp hw1
Name : Wei Huang
Course: cs 325
Data:winter 2020
*************************************/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
... | true |
2f00c3aa15580017ed10d13871601b93dc2fb4cf | C++ | HoangNam666/Nam | /baitap9(1).cpp | UTF-8 | 704 | 2.796875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
bool ktchuoi(char a[][100],unsigned int c,char b[]){
for (int i=0;i<c;i++){
int z=0,max=0;
for (int j=0;j<strlen(a[i]);j++){
if (a[i][j]==b[z]){
z++;
if (z>max){
max=z;
}
} else {
z=0;
}
}
if (max==strlen(b)){
return true;
}
}
return f... | true |
01d05839e32cf690ee78f9edce034c4ac37714e2 | C++ | morishitamakoto0330/AtCoder | /AtCoderBeginnerContest/049/b.cpp | UTF-8 | 697 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int i, index;
int H, W, new_H;
string s_tmp;
vector<string> C, new_C;
// get input ---------------------------------
cin >> H >> W;
new_H = H*2;
for(i = 0; i < H; i++) {
... | true |
f053dd5168c52022d5136bd9ecf09b5d2872f554 | C++ | bobzhw/question | /question/reorderlist.cpp | GB18030 | 1,274 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<vector>
//L0->L1->L2->L3->...->Ln-1->Ln
//L0->Ln->L1->Ln-1->L2->Ln-2->...
using namespace std;
//Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
void reorderList(ListNode *head) {
if (he... | true |
68b459d65c877a35c383d9f99ea48db18d6e5384 | C++ | gabrieltaets/Competitive-Programming | /uri/1259.cpp | UTF-8 | 426 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
vector<int> par, impar;
scanf("%d",&N);
while(N--){
int x;
scanf("%d",&x);
if(x&1) impar.push_back(-x);
else par.push_back(x);
}
sort(par.begin(),par.end());
sort(impar.begin(),impar.end());
for(int i = 0; i < par.size(); i... | true |
42e0a557d23068bda11b3ed90ccc86599651197b | C++ | vilashkardate/DSA_Sheet | /Array/29_Trapping_Rain_Water.cpp | UTF-8 | 1,250 | 3.921875 | 4 | [] | no_license | #include <iostream>
using namespace std;
int max(int x, int y) {
return (x > y) ? x : y;
}
int min(int x, int y) {
return (x < y) ? x : y;
}
// Function to find the amount of water that can be trapped within
// a given set of bars in linear time and extra space
int trap(int bars[], int n)
{
// base cas... | true |
5225c8b670d217034c6eda2f2838dba79e19786d | C++ | Maciej3206/university-db-1 | /Menu.cpp | UTF-8 | 6,811 | 3.203125 | 3 | [] | no_license | #include "Menu.hpp"
void Menu::showMenu() const {
std::cout << "*************************************" << '\n';
std::cout << "****** UNIVERSITY-DB DATABASE *******" << '\n';
std::cout << "*************************************" << '\n';
int lp = 0;
for (const auto& option : options_) {
... | true |
b3313393e90551860e8efabe930259101ab814cf | C++ | rishup132/My-Codes | /spoj/MAXSC.cpp | UTF-8 | 645 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n,x;
cin >> n;
vector <int> v[n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin >> x;
v[i].push_back(x);
}
sort(v[i].begin(),v[i].end(),greater<int>());
}
ll... | true |
6a6105fb03183a25065a5753cd19582fd2359638 | C++ | whocloud/start | /EP/EP205.cpp | UTF-8 | 526 | 2.734375 | 3 | [] | no_license | /*************************************************************************
> File Name: EP205.cpp
> Author:
> Mail:
> Created Time: 2018年11月24日 星期六 09时38分31秒
************************************************************************/
#include<stdio.h>
int gcd (int a, int b) {
return (b ? gcd(b, a % b) : a);
}... | true |
c691fe65c720f8b9701ccdc0ccbd6629a2f1c589 | C++ | mdyang/oj-solutions | /nyist/52/main.my.cpp | UTF-8 | 598 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <map>
using namespace std;
typedef unsigned long long ull;
int ten[6] = {1,10,100,1000,10000,100000};
int mulmod(ull a, ull b, int c){
return (a*b)%c;
}
int main(){
ull c;
cin>>c;
while(c--){
int n,k;
map<int,int> s;
cin>>n>>k;
n%=ten[k];
... | true |
1712a4a65c008668d5e006ce02d64bc51dc356ef | C++ | jetzoc/Portenta-Tests | /ADC_DAC_Tests/dac_to_adc_loopback_ramp_test/dac_to_adc_loopback_ramp_test.ino | UTF-8 | 2,094 | 3.125 | 3 | [] | no_license | /*
* DAC to ADC loop test for the Portenta board
* - 12 bit resolution for DAC
* - 12 bit resolution for ADC
* - Uses a software generated signal that outputs the full 12-bit range of DAC
- Ramp with a step size
* - Has AREF pin connected to 3.3V
*
* Hardware set-up:
* A0 = analog i... | true |
8562048487e6ffad993514ea22e527ec53a1b1e9 | C++ | mmarkiewicz/sequenceLibrary | /Sequence/Callbacks/Smap.h | UTF-8 | 717 | 2.71875 | 3 | [] | no_license | #ifndef _SEQUENCE_CALLBACK_SMAP_H_
#define _SEQUENCE_CALLBACK_SMAP_H_
#include <utility>
#include <memory>
#include "Sequence/Sequence.h"
namespace seq
{
template <typename S, typename T>
class Smap : public Type<T>::SimpleCallback
{
public:
typedef std::function<T(S)> fType;
typename Type<T>::... | true |
1afcff74e9ec782d08e933542e6f44e8b3398da4 | C++ | yaominzh/CodeLrn2019 | /mooc40-bobo-Interview/Play-with-Algorithm-Interview-master/03-Using-Array/cpp/05-Sort-Colors/main.cpp | UTF-8 | 1,155 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <vector>
#include <cassert>
using namespace std;
// 75. Sort Colors
// https://leetcode.com/problems/sort-colors/description/
//
// 计数排序的思路
// 对整个数组遍历了两遍
// 时间复杂度: O(n)
// 空间复杂度: O(k), k为元素的取值范围
class Solution {
public:
void sortColors(vector<int> &nums) {
int count[3] = {0};... | true |
bd3172b61901b9728a70f4f6bc9b46f542e31a53 | C++ | LiunxPaisley/Cpp_Primer | /Chapter 17. Specialized Library Facilities/17.3. Regular Expressions/regular_expression.cpp | UTF-8 | 2,579 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <regex>
using namespace std;
bool valid(const smatch& m) {
if (m[1].matched) {
return m[3].matched && (m[4].matched == 0 || m[4].str() == " ");
}
else {
return !m[3].matched && m[4].str() == m[6].str();
}
}
int main() {
/*regex使用*/
cout << "... | true |
5f68bdf90e5a08f3cabc91a41ffacdadb01cd570 | C++ | cnrkaya/EGUI-21L-Kaya-Caner | /lab1/mainwindow.cpp | UTF-8 | 8,139 | 2.5625 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "recipedialog.h"
#include "recipe.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowTitle("Recipe Planner");
initializeRecipeTableView();
initializeNeedLi... | true |
e0cfe4e92cd200cfc996b91759e2d006dad69462 | C++ | sarainigo/Chess_Game_Project | /pieza.hpp | UTF-8 | 3,160 | 2.5625 | 3 | [] | no_license |
// pieza.hpp
// trabajo ajedrez prueba
//
// Created by Sara Íñigo on 10/5/16.
// Copyright © 2016 Sara Íñigo. All rights reserved.
//
#ifndef pieza_hpp
#define pieza_hpp
#include <stdio.h>
class Casilla;
/* pieza_hpp */
#include<string>
#include <stdlib.h>
#include <stdio.h>
#include<iostream>
using namespa... | true |
022e6f05eea045fd0a86dc1cb0b692a7094e6b61 | C++ | ChoiWooCheol/LaneChange-Manager | /lanechange_manager/include/lanechange_manager_state.hpp | UTF-8 | 5,061 | 2.84375 | 3 | [] | no_license | #ifndef __LANECHANGE_MANAGER_STATE__
#define __LANECHANGE_MANAGER_STATE__
#include <map>
#include <vector>
#include <string>
enum STATE
{
FOLLOW,
NEED_LANE_CHANGE,
CHECK_NEXT_LANE,
EXCUTE_LANE_CHANGE,
LANE_CHANGE_DONE
};
/* transition
* not_need_lane_change
* received_global_path
* la... | true |
3e5b1e7e3790048d4118a0a7d4b56e803e802461 | C++ | schets/fast_rng | /bench.cpp | UTF-8 | 3,014 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <time.h>
#include "xorshift.hpp"
constexpr static size_t num_loop = 1e8;
constexpr static int num_work = num_loop;
using namespace std;
template<class seeder>
void seed_rn(seeder &rn) {
rn.seed(0xdeadbeef, 0xcafebabe);
}
//this forces the compiler to actually
//do the full... | true |
5a3b4b46c66d39b4aacead306d141c7d05851eaf | C++ | dlsyj/AlgoPrac | /CiCT/C++/align_malloc.cpp | UTF-8 | 737 | 3.0625 | 3 | [] | no_license | //
// align_malloc.cpp
// Algorithms
//
// Created by WangJZ on 14-3-20.
// Copyright (c) 2014年 WangJZ. All rights reserved.
//
/*
13.9编写支持对其分配的 malloc和free函数,分配内存时,malloc函数返回的地址必须能被2的n次方整出。
*/
#include "cict_c++.h"
void *align_malloc(size_t alignment,size_t byte_needed){
void *p1;//申请的指针
void **p2;/... | true |
e035790c22a269cfb7b80208627a8ce16b5739ce | C++ | dev-embedded/juequ | /cpp_primer5/ch1/1-10.cc | UTF-8 | 289 | 3.03125 | 3 | [] | no_license | // <<C++ Primer 5th Edition>> by Stanley B. Lippman - Aug2012
// Page 39 (pdf, -25), Chapter 1,
// Exe. 1.10
#include <iostream>
int main()
{
std::cout << "Print the numbers from ten down to zero: " <<std::endl;
int i=10;
while(i>=0)
std::cout << i-- <<", ";
std::cout << std::endl;
return 0;
}
| true |
1f849b5e461b13d25ed38e4ff84c3860d7982ac8 | C++ | AnYelg/Tienda_digital | /Dog.cpp | UTF-8 | 662 | 3.171875 | 3 | [] | no_license | #include "Dog.h"
Dog::Dog()
{
setSize(12);
setAge(2);
setColor(color);
setType("corgi");
setPrecio(10);
}
Dog::Dog(int theSize, int theAge, Color theColor, string theType)
{
setSize(theSize);
setAge(theAge);
setColor(theColor);
setType(theType);
setPrecio(10);
}
void Dog::setTyp... | true |
8b8afd334a21461ceec9596d35caf1e88470126a | C++ | mhyeun/simon-says | /code/simonsays.cpp | UTF-8 | 6,204 | 2.890625 | 3 | [] | no_license | #include "PC_FileIO.c"
const int MAX_SIZE = 30;
//welcome message
void welcomeMessage()
{
displayCenteredBigTextLine(2, "WELCOME");
displayCenteredBigTextLine(4, "TO");
displayCenteredBigTextLine(6, "SIMON SAYS!");
displayCenteredBigTextLine(8, "860");
displayString(14, " PRESS ANY BUTTON TO BEGIN.... | true |
e262b8e592d65edabb8207bb2436c77c68e791f0 | C++ | Taoaoxiang/PracticeLeetCode | /Problems/0KXXX/0K0XX/0K07X/No_70_Climbing-Stairs.cpp | UTF-8 | 950 | 3.734375 | 4 | [] | no_license | //You are climbing a stair case.It takes n steps to reach to the top.
//
//Each time you can either climb 1 or 2 steps.In how many distinct ways can you climb to the top ?
//
//Note : Given n will be a positive integer.
//
// Example 1 :
//
// Input : 2
// Output : 2
// Explanation : There are two ways to climb to the ... | true |
9341f21ced0e3a2e5415ae2f0c36e3b385439fcb | C++ | nnard1616/HackerRankSolutions | /cpp/Custom_Datastructures/Priority_Deque.hpp | UTF-8 | 2,344 | 3.15625 | 3 | [] | no_license | //
// Created by Nathan Nard on 12/19/18.
//
#ifndef CPP_PRIORITY_DEQUE_HPP
#define CPP_PRIORITY_DEQUE_HPP
#include <bits/stdc++.h>
#include "../common/common.hpp"
namespace common {
template<class Comparable>
class Priority_Deque {
private:
int maxSize;
deque<Comparable> unsortedOrder;
... | true |
7aea40ffba2816a45a7883e8e145f8712c03b200 | C++ | OMWi/oaip-1sem | /Лабы/LR5/dop2(ne nado)/File1.cpp | UTF-8 | 1,497 | 2.921875 | 3 | [] | no_license | #pragma hdrstop
#pragma argsused
#include <iostream>
#include <conio.h>
#include <ctime>
using namespace std;
float **Create(int line, int col)
{ float **arr = new float *[line];
for (int i = 0; i < line; i++) {
arr[i] = new float [col];
}
return arr;
}
void Delete(float **arr, int line)
{ for (int i = 0; i... | true |
314e55d194b869297acd64891c99f05d3e0707cf | C++ | kunhuicho/crawl-tools | /codecrawler/_code/hdu1040/16207629.cpp | UTF-8 | 1,394 | 2.828125 | 3 | [] | no_license | /*
* hdu-1040
* mike-w
* 2012-4-14
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_SIZE 1024
#define HEAP_SIZE 2048
#define LC(X) (2*(X))
#define RC(X) (2*(X)+1)
#ifndef true
#define true 1
#endif
int heap[HEAP_SIZE];
int N,T;
int swap(int *e1, int *e2)
{
int tmp=*e1;
*e1=*e2;
*... | true |
0a0e522feeda560d2a81f2f1e03d1259894526d3 | C++ | MarDPop/rocket | /project/SingleStage/src/proto/src/WindHistory.cpp | UTF-8 | 1,866 | 2.921875 | 3 | [] | no_license | #include "../include/WindHistory.h"
#include <iostream>
#include <fstream>
#include <string>
#include "../../common/include/util.h"
WindHistory::WindHistory() {
this->wind.zero();
}
WindHistory::~WindHistory() {}
void WindHistory::load(std::string fn) {
std::ifstream file(fn);
if(!file.is_open()) {
... | true |