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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a738ae690bc2c692a80c721fa5ecdede8582ba47 | C++ | vrcordoba/Klondike | /src/controllers/SaveController.hpp | UTF-8 | 936 | 2.65625 | 3 | [] | no_license | #ifndef CONTROLLERS_SAVECONTROLLER_HPP_
#define CONTROLLERS_SAVECONTROLLER_HPP_
#include <string>
#include "Controller.hpp"
#include "OperationController.hpp"
namespace Models
{
class Game;
class Pile;
}
namespace Utils
{
class PermanentMediumWriter;
}
namespace Controllers
{
class OperationControllerVisitor;
cla... | true |
f7f0fb94b28dde780749f36428e3dfd86e1b3f71 | C++ | shindj1219/algorithm | /Longest_Substring/my_answer.cc | UTF-8 | 785 | 3.15625 | 3 | [] | no_license | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int max_length{0};
std::string temp;
std::vector<char> char_arr;
while(!s.empty()) {
auto c{s.at(0)};
for(auto iter = char_arr.begin(); iter!=char_arr.end(); iter++) {
if(*iter == c) {
... | true |
604100092c0d6f59b6659dd1d127c16403226ee5 | C++ | alexandraback/datacollection | /solutions_5695413893988352_1/C++/carlop/B.cpp | UTF-8 | 2,920 | 2.734375 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <assert.h>
#include <set>
using namespace std;
int number_of_inversion(const string & S) {
int c=0;
for (int i=1; i<S.size(); i++) if (S[i] != S[i-1]) c++;
retur... | true |
a2c834cc240409330ee870a3058db34169a8d214 | C++ | ponxosio/EvoCoder | /src/protocolGraph/ConditionEdge.h | UTF-8 | 2,677 | 2.59375 | 3 | [
"BSL-1.0"
] | permissive | /*
* ConditionEdge.h
*
* Created on: 15 de mar. de 2016
* Author: angel
*/
#ifndef SRC_FLUIDCONTROL_PROTOCOLGRAPH_CONDITIONEDGE_H_
#define SRC_FLUIDCONTROL_PROTOCOLGRAPH_CONDITIONEDGE_H_
//boost
#include <memory>
//local
#include "../graph/Edge.h"
#include "../util/Utils.h"
#include "../operables/comparis... | true |
0d838762e9801461e04903385f796588e27f9000 | C++ | fanzcsoft/wxExtension | /extension/src/cmdline.cpp | UTF-8 | 6,711 | 2.546875 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
// Name: cmdline.cpp
// Purpose: Implementation of wxExCmdLine class
// Author: Anton van Wezenbeek
// Copyright: (c) 2018 Anton van Wezenbeek
////////////////////////////////////////////////////////////////////////////////
#inc... | true |
fbea67df2862ccdb26591fa810fef0c5d4a04864 | C++ | adamap/code-test2 | /28strtstr.cpp | UTF-8 | 687 | 3.671875 | 4 | [] | no_license | //Implement strStr().
//
//Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
//
//
class Solution {
public:
int strStr(string haystack, string needle)
{
for ( int i = 0; i <= (int)(haystack.size()-needle.size()); i++)
{
i... | true |
06edf0e9df0744d51f56d38282c5998c7f1376e8 | C++ | drzaal/flippy-board | /SourceArt/ArduinoFirmware/flippyBoard/flippyBoard.ino | UTF-8 | 2,225 | 3.09375 | 3 | [] | no_license | /* Flippy Board
* Global Game Jam 2017
*/
// Characters to send over serial to cause different button flash actions
const int MODE_ATTRACT = 0; // A
const int MODE_OFF = 1; // 0
const int MODE_ON = 2; // 1
const int MODE_DIE = 3; // X
const int MODE_WIN = 4; // W
int led = 9;
int brig... | true |
ed173114ab7a3612e124698dba7bc830758ca1e5 | C++ | emrekavak/CSE241-OOP_HomeWorks | /hw5/connectfourplusundo.h | UTF-8 | 1,817 | 2.859375 | 3 | [] | no_license | //This file is the file connectfourplusundo.h
//This is the interface for the class ConnectFourPlusUndo
#ifndef CONNECTFOURPLUSUNDO_H
#define CONNECTFOURPLUSUNDO_H
#include "connectfourplus.h"
#include "connectfourabstract.h"
#include<vector>
namespace ConnectFour{
class ConnectFourPlusUndo : public ConnectF... | true |
d712deb89b29e8e7ab25f019f89562afc6891bfa | C++ | Rosovskyy/HeatConductivity | /headers/matrix.h | UTF-8 | 1,834 | 3.484375 | 3 | [] | no_license | #ifndef HEATCONDUCT_MATRIX_H
#define HEATCONDUCT_MATRIX_H
#include <algorithm>
class Matrix {
private:
double *matr = nullptr;
int cols;
int rows;
public:
Matrix(int rows, int cols){
this->rows = rows;
this->cols = cols;
matr = new double[rows*cols];
}
double* getRowCopy... | true |
9fe1dcde50ffa23249258ac40acc18f303a64e13 | C++ | accountFlp/0223 | /test/EventLoopThread_test.cpp | UTF-8 | 689 | 2.65625 | 3 | [] | no_license | #include "mEventLoopThread.h"
void test(){
std::cout<<"test"<<std::endl;
}
int main(){
std::cout<<BASE::getCurrentPthreadID()<<std::endl;
net::mEventLoopThread t1,t2,t3;
net::EventLoop *ev1=t1.startLoop();
net::EventLoop *ev2=t2.startLoop();
net::EventLoop *ev3=t3.startLoop();
ev1->runInThre... | true |
8dac554ad340bd9a7eca4385bf8807255ac93f31 | C++ | isthatalex/semestral_work | /src/CWall.cpp | UTF-8 | 539 | 2.75 | 3 | [] | no_license | //
// Created by alexz on 5/8/18.
//
#include "CWall.h"
#include <iostream>
int CWall::cnt = 0;
CWall::CWall(const char *textureName, int x, int y, int w, int h) : CGameObject(textureName, x, y, w, h) {
}
void CWall::collideWith(CHero &x) {
x.setxVel() = 0;
x.setyVel() = 0;
std::cout << "Collision wall!... | true |
84fc020903749243496438a8f82d88eeb25ad67a | C++ | gpeal/Arduino | /libraries/ChLCD_MCP2300x/examples/HelloWorld/HelloWorld.ino | UTF-8 | 1,581 | 2.84375 | 3 | [] | no_license | /*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World... | true |
df78cb68d994af1557102a3950f20da34eca09d9 | C++ | yyyeader/ACM | /HDU/HDU 2993 MAX Average Problem(斜率DP经典+输入输出外挂).cpp | WINDOWS-1252 | 934 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#include<algorithm>
#include<stdio.h>
using namespace std;
const int N=1e5+5;
int q[N],head,tail;
long long sum[N];
double Slope(int k,int j){
return double(sum[j]-sum[k])/(j-k);
}
//
const int BUF=25000000;
char Buf[BUF],*buf=Buf;
template <class T>
inline void read(T &a){
for... | true |
6d2217db5acbaf0f4181895cece497e5b37743c3 | C++ | Seledriac/Aeroport | /src/Implementations/Passager.cpp | UTF-8 | 5,455 | 2.875 | 3 | [] | no_license | // Auteurs : Tom BOUMBA et Antoine Zaug, promo L3 info à la FST de l'université de Limoges
#ifndef Passager_H_
#include "../Headers/Passager.hpp"
#endif
#ifndef Reservation_H_
#include "../Headers/Reservation.hpp"
#endif
#ifndef Vol_H_
#include "../Headers/Vol.hpp"
#endif
#include <iostream>
#include <fstream>
lis... | true |
73857734915435e04df57e0c3c5bae3427994b18 | C++ | johnsonj/SimplyAcademic | /PrimitiveTypes/PrimitiveTypes.cpp | UTF-8 | 5,530 | 3.171875 | 3 | [] | no_license | #include "stdafx.h"
#include<cmath>
#include<functional>
#include<iostream>
#include "TestSuite.h"
#define CHAR_BIT 8
/*******************************************
* Parity of a integer value
* Even parity: 1011 = 1, 1001 = 0
******************************************/
// This won't ever finish. sizeof(unsigned in... | true |
1fe01141f7b5a6dadf2cb5cbb202c77361a3b6b3 | C++ | Xuloh/set09121-project | /src/Tilemap.h | UTF-8 | 2,738 | 2.90625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <SFML/Graphics.hpp>
#include <string>
#include <memory>
#include <unordered_map>
#include <string>
#include <vector>
#include <Box2D/Box2D.h>
namespace tilemap {
// the different kinds of tiles
enum Tile {
EMPTY = ' ',
START = 's',
END = 'e',
WALL = 'w',
... | true |
fe44dc8f1975069625559d7eca90d9d927b51684 | C++ | joemulray/171-172 | /171/CS 171 HW 5/CS 171 HW 5/main.cpp | UTF-8 | 6,335 | 2.859375 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <fstream>
using namespace std;
void introduction(istream &is, ostream &os, string target, string replacement)
{
string data,instruct;
cout<<"Do you want instructions (y/n): ";
os<<"Do you want instructions (y/n): ";
... | true |
56e88319f9be8081e6e7fccbfb0847a450e6aa67 | C++ | 7phalange7/CP_Templates | /Sorting and Searching/Heap Sort.cpp | UTF-8 | 2,033 | 3.78125 | 4 | [] | no_license | // HEAP SORT
// Time Complexity - O (N * logN)
// Space Complexity - O(1)
// Stability - Unstable ( Only Quick, Selection, Heap are unstable, rest all are stable )
#include <bits/stdc++.h>
using namespace std;
// To heapify a subtree rooted with node i which is
// an index in a[]. n is size of heap
void heapify(int... | true |
73ad4f67245aa1da7bc36dfd70893683cb7e9625 | C++ | patrick-han/raytracer | /rt/sphere.h | UTF-8 | 1,674 | 3.078125 | 3 | [] | no_license | #ifndef SPHERE_H
#define SPHERE_H
#include "rtweekend.h"
#include "hittable.h"
/*
* Child class for a hittable sphere object
*/
class sphere : public hittable
{
public:
point3 center;
double radius;
shared_ptr<material> mat_ptr;
sphere()
{
}
sphere(point3 cen, double r, shared_ptr<material> m) : center(ce... | true |
384dd38df5b3e099dc8aae3571e332fab0affa6e | C++ | lygstate/captive | /arch/common/include/dbt/support.h | UTF-8 | 1,582 | 2.625 | 3 | [
"MIT"
] | permissive | /* SPDX-License-Identifier: MIT */
#pragma once
#include <dbt/common.h>
namespace captive {
namespace arch {
namespace dbt {
namespace terrible {
struct arg_match_struct {
void *ptr;
};
}
}
}
}
inline void *operator new(dbt_size_t, captive::arch::dbt::terrible::arg_match_struct *__p){retur... | true |
4b7f57f9bf5959db2fb4501e1b23a16f2526438d | C++ | theDreamBear/algorithmn | /leetcode/680.验证回文字符串-ⅱ.cpp | UTF-8 | 2,838 | 3.453125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=680 lang=cpp
*
* [680] 验证回文字符串 Ⅱ
*/
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;... | true |
f8946f47a269cb0b4f71be890df86d4ed192ddaa | C++ | shining-yang/DSCPP | /src/05_StackLinkedListCustomized/05_StackLinkedListCustomized.cpp | UTF-8 | 661 | 2.953125 | 3 | [] | no_license | //
// Test case for stack
//
#include "StackLinkedListCustomized.h"
using namespace DSCPP::Stack;
int main(int argc, char* argv[]) {
char x;
StackLinkedListCustomized<char> s;
s.Push('A').Push('B').Push('C').Push('D').Push('E');
cout << s << endl;
s.Pop(x);
cout << s << endl;
s.Push('B');
s.Push('X'... | true |
c729516cc6c0b02ea2776b7d9da67bfeaaf04792 | C++ | Airbroub2019/C- | /TP2/TP2_5/grille.hh | UTF-8 | 742 | 2.828125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include <array>
#include <string>
using coordonnee = signed int;
enum class etatcellule {
vivant,
mort
};
enum class structure {
oscillateurligne,
floraison,
planeur,
oscilateurcroix
};
class grille {
public:
grille (coordonnee largeur... | true |
ec71d8f3ee7cc3681a743a296bdd42a2fabd5e5b | C++ | matanaliz/ShellExt | /ExperimentalLogger/backtrace.cpp | UTF-8 | 384 | 2.625 | 3 | [] | no_license | #include "backtrace.h"
#include "backtrace_impl.h"
#include <new>
backtrace::backtrace()
: m_impl(new (std::nothrow) backtrace_impl())
{
}
// Dtor cannot be defaulted with forward declarated class
backtrace::~backtrace()
{
}
std::string backtrace::callstack()
{
// Handle this in other way
return m_impl ? m_impl->c... | true |
b5508268659114d0f25077fa3487a4b69a370136 | C++ | nethojs29/ProgramacionDeComputadoras | /buscaminas mas wapo, ya mero queda.cpp | UTF-8 | 7,052 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <windows.h>
#include <conio2.h>
#include <ctime>
#include <cstdlib>
using namespace std;
#define COLUMNAS 9
#define FILAS 9
#define SIN_BOMBA -2
#define BOMBA -1
#define SIN_JUGAR -3
#define ESTADO_PERDEDOR 0
#define ESTADO_GANADOR 1
#define ESTADO_... | true |
07a0bfbd3f622db663564bfc60f61617678bae34 | C++ | rgatkinson/ParticleDmxNeopixel | /src/Lumenizers/MorseCodeLuminance.h | UTF-8 | 5,553 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// MorseCodeLuminance.h
//
#ifndef __MORSE_CODE_LUMINANCE_H__
#define __MORSE_CODE_LUMINANCE_H__
#include "Lumenizer.h"
#include "MorseCode.h"
#include "Util/Deadline.h"
struct MorseCodeLuminance : Lumenizer
{
//----------------------------------------------------------------------------------------------
... | true |
345aa4b53a2038795234483db09fc51ce744c707 | C++ | ArturZieba/CPPLearning | /Operators2/Operators2.cpp | UTF-8 | 1,092 | 4.09375 | 4 | [] | no_license | #include <iostream>
#include <algorithm> //For std::max
bool approximatelyEqualAbsRel(double a, double b, double absEpsilon, double relEpsilon)
{
//Check if numbers are almost equal (needed when comparing numbers near zero)
double diff{ std::abs(a - b) };
if (diff <= absEpsilon)
return true;
//If the ... | true |
b170081e30d52e3d1516345795278517bd768a6c | C++ | lucasmedeiros/praticasPLP | /pratica1/e3.cpp | UTF-8 | 1,383 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int* split(string entrada, int size) {
int* array = new int[size];
int j = 0;
for (int i = 0; i < entrada.length(); ++i) {
char atual = entrada[i];
if (atual != ' ') {
array[j] = atual - 48;
j++;
}
... | true |
16d98fab1647c53cb39d2d48d6b4eba15eb2ef27 | C++ | RNaveen99/coding-practice | /practice-codes/target_sum.cpp | UTF-8 | 1,297 | 3.421875 | 3 | [
"MIT"
] | permissive | /*
* Author : Jatin Rohilla
* Date :
*
* Editor : Dev c++ 5.11
* Compiler : g++ 5.1.0
*
* Problem : Given an array of integers, return indices of the two numbers such that
* they add up to a specific target.You may assume that each input would have
* exactly one solution, and you may not use the same elem... | true |
c7d419555ca11a7368ca53df6f8d8fa1030b5f03 | C++ | patiwwb/placementPreparation | /LinkedList/DoublyCLLinsertdelete.cpp | UTF-8 | 10,303 | 3.796875 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
struct node *prev;
int data;
struct node *next;
}cdll;
cdll *head;
void insert( int item ){
// First check if the item being inserted forms the first node. //
if( head == NULL ){
head = ( cdll * )malloc( sizeof( cdll ) );
h... | true |
6665179631716115653103d7f60c4c640f7af5d6 | C++ | fastbuild/fastbuild | /Code/Core/CoreTest/Tests/TestSemaphore.cpp | UTF-8 | 3,767 | 3.1875 | 3 | [
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // TestSempahore.cpp
//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include "TestFramework/TestGroup.h"
// Core
#include <Core/Process/Semaphore.h>
#include <Core/Process/Thread.h>
// TestS... | true |
581e0267094c80f2b119d67ebb46375f0e783f8e | C++ | aaron-lii/algorithm_and_structure | /c++/算法transform.cpp | UTF-8 | 1,214 | 3.96875 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
/*
* transform(iterator begin1, iterator end1, iterator begin2, _func);
* 功能:将源容器值搬运到目标容器,并对值做func运算
* 参数:(源容器起始迭代器,源容器结束迭代器,目标容器起始迭代器,函数或函数对象)
* 注意:目标容器要初始化大小为源容器大小
* 底层:for循环遍历源容器迭代器,解引用后调用func函数,将函数return的值直接等号赋值给目标容器迭代器
*/
using namespace std;
// 对... | true |
10ca87bf68965589e1e9aa18cd5ea1d5cf2c1329 | C++ | kamalsinghy/CppProg | /Cpp_3.cpp | UTF-8 | 274 | 3.140625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int i = 100;
int *iptr = &i;
unique_ptr<int> ptr;
ptr.reset(iptr);
if (iptr == nullptr) {
cout << "iptr is nullptr" << endl;
}
cout << iptr << endl;
cout << *iptr << endl;
}
| true |
cea621abbaf4a6f9bfcb0faab0e56b8105cfeee5 | C++ | miviwi/Hamil | /Hamil/include/yaml/document.h | UTF-8 | 1,217 | 2.890625 | 3 | [] | no_license | #pragma once
#include <common.h>
#include <yaml/node.h>
#include <string>
#include <memory>
#include <utility>
namespace yaml {
class Document {
public:
struct Error {
public:
Error(size_t line_, size_t column_, std::string&& reason_) :
line(line_+1), column(column_+1), reason(std::move(reason_)) /* ... | true |
f39627f5641b752ca6be80e88f635e841e63cc6f | C++ | EmlynLXR/Hust | /C/实验8/源程序替换.cpp | GB18030 | 444 | 2.984375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
int main(int argc, char* argv[])
{
char ch;
if(argc!=2){
printf("Arguments error!\n");
exit(-1);
}
if(freopen(argv[1],"r",stdin)==NULL){ /*ʹstdinָĿļ*/
printf("Can't open %s file!\n",argv[1]);
exit(-1);
}
while((ch=getchar())!=EOF) /* stdinжַ */
... | true |
0874663adf7b7a0ec9166c140a90c12339a96dd8 | C++ | zinsmatt/Programming | /LeetCode/medium/Single_Number_II.cxx | UTF-8 | 580 | 2.625 | 3 | [] | no_license | class Solution {
public:
int singleNumber(vector<int>& nums) {
vector<int> count(32, 0);
int res = 0;
for (int i = 0; i < 32; ++i)
{
int count = 0;
for (auto x : nums)
{
count += (x >> i) % 2;
}
... | true |
60f028ca1cfc4393b7be46c7aa213bea55382571 | C++ | adamsandwich/PAT_Basic-Level_Practise | /1070. 结绳(25).cpp | UTF-8 | 438 | 2.890625 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n, sum;
cin >> n;
vector<int> len;
for (int i = 0; i < n; i++)
{
int t;
cin >> t;
len.push_back(t);
}
sort(len.begin(), len.end());
int i = 0;
sum = *len.begin();
for (vector<int>::iterator i... | true |
dbb1ba3952ad201a904fa69b75ec723ed319a06e | C++ | cbshiles/storm | /sketch.hpp | UTF-8 | 455 | 3.015625 | 3 | [] | no_license |
#class Parent;
#include "base.hpp"
class Child
{
protected:
Parent* _parent;
};
class Parent : public Child
{
public:
Parent(Parent* parent = NULL);
inline void after(Parent* n)
{
if (_parent != NULL)
_parent->swap(this, n);
else
n->before(this);
}
inline void before(Child* n)
{_childre... | true |
df2f60cf5ea7bfadfbae054e84db4b8eaa312c29 | C++ | colinblack/game_server | /server/app/data/DataComponent.h | UTF-8 | 1,461 | 2.515625 | 3 | [] | no_license | #ifndef DATA_COMPONENT_H_
#define DATA_COMPONENT_H_
#include "Kernel.h"
struct DataComponent
{
uint8_t position; //在装备区的位置
uint8_t master; //主属性类型
uint8_t slave1; //副属性1类型
uint8_t slave2; //副属性2类型
uint8_t slave3; //副属性3类型
uint32_t ud;
uint32_t uid;
uint32_t compid;
uint32_t level;
... | true |
7a77fcf3270f4cedbb99d3a31c78880d118e5ede | C++ | rafaelGuasselli/estudo_cpp | /uri/iniciante/e1041.cpp | UTF-8 | 489 | 2.765625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
float x,y;
cin >> x >> y;
if(x == 0 && y == 0){
cout<<"Origem\n";
}else if(x == 0){
cout<<"Eixo Y\n";
}else if(y == 0){
cout<<"Eixo X\n";
}else if(x > 0){
if(y > 0){
cout<<"Q1\n";
}else{
... | true |
c45499cd3f495780f4f12016c840b9a8cbc0a0e7 | C++ | nikonikolov/c_compiler | /src/DataStructures/ArrayExpression.cpp | UTF-8 | 1,834 | 2.65625 | 3 | [] | no_license | #include "ArrayExpression.h"
ArrayExpression::ArrayExpression(BaseExpression* first_dim_mem, const int& line_in, const string& src_file_in) :
BaseExpression(EXPR_array_expr, line_in, src_file_in) {
dimension = new vector<BaseExpression*>;
dimension->push_back(first_dim_mem);
}
ArrayExpression::~ArrayExpression(){... | true |
583ca4f386d5925e657ff98fdee8a6ce02a7a990 | C++ | Mikkareem/Coding-Programs | /geeksforgeeks/checkSortingRecursive.cpp | UTF-8 | 349 | 3.3125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool checkAsc(const vector<int>& a, int index)
{
if(index == a.size() - 1) return true;
// Check for first 2 numbers, if true, recursively check next 2.
return (a[index] < a[index+1]) && checkAsc(a, index + 1);
}
int main()
{
vector<int> a = {1, 2, 3, 4, 5, 6, 7, 8};... | true |
f5d66e3a7bf583b5cffc42b6696180e80ac74ec5 | C++ | mathnogueira/mips | /include/mips/instructions/instruction.hpp | UTF-8 | 1,268 | 3.21875 | 3 | [
"MIT"
] | permissive | /**
* \file instruction.hpp
*
* Arquivo contendo a estrutura abstrata que representa uma instrução qualquer
* em uma arquitetura de 16 bits.
*
*/
#pragma once
#include <mips/core.hpp>
#include <mips/units/control.hpp>
#include <mips/flag.hpp>
namespace MIPS {
/**
* Classe abstrata responsável por representar ... | true |
056dd3f03ba281568d86c5e36e7130211efe46ac | C++ | dekorlp/GDV | /spaceGame/erstesProjekt/PolygonGenerator.cpp | ISO-8859-1 | 17,340 | 2.5625 | 3 | [] | no_license | #include <GL/freeglut.h>
#include <GL/SOIL.h>
#include <iostream>
#include "PolygonGenerator.h"
#define _USE_MATH_DEFINES
#include <cmath>
// Texturen werden geladen
void PolygonGenerator::initPolygonGenerator()
{
hull = SOIL_load_OGL_texture("textures/hull.jpg", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID,
S... | true |
52a7b5fb652690c387d5beea1c7156386a6a0cc3 | C++ | feel-coding/algorithm-practice | /이진탐색.cpp | UTF-8 | 341 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int arr[100005];
int main() {
int n, q;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int num;
for (int i = 0; i < q; i++) {
cin >> num;
if (binary_search(arr, arr + n, num)) {
cout << "YES\n";
}
else {
cout << "NO\n";... | true |
259b17dda129beae7e8350271a5fb521d94e849d | C++ | DJWalker42/laserRacoon | /inc/adv/SparseMat.h | UTF-8 | 3,914 | 3.0625 | 3 | [] | no_license | #ifndef SPARSEMAT_HPP
#define SPARSEMAT_HPP
#include <adv/row.hpp>
#include <adv/mesh.hpp>
#include <staticMatrix.hpp>
#include <iomanip>
namespace phys{
template<class T> class sparseMat;
// transpose of a sparse matrix
template<class T>
const sparseMat<T> transpose(const sparseMat<T>&);
// return the diagon... | true |
daa39a495ce7b93904e6a525a533b11ffb99a740 | C++ | ahmethelvaci/datastructure | /linkedlist4_delete.cpp | UTF-8 | 2,058 | 3.46875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct n {
int x;
n * next;
};
typedef n node;
node * createNode(int x) {
node * n;
n = (node *) malloc(sizeof(node));
n->next = NULL;
n->x = x;
return n;
}
void bastir (node * r)
{
int i = 0;
while (r != NULL) {
printf("%d=>%d ", ... | true |
ba4e741c7a5a2e11c4c38fbdb3b24620af15887a | C++ | lololalayoho/Algo_share | /20210215/평범한 배낭/lololalayoho.cpp | UTF-8 | 554 | 2.609375 | 3 | [] | no_license | /* https://www.acmicpc.net/problem/12865 */
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int N, K;
int DP[102][100002];
struct package {
int w;
int v;
};
vector<package> v1;
int main() {
cin >> N >> K;
for (int i = 0; i < N; i++) {
package p;
cin >> p.w >> p.v;
v1.push_bac... | true |
01957394ba539129336ab0f9d4153fa8138897de | C++ | Exploratory-Studios/Fear-Of-The-Dark | /Code/EntityProjectile.cpp | UTF-8 | 2,889 | 2.53125 | 3 | [] | no_license | #include "EntityProjectile.h"
#include <XMLDataManager.hpp>
#include "Singletons.h"
EntityProjectile::EntityProjectile(glm::vec2 pos, unsigned int layer, unsigned int id) : Entity(pos, layer) {
m_id = id;
init();
}
EntityProjectile::EntityProjectile(glm::vec2 pos, unsigned int layer, EntityIDs id) : Entity(pos, ... | true |
055eddfe01e16756302eb021f6e1529db3650582 | C++ | AlexanderJFranco/DrinkType | /DrinkTypes.h | UTF-8 | 1,086 | 3.3125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Drink{ //Parent Drink Class
friend ostream& operator<<(ostream& os,const Drink& s); //Output overload for printing drinks to screen
public:
Drink();
virtual void GetDescription() const;
const char * GetBeverageName() const;
co... | true |
72df84aeb2054edcec6f8ce2a079ac791d0fb308 | C++ | VukanJ/Chess | /ZobristHash.cpp | UTF-8 | 1,434 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "ZobristHash.h"
ZobristHash::ZobristHash()
{
entries.resize(static_cast<size_t>(1e6));
hashSize = static_cast<size_t>(1e6);
}
ZobristHash::ZobristHash(size_t _hashSize)
{
entries.resize(_hashSize);
hashSize = _hashSize;
}
ZobristHash::entry& ZobristHash::getEntry(const U64& key)
{
//cout << hex << key ... | true |
d66c449e57187dda279e67c374476ac9dbbde9e6 | C++ | Jorgespidy/Labs_Digital2 | /Laboratorio5/Lab5/Lab5.ino | UTF-8 | 4,108 | 3.09375 | 3 | [] | no_license | //Universidad del Valle de Guatemala
//Departamento de Ingenieria Mecatronica y Electronica
//Digital 2 - Seccion 20
//Jorge Castillo - 18209
// se incluyen las librerias
#include <SPI.h>
#include <SD.h>
// defino mis variables
File archivo;
File root;
int opcion;
void opciones(void);
void mostrar(voi... | true |
fb1f5a50e93d531166f8446cbdefe19f2930ea85 | C++ | levifussell/Olive_ASCII-Game-Engine- | /Screen/ScreenBuffer.h | UTF-8 | 941 | 2.828125 | 3 | [
"MIT"
] | permissive | #ifndef SCREEN_BUFFER
#define SCREEN_BUFFER
#include<iostream>
#include "../Objects/GameObject.h"
#include "../DataStructures/LinkedList.h"
#include "Colors/colors.hpp"
class ScreenBuffer
{
private:
const unsigned int borderSize = 4;
int width;
int height;
ColorType backgroundColor;
char** screen... | true |
24ab8aeb9327534a3bf0df19dc9418911280de90 | C++ | maxtla/Project-Disaster | /Light.h | UTF-8 | 964 | 2.765625 | 3 | [] | no_license | #pragma once
#ifndef LIGHT_H
#define LIGHT_H
#include <DirectXMath.h>
#include <d3d11.h>
using namespace DirectX;
enum LightTypes
{
POINT_LIGHT,
DIRECTIONAL_LIGHT
};
class Light
{
private:
__declspec(align(16))
struct LightType
{
DirectX::XMVECTOR lightPosOrDir;
DirectX::XMVECTOR lig... | true |
3cc7713e1ec289611015f95c4fd7f163da9851d4 | C++ | MrGarrowson/A01018714_Ayms18 | /Actividades/A4.2/Observer/observer.cpp | UTF-8 | 846 | 3.484375 | 3 | [] | no_license | #include <vector>
#include <string>
virtual class Observer()
{
public:
std::string name;
Observer(std::string n){
name = n;
}
virtual void update(std::String c){
printf(" %s",c);
}
}
virtual class Subject()
{
public:
std:: vector <Observer> VO;
std:: string name;
std:: string message;
void ... | true |
87d20b06a5887cb01bde4d6500aa57631d1c764a | C++ | ajunior/cp | /uri/Cpp/2003.cpp | UTF-8 | 586 | 3.515625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int h, m, delayed_h, delayedInMinutes;
while (scanf("%d:%d", &h, &m) != EOF) {
delayed_h = h + 1; // Incrementando uma hora, devido o delay máximo que é de 60 minutos.
// 8 é o literal para a hora marcada do encontro dos amigos no termina... | true |
49ed290cf605abc86ae03d5d7ec6f5e327075505 | C++ | ran16/snake-game-Ncurses | /fruit_doublePoints.cpp | UTF-8 | 496 | 2.5625 | 3 | [] | no_license | #include "fruit_doublePoints.h"
#include <ncurses.h>
fruit_doublePoints::fruit_doublePoints(snake* snake): fruit(snake){}
void fruit_doublePoints::takeEffect(player* nplayer, snake* nsnake){
nsnake -> grow(); //increase snake length by 1
nplayer -> setScore(2); //increase score by 2
nsnake ->setSpeed(5); //5 is a ... | true |
3e0eb15b5b4657bc60ec9409735724807eb5f830 | C++ | TechnionTDK/cq-random-enum | /CQs/Q2_N/files/Q2_N__N_Parcel.h | UTF-8 | 2,691 | 2.625 | 3 | [] | no_license | #ifndef RANDOMORDERENUMERATION_Q2_N__N_PARCEL_H
#define RANDOMORDERENUMERATION_Q2_N__N_PARCEL_H
#include <iostream>
#include <chrono>
#include "../../AbstractDatabase/Table.h"
#include "../../AbstractDatabase/SplitTable.h"
#include <boost/functional/hash.hpp>
#include "Q2_N__R_Parcel.h"
#ifdef PROJECTION_Q2_N
#endif
... | true |
b27ee9d55bfdd6493a6a61ceb1e9326a2b30d596 | C++ | RC-MODULE/nmOpenGL | /src_proc0/pc/doubleSubC_32f.cpp | UTF-8 | 209 | 2.609375 | 3 | [] | no_license |
extern "C"{
void doubleSubC_32f(float* src1, float* src2, float C1, float C2, float* dst1, float* dst2, int size){
for(int i = 0; i < size; i++){
dst1[i] = src1[i] - C1;
dst2[i] = src2[i] - C2;
}
}
} | true |
0b8d7d8fc59e345f4d59e2e04ab3e00f35584060 | C++ | zmbilx/cxxPrimerPlus6th | /04第四章/4-08-strtype2.cpp | UTF-8 | 969 | 3.921875 | 4 | [] | no_license | #include <iostream>
#include <string>
int main(){
using namespace std;
string s1 = "penguin";
string s2,s3;
cout<<"You can assign one string object to another:s2 = s1\n";
s2 = s1;
cout<<"s1: "<<s1<<",s2: "<<s2<<endl;
cout<<"You can assign a C-style string to a string object.\n";
cout<< "s2 = \"buzzard\"\n";
... | true |
158e5aad7a3dcc3cc932557f989657181656b2c8 | C++ | ayushchopra96/topologize | /modify.cpp | UTF-8 | 927 | 2.53125 | 3 | [] | no_license | /*1
4
3
7 4
2 4 6
8 5 9 3*/
#include <bits/stdc++.h>
#include "header.h"
using namespace std;
//3 single bond hai to 109.5
//1 double bond 120
// 1 triple bond 180
void read_pdb(char *argv,struct pdb pdbfile[1000],int &file_length)
{
//n= read nth pdb
file_length=0;
fstream fp;
fp.open(argv,ios:... | true |
90725c725201b9354160568677a719220d3b3abb | C++ | yzpd/data_structure | /hash.cpp | GB18030 | 5,531 | 3.1875 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "hash.h"
#define MAXWORDLEN 80 //ij
//λƷַλλ5λ,ڵintֵ
int Hash(const char* key, int TableSize) {
unsigned int H = 0;
while (*key != '\0')
H = (H << 5) + *key++;
return H % TableSize;
}
//ȷһСTableS... | true |
7cdc68ec13203faf52287714e2fcffaa715b37d3 | C++ | yeahzdx/Leetcode | /Int To Roman.cpp | UTF-8 | 828 | 3.5625 | 4 | [] | no_license | #include"head.h"
string intToRoman(int num){
string symbol[]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
int value[]={1000,900,500,400,100,90,50,40,10,9,5,4,1};
int i=0;
string res;
while(num!=0){
if(num>=value[i]){
num-=value[i];
res+=symbol[i];
}
else
++i;
}
re... | true |
f49cf390dba058dd9b0f79b631140581fb08ae64 | C++ | lyost/d3d12_framework | /d3d12_framework/src/Time/PerformanceTimer.cpp | UTF-8 | 730 | 2.75 | 3 | [] | no_license | #include "private_inc/Time/PerformanceTimer.h"
PerformanceTimer* PerformanceTimer::Create()
{
LARGE_INTEGER freq;
if (!QueryPerformanceFrequency(&freq))
{
return NULL;
}
else if (freq.QuadPart == 0)
{
return NULL;
}
return new PerformanceTimer(freq.QuadPart / 1000.0f);
}
PerformanceTimer::P... | true |
4d1bfbe7631796eded50fe6567282eaced65350d | C++ | fazlerahmanejazi/UVa-Solutions | /Chapter-III/10341 - Solve It(Fast).cpp | UTF-8 | 647 | 2.78125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std ;
#define least 0.000000000001
int p,q,r,s,t,u;
double f(double x)
{
return p*exp(-x) + q*sin(x) + r*cos(x) + s*tan(x) + t*x*x + u;
}
double fd(double x)
{
return -p*exp(-x) + q*cos(x) - r*sin(x) + s/(cos(x)*cos(x)) + 2*t*x;
}
double solve()
{
i... | true |
a4b4c0c51100da63e141b2a8714d3810d5df1f47 | C++ | alperbek/arduino-kursu | /Kodlar/FUNDAMENTALS/3a - button/8led_3button/8led_3button.ino | UTF-8 | 2,977 | 3 | 3 | [] | no_license | /*
* Can not be use 3 button with interrupt
* because of Arduino Uno support only 2 (d2,d3) input for interrupt.
*/
const byte leftButton = 12;
const byte blinkButton = 11;
const byte rightButton = 10;
const byte buttonReadCount = 3; // Read multiple times to avoid button bounce
byte led = 2; // l... | true |
5814b035dd5519c401593e1125b783ecbb2d03e9 | C++ | CaterTsai/squre_arduino | /LOpen.h | UTF-8 | 1,802 | 2.875 | 3 | [] | no_license | #include "baseLight.h"
//------------------------------------
//LOpen
class LOpen : public baseLight
{
public:
LOpen(eMode mode, int len)
: baseLight(mode, len)
, _openT(1000)
, _timer(0)
{
_animV = 1.0f / (_openT / 1000.0);
}
virtual void play(ePlayType t)
{
_isPla... | true |
1cd8551668c113817985b0fac9d2699e4404b321 | C++ | arnaudgelas/Examples | /c++/SDL/Events/SDLEvents.cpp | UTF-8 | 2,510 | 2.921875 | 3 | [] | no_license | /*This source code copyrighted by Lazy Foo' Productions (2004-2008) and may not
be redestributed without written permission.*/
//The headers
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <string>
#include <iostream>
#include "SDL_Helper.h"
#include <GL/glut.h>
#include <assert.h>
using namespac... | true |
8629a68f7633173e0318015618e43407c5eda3c3 | C++ | JimNilsson/DV1553H17Lp2 | /Lektion7/Square.cpp | UTF-8 | 453 | 3.609375 | 4 | [] | no_license | #include "Square.h"
#include <iostream>
Square::Square(const std::string & color, float side) : Shape(color)
{
this->sideLength = side;
}
Square::Square() : Shape()
{
this->sideLength = 1.0f;
}
Square::~Square()
{
}
float Square::GetArea() const
{
return sideLength * sideLength;
}
void Square::Draw() const
{
f... | true |
5552b6ca49c0b6e6fdda2d3372e2c9c661a1c491 | C++ | isVoid/Leet_codebase | /162FindingPeakElement.cpp | UTF-8 | 1,377 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include "dbg.hpp"
using namespace std;
struct ListNode;
struct TreeNode;
class Solution {
public:
// Runtime: 4 ms, faster than 97.5... | true |
6e0eef6b6a2cb580a2f16a9295c4f6bf0d1c3516 | C++ | kunnapatt/Competitive | /Problem/10107/10107.cpp | UTF-8 | 531 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std ;
#define FOR(i, a, b) for(int i = a ; i < b ; i++)
#define vi vector<int>
#define vii vector<long>
#define long long long
int main(){
int n ;
vi a ;
while ( cin >> n){
a.push_back(n) ;
sort(a.begin(), a.end()) ;
if ( a.size() % 2 != 0 ... | true |
6b07104dcc2ae66f6fd3d6d96e6727512c301e99 | C++ | zerohoon96/BOJ_algorithm | /Silver/숨바꼭질 S1.cpp | UTF-8 | 679 | 2.6875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <queue>
int length[200000]={-1,};
using namespace std;
int main(void){
int n,k,cur;
queue<int> que;
scanf("%d%d",&n,&k);
que.push(n);
memset(length,-1,sizeof(int)*200000);
length[n]=0;
while(1){
cur=que.front();
que.pop();
if(cur==k){
pr... | true |
a5eaf26df8bcbafcdfffac12615a5ec66bb5538b | C++ | wangluo2028/HearthStoneRobot | /Robot/handWritten-digit-recognition-based-on-OpenCV/handWritten digit recognition based on OpenCV/preprocess.cpp | GB18030 | 1,061 | 2.59375 | 3 | [] | no_license | #include "opencv2/imgproc/types_c.h"
#include"preprocess.h"
void preProcess(const Mat& srcImage, Mat& dstImage)
{
Mat tmpImage = srcImage.clone();
if (tmpImage.type() != CV_8UC1)
{
cvtColor(tmpImage, tmpImage, CV_BGR2GRAY);
}
//ֵ˲Ԥ
//GaussianBlur(tmpImage, tmpImage, Size(3, 3), 0, 0, BORDER_DEFAULT);
medianBl... | true |
c44ef5656f6fdf7a45af136dc837afd08b06a4d9 | C++ | heechan3006/CS | /BOJ/BOJ_17472/Project4/소스.cpp | UTF-8 | 3,170 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <queue>
#include <vector>
#define MAXN 10
#define INF 987654321
using namespace std;
int N, M;
int map[MAXN][MAXN];
bool visited[MAXN][MAXN];
struct node {
int u;
int v;
int weights;
};
int dist[7][7];
int max_v = 0;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
... | true |
28763cebfded1ae456091052381ff3ec27a9349b | C++ | HelderAntunes/competitive-programming | /uva/dynamicProgramming/Max2D-Sub-range/UVA11951.cpp | UTF-8 | 1,381 | 2.625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <climits>
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long int ll;
int a[105][105];
/*
* helde... | true |
c44685dd2b04c29569f08bf4fe93f959348a7743 | C++ | igorodinskiy/Laboratory_work_SN-11 | /Laboratory_work_6.cpp | UTF-8 | 909 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout << "PROGRAM ONE" << endl;
int a[20];
int i = 0;
for ( i = 0; i < 20; i++ ) a[i] = rand()%100-50;
cout << "Massif: ";
for ( i = 0; i < 20; i++ ) cout << a[i] << "; ";
cout << "\n";
int b=0;
cout << "Enter number (from -50 to 50): "... | true |
6aaebe1edd4e6504acbb76787412d1e6d5e60471 | C++ | AlamyLiu/hw2_sort | /main.cpp | UTF-8 | 6,632 | 2.828125 | 3 | [] | no_license | /*
* main() entry
*/
#include <cerrno>
#include <iostream>
#include <string>
#include <fstream> // ifstream, ofstream
#include <stdlib.h> // atoi
#include <getopt.h> // getopt_long()
#include <unistd.h> // getopt()
//#include <regex> // regex
#include <list> // list of SIDLList class
#include "SIntFormat.hpp"... | true |
7f44fbafe789507dac8767024ff76b850c47df1e | C++ | ian-bird/compNetProject | /src/process_binary.cpp | UTF-8 | 3,070 | 2.890625 | 3 | [] | no_license | #include "process_binary.h"
//function to perform file read in
void readFile(SOCKET mySocket, char *type)
{
char *buffer = (char *)malloc(sizeof(char) * 255);
int length;
FILE *output = (FILE *)buffer;
int i;
int outputFileNum = 0;
//send request for next line of file
send(mySocket,"file next",(int)strlen("fil... | true |
9a4d0d81dbe0bf24dd323291cf0c6d370676e9ed | C++ | SandeepGarcha1234/NumericalCPPPractice | /FirstOrderODE.cpp | UTF-8 | 4,066 | 3.375 | 3 | [] | no_license | #include <cassert>
#include "FirstOrderODE"
FirstOrderODE::FirstOrderODE(const std::vector<double (*) (double t, Matrix v)>& FF, double t0, const Matrix& y0) :
F(FF), initialTime(t0), initialValue(y0){
assert(FF.size() == y0.getRows());
order = y0.getRows();
}
Matrix evaluate(const std::vector<double (*) (double t,... | true |
f263bffeae286a40edbba3998b41db5c7d7780cf | C++ | e8yes/eyes-connect | /src/stopwatch.cpp | UTF-8 | 593 | 2.765625 | 3 | [] | no_license | #include <ctime>
#include "stopwatch.h"
StopWatch::StopWatch()
{
}
unsigned StopWatch::begin(unsigned total_amount)
{
m_total = total_amount;
m_begin = clock();
m_last = m_begin;
return m_begin;
}
float StopWatch::dt() const
{
return m_dt;
}
float StopWatch::check_point()
{
... | true |
f795b5dbf77889c01e584530d59fb4fb0420b409 | C++ | ImranIsmael/C | /5-Constructors.cpp | UTF-8 | 768 | 3.734375 | 4 | [] | no_license | //Constructors
#include <iostream>
#include <string>
using namespace std;
//Constructors does not have a return type so we do not need to type in int/void/string etc
//Constructors name is always the same as the class name
//Main reason to use constructors is to give variable initial value*
//You can create mu... | true |
5596e3ddbf6c870afcb449746b2353de9c96bcec | C++ | guihunkun/LeetCode | /307.cpp | UTF-8 | 1,907 | 3.9375 | 4 | [] | no_license | /*
class NumArray
{
public:
vector<int> cur;
NumArray(vector<int>& nums)
{
for(int i = 0; i < nums.size(); i++)
cur.push_back(nums[i]);
}
void update(int i, int val)
{
cur[i] = val;
}
int sumRange(int i, int j)
{
int sum = 0;
... | true |
c152ee298c75838c8bd143048b3a1132c56a04cd | C++ | Morpheu5/qtuiotouch | /include/dosc/decoder.hpp | UTF-8 | 2,752 | 2.546875 | 3 | [] | no_license | /// UNCLASSIFIED
#ifndef DOSC_DECODER_HEAD
#define DOSC_DECODER_HEAD
#include "bytes.hpp"
#include <string>
#include <map>
#include <boost/function.hpp>
#include <boost/cstdint.hpp>
namespace dosc {
using boost::int32_t;
using boost::int64_t;
enum osc_type_tags {
osc_int32_tag = 'i', // 4 bytes, int32_t... | true |
d522ccd6eee02ff4fd52c4977b43a9e53d272013 | C++ | mertsalik/kruskal-with-disjointset | /Kruskal_DisjointSet/Kruskal_DisjointSet/Graph.cpp | UTF-8 | 1,154 | 3.109375 | 3 | [] | no_license | #include "Graph.h"
#include <algorithm>
Graph::Graph(void)
{
}
Graph::Graph(string CityFilename,string FlightFilename)
{
readCityData(CityFilename);
readFlightData(FlightFilename);
}
Graph::~Graph(void)
{
}
void Graph::readFlightData(string Filename)
{
std::ifstream input( Filename);
int counter ... | true |
834ad07562c9fbc487cabff778362ac4a6eb9111 | C++ | protectors/ACM | /UVA/UVA10082-WERTYU.cpp | UTF-8 | 458 | 2.515625 | 3 | [] | no_license | //UVA10082
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <vector>
#include <map>
using namespace std;
int main()
{
char s[]={"`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"};
int i,c;
while((c=getchar())!=EOF)
{
for(i... | true |
c00230293b5f7f6985e9ad4a145b22381ce9596c | C++ | Liby99/RaytracerOld | /src/util/Color.cpp | UTF-8 | 250 | 2.984375 | 3 | [] | no_license | #include "Color.h"
Color::Color() {
r = 0;
g = 0;
b = 0;
}
Color::Color(vec3 color) {
r = color.x;
g = color.y;
b = color.z;
}
Color::Color(float r, float, g, float b) {
this->r = r;
this->g = g;
this->b = b;
}
| true |
e990f061f49877bd44a04d7cc5af566e4fab21e6 | C++ | ggasper/RSSAggregator | /src/ui/favouritestar.cpp | UTF-8 | 1,405 | 2.5625 | 3 | [] | no_license | #include "favouritestar.h"
FavouriteStar::FavouriteStar()
{
m_state = false;
star = new QPolygonF;
test = new QPolygonF;
for (int i = 0; i < 5; ++i) {
double perCircle = i / 5.0;
double perInner = (i+3)%5 / 5.0;
qDebug() << 2*QPointF(std::sin(perCircle*2*PI), (-1)*std::cos(perCi... | true |
83aa1af232e70bcd446841154cf46b34f2dc4b65 | C++ | KayvanMazaheri/acm | /codeforces/197a.plate-game/197a.cpp | UTF-8 | 162 | 2.84375 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main()
{
int a, b, r;
cin >> a >> b >> r;
cout << (2 * r > min(a, b) ? "Second" : "First") << endl;
return 0;
}
| true |
254414f134ebf4f5cc7f0c14fb1172770c22f731 | C++ | qqdown/LeetCode | /LeetCode/307.h | WINDOWS-1252 | 1,762 | 3.203125 | 3 | [] | no_license | #pragma once
#include "leetcode.h"
namespace _307 {
class NumArray {
public:
NumArray(vector<int> nums) {
size = nums.size();
int initsize = nums.size() * 4 + 10;
this->segTree = new int[initsize];
memset(segTree, 0, initsize*sizeof(int));
buildTree(1, 0, nums.size() - 1, nums);
}
void updat... | true |
1d2dda8263a5797ef85704dab2aceef73a98f4cb | C++ | tinaba96/master | /major_research/others/modified_q3DanQ/src/host/m.cpp | UTF-8 | 5,601 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <random>
#include <string>
#include <cstring>
#include <fstream>
#include <sstream>
#include "../kernel/kernel.cpp"
//#include "get_data.h"
//#include "loss.h"
//#include "optimizer.h"
//conv -> relu -> maxpooling -> affine -> relu -> affine -> sigmoid
... | true |
e058bd3893c2501efe02c70be92fd549789a8ca7 | C++ | henriquedavid/snaze | /include/ia_astar.h | UTF-8 | 9,810 | 3.0625 | 3 | [] | no_license | #include "ai.hpp"
/// === ALIASES ===
using pPair = std::pair<uint, std::pair<uint, uint>>;
/// == STRUCTURES ==
/// A Cell with 'f', 'g', 'h' values.
Cell::Cell(Point p): parent(std::make_pair(p.x,p.y)), HasParent(true), f(0u), g(0u), h(0u)
{ }
Cell::Cell(std::pair<int,int> p): parent(p), HasParent(true), f(0... | true |
9e3e5ac96978ab8392344ca67ab5b1044fda3a55 | C++ | tobias-froehlich/beegenerator | /test/test_Generator.cpp | UTF-8 | 1,337 | 2.8125 | 3 | [] | no_license | #include "../src/Generator.h"
TEST (Generator, create_and_delete ) {
Generator* generator_ptr;
Parameters* parameters_ptr = new Parameters();
parameters_ptr->read_file(
"../test/testfiles/generator_parameters_wrong1.txt");
ASSERT_THROW(
generator_ptr = new Generator(parameters_ptr, 0... | true |
c48c60745694b260dab6e5cd34949db0803fa1a2 | C++ | libo8621696/CPP_Course3 | /eclipse/main9_2.cpp | UTF-8 | 663 | 2.671875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
char s1[80], s2[80];
cin.getline(s1, 80);
cin.getline(s2, 80);
int len1 = 0, len2 = 0;
for(len1 =0; s1[len1]!= '\0'; len1++);
for(len2 =0; s2[len2]!= '\0'; len2++);
for(int j=0; j<len1; j++)
{
if(s1[j]>=97&&s1[j]<=122)
... | true |
17057e0643a04a9ac1f41aeebb2a4327055f58fc | C++ | yiorgosynkl/ntua-ece-progintro | /lowsum/lowsum.cpp | UTF-8 | 1,067 | 3.140625 | 3 | [] | no_license | /**********************************************************************
* Project : ntua-ece-progintro
* Program name : lowsum.cpp
* Author : yiorgosynkl (find me in Github: https://github.com/yiorgosynkl)
* Date created : 20200115
* Purpose : find a sum of 2 numbers closest to ... | true |
894b1ee95b04bc2b8981f30e7afa33a30dddb58c | C++ | AlexLeSang/ranges-example | /range-v3.hpp | UTF-8 | 478 | 3.140625 | 3 | [] | no_license | #pragma once
#include <range/v3/all.hpp>
#include <vector>
namespace range_v3 {
decltype(auto) number_of_squared_integers_divisible_by_3_5_and_7(
const std::vector<int> &numbers) {
using namespace ranges;
const auto squared =
numbers | view::transform([](const auto v) { return v * v; });
const auto... | true |
60690a5fd7d54ec92ea0d8090c42f1c8c3469432 | C++ | bonastos/yadif | /test/provider_test.cpp | UTF-8 | 1,849 | 2.5625 | 3 | [
"BSL-1.0"
] | permissive | /*
* Copyright 2015 Dirk Bonekamper
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <catch.hpp>
#include <yadif.hpp>
#include <map>
using namespace yadif;
namespace {
struct DestructionR... | true |
aa5a43718525b0980194dfaa09e8e07cfffe3b73 | C++ | dshnightmare/LeetCodeC | /src/MergeInterval.cpp | UTF-8 | 1,049 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
class Solution{
public:
vector<Interval> merge(vector<Interval> &intervals){
vector<Interval> result;
if(intervals.size() == 0)
... | true |
ffb8dba1947a6ee6040ebc39060b2a45c4c7d5ac | C++ | Mike2208/Monte_Carlo | /Monte_Carlo/algorithm_voronoi_fields.cpp | UTF-8 | 7,548 | 2.78125 | 3 | [] | no_license | #include "algorithm_voronoi_fields.h"
bool ALGORITHM_VORONOI_FIELDS::DISTRICT_CHANGE_VECTOR::AreChangedIDs(const ID &DistrictID1, const ID &DistrictID2) const
{
for(const auto &curChange : *this)
{
if((curChange.OldID == DistrictID1 && curChange.NewID == DistrictID2) ||
(curChange.OldID == DistrictID2 && curCh... | true |
80443626a811a73e5b55027150149e90b1503932 | C++ | pixled/pixled-lib | /src/pixled/signal/signal.cpp | UTF-8 | 541 | 2.828125 | 3 | [] | no_license | #include "signal.h"
namespace pixled { namespace signal {
float Sine::operator()(led l, time t) const {
return std::sin(2*PI * this->call<0>(l, t));
}
float Square::operator()(led l, time t) const {
return std::sin(2*PI * this->call<0>(l, t)) > 0 ? 1 : -1;
}
float Triangle::operator()(led l, time t) const ... | true |
c8126fd3f4c74702da90798a2a080e652072759a | C++ | rsalinas6721/C-_Fantacy_Combat_Game | /blueMen.hpp | UTF-8 | 580 | 2.796875 | 3 | [] | no_license | /*
Author: Ricky Salinas
Due Date: 5 August 2018
Description: BlueMen Class
*/
#ifndef BLUEMEN_HPP
#define BLUEMEN_HPP
#include "character.hpp"
// Constructor and function prototypes for class are initialized
class BlueMen : public Character
{
protected:
std::string name;
int armor;
int stre... | true |