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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6c62aa3adf2e55d8166011885ac922447e80c008 | C++ | Khuromu/CustomPhysXEngineOpenGL | /Rigidbody with Rotation/CollisionEngine_VS2015/CollisionEngine/Polygon.cpp | UTF-8 | 10,471 | 2.640625 | 3 | [] | no_license | #include "Polygon.h"
#include <GL/glu.h>
#include "InertiaTensor.h"
#include "PhysicEngine.h"
#include "GlobalVariables.h"
#include "Renderer.h"
#include "Collision.h"
CPolygon::CPolygon(size_t index)
: m_vertexBufferId(0), m_index(index), density(0.1f)
{
aabb = new AABB();
}
CPolygon::~CPolygon()
{
DestroyBuffe... | true |
47c5deeb60749cdfdb9d8c0b54251db00efdba93 | C++ | david20571015/Introduction-to-Computers-and-Programming | /lab4/2.cpp | UTF-8 | 293 | 2.75 | 3 | [] | no_license | #include<stdio.h>
int main(void){
int n=0;
double x,arcsin;
printf("x = ");
scanf("%lf",&x);
double term=x;
while((term>=1e-12)||(term<=-1e-12)){
arcsin+=term;
n++;
term=term*(2*n-1)*(2*n)*(2*n-1)/4/n/n/(2*n+1)*x*x;
}
printf("arcsin %.2lf = %.10lf",x,arcsin);
return 0;
}
| true |
d5f0f29299ef6b026192cbc4c9fdb442666bbe69 | C++ | luisfmplus/proyecto3_ED | /Codigo/7BPersonas.cpp | UTF-8 | 21,290 | 3.234375 | 3 | [] | no_license |
/*
Manejo de errores.
1 = todo bien
-1 = lista vacia
-2 = fuera de rango
-3 = repetido
-4 = error en general
*/
//falta implementar la funcion de borrarNodo()
//modificaciones en: abcdefg
#include <iostream>
using namespace std;
class PaginaNodoPersona;
class NodoPersona {
public:
... | true |
718406d9bf9303798875e7b33d6a56809e0eaa39 | C++ | DayOut/SIP_1_bidirectional_ring_list | /SIP_1_bidirectional_ring_list/SIP_1_bidirectional_ring_list.cpp | WINDOWS-1251 | 13,459 | 3.421875 | 3 | [] | no_license | // SIP_1_bidirectional_ring_list.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <ctime>
using namespace std;
template <typename T>
class List
{
private:
template<typename T>
struct TElem
{
T inf;
TElem< T > *next;
... | true |
6af4fb0e0ec985a9c2e552ecd56c422333b0b96c | C++ | ZhuoerFeng/2019-OOP | /PA5/problem_32/pizza.h | UTF-8 | 1,898 | 3.53125 | 4 | [] | no_license | #pragma once
#include <cstring>
#include <iostream>
#include "plate.h"
class Pizza {
protected:
std::string name;
int ketchup, cheese;
bool cooked;
bool cutted;
Plate *plate;
public:
Pizza(const std::string &name, int ketchup, int cheese)
: name(name), ketchup(ketchup), cheese(cheese), cooked(false), cutted... | true |
96f7fceaaadcb36848fe2859b91512aa229e89fd | C++ | Sara3/-prefix-notation-to-infix-notation.- | /Stackfunctions.h | UTF-8 | 964 | 2.875 | 3 | [] | no_license | //----------------------------------------------------------------------------
// File -------- stackfunctions.h
// Programmer -- Sabera Daqiq
//
// This file contains declarations for the class stingstack and for toinfix function
// functions. See the accompanying implementation file for details.
//-----------------... | true |
36eb63dfe052526e41acf283616bd86e4ec764db | C++ | Hotanmes/PAT | /PAT_advanced/1138.cpp | UTF-8 | 955 | 3.140625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;
vector<int> pre,in;
bool flag = false;
void postorder(int prel, int inl, int inr)//参数意义分别为先序遍历序列中根结点下标、中序遍历序列中最左端结点下标和最右端结点下标
{
if (inl > inr || flag == true)
return;
int i = inl;
while (in[i] != pre[prel])//找出根结点在中序遍历序列中的下标
... | true |
f8280e4aa0feca3ba90605c5505a0e41bd58ebde | C++ | farabiahmed/MachineLearningFramework | /include/Representations/RepresentationUDP.hpp | UTF-8 | 1,512 | 2.546875 | 3 | [] | no_license | /*
* RepresentationUDP.hpp
*
* Created on: May 28, 2017
* Author: farabiahmed
*/
#ifndef REPRESENTATIONS_REPRESENTATIONUDP_HPP_
#define REPRESENTATIONS_REPRESENTATIONUDP_HPP_
#include <cmath>
#include <iomanip>
#include <cassert>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#i... | true |
9f8b61352f39e59650f315d823b756bf1c361bc0 | C++ | MQuy/mlang | /mc/src/llvm/const_eval.h | UTF-8 | 3,140 | 2.703125 | 3 | [] | no_license | #ifndef LLVM_CONST_EVAL_H
#define LLVM_CONST_EVAL_H 1
#include <memory>
#include "ast/parser.h"
#include "semantic/translation_unit.h"
class IR;
class ConstExprEval : NodeVisitor
{
public:
ConstExprEval(IR *ir, std::shared_ptr<ExprAST> expr)
: ir(ir)
, expr(expr)
{
}
int eval();
void *visit_literal_expr(... | true |
c676ac1d41ac63b83eb7edee9864fffa82774705 | C++ | red-rick/CFundamentals | /Chapter_9/Exercise_1/golf.cpp | UTF-8 | 510 | 3.078125 | 3 | [] | no_license | #include<iostream>
#include"golf.h"
void setgolf(golf & g, const char * name, int hc)
{
strncpy(g.fullname, name, Len);
g.handicap = hc;
}
int setgolf(golf & g)
{
std::cout << "Enter Full Name: ";
std::cin.getline(g.fullname, Len);
if (strlen(g.fullname) == 0)
return 0;
std::cout << "Enter handicap: ";
(std:... | true |
1efefdc0d60e5feb481b753674c8d8bfcae8c0bf | C++ | gviau/sketch-stl | /src/sketch_string.cpp | UTF-8 | 18,978 | 3.15625 | 3 | [
"MIT"
] | permissive | #include "sketch_string.h"
#include <math.h>
namespace SketchStl {
string::string() : data_(nullptr), length_(0), capacity_(1) {
data_ = (char*)malloc(1);
data_[length_] = '\0';
}
string::string(const string& str) {
length_ = str.length_;
capacity_ = str.capacity_;
data_ = (char*)malloc(capacit... | true |
1cb0b0fc3be00d85f73629a1045d53878d19d454 | C++ | longruiliu/Personal-Work | /leetcode/level_order_one_bt.cpp | UTF-8 | 2,759 | 3.5 | 4 | [] | no_license | #include<iostream>
#include<stdlib.h>
#include<vector>
using namespace std;
typedef struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
}*Tree;
class Solution {
public:
vector<vector<int> > levelOrder(TreeNode *root)
{
... | true |
3b816cdc94e33268141a224e51261b7518754681 | C++ | Turtlesoup/SuperRobotHunt | /LDGame/BezierCurve.cpp | UTF-8 | 928 | 2.984375 | 3 | [] | no_license | #include "BezierCurve.h"
#include "MathHelper.h"
BezierCurve::BezierCurve() : _p1(Vector2<float>()),
_p2(Vector2<float>()),
_p3(Vector2<float>())
{
}
BezierCurve::BezierCurve(Vector2<float> p1, Vector2<float> p2, Vector2<float> p3) : _p1(p1),
_p2(p2),
_p3(p3)
... | true |
b7cb36ea92e7049de444df4dd3eef01a6944149f | C++ | SeoRiel/SortList | /SortList/SquentialSort.cpp | WINDOWS-1252 | 294 | 3.34375 | 3 | [] | no_license | #include "SortHeader.h"
// (Squential Sort)
// TC : O(n^2)
// SC : O(n)
void SquentialSort(int input[], int count)
{
for (int i = 0; i < count - 1; ++i)
{
for (int j = i + 1; j < count; ++j)
{
if (input[i] < input[j])
{
Swap(input[i], input[j]);
}
}
}
} | true |
d4a378aabae89b23b6432685c15524ba3e900488 | C++ | thomasvangoidsenhoven/Raytracer-3D-Cplus | /raytracer/raytracer/imaging/bitmap.cpp | UTF-8 | 1,946 | 3.3125 | 3 | [] | no_license | #include "imaging/bitmap.h"
#include <algorithm>
#include <assert.h>
using namespace imaging;
imaging::Bitmap::Bitmap(unsigned width, unsigned height)
: m_pixels(width, height, colors::black())
{
// NOP
}
unsigned imaging::Bitmap::width() const
{
return m_pixels.width();
}
unsigned imaging::Bitmap::hei... | true |
3aff56b309a765ce71a25feb0a121d12099cecb9 | C++ | cazBlue/AIEYearOneProjects | /Assessment One & Two/source/enemy.cpp | UTF-8 | 2,612 | 3.078125 | 3 | [] | no_license | #include "enemy.h"
#include "character.h"
#include <math.h>
//Character::Character(Level *level, DrawEngine *de, int s_index, float x, float y, int lives, char u, char d, char l, char r) : Sprite(level, de, s_index, x, y, lives)
Enemy::Enemy(Level *lvl, DrawEngine *de, int s_index, float x, float y, int i_lives) : S... | true |
d4bee37bd8d8d1b24f1f2bcb46d2efa02f257142 | C++ | amkashyap1220/CSCI-241-Intermediate-Programming | /Assign5/account.cpp | UTF-8 | 1,983 | 3.9375 | 4 | [] | no_license | /**
* @file account.cpp
* @author Alexander Kashyap (z1926618@students.niu.edu)
* @date 2021-02-18
*
* Assignment 5
* Course: CSCI 241
* Section: 1
*/
#include <iostream>
#include <iomanip>
#include "account.h"
using namespace std;
/**
* @brief Return the account number for an account
*
* @return const... | true |
09cf3cd15842850302dd5501d907ea476cdde444 | C++ | darbyjohnston/DJV | /examples/Desktop/ComboBoxDesktopExample.cpp | UTF-8 | 2,694 | 2.578125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2004-2020 Darby Johnston
// All rights reserved.
#include <djvDesktopApp/Application.h>
#include <djvUI/ComboBox.h>
#include <djvUI/GridLayout.h>
#include <djvUI/Window.h>
#include <djvCore/Error.h>
#include <djvCore/String.h>
using namespace djv;
int main(... | true |
4add425eae3c81bdc5ebed3f1c36bc8a38ad9b14 | C++ | VT-ATEx/Core-2014 | /Current_Code/Libraries/cppfiles/tests/INTEGRATED_TEST/cutdown.cpp | UTF-8 | 808 | 2.703125 | 3 | [] | no_license | #include "cutdown.h"
#define LED0_PATH "/sys/class/leds/beaglebone:green:usr0"
using namespace std;
void on_led() {
std::fstream fs;
fs.open(LED0_PATH "/trigger", std::fstream::out);
fs << "none";
fs.close();
fs.open(LED0_PATH "/brightness", std::fstream::out);
fs << "1";
fs.close();
}
int activate_cutdow... | true |
6380c09285efdc177c0d5c87d2621712ee25d0f7 | C++ | byllyfish/oftr | /include/ofp/oxmregister.h | UTF-8 | 1,723 | 2.875 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2016-2018 William W. Fisher (at gmail dot com)
// This file is distributed under the MIT License.
#ifndef OFP_OXMREGISTER_H_
#define OFP_OXMREGISTER_H_
#include "ofp/oxmtype.h"
namespace ofp {
/// Concrete class representing the bits of an OXM register.
///
/// A register's string representation is... | true |
3d3448d4a3016b060b3ec7c3a34ea66255e69107 | C++ | jin1408/StudyingDataStructure | /Meeting3.cpp | UTF-8 | 1,689 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
// Deque를 이용한 meeting program
using namespace std;
int main(){
cout << "This is meeting program" << endl;
deque<string> man;
deque<string> woman;
int count =0;
string name;
string ge... | true |
9556b36a0c26279b07203de5005b2dc6e14a3d18 | C++ | rafsan99/Problem-Solving | /Business trip.cpp | UTF-8 | 569 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,a[12],i,sum=0;
cin>>n;
for(i=0;i<12;i++){
cin>>a[i];
}
sort(a,a+12,greater<int>());
if(n==0){
cout<<0;
return 0;
}
for(i=0;i<12;i++){
if(a[i]==n){
... | true |
dbf764f08f22f30f14cbed3b593f0ece9c2e9f43 | C++ | mborko/code-examples | /cpp/checkInt.cpp | UTF-8 | 497 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <sstream>
using namespace std;
int main(int argc, char** argv)
{
int temp;
if ( argc >= 2 ) {
if ( ! ( stringstream(argv[1]) >> temp ) ){
cout << "That was not an integer...\nTry again!" << endl;
return EXIT_FAILURE;
} else {
cout << temp <<... | true |
c2cc4e02f351ed23a756905e4eae4f616845d73e | C++ | ccup/cctest | /spec/core/test_desc_spec.cc | UTF-8 | 1,699 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #include "cctest/cctest.h"
#include "cctest/core/test_desc.h"
using namespace cctest;
namespace {
FIXTURE(TestDescSpec) {
TEST("without annotation") {
TestDesc desc("test name");
ASSERT_EQ("test name", desc.name());
}
TEST("extract test name") {
TestDesc desc("@{id=xxx} test name");
ASSERT_EQ(... | true |
9ef29b6dd3730ec18413f4d3c8156c46a54f64d1 | C++ | BuiDucAnh68/CTDL-GT | /ASS1/bai 5/bai 5/bai 5cpp.cpp | UTF-8 | 2,414 | 3.5625 | 4 | [] | no_license | // Hãy tách danh sách vừa nhập thành 2 danh sách l1 và l2 sao cho:
//l1 bao gồm các số chẵn không trùng nhau.
//l2 bao gồm các số lẻ không trùng nhau.
//Đều được xếp theo thứ tự đầu vào
#include<iostream>
using namespace std;
struct node
{
int info;
node *pNext;
};
struct List
{
node *pHead;
node *pTail;
};
void ... | true |
39991391a8ca7210b1ac9e783c87d893d042ce15 | C++ | naimovfayyoz/cpp-projects | /Projects based on particular topics/4.Loop control structures/lab-4/Source4.cpp | WINDOWS-1252 | 323 | 3.265625 | 3 | [] | no_license | /*Name:Fayyoz Naimov
ID:U1910071
ASSIGNMENT: 4
5.Program to display sum of series 1+1/2+1/3+.+1/n. .*/
#include <iostream>
using namespace std;
int main5() {
float a, sum = 0;
cout << "Enter the number of series" << endl;
cin >> a;
for (float i = 1; i <= a; i++) {
sum = sum + (1 / i);
}
cout << sum << endl;
... | true |
1e3e86d05af9a049a7b989b4c58da514e9941a9f | C++ | alikhalid/UVA-Submissions | /WordSearch.cpp | UTF-8 | 3,288 | 2.59375 | 3 | [] | no_license | #include <string>
#include <iostream>
using namespace std;
#define endl '\n'
string direction, *a;
int matrixRow, matLength;
int check(string word) throw()
{
string n, ne, e, se, s, sw, w, nw;
bool found = false;
int index = 0, col = 32, length;
length = word.length();
while (index <= matLength... | true |
88af6377221e94fc36db490b287d11b17f51d1e3 | C++ | iamslash/learntocode | /leetcode/DiagonalTraverse/a.cpp | UTF-8 | 1,497 | 3.21875 | 3 | [] | no_license | /* Copyright (C) 2019 by iamslash */
#include <cstdio>
#include <vector>
// O(N) O(1)
// 72ms 100.00%
class Solution {
public:
std::vector<int> findDiagonalOrder(
std::vector<std::vector<int>>& M) {
std::vector<int> rslt;
if (M.empty() || M[0].empty())
return rslt;
int h = M.size();
... | true |
d8576bb8bfa1af34777aa0d75a1cf3628d975b06 | C++ | xandrl09/ISA | /main.cpp | UTF-8 | 835 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <getopt.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
using namespace std;
void help()
{
cerr << "Run the program with arguments -i or -r." << endl;
}
int check_params(int argc, char *argv[])
{
string promena;
if(argc < 2)
{
}
else if(argc == 3)
... | true |
30902ceea9eac986a50bb3f569d7e0d87297502c | C++ | THISISAGOODNAME/SkelAnimation | /src/RHI/Backend/OpenGL/Uniform.cpp | UTF-8 | 1,599 | 2.59375 | 3 | [
"LicenseRef-scancode-public-domain",
"MIT"
] | permissive | #include "RHI/Uniform.h"
#include <glad/gl.h>
#include "Math/vec2.h"
#include "Math/vec3.h"
#include "Math/vec4.h"
#include "Math/mat4.h"
#include "Math/quat.h"
template Uniform<int>;
template Uniform<ivec4>;
template Uniform<ivec2>;
template Uniform<float>;
template Uniform<vec2>;
template Uniform<vec3>;
template Un... | true |
1eadc05f0122bd7a103a5f9a8bc03f5ae1317d49 | C++ | artnitolog/cpp-grammars_course | /other/mutex1.cpp | UTF-8 | 1,129 | 3 | 3 | [] | no_license | #include <thread>
#include <mutex>
#include <vector>
#include <iostream>
// volatile long long v1 = 0;
// volatile long long v2 = 0;
long long v1, v2 = 0; // несколько нитей => НЕ НАДО ВОЛАТАЙЛ ЕСТЬ МЬЮТЕКС
std::mutex m, m2;
int main() {
std::vector<std::thread> thrs;
for (int i = 0; i < 10; i++) {
... | true |
73be6b1a4e9de8b25a7388e5d6c4bf300fea39fa | C++ | gxshao/LeetCode | /Array/LeetCode_628_Maximum_Product_of_Three_Numbers.cpp | UTF-8 | 987 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
/**
* Given an integer array, find three numbers whose product is maximum and output the maximum product.
Example 1:
Input: [1,2,3]
Output: 6
Example 2:
Input: [1,2,3,4]
Output: 24
Note:
The le... | true |
d575ea600e14281506cf12b9f7e13489a1725a26 | C++ | billiesu/EE599-HW4 | /Q1/src/lib/solution.h | UTF-8 | 401 | 2.734375 | 3 | [] | no_license | #ifndef TEMPLATE_SOLUTION_H
#define TEMPLATE_SOLUTION_H
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <numeric>
using std::vector;
using std::cout;
using std::endl;
class Solution {
public:
vector<int> Filter(vector<int> input);
vector<int> Map(vector<int> input);
int Re... | true |
a011f3a56961993e3ab24922446953a0445d348d | C++ | kekekeks/prowingen | /native/include/com.h | UTF-8 | 2,588 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#ifndef COM_H_INCLUDED
#define COM_H_INCLUDED
#include <cstring>
typedef struct _GUID {
unsigned int Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
} GUID;
typedef GUID II... | true |
7115c2e11ba00c7f703928a16428677695a08594 | C++ | PlumpMath/earSight-openFrameworks | /src/testApp.cpp | UTF-8 | 3,649 | 2.53125 | 3 | [] | no_license | #include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// initialise sound
soundStream.setup(this, 2, 0, SAMPLE_RATE, BUFFER_SIZE, 4);
camWidth = 640;
camHeight = 480;
// init web cam
vidGrabber.setDeviceID(0);
vidGrabber.setDesiredFrameRate(60);
vidGrab... | true |
590a0e9aa7a025ad69f8413d9167b3be005361e9 | C++ | kobortor/Competitive-Programming | /cf-gym/NWERC-2021/G.cpp | UTF-8 | 2,712 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define allof(x) (x).begin(), (x).end()
const int MAXN = 5005;
typedef pair<int, int> pii;
int n, w;
string words[MAXN];
int max_width[MAXN][MAXN];
int prv[MAXN];
int cost[MAXN];
bool good(int rows) {
memset(cost, 0x3f, sizeof cost);
cost[0] = 0;
for (in... | true |
e17579fd8c4e7d2438284bc5187067bc2743c769 | C++ | xmuliushuo/learn | /cplusplus/e_4_28.cpp | UTF-8 | 439 | 3.09375 | 3 | [] | no_license | /*
* e_4_28.cpp
*
* Created on: 2012-12-3
* Author: liushuo
*/
#include <vector>
#include <iostream>
using std::cin;
using std::cout;
using std::vector;
void e_4_28()
{
vector<int> ivec;
int num;
while (cin >> num) {
ivec.push_back(num);
}
int *array = new int[ivec.size()];
int *p = array;
for (... | true |
99aacc9848f71f0733d1e162ad7044853736d32c | C++ | EXPmaster/CouseProjectC | /综合设计/dataset.cpp | UTF-8 | 7,858 | 2.96875 | 3 | [] | no_license | #include "dataset.h"
extern void Append(ppStudent head, int number, int subject);
extern void TraverseList(pStudent head);
void GetInfo(ppStudent student)
{
int number = 0, subject = 0;
if (*student == NULL)
{
puts("请输入考试科目总数");
while (!scanf("%d", &subject) || (subject <= 0 || subject >... | true |
b75ed88f32bd95b6093ccb80330f76bed9f134fa | C++ | kohutjan/HABCforNRP | /src/scheduling_period/employee.cpp | UTF-8 | 2,191 | 2.953125 | 3 | [] | no_license | #include "scheduling_period/employee.hpp"
using namespace std;
using namespace boost::gregorian;
void Employee::LoadFromStream(ifstream &periodStream)
{
string ignore;
periodStream >> this->id;
cout << this->id << ", ";
periodStream >> ignore;
periodStream >> this->name;
this->name.pop_back();
cout <<... | true |
21e4a149ffc2865d3fcee66b1bdb31367609f876 | C++ | helldongdae/COCO | /answers/H.cpp | UTF-8 | 1,472 | 2.90625 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <queue>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include<fstream>
using namespace std;
vector<int> tree[50001];
int level[50001] = { 0 };
int parent[50001] = { 0 };
queue<int> q;
void DFS(int src){
q.push(src);
level[src] = 0;
parent[src] = 0;
wh... | true |
2433241c28df5b0633934488cf48a4e42803260f | C++ | othis001/solutions | /subsetsXOR.cpp | UTF-8 | 2,209 | 4.125 | 4 | [] | no_license | /*******************************
* subsetsXOR.cpp by Oliver Thistlethwaite
*
* Purpose: This is a program that takes an input an array of nonnegative integers.
* It will then compute the sum of the XORs of all the subsets.
******************************/
#include <cmath>
#include <vector>
#include <iostr... | true |
49590bbf74359e3f3e986346e916bef478416193 | C++ | kl456123/cpp_best_practice | /src/executor.cc | UTF-8 | 1,648 | 2.5625 | 3 | [] | no_license | #include <vector>
#include "core/graph/executor.h"
class ExecutorImpl: public Executor{
public:
explicit ExecutorImpl(const LocalExecutorParams& param):param_(param){
}
virtual void RunAsync(const Args& args)override;
Status Initialize(const Graph& graph);
private:
L... | true |
8030391dca0f9d8fc66957591b6cff7fa3dd9eb8 | C++ | LiYuRio/leetcode-daily | /leetcode/2-Add-Two-Numbers.cpp | UTF-8 | 1,625 | 3.8125 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode* next) : val(x), next(next) {}
};
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* result = new ListN... | true |
2b2dd249e383ba6ca2b71b9aab153b214580a3b1 | C++ | minghsu0107/workspace | /C++/Practice3/exam2.cc | UTF-8 | 2,077 | 3.140625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct Test
{
int seq;
int math;
int total;
};
bool compare1(const Test &a, const Test &b){
return a.total > b.total;
}
bool compare2(const Test &a, const Test &b){
return a.math > b.math;
}
bool compare(const Test &a, const T... | true |
37a52127ee632e83838eaa150ae2b8bc67b3f907 | C++ | HaochenLiu/My-LeetCode-CPP | /030.cpp | UTF-8 | 1,436 | 3.5 | 4 | [] | no_license | /*
030. Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters.
For example, given:
S: "barfoothefoobarman... | true |
e9cd20f19991ac8b77c84c6072c152d1454b15a8 | C++ | ketlynsena/LogiKids | /LogiKids/Test-LogiKids/test_map_coloring.cpp | UTF-8 | 5,255 | 2.578125 | 3 | [] | no_license | #include "pch.h"
//#include "../LogiKids/game.h"
#include "../LogiKids/map_coloring.h"
TEST(TestMapColoring, TestInit)
{
Map_Coloring* colorindo_bh = new Map_Coloring();
EXPECT_TRUE(colorindo_bh);
}
TEST(TestMapColoring, TestAddRegion)
{
Map_Coloring* colorindo_bh = new Map_Coloring();
Regiao regiao;
SDL_Color c... | true |
52325bf325bb70ad39e3df0279e2c3e8cc6d4114 | C++ | xUhEngwAng/oj-problems | /nowcoder/NC39 N皇后问题.cpp | UTF-8 | 1,124 | 2.828125 | 3 | [] | no_license | class Solution {
public:
/**
*
* @param n int整型 the n
* @return int整型
*/
vector<pair<int, int>> positions;
int ret = 0;
bool is_violate(const pair<int, int>& lh, const pair<int, int>& rh){
if(lh.first == rh.first || lh.second == rh.second)
return true;
... | true |
efd67ddbf6ca26e3a6e258e9f21ebbceb11fdf41 | C++ | ajmarkestad/Fys4150 | /Project3/main.cpp | UTF-8 | 6,893 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <stdlib.h>
#include "ensemble.h"
#include "solver.h"
#include <ostream>
#include <sstream>
#include <string>
#include <fstream>
using namespace std;
ofstream ifile;
void createparticles(Ensemble &system,int nargs, char **vargs, string input_file);
int main(int nargs, cha... | true |
d38b83315b2c471c72cdc2d77acec33828b523dc | C++ | daixinye/zjucst | /c&cpp/1008/exam/7-1.cpp | UTF-8 | 1,279 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
class Student {
public:
int department;
string name;
int height;
int weight;
Student(int d, string n, int h, int w){
department = d;
name ... | true |
1e1fa0c7b8df40bf687cf079a021e39676ff04d4 | C++ | laomd-2/high-performance | /cuda/matrix/host_s.cpp | UTF-8 | 714 | 3.125 | 3 | [] | no_license | //
// Created by laomd on 2018/12/6.
//
#include <iostream>
#include <vector>
#include <ctime>
using namespace std;
typedef vector<double> DVector1D;
void cal_one_ele(size_t i, size_t j, size_t n, double* P) {
double sum = 0;
for (int k = 0; k < n; ++k) {
double a_ik = i - 0.1 * k + 1, b_kj = 0.2 * j ... | true |
46a20f08349ae242488e5ada874dd962224d21b9 | C++ | mskoenz/arduino_crash_course | /program/acc_recap/W3_01_eeprom_serialize/eeprom_serialize.cpp | UTF-8 | 2,621 | 3.328125 | 3 | [
"WTFPL"
] | permissive | // Author: Mario S. Könz <mskoenz@gmx.net>
// Date: 02.11.2013 14:47:10 CET
// File: eeprom_serialize.cpp
#include <Arduino.h>
#include <EEPROM.h> //don't forget this header
// main idea: -read and write to the EEPROM (is like a harddrive)
// -EEPROM data remains even after the power is lost (no mat... | true |
25623381d9cde6fa4161867bdd33b40105d7220a | C++ | kwdeveloper/migrando-c-cpp | /cap12/lambda.cc | UTF-8 | 1,209 | 2.96875 | 3 | [] | no_license | // Este programa utiliza a biblioteca Boost
#include <iostream>
#include <vector>
#include <cmath>
#include <boost\lambda\lambda.hpp>
#include <boost\lambda\bind.hpp>
#include <boost\lambda\if.hpp>
using namespace std;
using namespace boost::lambda;
int f()
{
static int x = 0;
return x++;
}
template<typename T>... | true |
8d425620cb75fefd8e46a432fc766a25ec66ad6d | C++ | Avraham1820/code-in-c | /Rational/main.cpp | UTF-8 | 843 | 2.71875 | 3 | [] | no_license | //AUTHOR: Eliran shaharabani
//IDs: 032472664
//KVUTZA: Gay yehezkel
//TITTLE: Targil 1 Seif 1
//SUBJECT:
/****************************************
* *
* rational *
*
* *
*****************************************/
#include <iostream>
using namespace std;
#include "Rational.h"
... | true |
fa01c06ac8fb3da2fd28b78f37acd1e2fc990ff9 | C++ | pmienk/hypodermic | /Hypodermic/TypeCaster.hpp | UTF-8 | 1,097 | 2.6875 | 3 | [] | no_license | #ifdef HYPODERMIC_TYPE_CASTER_H_
# ifndef HYPODERMIC_TYPE_CASTER_HPP_
# define HYPODERMIC_TYPE_CASTER_HPP_
namespace Hypodermic
{
template <class ConcreteType, class InterfaceType>
TypeCaster< ConcreteType, InterfaceType >::TypeCaster(const std::type_info& typeInfo)
: typeInfo_(t... | true |
0c241e6665b064b9bf450158408f2cca535815dc | C++ | hwangdav000/Bus_Simulation | /src/passenger_generator.h | UTF-8 | 1,567 | 3.125 | 3 | [] | no_license | /**
* @file passenger_generator.h
*
* @copyright 2019 3081 Staff, All rights reserved.
*/
#ifndef SRC_PASSENGER_GENERATOR_H_
#define SRC_PASSENGER_GENERATOR_H_
/*******************************************************************************
* Includes
************************************************************... | true |
d0d6ff9517da598927f63a30a128119f038647a8 | C++ | institution/nn5 | /src/ext/experimental/vals.hpp | UTF-8 | 930 | 3.40625 | 3 | [] | no_license | #pragma once
#include <type_traits>
template <class I>
struct Vals{
using KPV = typename I::value_type;
using PV = typename std::tuple_element<1, KPV>::type;
using V = typename std::remove_pointer<PV>::type;
struct Iter{
I i;
Iter(I i): i(i) {}
void operator++() {
++i;
}
V & operator*() {... | true |
68207b3d2782ecd81c50ce01c46c41906082743d | C++ | lmhtz/StdOS | /Libraries/Core/List.h | GB18030 | 1,276 | 3.40625 | 3 | [] | no_license | #ifndef _List_H_
#define _List_H_
#include "Type.h"
typedef int (*IComparer)(const void* v1, const void* v2);
// 䳤бڴ洢ָ
class IList
{
public:
IComparer Comparer; // Ƚ
IList();
inline int Count() const { return _Count; }
// ӵԪ
void Add(void* item);
// ɾָλԪ
void RemoveAt(int index);
// ɾָԪ
int Re... | true |
6985b2835a26525449709b53791e0bfcfcd42777 | C++ | AFLplusplus/Grammar-Mutator | /lib/antlr4_shim/antlr4_shim.cpp | UTF-8 | 3,364 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /*
american fuzzy lop++ - grammar mutator
--------------------------------------
Written by Shengtuo Hu
Copyright 2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ma... | true |
647bd6903204d460b225d6b9e281379437a90b29 | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/14_18039_8.cpp | UTF-8 | 2,015 | 2.734375 | 3 | [] | no_license | #include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int qn, pn;
int gcd(int a, i... | true |
16fffa521dd1f22d568a714592f3f63afdef94d4 | C++ | kkyyou/Mini_CAM_Solution | /pad.cpp | UTF-8 | 1,378 | 2.796875 | 3 | [] | no_license | #include "pad.h"
#include <QPainterPath>
CPad::CPad(const QPoint ¢er) :
CFeature(_FEATURE_PAD),
m_center(center)
{
}
QPoint CPad::getCenterPoint()
{
return m_center;
}
QString CPad::getPointInfo()
{
QPoint center = getCenterPoint();
double dx = (double) center.x() / _MILLION;
double dy ... | true |
065a199afcb27c927388923096c04c43c115626c | C++ | gabb99/tsjson | /gTests/array_object.tests.cpp | UTF-8 | 13,617 | 2.53125 | 3 | [
"MIT"
] | permissive | //
// array_object.tests.cpp
// tsjson
//
// Created by Gabriel Beauchemin on 2018-12-05.
// Copyright © 2018 Gabriel Beauchemin. All rights reserved.
//
#include "gtest/gtest.h"
// Use rapidjson for validation
#include "document.h" // rapidjson's DOM-style API
using namespace rapidjson;
#include "tsobject.h... | true |
601df96a57f30920bda9e784471b4ad8d872b8e5 | C++ | nanocurrency/nano-node | /nano/secure/network_filter.hpp | UTF-8 | 2,799 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive |
#pragma once
#include <nano/lib/numbers.hpp>
#include <mutex>
#include <cryptopp/seckey.h>
#include <cryptopp/siphash.h>
namespace nano
{
/**
* A probabilistic duplicate filter based on directed map caches, using SipHash 2/4/128
* The probability of false negatives (unique packet marked as duplicate) is the prob... | true |
b5e5f3f4a00d3d6fa45aaffdcfdf1dcb4b5d4bab | C++ | bpiatek91/ACC-1337 | /Lab5/dateVS.cpp | UTF-8 | 338 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <iomanip>
#include "dateVS.hpp"
using namespace std;
int main() {
Date date;
int m, d, y;
cout << "Welcome to the date converter";
while (true) {
cout << "Please enter the month: ";
cin >> m;
cout << "Please enter the day: ";
cin >> d;
cout << "Please enter... | true |
fa0062ceed92acf75505654f41413da39e1a1126 | C++ | phartz/Whac-A-Mol | /src/main.cpp | UTF-8 | 2,839 | 2.703125 | 3 | [] | no_license | #include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 8
#... | true |
d12db87dafaac21edf9e569d9d783b962c3be91b | C++ | parhelia512/core-impact | /source/CIStardustModel.cpp | UTF-8 | 3,423 | 2.828125 | 3 | [] | no_license | //
// CIStardustModel.cpp
// CoreImpact
//
// This model class represents all the information for a single stardust.
//
// Created by Brandon Stein on 3/1/21.
// Copyright © 2021 Game Design Initiative at Cornell. All rights reserved.
//
#include "CIStardustModel.h"
/** Maximum speed of a stardust */
#define MAX... | true |
c4ef821c7f177b484c20c734ad5d9d04714714b6 | C++ | SimonaMihai31/C-Math-Programs | /Edge_covering_number_and_a_minimum-edge_cover;/Edge_Cover/edge-cover/main.cpp | UTF-8 | 286 | 3.515625 | 4 | [] | no_license | // C++ program to find Edge Cover
#include <bits/stdc++.h>
using namespace std;
// Function that calculates Edge Cover
int edgeCover(int n)
{
float result = 0;
result = ceil(n / 2.0);
return result;
}
// Driver Code
int main()
{
int n = 5;
cout << edgeCover(n);
return 0;
}
| true |
d455c81221bfc0dee38ac3d176c4cf113d2e900c | C++ | kk4ne/First-Repsitory | /sum.cpp | UTF-8 | 214 | 3.125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int Sum (int a, int b) {
return a+b;
}
void main() {
cout <<" Hello, GIT" << endl;
int a, b;
cout << "Enter two numbers: ";
cin >> a >> b;
Sum(a,b)
} | true |
c3545d17c3ca894fa46f830499fb740292f1bfdf | C++ | teohklun/imdc2020_DHL_Google | /building-an-app/building-an-app-2/abc.cpp | UTF-8 | 6,837 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
using namespace std;
//declare constant - problem specification, population size
const int GENE = 8;
const int CAPACITY = 104;
const int POP_SIZE = 30;
const int WEIGHT[GENE] = { 25, 35, 45, 5, 25, 3, 2, 2 };
const float CO_p... | true |
30f59963a89c0ee0ef9f9a7744086be18bf9ef47 | C++ | slaakko/soulng | /sngxml/example/library/Config/Config.cpp | UTF-8 | 5,032 | 2.5625 | 3 | [] | no_license | #include <Config/Config.hpp>
#include <Config/Configuration.hpp>
#include <Config/Ids.hpp>
#include <sngxml/dom/Document.hpp>
#include <sngxml/dom/Parser.hpp>
#include <soulng/util/Path.hpp>
#include <boost/filesystem.hpp>
#include <fstream>
namespace config {
using namespace soulng::util;
const int defaultServerPor... | true |
96797d728cd17f03d255c7ce24ca609c14a2d100 | C++ | tectronics/nwmc | /DesignatedDrinkers_NWMC/source/EntitySystem/ConcreteEntity.cpp | UTF-8 | 11,276 | 2.59375 | 3 | [] | no_license | /*************************************************************
| File: ConcreteEntity.cpp
| Author: Ryan T. Miller (metalhead71@Hotmail.com) with references from Doug Monroe (dmonroe@fullsail.com)
| Course: SGP 1307
| Purpose: ConcreteEntity class is used for a velocity-based game object. It is the parent class for ... | true |
f20f0e1a42ba3595a569b4326f743945790b6260 | C++ | runngezhang/sword_offer | /nowcoder/cpp/牛客. 出现次数的TopK问题.cpp | UTF-8 | 2,313 | 3.546875 | 4 | [] | no_license | class Solution {
public:
// 交换vec内两个元素的值
template <class T>
void swap(vector<T>& vec, int l, int h) {
T tmp = vec[l];
vec[l] = vec[h];
vec[h] = tmp;
}
// 大顶堆下沉函数,出现次数越多,字典序越小的,放在前面
void heapify(vector<string>& strs, vector<int>& cnts, int n, int i) {
int larg... | true |
563e2dd3dc4d9af305b996620bb3647c3fbacb6f | C++ | chreden/trview | /trview.app/Tools/Measure.h | UTF-8 | 2,030 | 2.796875 | 3 | [
"MIT",
"BSD-3-Clause",
"Zlib"
] | permissive | #pragma once
#include <optional>
#include <trview.app/Geometry/IMesh.h>
#include "IMeasure.h"
namespace trview
{
class Measure final : public IMeasure
{
public:
/// Create a new measure tool.
/// @param device The device to use to create graphics resources.
explicit Measure(const s... | true |
8ab48969fbc96d5ded51b99182cf06880633e542 | C++ | Omlovee/codingback | /LeetCode/1.hpp | UTF-8 | 389 | 3.078125 | 3 | [] | no_license | #pragma once
class 1
{
public:
vector<int> twoSum(vector<int> nums, int target)
{
vector<int> res;
for(int i = 0;i < nums.size();++i)
{
for(int j = i + 1;j < nums.size();++j)
{
res.push_back(i);
res.push_back(j);
br... | true |
917473895dc6104a3d12023a175f0467d5796fb8 | C++ | offamitkumar/UVA--Online-Judge | /Solution/Problem_000927/Solution.cpp | UTF-8 | 1,678 | 2.796875 | 3 | [] | no_license | /*
* As the given constraints are very tight
* so even a single mistake in the input and output will certainly
* lead you to the wrong answer.
*/
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
... | true |
ab91ea6e21d19f448ccef94c5b51a02e00295c62 | C++ | vintageplayer/Arduino-Sample-Codes | /nodeMCU/connection_setup.ino | UTF-8 | 8,608 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* BasicHTTPClient.ino
*
* Created on: 24.05.2015
*
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#define USE_SERIAL Serial
ESP8266WiFiMulti WiFiMulti;
int sensorInterrupt = 5; // 5 = digital pin d1
int sensorInterrupt2... | true |
ec2b8dfba335cb98a72f31535f802265ea8643a0 | C++ | jmurrayufo/Gaia-Forge | /Src/system/noise/Noise.cpp | UTF-8 | 3,135 | 2.671875 | 3 | [] | no_license | #include "Noise.h"
Noise::Noise()
{
Seed=0;
Period=1;
Amplitude=1;
Octaves=1;
Persistance=1;
InterpType=NOISE_INTERP_CUBIC;
}
void Noise::test(void)
{
int start=SDL_GetTicks();
int i;
Period=100;
Octaves=50;
Amplitude=10;
Persistance=2;
InterpType=NOISE_INTERP... | true |
32faac2a823cc058a11aed7b4c11460fc58b34b0 | C++ | othmanabdulsalam/Abdulsalam_Othman_CG_Assignment_1 | /chLinkedList/chLinkedList.cpp | UTF-8 | 4,509 | 2.859375 | 3 | [] | no_license | #include "stdafx.h"
#include "chLinkedList.h"
void initList(chLinkedList* pList, unsigned int uiType)
{
if(pList)
{
pList->m_pHead = 0;
pList->m_pTail = 0;
pList->m_uiType = uiType;
}
}
void destroyList(chLinkedList* pList, chListDeletor* pDeletor)
{
if(pList)
{
if(pDeletor) for(chLinkedListElement *pE=p... | true |
a6666776fd739b917f4aea761d1691dfc85f6304 | C++ | narghyriou99/syspro-project1 | /include/skiplist.h | UTF-8 | 1,594 | 3.03125 | 3 | [] | no_license | #ifndef SKIPLIST_H_
#define SKIPLIST_H_
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include "citizen.h"
using namespace std;
#define MAXLEVEL 10
struct SLN { //Skip List Node
int citizenId, level;
CN* citizen; //Ptr to citizen
SLN** next; //Array of ptrs
... | true |
800645e8b6079d0d5d9bf5014429c59b9ca23ccd | C++ | imranhasanhira/opengl-oop-framework | /Terrain/SkyBox.cpp | UTF-8 | 3,745 | 2.875 | 3 | [] | no_license | /*
* File: SkyBox.cpp
* Author: Ibrahim
*
* Created on June 30, 2012, 3:50 AM
*/
#include "SkyBox.h"
GLuint SkyBox::skyTopId = -1;
GLuint SkyBox::skyLeftId = -1;
GLuint SkyBox::skyRightId = -1;
GLuint SkyBox::skyFrontId = -1;
GLuint SkyBox::skyBackId = -1;
SkyBox::SkyBox(double width, doubl... | true |
992e18ff5e0b04fbda002fce1157d86eb67356ed | C++ | jiri/constellation | /src/Foundation/Infrastructures/Wiring.hpp | UTF-8 | 2,516 | 2.828125 | 3 | [] | no_license | #pragma once
#include <set>
#include <Foundation/Infrastructures/Infrastructure.hpp>
class Wiring;
class Connector {
public:
virtual ~Connector() = default;
virtual void merge(Connector* other) = 0;
virtual void split(Connector* other) = 0;
virtual glm::vec2& position() = 0;
bool magnetic = false;
Con... | true |
b25344e9feff13863bcde8f4ca32da5547e1b45e | C++ | southpawgeek/perlweeklychallenge-club | /challenge-153/ulrich-rieke/cpp/ch-2.cpp | UTF-8 | 761 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
int factorial( int num ) {
if ( num == 0 ) {
return 1 ;
}
else {
int fac = 1 ;
for ( int i = 1 ; i < num + 1 ; i++ )
fac *= i ;
return fac ;
}
}
int main( int argc, char* argv[] ) {
i... | true |
71bcf56432621dd7487e8b8ed1c05ca4836717d8 | C++ | nploi/Cplusplus | /Exercise/HackerRank/Data Structures/Heap/JesseAndCookies.cpp | UTF-8 | 736 | 2.84375 | 3 | [] | no_license | //https://www.hackerrank.com/challenges/jesse-and-cookies/problem
#include<iostream>
#include <queue>
#include <vector>
using namespace std;
#define ll long long
int main() {
priority_queue<ll, vector<ll>, greater<ll> > pq;
ll n, k;
cin >> n >> k;
for (int i = 0; i < n; ++i) {
ll val;
... | true |
a7e870e5599f0bd3d53acc8476a4a8f31cc318d1 | C++ | WhiZTiM/coliru | /Archive2/a2/fe9847b43e2d0e/main.cpp | UTF-8 | 665 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
struct Foo {
string str;
int a;
vector<int> vec;
int b;
int *ptr;
};
int main()
{
// simulating memory randomizing
// {
srand(time(0));
unsigned char *buf = new unsigned char[1024];
... | true |
df2a616e844a968b25a2068d90fcda090af8f59e | C++ | bluepine/topcoder | /topcoder-master/Jewelry.cpp | UTF-8 | 3,680 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<list>
#include<deque>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<sstream>
#include<cstring>
using namespace std;
typedef vect... | true |
fa68dc6385ba7e804b5c1b4aba5d1c3fbcbcc990 | C++ | WarlordRises/Odyssey | /src/myengine/Keyboard.cpp | UTF-8 | 477 | 2.609375 | 3 | [] | no_license | #include "Keyboard.h"
Keyboard::Keyboard()
{
}
Keyboard::~Keyboard()
{
}
//bool Keyboard::GetKey(int _keyCodes)
//{
//
//}
//
//bool Keyboard::GetKeyDown(int _keyCodes)
//{
//
//}
//
//bool Keyboard::GetKeyUp(int _keyCodes)
//{
//
//}
bool Keyboard::Events()
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
... | true |
3433e57bae179a51d3658db4adf9423290a1a2e9 | C++ | mrfeod/libstepparser | /src/tokenizer/token.cpp | UTF-8 | 1,178 | 3.453125 | 3 | [] | no_license | #include "token.hpp"
using namespace std;
Token::Token(const Token::Id& i)
: id_(i)
{
if (i == Id::NUMBER) {
data_ = 0.;
} else {
data_ = string();
}
}
Token::Token(const string& str)
: id_(Id::STR)
{
data_ = str;
}
Token::Token(double num)
: id_(Id::NUMBER)
{
data_ =... | true |
9d71459b3ec10f05c761463566efa5fa0548733c | C++ | alexandraback/datacollection | /solutions_1483488_1/C++/itsuper/C.cc | UTF-8 | 1,258 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
ifstream input;
ofstream output;
long long f[12];
int icount(long long num,int n,long long up) {
if ( n == 1) return 0;
int res = 0;
vector <long long> vec;
... | true |
e5b57e1c4bd2181fbb148c0adba4bf96120e38c8 | C++ | znvmk/Study | /CPP/STL/2.C++程序标准库/5.8-以函数作为算法的参数/print.hpp | UTF-8 | 261 | 3 | 3 | [
"WTFPL"
] | permissive | #include <iostream>
template<class T>
inline void PRINT_ELEMENTS(const T& col1, const char* optcstr="")
{
typename T::const_iterator pos;
std::cout<<optcstr;
for(pos=col1.begin();pos!=col1.end();++pos)
{
std::cout<<*pos<<' ';
}
std::cout<<std::endl;
}
| true |
35c2965cc653df307ea346d6da22bc34ed122c83 | C++ | llu0120/Cpp-Algorithm | /DataStructure/array/GameofLife.cpp | UTF-8 | 3,541 | 3.9375 | 4 | [] | no_license | /*
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."
Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizontal... | true |
d696089a0993219434db4c8e397554a9d3ed0975 | C++ | nguyentrungduc08/Socks5_Scan | /socScanPort.cpp | WINDOWS-1252 | 19,582 | 2.78125 | 3 | [] | no_license | #include "definition.h"
int sendData_s(SOCKET s, const void *buffer, int buflen)
{
const char *pbuf = (const char*) buffer;
while (buflen > 0)
{
int numSent = send(s, pbuf, buflen, 0);
if (numSent == SOCKET_ERROR)
return SOCKET_ERROR;
pbuf += numSent;
buflen -= n... | true |
37a9a81174c8ff1e8786eac11a1b02ca64926cdb | C++ | S0mas/ChessNew | /bishop.cpp | UTF-8 | 4,186 | 2.78125 | 3 | [] | no_license | #include "pieces.h"
#include <typeinfo>
Bishop::Bishop(int player, int x, int y)
{
owner = player;
if(owner>0)
{
value = 105;
}
else
{
value = -105;
}
i=x;
j=y;
activeOn=false;
this->setText("B");
}
Bishop::~Bishop()
{
}
void Bishop::checkActive()
{
... | true |
f129ef3b78227f4322ff5fc3c5c9fbcd4ba9f934 | C++ | md143rbh7f/competitions | /topcoder/srm/433/MagicWords.cpp | UTF-8 | 643 | 2.796875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
char tmp[200];
int p[8];
struct MagicWords
{
int count( vector<string> s, int k )
{
for( int i = 0; i < s.size(); i++ ) p[i] = i;
int ans = 0;
do
{
int index = 0, i = 0, j = 0;
for( i = 0; i < s.size(); ... | true |
e533002ce61f08dff91b2a1658810dbc936fa959 | C++ | egorlw26/UniversityLabs | /5th_Course/Semester1/Cryptography/Lab3/SHA-256/SHA-256/SHA_256.h | UTF-8 | 2,221 | 2.5625 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
class SHA_256
{
private:
// round constants
const unsigned int K[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be... | true |
26a2a2ed0a0c0903267455e6f253111e92609aa8 | C++ | liuruoqian/CS225 | /mp7/maze.h | UTF-8 | 461 | 2.921875 | 3 | [] | no_license | /* Your code here! */
#include <vector>
#include "png.h"
using namespace std;
#ifndef _MAZE_H
#define _MAZE_H
class SquareMaze{
public:
SquareMaze();
void makeMaze(int width, int height);
bool canTravel(int x, int y, int dir) const;
void setWall(int x, int y, int dir, bool exists);
vector<int> solveMaze();
PNG ... | true |
4cf476855a2de93d47ab1e048de5c60fa46b2b4f | C++ | xinlianyu/EventCollection | /weights.h | UTF-8 | 8,115 | 2.59375 | 3 | [] | no_license | /*
Edge Weight Classes
Brian Dean
1997
Adapted by Song Gao for stochastic dependent link travel times
April 29, 2004
Song Gao, Added NOI related variables, Feburary 2007
*/
#pragma comment(lib,"ws2_32.lib")
#ifndef EDGEWEIGHTS
#define EDGEWEIGHTS
#define INT_INFINITY (int)2147000000
#define ... | true |
1a60928f1aa25602b1ef8bbd05293bf681d86d1a | C++ | SeanWuLearner/leetcode_vsstudio | /LeetCode/LeetCode/Q0326_PowerOfThree.h | UTF-8 | 1,109 | 3.421875 | 3 | [] | no_license | #pragma once
#include "DebugUtils.h"
#pragma region odinary solution
//class Solution {
//public:
// bool isPowerOfThree(int n) {
// if (n == 0)
// return false;
//
// while (n != 1)
// {
// if (n % 3 != 0)
// return false;
// n /= 3;
// }
// return true;
// }
//};
#pragma endregion
#pragma region geni... | true |
d9a57a17669cb9bbcf6595427bef4b5a7220b4af | C++ | nhayesroth/cs106b_4 | /PriorityQueue/PriorityQueue/src/pqueue-heap.cpp | UTF-8 | 2,459 | 3.53125 | 4 | [] | no_license | /*************************************************************
* File: pqueue-heap.cpp
*
* Implementation file for the HeapPriorityQueue
* class.
*/
#include "pqueue-heap.h"
#include "error.h"
#include <iostream>
int DEFAULT_SIZE = 1;
HeapPriorityQueue::HeapPriorityQueue() {
logicalLength = 0;
list = new str... | true |
5b47bd89487941cc0ac5fbded52190c9fd9ff1ea | C++ | KasperHdL/Auris-Game-Engine | /Auris/src/Auris/Systems/Input.cpp | UTF-8 | 5,166 | 2.859375 | 3 | [] | no_license | #include "Auris/Systems/Input.hpp"
#include <iostream>
#include "Auris/Game.hpp"
using namespace Auris;
std::map<SDL_Scancode, bool> Input::heldKeys; //all held keys
std::map<SDL_Scancode, bool> Input::downKeys; //all down keys
std::map<SDL_Scancode, bool> Input::upKeys; //all up keys
std::map<SDL_JoystickID,SDL_Gam... | true |
70c8b3c09f722054867bdf7d823e2c1f302ca179 | C++ | JashDave/ReferenceCodes | /ModularArathimatic.cpp | UTF-8 | 1,656 | 3.40625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
class ModularFactorial{
private:
vector<ull> facttable;
ull mod;
public:
ModularFactorial(ull size,ull m){
facttable.resize(size,0);
facttable[0]=1;
mod = m;
}
ull fact(int x){
if(... | true |
c4039b012c3c8a3ed53f2c8a6e9a71018a252a23 | C++ | GrzegorzNieuzyla/Advent-of-Code-2018 | /day05/solution.cpp | UTF-8 | 1,156 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <list>
#include <cstdlib>
#include <climits>
// Calculates size after reaction
// can also specify letter (uppercase) to exclude from reaction
int reaction(std::list<char> string, char c = 0){
if(c != 0){
string.remove(c);
string.remove(c + 32);
}
for(auto it ... | true |