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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1f561f936565fe8a4cda6b2b83cac61d49145604 | C++ | playercore/mv_management | /source/ini_control.cpp | UTF-8 | 2,571 | 2.578125 | 3 | [] | no_license | #include "ini_control.h"
#include <memory>
using std::vector;
using std::wstring;
using std::unique_ptr;
CIniControl::CIniControl()
: m_profilePath()
{
}
CIniControl::~CIniControl()
{
}
void CIniControl::Init(const wchar_t* path)
{
m_profilePath = path;
}
wstring CIniControl::GetIDFrom()
{
return GetP... | true |
e561f11e4bde34b3878a0df71a0d035582d68359 | C++ | degrand1/DataStructures | /Queue.h | UTF-8 | 635 | 3.234375 | 3 | [] | no_license | #ifndef QUEUE_H
#define QUEUE_H
#include "LinkedList.h"
template<class Data>
class Queue {
public:
Queue(){ List = new LinkedList<Data>(); }
~Queue();
Node<Data>* Dequeue();
void Enqueue( Data Value );
bool IsEmpty() { return List->IsEmpty(); }
private:
LinkedList<Data>* List;
};
template<class Dat... | true |
63a2f301ea444c5ca7c3196852c7dbf09783cf53 | C++ | IvanIsCoding/OlympiadSolutions | /DMOJ/acc3p4.cpp | UTF-8 | 2,120 | 2.578125 | 3 | [] | no_license | // Ivan Carvalho
// Solution to https://dmoj.ca/problem/acc3p4
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e6 + 10;
ll seg[4 * MAXN], lazy_a[4 * MAXN], lazy_r[4 * MAXN];
int N, Q;
ll soma_pa(ll a, ll r, ll n) {
ll b = a + (n - 1) * r;
return ((a + b) * n) / 2;
}
vo... | true |
f8b70aadc1d9436ca68ef223ce0c8d4733c977df | C++ | woke5176/Algoritms-and-data-structures | /118A_codeforces_String_Task.cpp | UTF-8 | 329 | 2.953125 | 3 | [] | no_license |
#include <iostream>
#include <cstring>
using namespace std;
int main() {
string s;
cin>>s;
for(int i=0;i<s.size();i++){
char ch=tolower(s[i]);
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' || ch=='y'){
continue;
}else{
cout<<"."<<ch;
}
}
return ... | true |
a004f7e81b9e83a3872f2e76a7604415559cb00e | C++ | stevens-rocksat-2020/oven_code | /src/PID-JACK.cpp | UTF-8 | 972 | 2.5625 | 3 | [] | no_license | #include "PID-JACK.h"
#include "OvenTemp.h"
OvenState ovenState = OvenState_OFF;
void PID::reset()
{
totalError=0;
lastError=0;
lastTimestamp=millis()-100;
}
double PID::get(double input)
{
double dt=(millis()-lastTimestamp)/1000.0;
if(dt<10)
{
dt=10;
}
lastTimestamp=millis();
... | true |
b3f65d477252560603a94498f2c7277e2fc02d54 | C++ | Gunjan827/Datastructures-and-Algorithms | /Stacks/nearest_smaller_to_right.cpp | UTF-8 | 975 | 4.09375 | 4 | [] | no_license | /*Given an array of integers, find the closest (not considering distance, but value) smaller on right of
every element. If an element has no smaller on the right side, print -1.*/
#include <iostream>
#include <stack>
using namespace std;
void printNSR(int arr[], int n){
stack <int> s;
int flag = 0;
s.pus... | true |
e66caa448c1891040e2bc21402fa6a72e6950dbf | C++ | kihx/rasterizer | /xtozero/Texture.h | UTF-8 | 2,776 | 2.6875 | 3 | [] | no_license | #ifndef _TEXTURE_H_
#define _TEXTURE_H_
#include <vector>
#include <map>
#include <string>
#include <memory>
#include "XtzMath.h"
#include "XtzThreadPool.h"
namespace xtozero
{
enum COLOR
{
BLUE = 0,
GREEN,
RED,
};
struct TEXEL
{
unsigned char m_color[3];
};
class CFilter
{
public:
explicit CFilt... | true |
3e6f62c81c266ab224b6448a52aedbef4406af29 | C++ | 20191864233/G20 | /c/c6/6.5/66.cpp | GB18030 | 658 | 2.84375 | 3 | [] | no_license | // 66.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
void nixv(int a[],int i);
int main(int argc, char* argv[])
{
int a[100],n;
int i;
printf("ij:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("... | true |
65ae694f8c39e103f6e85d7587adb67dc24653ce | C++ | OhYee/PAT | /basic/1024.cpp | UTF-8 | 3,155 | 3.328125 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include<cstring>
const int maxn = 10010;
char s[maxn];
char base[maxn];
/*
Find the first character c in the string s.
Arguments:
s - string
len - length of s
c - the character to find
Return:
The position of the ... | true |
c664e44145f42f076e43531f264c59ced06907cd | C++ | eldr4d/buildit | /build/read.cpp | UTF-8 | 4,496 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include "logmanager.hpp"
using namespace std;
typedef struct{
int employer = -1;
string token;
bool HTML = false;
bool state = false;
bool rooms = false;
vector<pair<string,bool> > names;
string logFile;
bool allO... | true |
7c3ca333192de06d56f9f0519fc079ed24c07f56 | C++ | QINGSHURUNINDEXINGMING/CPP | /106_1實習+課堂/實習9_1201/最接近的完全平方數.cpp | BIG5 | 1,348 | 4.03125 | 4 | [] | no_license | // (̱)g@Ө禡int sqrfloor(int n)AӨ禡@nApöǦ^pnḆnk(ơG}ڸƤ)C
// psqrfloor(5)hǦ^4Fsqrfloor(9)hǦ^9C
#include <iostream>
using namespace std;
int sqrfloor(int n)
{
for (int i = n; i>0; i--)
{
for (int j = 0; j < i; j++)
{
if (j*j == i)
{
return i;
}
}
}
}
int main()
{
int num;
cin >> num;... | true |
b8e60cfdc6f88c2aaa65f4c44e65fea28c319955 | C++ | mothaibatacungmua/finger_of_death | /model/bert/common.cpp | UTF-8 | 969 | 2.734375 | 3 | [] | no_license | #include "common.h"
#include <fstream>
#include <string>
#include <iostream>
std::string StringFormat(const std::string fmt_str, ...) {
int final_n, n = ((int)fmt_str.size()) * 2; /* Reserve two times as much as the length of the fmt_str */
std::unique_ptr<char[]> formatted;
va_list ap;
while(1) {
... | true |
644607e30cea774320e07998ba58a6f80098132f | C++ | nkorzh/Algorithms-DM | /1 semester/CT/3lab-DP/B.cpp | UTF-8 | 1,456 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000
int n, m; // <= 10 000
enum class Move : int {
R, D
};
vector<int> cost;
vector<vector<int>> d;
vector<vector<Move>> path;
int main() {
ios_base::sync_with_stdio(false);
// freopen("a.in", "r", stdin);
cin >> n >>... | true |
6ed2516bad72353d31697ee5d36d0ecdfd933c0c | C++ | matthewfl/stuff | /any.hpp | UTF-8 | 3,284 | 3.640625 | 4 | [] | no_license | #ifndef _ilang_any
#define _ilang_any
/* based off the boost::any class
* created to give greater control over the generic types
* added features:
* able to delete generic types that are pointers without know what they are
*
*/
#include <typeinfo>
#include <assert.h>
namespace ilang {
class any {
public:
... | true |
046e6b83a7a18af73bbb96c4af0189504b24400f | C++ | seanjsavage/TrainLight | /firmware/trainlight/application.ino | UTF-8 | 3,487 | 2.828125 | 3 | [] | no_license |
#include "neopixel.h"
int activityLed = D7;
unsigned int updateTimeout = 0; // next time to contact the server
#define PIXEL_PIN D0
#define PIXEL_COUNT 60
#define PIXEL_TYPE WS2812B
#define FAR 10
#define CLOSE 5
#define CLOSER 2
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
... | true |
75875dfbb75443933dab90ed969127a80a4071fd | C++ | m19s/multi-ems | /example/ems_digital/wire_ems_time/wire_ems_time.ino | UTF-8 | 2,493 | 2.5625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | //2017/9/7
//Michi Kono, U-Tokyo
#include <Metro.h>
#include <Wire.h>
//500 Hz max for voltage, due to metro.h res
int channelNum = 10;
Metro metroVolt[10]; //count time for pulse
Metro metroTime[10]; //count time for duration
int metroFlag[10]; //counting completed
int channelState[10]; //the state of the channel
i... | true |
2fff43078eabe417445846cdf5b08d924aaa247e | C++ | jml312/Cpp-course | /HW2/HW2Q2/main.cpp | UTF-8 | 665 | 3.53125 | 4 | [] | no_license | #include <iostream>
using namespace std;
string buildSentence(char components[], int lc, int places[], int lp);
int main() {
char components[] = {"ol,wrd eH"};
int places[] = {8, 7, 1, 1, 0, 2, 6, 3, 0, 4, 1, 5};
cout << buildSentence(components, 9 , places, 12);
return 0;
}
string buildSentence(char... | true |
89c493935ff5c0846c1bb39821929bf7d7116998 | C++ | shobhit-saini/IB | /Day14/Trailing_Zeros_in_Factorial.cpp | UTF-8 | 380 | 3.5 | 4 | [] | no_license | /*
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Example :
n = 5
n! = 120
Number of trailing zeros = 1
So, return 1
*/
int Solution::trailingZeroes(int A) {
int res, no = 0;
res = A/5;
no += res;
while(res > 0)
{
... | true |
bf6f8dfb401c5969568b6f1665a6e17a48eb623b | C++ | LeeJehwan/Baekjoon-Online-Judge | /code/11437_LCA.cpp | UTF-8 | 936 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define endl '\n'
const int MAX_N = 50001;
vector<int> adj[MAX_N];
int lv[MAX_N], parent[MAX_N], chk[MAX_N];
void dfs(int here) {
chk[here] = 1;
int next;
for (int i = 0; i < (int)adj[here].size(); i++) {
next = adj[here][i];
if (... | true |
f547764d36b2410df35eef1b1da4072a9e9ab875 | C++ | ywchen1994/ywchen | /RTEXTool/RingBuffer.cpp | UTF-8 | 1,365 | 2.765625 | 3 | [] | no_license | #include "StdAfx.h"
#include "RingBuffer.h"
CRingBuffer::CRingBuffer(void)
: m_HeadRingBuffer(0)
, m_TailRingBuffer(0)
{
for(int i = 0 ; i < RingBufferSize ; i++)
{
m_DataRingBuffer[RingBufferSize] = 0;
}
}
CRingBuffer::~CRingBuffer(void)
{
}
bool CRingBuffer::BufferIsFull(void)
{
//TRACE("head = %d , tail ... | true |
2a539e4fa56cb052425022938879845b9210d6a5 | C++ | jiuyewxy/Cpp-Primer-Plus | /ch2/Q05.cpp | UTF-8 | 334 | 3.515625 | 4 | [] | no_license | #include <iostream>
float exchange(float);
int main()
{
using namespace std;
float celsius;
cout<<"Please enter a Celsius value:";
cin>>celsius;
cout<<celsius<<" degrees Celsius is "<<exchange(celsius)<<" degrees Fahrenheit."<<endl;
return 0;
}
float exchange(float degree)
{
return degree... | true |
d664864c8e1d4c264a30da60e3522dea8a5b9d43 | C++ | Frank-Oroche/Algoritmos-Planificacion | /AlgoPlanificacion.cpp | ISO-8859-10 | 4,845 | 3.21875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define M 10 //tamao de la matriz (numero de procesos - 1)
void FCFS(int array[M][2]);
void SRTF(int array[M][2]);
void RR(int array[M][2]);
int menu();
void ImprimirMatriz(int lastdone, int output[M][100]);
void CopiarArray(int arr[M][2],int array[M][2]);
in... | true |
acc2ed52b9cf9d749810964654c3df47fd331332 | C++ | R-Lebudi/Cplusplus | /ATM app/main.cpp | UTF-8 | 1,880 | 4.125 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
double balance, withdraw, deposit, overdraft;
balance = 0;
int input;
cout << "Press 1 to display BALANCE \n"
<< "Press 2 to DEPOSIT money into the account \n"
<< "Press 3 to WITHDRAW money from the account \n"
... | true |
30d2901b3b2ed8c14cea3e89991e4cc5ceb53b57 | C++ | sauravstark/Preparations | /025 - AVL Tree Deletion.cpp | UTF-8 | 4,163 | 3.828125 | 4 | [] | no_license | #include <stack>
#include <algorithm>
struct Node
{
int data;
Node *left;
Node *right;
int height;
};
int height(Node* node) {
if(node == nullptr)
return 0;
return node->height;
}
Node* rotateL(Node *root);
Node* rotateR(Node *root);
Node* deleteNode(Node* root, int data) {
... | true |
cd5cd2e40aa2ee4e21ee1b7494ed89a187098b26 | C++ | HyunsuKim6/Algorithm | /Divide&Conquer/2448.cpp | UTF-8 | 633 | 3.390625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int a[8000][4000] = { 0 };
void star(int x,int y, int h) {
if (h == 3) {
a[x][y] = 1;
a[x - 1][y + 1] = 1;
a[x + 1][y + 1] = 1;
a[x - 2][y + 2] = 1;
a[x - 1][y + 2] = 1;
a[x][y + 2] = 1;
a[x + 1][y + 2] = 1;
a[x + 2][y + 2] = 1;
return;
}
star(x, y, h/ 2... | true |
c485732a9f44d2ea4cb0e0808d5505f2c7e02fc1 | C++ | Shubham915Arora/C- | /struct1.cpp | UTF-8 | 4,079 | 3.484375 | 3 | [] | no_license | #include<iostream >
#include<cstdlib>
using namespace std;
struct emp
{
int ecode;
char name[50];
int age ;
float salary;
char ch1;
};
int main()
{
emp e[1];
for(int i=0;i<=1;i++){
cout<<"\n Please Enter the details of the Employee : "<<i;
cout<<"\n Employee code :";
cin>>e[i].ecode;
... | true |
cc593452c85d96c974dc33c06b9a8197312d76c5 | C++ | LuisMiranda132/othelloAI | /final/scout.cc | UTF-8 | 501 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "scout.h"
#include <iostream>
#include <time.h>
using namespace std;
int main(){
int i;
int j;
for (j = 33; j>=0; --j) {
state_t init;
bool curPlay = true;
for(i=0;i<j;++i){
init = init.move(curPlay,PV[i]);
curPlay = !curPlay;
}
time_t start, end;
time (&start);
int n = scout(init, 34... | true |
8ba140130111a2cdd14275d569d4e4d2d3eb876d | C++ | jacky-huiyao/LeetCode | /Algorithm/#35#Search_Insert_Position/Search_Insert_Position.cpp | UTF-8 | 607 | 3.453125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
int searchInsert(int A[], int n, int target)
{
int i = 0;
int j = n - 1;
while (i <= j)
{
int mid = (int)((i + j)/2);
if (A[mid] == target)
r... | true |
1f71e2700c9faab1a3e9d8cadc7c5a87df1985d2 | C++ | RaresPopescu0807/ComputerGraphics | /Framework-EGC-master/Source/Laboratoare/Tema2/Transform3D.h | UTF-8 | 1,153 | 2.984375 | 3 | [] | no_license | #pragma once
#include <include/glm.h>
namespace Transform3D
{
// Translate matrix
inline glm::mat4 Translate(float translateX, float translateY, float translateZ)
{
// TODO implement translate matrix
return glm::mat4(1,0,0,0,0,1,0,0,0,0,1,0,translateX,translateY,translateZ,1);
}
// Scale matrix
inline glm... | true |
56a95e7afccabb9df6f9b1c78a7acc20dfc00bb6 | C++ | anushkaGurjar99/Data-Structure-and-Algorithms | /LEETCODE/Math/Q171. Excel Sheet Column Number.cpp | UTF-8 | 865 | 3.34375 | 3 | [] | no_license | /*
* Author : Anushka Gurjar
* Date : June 2020
* flags : -std=c++14
*/
#include<bits/stdc++.h>
using namespace std;
// Problem Statement: https://leetcode.com/problems/excel-sheet-column-number/
class Solution{
public:
int titleToNumber(string s){
if(s.size() == 0)
return 0;
... | true |
546b7f294958ac73059c3d3ae08f4bb389e2c554 | C++ | bobur554396/PPI2020FALL | /w3/G1/20.cpp | UTF-8 | 336 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
// do while
/*
for(;condition;){
}
while(condition){
}
do {
} while(condition)
*/
// int i = 100;
// while(i < 10){
// cout << i << " ";
// i++;
// }
int i = 100;
do {
cout << i << " ";
i++;
} while (i < 10)... | true |
4a4f24d8f9bf57723389c81be143ba0aa88991e4 | C++ | Vitaliy-Grigoriev/PDL | /core/endian/engines/impl/LittleEndianImpl.hpp | UTF-8 | 2,621 | 2.890625 | 3 | [
"MIT"
] | permissive | // ============================================================================
// Copyright (c) 2017-2021, by Vitaly Grigoriev, <Vit.link420@gmail.com>.
// This file is part of PdlFramework open source project under MIT License.
// ============================================================================
#pragma o... | true |
ed5b1e5b324fa607deee6173e4efd8b02ea78755 | C++ | AbdelrahmanShaheen/DataStructures_Imp | /AVL-Tree/src/AvlTree.cpp | UTF-8 | 5,786 | 3.5 | 4 | [] | no_license | #include "../include/AvlTree.h"
#include <iostream>
using namespace std;
AvlTree::AvlTree(Node *r) : root(r) {}
void AvlTree::Insert(int value) {
root = Insert(value, root);
}
Node *AvlTree::Insert(int value, Node *ptr) {
Node *newNode;
if (root == NULL) //if tree is empty.
{
//Create a newn... | true |
941e6c2c3c901f5ae292f948675889feab807855 | C++ | barunpuri/study | /C++ lifegame/lifegame.cpp | UTF-8 | 3,075 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <vector>
#include "lifegame.h"
lifegame::lifegame()
:row_size_(0), col_size_(0), generation_(0)
{
field_.clear();
}
lifegame::lifegame(std::ifstream &fin)
:row_size_(0), col_size_(0), generation_(0)
{
int data;
fin >> row_size_ >> col_size_;
input_data(fin)... | true |
0174453f6da12956086db4c5bd27044e95344800 | C++ | bytzar/Tic-Tac-Toe-C- | /tic tac toe/Debug/main.cpp | UTF-8 | 5,127 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <windows.h>
using namespace std;
char square[9] = { '0','1','2','3','4','5','6','7','8' };
int cock = 0;
int i;
void grid() //prints the 3x3 grid
{
for (i = 0; i <= square[8]; i++) //repeats eight times, once for each square
{
if (i == 3) //once th... | true |
98242946077d35f182f3ff418fed3b28f95afc0e | C++ | rafaelGuasselli/estudo_cpp | /Exemplos/stl/templates/vector.cpp | UTF-8 | 1,990 | 3.65625 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> vetor2;//Vector<tipo> nome;
vector<int> vetor(3,5);//Parametros (x,y) tem o mesmo funcionamento do assign
//caso não tenha o valor x sera adicionado 0 y vezes
vetor2.clear();//"Reseta o vetor", muda o tamanho do vetor pra... | true |
9e1f5b43cca6ecb29aa696c37631ffc7b28000c8 | C++ | VRedBull/C-Fundamentals | /Source Code/Basics/StockMarket.cxx | UTF-8 | 582 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <cmath> //Just a library to let us use some math functions
using namespace std;
int main(){
float amount, principal, interest=0.02;
int nDays;
cout<<"Enter for many days you wanna invest = "<<flush;
cin>>nDays;
cout<<"Enter your Money : "<<flush;
cin>>amount;
... | true |
f96bab658aaf562ee49d78a57850ba91ffb2fb77 | C++ | shubh09/shared | /Topcoder/SRM410/DIV2 - 250.cpp | UTF-8 | 1,407 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
using namespace std;
#define FOR(i,a,b) for (i=a;i<b;i++)
#define s(n) scanf("%d",&n)
#define p(n) printf("%d\n",n)
#define pl(n) printf("%ll... | true |
6e26a7487fd17d620c59b39e59e8a3b7522f9967 | C++ | Graphics-Physics-Libraries/RenderLibrary | /TFMEngine/src/tests/SimpleScene.cpp | UTF-8 | 4,687 | 2.5625 | 3 | [] | no_license | #include "tests/SimpleScene.h"
namespace SimpleScene
{
Mesh::Mesh * loadMesh(const std::string & file, unsigned int options)
{
std::vector<Mesh::Mesh *> meshes = Mesh::MeshManager::getInstance().loadMeshFromFile(file, options);
if (meshes.size() == 0)
{
Log::getInstance().logError("No meshes were found in t... | true |
3fe13b1fbe2b540569a5ff5216e0cc68ff72de97 | C++ | SJX516/DataStructureCppCode | /表达式计算/Calculate.cpp | GB18030 | 5,186 | 3.109375 | 3 | [] | no_license | #include "Calculate.h"
#include <string.h>
using namespace std;
Calculate::Calculate(string temp)
{
infix = temp;
for(int i = 0 ; i < 20; i++)
{
ser_num[i] = 0;
}
ser = -1;
}
Calculate::~Calculate()
{
symbol_stack.Clear();
suffix_stack.Clear();
}
int Calculate::Get_ser_num() ... | true |
517b74b75dd646062546cfaed1b57e7e31764bea | C++ | MykolaNemo/AdventOfCode | /2016/Day-19/main.cpp | UTF-8 | 1,610 | 3.609375 | 4 | [] | no_license | #include <iostream>
int input = 3018458;
template<class T>
struct Node
{
T value;
Node* next = nullptr;
Node(Node* parent, T data)
{
parent->next = this;
value = data;
}
Node(T data)
{
value = data;
}
void remove_next()
{
if(next != nullptr)
... | true |
e81a0cd5eaa5297ec7c05622a79ee2d2c19cdfbd | C++ | batux/stochastic_cellular_automata | /parallel_dataset_processing/src/hashcode_producer/HashcodeProducer.cpp | UTF-8 | 1,140 | 3.125 | 3 | [] | no_license | /*
* HascodeProducer.cpp
*
* Created on: Dec 17, 2017
* Author: batuhan
*/
#include "HashcodeProducer.h"
HashcodeProducer::HashcodeProducer() {
// TODO Auto-generated constructor stub
}
HashcodeProducer::~HashcodeProducer() {
// TODO Auto-generated destructor stub
}
int HashcodeProducer::createHashCod... | true |
e7a817a21570e7279300d9a3dd743ef63151c606 | C++ | Leshy4/Cpp17-REF-and-Practice | /CODE from Book && Random/PolyAnimals/PolyAnimals.cpp | UTF-8 | 959 | 2.8125 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <memory>
void AnimalsBeingsDogsBeingThings();
int main()
{
AnimalsBeingsDogsBeingThings();
}
void AnimalsBeingsDogsBeingThings()
{
Animal atticusAnimal("Atticus", 16, 25);
atticusAnimal.talk();
Dog atticusDog("Doggo", 20, 303);
atticusDog.talk... | true |
b9bff60413f96753140c32cb12ceb048a5780248 | C++ | coreyao/MyRepository | /LearningOpenGL/Source/FrameWork/ParticleSystem.cpp | UTF-8 | 14,264 | 2.578125 | 3 | [] | no_license | #include "ParticleSystem.h"
#include "OpenGL/GLProgramManager.h"
#include "Director.h"
#include "Image/PNGReader.h"
#include "Mesh.h"
#include <utility>
void CParticleSystem::AddEmitter( CEmitter* pNewEmitter )
{
pNewEmitter->m_pParticleSystem = this;
m_vEmitter.push_back(pNewEmitter);
}
void CParticleSystem::Upda... | true |
9726016f382e9540407819093fd22a9020b491c6 | C++ | Spencer-Yoder/Ring-Bell | /GetTime.cpp | UTF-8 | 689 | 3.578125 | 4 | [
"MIT"
] | permissive | #include "Header.h"
#include<ctime> //Used for getting time
//This Funciton Gets the current time from the computer and
//converts it into local time. It saves the time in the class
//varables.
void RingBell::GetTime()
{
time_t currentTime;
struct tm *localTime;
time(¤tTime); // ... | true |
c52cd48cc69b99d72f176051c9469815e2de5003 | C++ | happycoder0011/Competitive-Coding-Contest-Solutions | /SEPTEMBER_long_challenge.cpp/chefina_and_swap.cpp | UTF-8 | 878 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ulli;
bool check(int a[],int n,int sum)
{
int all=0;
for(int i=0;i<n;i++)
{
if(all<sum)
all += a[i];
else
if(all==sum)
return true;
else
if(all>sum)
... | true |
abdf3ecc1399d09c519616716d76b6bdd2b7b1e1 | C++ | peshe/SDP20-21 | /exercises/2&4/Data Structures/Trees/ArbitraryTrees/Practice_Tasks/Solutions.cpp | UTF-8 | 4,541 | 3.203125 | 3 | [
"CC0-1.0"
] | permissive | #include <iostream>
#include <vector>
#include <queue>
struct Node
{
int fData;
std::vector<Node*> fChildren;
Node( int data = 0 ) : fData(data) {}
};
Node* createTree()
{
int count = 0;
Node* root = new Node( count++ );
root->fChildren.push_back(new Node( count++ ));
root... | true |
8abe1b7caf2644fecfb0972938f283539f8d3ffa | C++ | datk1912/PokerProject | /1.3.cpp | UTF-8 | 479 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
int count1(int n, int m)
{
static int s = 1, dem = 0;
if (m == n) return 1 + dem;
for (int i = m; i <= n; i++)
if (s*i < n)
{
s *= i;
count1(n, i);
if (s > 1 )s /= i;
}
else if (s*i == n)
{
s = 1... | true |
c4b79158ac9cac73944bfbc3b40af18c4f827dce | C++ | KarimAmrM/Restaurant-Ds-simulator | /Restaurant/Data Structers/PriorNode.h | UTF-8 | 634 | 3.5 | 4 | [] | no_license | #pragma once
template<class T>
class PriorNode //This class is the same ass node but added a prioirty for the implemnetation of the priority queue
{
private:
T item;
double priority;
PriorNode<T>* next;
public:
PriorNode()
{
next = nullptr;
}
PriorNode(T newItem)
{
item = newItem;
next = nullptr;
}
... | true |
100b08301153d00e3676f71d195c1e2be27f4fda | C++ | maxyypoo/cs | /TotalofAll/110C/excp.cpp | UTF-8 | 1,018 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <stdexcept>
using namespace std;
template<class ItemType>
class Box
{
private:
ItemType item;
public:
void setItem(const ItemType& i)
{ item = i; }
ItemType getItem() const
{ return item; }
};
Box<int> findBox(Box<int> boxes[], int size, int target)
{
int i = 0;
bool foun... | true |
eeb609e4221a78d9d345f614bbdbeec14c690595 | C++ | mariusjcb/LFA_HOMEWORK_3 | /LFA_HOMEWORK_3/Pair.cpp | UTF-8 | 1,335 | 3.171875 | 3 | [] | no_license | //
// Pair.cpp
// LFA_HOMEWORK_3
//
// Created by Marius Ilie on 26/05/17.
// Copyright © 2017 Marius Ilie. All rights reserved.
//
#include "Pair.hpp"
//MARK: Setters
void Pair::setLeg(Pair* pair) {
this->leg = pair;
}
void Pair::setX(char x) {
this->x = x;
}
void Pair::setNod(int z) {
this->nod = ... | true |
977cbe01854428aa9445592b71a719bc018f1f3f | C++ | Shreyas9699/Strings | /ReverseWordsInString.cpp | UTF-8 | 561 | 3.296875 | 3 | [] | no_license | //Given a String of length S, reverse the whole string without reversing the individual words in it. Words are separated by dots.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin>>T;
while(T--){
string s, it;
cin>>s;
... | true |
e18a7502f0b45b0c8e4f9d2e2c10f725a43436d1 | C++ | dsteinel/TheWurlitzer | /calcFreq.ino | UTF-8 | 651 | 2.5625 | 3 | [] | no_license |
/*** CONNECT FREQ SOURCE TO PIN 2 ***/
//http://forum.arduino.cc//index.php?topic=64219.30
/*** INTERRUPT SERVICE ROUTINE ***/
void isr(){
unsigned long now = micros();
if (numPulses == 1){
firstPulseTime = now;
}
else{
lastPulseTime = now;
}
++numPulses;
}
/*** READ FREQ ***/
float readFrequenc... | true |
51a8c2dea3d595c3794d6738968a427fc2bb9ae2 | C++ | lafio/work_space_C | /acm.hdu.edu.cn/1005_number_sequence.cpp | UTF-8 | 876 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int fx(int a,int b,int n){
int begin=0,end=1;
int r[60];
int flag=0;
r[0]=r[1]=r[2]=1;
if(n==2||n==1){
return 1;
}else{
for(int i=3;i<=n && !flag;i++){
r[i]=(r[i-1]*a+r[i-2]*b)%7;
for(int j=2;j<i;... | true |
f188e9ab9c788128c0613d1c77662b7f19b32a83 | C++ | LPD-EPFL/consensusinside | /mpass/src/test/test_queue_pthread_wait.cc | UTF-8 | 3,508 | 2.671875 | 3 | [] | no_license | /**
* @author Aleksandar Dragojevic aleksandar.dragojevic@epfl.ch
*
*/
#include <stdio.h>
#include <pthread.h>
#include "../common/constants.h"
#include "../common/time.h"
#include "../common/inttypes.h"
#include "../mpass/queue.h"
#include "test_queue_busy_wait.h"
struct thread_data {
mpass::QueueDefault *serve... | true |
fff3b6e1d37cbae7f4682ee2ed84c452e7cf0bba | C++ | viaduct/telim_tmsd | /ptr_comp.h | UTF-8 | 576 | 2.953125 | 3 | [] | no_license | #pragma once
#include <type_traits>
#include <memory>
namespace telimtmsd {
template <typename T>
struct PtrComp final
{
using is_transparent = std::true_type;
struct Adapt final
{
T const* ptr;
Adapt(T const* in) : ptr(in) {}
Adapt(std::shared_ptr<T const> const& in) : ptr(in.get()) {}
Adapt(std::unique_p... | true |
b6ff96493041589d9ef88f9ff6aff458a5cc41de | C++ | fedix/Algorithms_and_Data_Structures | /List/main.cpp | UTF-8 | 467 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include "List.h"
#include "List.cpp"
using namespace std;
int main() {
List<int> q;
cout << "testing as a queue" << endl;
q.push_back(1);
q.push_back(2);
q.push_back(3);
q.push_back(4);
q.push_back(5);
for (auto i = 0; i < q.GetSize(); i++)
cout << q[i] <<... | true |
dc597edccd767648b1bd0c5c846f4ae02e93c415 | C++ | coronalabs/corona | /platform/windows/Corona.Component.Library/CoronaLabs/WinRT/ImmutableByteBuffer.h | UTF-8 | 7,047 | 3.25 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown"
] | permissive | //////////////////////////////////////////////////////////////////////////////
//
// This file is part of the Corona game engine.
// For overview and more information on licensing please refer to README.md
// Home page: https://github.com/coronalabs/corona
// Contact: support@coronalabs.com
//
////////////////////////... | true |
725d9a85654f780124440e75009d6634497c534e | C++ | avinashw50w/ds_algo | /Dynamic programming/maximum sum subarray.cpp | UTF-8 | 1,998 | 3.15625 | 3 | [] | no_license | #include<bits/stdc++.h>
#define oo (1<<30)
using namespace std;
// dp solution //
int fun(int a[], int n) {
int dp[n + 1] = {};
dp[0] = a[0];
for (int i = 1; i < n; ++i) {
dp[i] = max(a[i], a[i] + dp[i - 1]);
}
return *max_element(dp, dp + n);
}
/* the concept is : S[i..j] = S[j] - S[i-1] ,w... | true |
c225b66f02ba872bd9e65173d4d86d9e346dd487 | C++ | TPVejercicios/BowPractica_3.0 | /ProyectosSDL/HolaSDL/GameState.h | ISO-8859-1 | 2,599 | 3.0625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <list>
#include "Resources.h"
#include "checkML.h"
using namespace std;
using uint = unsigned int;
class SDLApplication;
class GameObject;
class EventHandler;
class GameStateMachine;
class Background;
class Texture;
class Arrow;
/*
GameState manda los updates y renders los diferentes game obje... | true |
5b1a9257d34c20da264694065a17c00eb6097717 | C++ | jaleng/cs171 | /assignment_2/Vertex.h | UTF-8 | 1,172 | 3.59375 | 4 | [] | no_license | #ifndef VERTEX_H_
#define VERTEX_H_
#include <Eigen/Dense>
/** Hold 3 double coordinates for x,y,z space */
class Vertex {
public:
double x;
double y;
double z;
explicit Vertex(double _x, double _y, double _z)
: x{_x}, y{_y}, z{_z} {};
explicit Vertex(Eigen::MatrixXd m)
: x{m(0)}, y{m(1)}, z{m(2)... | true |
9793a864ca145792ac8443ffa8fb9e2677cc16cc | C++ | dagophil/gameprototype | /sources/Player.cpp | UTF-8 | 2,830 | 2.546875 | 3 | [] | no_license | #include "Player.h"
#include "Vehicle.h"
#include "Map.h"
Player::Player(int playerId)
: m_playerId(playerId),
m_lives(10),
m_opponent(0),
m_joystick(true)
{
srand(time(NULL) );
m_vehicle = new Vehicle("car.mesh",400.f,this);
//m_vehicle->translate(10*playerId,10*playerId,10*playerId... | true |
2c685d5fda953c113ff0ac56adb3f35abc7cea5d | C++ | sciplot/sciplot | /sciplot/Utils.hpp | UTF-8 | 14,748 | 2.703125 | 3 | [
"MIT"
] | permissive | // sciplot - a modern C++ scientific plotting library powered by gnuplot
// https://github.com/sciplot/sciplot
//
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
//
// Copyright (c) 2018-2021 Allan Leal
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this... | true |
0812576944f4692ac6b82131138a5a614f636d5c | C++ | hys2rang/WHrkTLQKF | /swexpert/swbasic/sum.cpp | UTF-8 | 1,617 | 3.59375 | 4 | [] | no_license | /*
다음 100X100의 2차원 배열이 주어질 때, 각 행의 합, 각 열의 합, 각 대각선의 합 중 최댓값을 구하는 프로그램을 작성하여라.
다음과 같은 5X5 배열에서 최댓값은 29이다.
[제약 사항]
총 10개의 테스트 케이스가 주어진다.
배열의 크기는 100X100으로 동일하다.
각 행의 합은 integer 범위를 넘어가지 않는다.
동일한 최댓값이 있을 경우, 하나의 값만 출력한다.
[입력]
각 테스트 케이스의 첫 줄에는 테스트 케이스 번호가 주어지고 그 다음 줄부터는 2차원 배열의 각 행 값이 주어진다.
[출력]
#부호와 함께 테스트 케이스... | true |
96da847f582197f461bb1e4f83c956e4b4471e50 | C++ | zyxave/baba | /public_html/asset/submission_files/370f6f8014a62a09268dd7a4a1d03c8b.cpp | UTF-8 | 256 | 2.671875 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int n,x,t,hit;
int cek(int x)
{
if(x==1) return hit;
hit++;
return cek(x/2);
}
int main ()
{
x=1;
cin>>t;
for(int i=1;i<=t;i++)
{
hit=0;
cin>>n;
if(n==1) hit=1;
cek(n);
cout<<hit<<endl;
}
}
| true |
7881ee8ebd98e4c34739bd70990c84e7f013d31f | C++ | 201419/Programming-Training | /Leetcode/0431-0440.cpp | UTF-8 | 1,698 | 2.828125 | 3 | [] | no_license |
// https://leetcode-cn.com/problems/encode-n-ary-tree-to-binary-tree/
// 431. 将 N 叉树编码为二叉树
// ---------------------------------------------------------------------------
// https://leetcode-cn.com/problems/all-oone-data-structure/
// 432. 全 O(1) 的数据结构
// -----------------------------------------------------------... | true |
45f82cc63f0a107cdb59db14199574af2ce6cce2 | C++ | Vaa3D/vaa3d_tools | /hackathon/PengXie/NeuronStructNavigator/cmake-3.6.2/Tests/CompileFeatures/cxx_contextual_conversions.cpp | UTF-8 | 635 | 3.1875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive |
#define assert(E) \
if (!(E)) \
return 1;
template <class T>
class zero_init
{
public:
zero_init()
: val(static_cast<T>(0))
{
}
zero_init(T val)
: val(val)
{
}
oper... | true |
2495dba0f132c1177ecb8160549e572faeb1c6d8 | C++ | lcccc/nfcjcodes | /85-8.cpp | UTF-8 | 930 | 2.6875 | 3 | [] | no_license | /*
* Author: Nfcj
* Created Time: 2011年08月05日 星期五 21时25分33秒
* File Name: 85-8.cpp
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
#define SZ(v) ((int)(v).size())
int tot,n,pm[50000];
bool ispm(int x)
{
f... | true |
f12fd625ffea11240c8f805b824ee7a6fa658e63 | C++ | Neema-Rawat/8june_IoT | /Motor_Timer.ino | UTF-8 | 1,723 | 2.9375 | 3 | [] | no_license | #include<LiquidCrystal.h>
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
const byte ctrl_key = 3;
const byte m_pins[2] = {12, 13};
void setup() {
lcd.begin(16, 2);
pinMode(ctrl_key, INPUT_PULLUP);
for (int i = 0 ; i < 2; i++)
pinMode(m_pins[i], OUTPUT);
}
bool gate_state = false;
int counter = 0; // ... | true |
bfad280af5fde9ff0b60ebbaee530dfd54a47a8c | C++ | fabiohenriquez/Archivo_Lab5_FabioHenriquez | /ingredientes.h | UTF-8 | 625 | 2.8125 | 3 | [] | no_license | #ifndef INGREDIENTES_H
#define INGREDIENTES_H
#include<string>
using std::string;
class ingredientes{
private:
string tipo;
string ingrediente;
int cantidad;
double duracion;
public:
ingredientes();//ctor por defecto
ingredientes(string,string,int,double);
string getIngrediente();//ins... | true |
eaac95e02a6f6e9b319f5892951818bce15d44e5 | C++ | huaxiufeng/leetcode | /src/algorithm/cpp/reverse-linked-list/main.cpp | UTF-8 | 2,585 | 4.03125 | 4 | [] | no_license | /*
Reverse a singly linked list.
click to show more hints.
Hint:
A linked list can be reversed either iteratively or recursively. Could you implement both?
*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
template <typename T>
void display(vector<T> array) {
fo... | true |
70dcc43e9b415294a83492399bd52a94b8ffe32b | C++ | RenMitsumata/Shu-Pre-Project | /Shader2D.cpp | SHIFT_JIS | 5,208 | 2.515625 | 3 | [] | no_license |
#include "Manager.h"
#include "DXManager.h"
#include "Component.h"
#include "Texture.h"
#include "Shader2D.h"
#include "window.h"
#include <Windows.h>
#include <stdio.h>
#include <io.h>
Shader2D::Shader2D()
{
}
Shader2D::~Shader2D()
{
}
void Shader2D::Init(const char * VS_Filename, const char * PS_Filename)
{
//... | true |
7cafbabb56a0cf2a27d2d4a8ce13d94fcb7407c1 | C++ | AvneetSandhu/Data-Structures-Program | /stack.cpp | UTF-8 | 1,331 | 3.921875 | 4 | [] | no_license | #include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
class stack
{
int top;
int Stack[500];
public:
void push();
void pop();
void display();
stack()
{
top=-1;
}
};
void stack::push()
{
int item;
if(top>500)
{
... | true |
5509bae7d2e29b6088ad0b8aebd3ab903a9f97a4 | C++ | sanus912/community-detection | /ori_MEMB.cpp | UTF-8 | 13,772 | 2.515625 | 3 | [] | no_license | ////////read .txt; omit the first 6 lines; from 0 to N-1;///////////////
#include <vector>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <sstream>
#include <iomanip>
#include <ctime>
using namespace std;
const int MAX=12501;
const int MAXR=10;
const int MINR=1;
... | true |
6af725d7f7d59d7d191a3eadd648ba85d6d2edbb | C++ | Conception-Electronique-Prive/Bootloader_L452_CAN | /Core/Inc/utils.hpp | UTF-8 | 448 | 3.09375 | 3 | [] | no_license | #pragma once
#include <array>
#include <cstdint>
template<typename T>
void toType(const std::array<uint8_t, 8>& data, T& var) {
uint8_t* ptr = (uint8_t*)&var;
for (size_t i = 0; i < sizeof(T); ++i, ++ptr) {
*ptr = data[i];
}
}
template<typename T>
void toArray(std::array<uint8_t, 8>& data, const T... | true |
592e9c296fa2c28ba62c445a338cb3d402f7403a | C++ | Aditya2150/SDE-Questions | /Day 7 (2 Pointers)/3sum.cpp | UTF-8 | 1,108 | 3.0625 | 3 | [] | no_license | // Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]]
// such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
// Notice that the solution set must not contain duplicate triplets.
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
... | true |
065b4d365f97140a0227bb75669d45f1f6c6d86a | C++ | nosuggest/sladeRode3 | /Chapter07/Teacher.cpp | UTF-8 | 2,027 | 3.453125 | 3 | [] | no_license | //
// Created by 沙韬伟 on 2019-09-24.
//
#include "Teacher.h"
const string &Teacher::getName() const {
return name;
}
void Teacher::setName(const string &name) {
Teacher::name = name;
}
int Teacher::getAge() const {
return age;
}
void Teacher::setAge(int age) {
Teacher::age = age;
}
float *Teacher::... | true |
a55cd1554f011eb44a261ce6bf43dd476df2b35e | C++ | Albert-learner/Lectopia | /HW17.cpp | UHC | 828 | 3.109375 | 3 | [] | no_license | /*ۼ : HW17*/
#include <stdio.h>
#include <string.h>
void myflush();
int main()
{
char eng_name[20];
double hei;
char gen;
char gend[8];
int i, len;
for (i = 0; i < 2; i++)
{
printf("(%d)\n", i+1);
printf("# Է : ");
fgets(eng_name, 20, stdin);
printf("# Ű Է(cm ) : ");
scanf("%... | true |
eeb2fb353d8e0cc563999fb7bdb2f802ab00e447 | C++ | niuxu18/logTracker-old | /second/download/rsync/gumtree/rsync_repos_function_259_rsync-2.6.8.cpp | UTF-8 | 922 | 2.671875 | 3 | [] | no_license | unsigned int clean_fname(char *name, BOOL collapse_dot_dot)
{
char *limit = name - 1, *t = name, *f = name;
int anchored;
if (!name)
return 0;
if ((anchored = *f == '/') != 0)
*t++ = *f++;
while (*f) {
/* discard extra slashes */
if (*f == '/') {
f++;
continue;
}
if (*f == '.') {
/* discard ... | true |
df0655c95ff6cf88449547d15594d796b7d12b70 | C++ | lbc3402785/expressServer | /thread/workingthread.cpp | UTF-8 | 422 | 2.5625 | 3 | [] | no_license | #include "workingthread.h"
WorkingThread::WorkingThread(QObject *parent):QThread (parent)
{
state=CREATED;
}
WorkingThread::WorkingState WorkingThread::getState() const
{
return state;
}
void WorkingThread::setState(const WorkingState &value)
{
state = value;
}
bool WorkingThread::getStopSignal() const
... | true |
31cc14a423af50f91898cface1261d815eff300e | C++ | TheMrViper/gain-money | /Octets.h | UTF-8 | 1,428 | 2.6875 | 3 | [] | no_license | #ifndef OCTETS_HEADER
#define OCTETS_HEADER
struct Rep {
size_t cap;
size_t len;
size_t ref;
static Rep null;
public:
void addref(void);
void release(void);
void * data(void);
void * clone(void);
void * unique(void);
void * reserve(unsigned int);
static size_t frob_size(un... | true |
a501e68a08548142259679309beaadc7b3e9213c | C++ | bishal1433/Competitive-Programming | /Competative programming/problem A/solution.cpp | UTF-8 | 874 | 2.5625 | 3 | [] | no_license | /*
Paste the below link in your browser for question:
https://codeforces.com/contest/1513/problem/A
*/
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
void solve()
{
int n,k; cin>>n>>k;
int check;
if... | true |
c7d1836d00ca82eb051d072e150c5238b9fafcd1 | C++ | lawtonsclass/f20-code-from-class | /csci40/lec29/sets.cpp | UTF-8 | 285 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <set>
using namespace std;
int main() {
set<int> s;
s.insert(2);
s.insert(1);
s.insert(3);
// check if an element is there
// (counts in sets can only ever be 0 or 1)
cout << s.count(2) << endl;
cout << s.count(4) << endl;
return 0;
}
| true |
0986b05a8866ffb5d63986e6f84424ea955290a7 | C++ | rychrd/waterScape | /src/imgProc.cpp | UTF-8 | 2,930 | 2.765625 | 3 | [] | no_license | //
// imgProc.cpp
// nng_test
//
// Created by Richard on 27/08/2019.
// Some pixel processing functions
#include <stdio.h>
#include "imgProc.h"
// RGB 0.2126 // 0.7152 // 0.0722
//-----------------------------------------------
Pxl::Pxl(){
w=320;h=240;chans=1;
gradX.allocate(w, h, chans);
gradY.al... | true |
75a3de96ebcd402f4318ad450bd8075f88cdb1ee | C++ | kei1107/algorithm | /problems/Atcoder/ABC075_D.cpp | UTF-8 | 2,302 | 2.703125 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = LLONG_MAX;
/*
<url:https://abc075.contest.atcoder.jp/tasks/abc075_d>
問題文============================================================
2次元座標上に N 個の点があります。
i(1≦i... | true |
066d482952039b114779db25b7acf3667cad256a | C++ | kyberdrb/EmployeeManagementSystem | /app/src/NoIDs_InID_Pool.h | UTF-8 | 209 | 2.84375 | 3 | [] | no_license | #pragma once
#include <exception>
class NoIDs_InID_Pool : public std::exception {
public:
const char* what() const noexcept override {
return "ID Pool is empty. No more IDs to borrow.";
}
};
| true |
678bfbcab1cf682e4c1c48d377b94c819caac177 | C++ | SubhamKumarPandey/DSA | /algorithms/CPlusPlus/Arrays/left-rotation.cpp | UTF-8 | 729 | 3 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
#define int long long int
#define pb push_back
using namespace std;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,left_rotation_val;
cin>>n>>left_rotation_val;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
left_rotation... | true |
cf050a54d1c7f9f00d424bd714584eac50d44c8e | C++ | jackdongrepo/3081W-Bus-Simulation | /labs/lab03_class_basics/point2.h | UTF-8 | 237 | 2.65625 | 3 | [] | no_license | #ifndef POINT2_H
#define POINT2_H
using namespace std;
class Point2 {
public:
Point2(float x = 0, float y = 0);
float DistanceBetween(Point2 other);
int Quadrant();
void Print();
private:
float x_cord, y_cord;
};
#endif | true |
cd98290c654949727f0457b02d079b75d3cb8e73 | C++ | spurnaye/ds-algos | /src/ds/LockFree/SPSCSpinLockQueue.h | UTF-8 | 1,467 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <atomic>
// open ended SPSC Queue
struct SPSCSpinLockQueue{
SPSCSpinLockQueue(){
head_ = new Node(-1, true);
tail_ = new Node(-1, true);
head_->next_ = tail_;
tail_->prev_ = head_;
};
SPSCSpinLockQueue& operator=(const SPSCSpinLockQueue& rhs) = delete;
... | true |
8f0406cef93e83ff4e4d2fdca39b5588c222e531 | C++ | futureyoungin/Algorithm-Study | /3-Week/dain/11659-구간합구하기4-dain.cpp | UTF-8 | 373 | 2.71875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
int N, M, sum = 0;
int array[100001];
cin >> N >> M;
for(int i=1;i<=N;i++){
int a;
cin >> a;
sum += a;
array[i] = sum;
}
for(int i=0;i<M;i++){
int start, end;
cin >> start >> end;... | true |
61ab74ced2c8f29a9cda05f9fdce8e237ab94002 | C++ | ayushkr667/Codeforces-Problem | /Building_Teams.cpp | UTF-8 | 1,266 | 2.515625 | 3 | [] | no_license | /*-------------------------------*
| Name: Ayush Kumar |
| College: SOE, CUSAT |
| Dept: CSE |
| Email: ayushkr667@gmail.com |
*-------------------------------*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp ... | true |
0344528cdf016279cfdb1b8819df9ef891e69f86 | C++ | garyhubley/ProjectEuler | /src/problem021.cpp | UTF-8 | 2,040 | 3.34375 | 3 | [] | no_license | /*
* File: Problem021.cpp
* Author: Gary Hubley
* Company: Self
* Description:
* This is my attempt at problem021 from projecteuler.net
*
* Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
* If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amic... | true |
2cbdf9fc57c16a37e493c3a446545ef3f5f93fce | C++ | withelm/Algorytmika | /leetcode/algorithms/c++/Beautiful Arrangement/Beautiful Arrangement.cpp | UTF-8 | 1,224 | 2.9375 | 3 | [] | no_license | class Solution
{
private:
vector<vector<int>> next;
int r;
vector<bool> vis;
void back(int k, int n)
{
// cout << k << " " << n << endl;
// for(int i = 1; i <= n; i++) cout << vis[i] << " ";
// cout << endl;
if (k == n + 1)
{
++r;
re... | true |
44effe60621418b97b6858d47ed02ffaeb3b13c7 | C++ | kmira1498/C-Class | /Practical 2/ex4/ex4.cpp | UTF-8 | 505 | 3.734375 | 4 | [] | no_license | #include <iostream>
using namespace std;
//define function floyd to create the desired floyd's triangle
void floyd (int lines)
{
int number = 1;
cout << "Number of lines you want to display of Floyd's triangle: ";
cin >> lines;
for(int i = 1; i <= lines; ++i)
{
for(int j = 1; j <= i; ++j)
... | true |
e30d2bf78c7b93635fc4d7ec3ae0467cbb400612 | C++ | Kristian-Krastev/OOP | /Introduction to Classes/Workers Task/Worker.h | UTF-8 | 392 | 2.90625 | 3 | [] | no_license | #ifndef _WORKER_H_
#define _WORKER_H_
#include <string.h>
class Worker
{
private:
char name[32];
size_t year;
double salary;
public:
Worker();
~Worker();
public:
const char* get_name() const;
size_t get_year() const;
double get_salary() const;
void set_name(const char*);
void set_year(size_t);
void set_... | true |
dbeb969700022b42103d0e73494410e54d00f0c3 | C++ | eskrut/multithread | /pthread/pthread.cpp | UTF-8 | 516 | 2.890625 | 3 | [] | no_license | #include <stdlib.h>
#include <pthread.h>
#include <assert.h>
void* someParallelTask(void *arg) {
int *preciousValue =
reinterpret_cast<int*>(arg);
*preciousValue = 1;
}
int main(int argc, char**argv) {
pthread_t thread;
int value, othreValue;
pthread_create(&thread,
... | true |
8766e63903161eb0fdc17d304b2a02840a2fb3e3 | C++ | shahzad-bhatti/mosaic_creator | /include/point.h | UTF-8 | 2,681 | 3.703125 | 4 | [] | no_license | /**
* @file point.h
* Definition of a point class for k dimensional points.
*
* @author Shahzad Bhatti
* @date Summer 2015
*/
#ifndef POINT_H__
#define POINT_H__
#include <array>
#include <cstdint>
template <int Dim>
class point
{
public:
static_assert(Dim > 0, "Dimension argument must be positive");
... | true |
04fa2a7c7bc260f15d335807b1266f7e8884ef68 | C++ | norhakobyan/Struct-Stack | /StructStack.cpp | UTF-8 | 849 | 3.71875 | 4 | [] | no_license | #include <iostream>
const int size = 5;
struct Stack {
int stack[size];
int res;
};
void push(Stack *, int);
int pop(Stack *);
int main() {
Stack * tmp = new Stack;
tmp->res = -1;
push(tmp, 1);
push(tmp, 2);
push(tmp, 3);
push(tmp, 4);
push(tmp, 5);
std::cout << std::endl;
std::c... | true |
368d96bd02471d2f38da3231fa387a892d09a9af | C++ | samkellett/lmadb | /libs/cxx/include/cxx/adt/persistent_flat_map.hpp | UTF-8 | 2,973 | 2.9375 | 3 | [] | no_license | #ifndef LMADB_CXX_ADT_PERSISTENT_FLAT_MAP_HPP
#define LMADB_CXX_ADT_PERSISTENT_FLAT_MAP_HPP
#include "cxx/filesystem.hpp"
#include <boost/container/flat_map.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
namespace lmadb::cxx {
template <typename Key, typename Value>
class persistent_flat_map {
// unti... | true |
42e67611f974263a92ac555c7f4da9189b74fbf9 | C++ | ryanxunhuan/Sequential_Experimental_Design | /src/fileRead.cpp | UTF-8 | 484 | 2.953125 | 3 | [] | no_license | #include "fileRead.h"
/* Functions with templates are defined in header file. */
void readScalarAsString(char* const val, char const * const data, int &pos)
{
/* Initializations. */
int ctrVal(0);
/* Find starting point for numeric value. */
while (data[pos] == ' ' || data[pos] == '=')
pos++;
/... | true |