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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fb40fc29224800a16a67ecaee051f254ce8d9403 | C++ | denisneuling/jserialport | /jserialport-native/src/main/cpp/JavaConverter.cc | UTF-8 | 1,203 | 2.875 | 3 | [] | no_license | #include "JavaConverter.h"
#include <jni.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <string>
jobject JavaConverter::ArrayList_from_Vector_chars(JNIEnv *env, std::vector<char*> v){
jclass clazz = (*env).FindClass("java/util/ArrayList");
jobject list = (*env).NewObject(clazz, (*env).Ge... | true |
1a3e77072bdec0856b7178edf507ad31aebb7ff3 | C++ | fossabot/YAODAQ | /src/Exception.cpp | UTF-8 | 1,300 | 3.109375 | 3 | [
"MIT"
] | permissive | #include "Exception.hpp"
std::string Exception::m_Format{"\n\t[Code] : {Code}\n\t[Description] : {Description}\n\t[File] : {File}\n\t[Function] : {Function}\n\t[Line] : {Line}\n\t[Column] : {Column}\n"};
fmt::text_style Exception::m_Style={fg(fmt::color::crimson) | fmt::emphasis::bold};
Exception::Exception(const S... | true |
8d0b04fd54224448b040a71c2bea350e1a143ff3 | C++ | wowns9270/code_up | /codility/EquiLeader.cpp | UTF-8 | 692 | 2.875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int solution(vector<int> A) {
map<int, int> arr;
for (int i = 0; i < A.size(); i++) {
int k = A[i];
if (arr.find(k) == arr.end()) {
arr[k] = 1;
}
else {
arr[k]++;
}
}
int r = 0;
int ret = 0;
for (auto it = arr.begin(); it != arr.end(); it++) {... | true |
c0b92a01ec566cae87921841e21ca0a93b09184f | C++ | brendenforbes/CPP-and-Me | /JumblePuzzle/JumblePuzzle/jumble.cpp | UTF-8 | 6,459 | 3.65625 | 4 | [] | no_license |
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <time.h>
#include <ctime>
#include "jumble.h"
using namespace std;
//Bad Jumble Exception
BadJumbleException::BadJumbleException(const string & message) :message(message) {}
string & BadJumbleException::what() { return message;... | true |
89425464d36d64bf1b4e4a8f5a213bca00ba9e92 | C++ | lelelexxx/leetCode-ptrOffer | /ptrOffer/ptrOffer_31.cpp | GB18030 | 615 | 3.46875 | 3 | [] | no_license | //31,ջѹ뵯
class Solution {
public:
bool IsPopOrder(vector<int> pushV, vector<int> popV) {
reverse(popV.begin(), popV.end()); //pushVpopVתջֱͨӱȽջƺʱpopʱpush
reverse(pushV.begin(), pushV.end());
stack<int, vector<int>> popS(popV);
stack<int, vector<int>> pushS(pushV);
stack<int> temp;
while (!pushS.empty())
... | true |
30dc238ce37e361c6a5efbaacbc669e3fc54e204 | C++ | LucaZilli/Numerical-Simulation | /exercises/esercitazione10/esercizio10.2/esercizio10.2.cpp | UTF-8 | 7,134 | 2.734375 | 3 | [] | no_license | #include "GeneticAlgorithm.h"
#include <iostream>
#include <cmath>
#include "mpi.h"
using namespace std;
vector < vector<double> > ReadRows( const char* filename , int N,int M);
int main (int argc, char *argv[]){
int size, rank, itag=0;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
... | true |
e4254b0bb4f2564266d58f37c618a4b52a079113 | C++ | TimBunk/tb2d | /tb2d/contactListener.cpp | UTF-8 | 1,606 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "contactListener.h"
ContactListener::ContactListener() {
}
ContactListener::~ContactListener() {
}
void ContactListener::BeginContact(b2Contact* contact) {
// Get fixture a and b from the contact
b2Fixture* fa = contact->GetFixtureA();
b2Fixture* fb = contact->GetFixtureB();
// Check if the received... | true |
bf3f7277e49c95c4659fefc70595e7ce60ff2c6e | C++ | UPCACM/DuckKnowNothing | /src/GraphAlgorithm/ShotestPath/Dijkstra+Priority_queue.cpp | UTF-8 | 1,218 | 3.0625 | 3 | [] | no_license | const int maxn = 1007, INF = 0x3f3f3f3f;
vector<pair<int, int> > edge[maxn];
int m, n, dist[maxn];
bool vis[maxn];
struct cmp {//重载优先队列比较方法
bool operator () (pair<int, int> y, pair<int, int> x) {//这里第一个是y,第二个是x
if(x.second == y.second) return x.first < y.first;
return x.second < y.second;
}
};
... | true |
ef6376a026ea9daaa179cef1a496965a5df92b36 | C++ | UkZya/C | /20181028_baekjoon_1002/20181028_baekjoon_1002/main.cpp | UTF-8 | 1,919 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <math.h>
#define UPLIMIT 10000
#define BOLIMIT -10000
typedef struct _testcase {
int ix1;
int ix2;
int iy1;
int iy2;
int ir1;
int ir2;
}testcase;
bool isCondition(testcase stTC) {
if (BOLIMIT <= stTC.ix1 && stTC.ix1 <= UPLIMIT && BOLIMIT <= stTC.ix2 && stTC.ix2 <= UPLIMIT &&
BO... | true |
3c044371487a90f8667f84fa85f3d9924ea9c8ea | C++ | yudonlee/ReviseCPlusPlus | /chap5/complex_number.cc | UTF-8 | 5,571 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cstdlib>
class Complex{
private:
double real , img;
public:
Complex(const char* str);
Complex(double real, double img) : real(real), img(img){}
Complex(const Complex& c){real = c.real, img = c.img;
std::cout<<"복사생성자 호출"<<std::endl;
}
//Complex operator+(const ... | true |
30f012bb141a1f526bd086a504e91dd5b6e1fa00 | C++ | NamNamju/Algorithm | /DP/baekjoon_11722.cpp | UHC | 766 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
// A ־ , ϴ κ ϴ α ۼϽÿ.
// baekjoon_11053 ſ . Ǯ ȴ.
int main() {
int arr[1002] = { 0, };
int num;
int dp[1002] = { 0, };
int max = 0;
cin >> num;
for (int i = 1; i <= num; i++) {
cin >> arr[i];
}
for (int i = num; i > 0; i--) { // ϴ κм ϱ Ųٷ for .
int min =... | true |
70eef444b86003744a186536fb459c80460001b8 | C++ | CrazyIEEE/algorithm | /OnlineJudge/LeetCode/第1个进度/1005.k-次取反后最大化的数组和.cpp | UTF-8 | 1,890 | 3.578125 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=1005 lang=cpp
*
* [1005] K 次取反后最大化的数组和
*
* https://leetcode-cn.com/problems/maximize-sum-of-array-after-k-negations/description/
*
* algorithms
* Easy (50.90%)
* Likes: 35
* Dislikes: 0
* Total Accepted: 6.6K
* Total Submissions: 12.9K
* Testcase Example: '[4,2,3]\n1'
*
... | true |
7cea05eb35462ebd407a23fd7079ddcf7f1bb6cc | C++ | theozornelas/throw-catch | /src/source/shoppingcart.cpp | UTF-8 | 3,642 | 2.65625 | 3 | [] | no_license | #include "shoppingcart.h"
#include "ui_shoppingcart.h"
#include "../header/shoppingcart.h"
/**
* @brief ShoppingCart::ShoppingCart Initializes the ui to appear on the screen.
* @param parent
*/
ShoppingCart::ShoppingCart(QWidget *parent) :
QWidget(parent),
ui(new Ui::ShoppingCart)
{
ui->setupUi(this);
}... | true |
02665ff32dac80225ebdca658656d34a062c4e44 | C++ | sanjusss/leetcode-cpp | /0/400/480/483.cpp | UTF-8 | 1,134 | 2.5625 | 3 | [] | no_license | /*
* @Author: sanjusss
* @Date: 2021-06-18 08:29:42
* @LastEditors: sanjusss
* @LastEditTime: 2021-06-18 09:08:07
* @FilePath: \0\400\480\483.cpp
*/
#include "leetcode.h"
class Solution {
public:
string smallestGoodBase(string n) {
uint64_t i = stoull(n);
int ones = 64;
while (!((1ull... | true |
68e737c5909c85bb643a6bc7328c1dd6c276e2b2 | C++ | tanlin816/xuexi | /Imageprocessing/Opencvexample/cmake/caper2/最邻近插值/main.cpp | UTF-8 | 1,526 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include<opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
int main()
{
Mat srcimage = imread("72dpi.jpg");
if(!srcimage.data)
{
cout << "image read is error!" << endl;
... | true |
0f9538b2d78b42c7243485dea489fa35c2fa1527 | C++ | ParadoxGameConverters/Vic2ToHoI4 | /src/V2World/Countries/CountryBuilder.h | UTF-8 | 2,122 | 3.140625 | 3 | [
"MIT"
] | permissive | #ifndef COUNTRY_BUILDER_H
#define COUNTRY_BUILDER_H
#include "src/V2World/Countries/Country.h"
#include <memory>
namespace Vic2
{
class Country::Builder
{
public:
Builder() { country = std::make_unique<Country>(); }
std::unique_ptr<Country> Build() { return std::move(country); }
Builder& SetTag(const std::... | true |
54ed0c4c4d4bfed196e8127955470d880b2f107b | C++ | alexdgarland/KRC | /Ch1/ProcessLine/MainSource/ProcessLine.cpp | UTF-8 | 3,510 | 3.15625 | 3 | [] | no_license | #include "ProcessLine.h"
#ifdef _WIN32
using std::string;
#endif
void main(int argc, char* argv[])
{
#ifdef __linux__
const char* options;
#endif
#ifdef _WIN32
TCHAR* options;
#endif
options = PROCESSLINE_GETOPT_OPTIONS;
int ArgumentIdentifier;
char* RunModeArgument = ... | true |
3f75cc4a7f386e358ddee6c2903fff1030705de9 | C++ | sachin2805/All-c-lab-manual | /resultantTime.cpp | UTF-8 | 1,529 | 4.09375 | 4 | [] | no_license | /*Add two values times and display resultant time in the hr.: min: sec
form using friend function(overload binary + operator)
a. T1- 2:40:35
b. T2- 3:35:30
c. Resultant time is- 06:16:05*/
#include<iostream>
using namespace std;
class time
{
int hr,m,s;
public:
void set(int x)
{
cout<<"\nEnter ... | true |
7456c8df3e37c2fd649f4a7d5e211f05ba06a058 | C++ | huongnguyenduc/OOP_Summer_Fsoft_Test | /OOP_Summer/OOP_Summer.cpp | UTF-8 | 10,490 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cstdio>
#include <fstream>
#include <vector>
#include <memory>
using namespace std;
enum JobTitle {
DEVELOPER,
MANAGER,
TESTER
};
class Employee {
public:
Employee(int id = 0, string name = "None", JobTitle jobTitle = DEVELOPER) {
this->id = id;
... | true |
3e8a3f0106407255140d19a8e55cda5952d51152 | C++ | hexagonal-sun/mattuliser | /src/dsp/dsp.h | UTF-8 | 2,143 | 2.53125 | 3 | [] | no_license | /****************************************
*
* dsp.h
* Declare a DSP plugin class.
*
* This file is part of mattulizer.
*
* Copyright 2010 (c) Matthew Leach.
*
* Mattulizer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free... | true |
9888dd4dd56871552b117d20cc1b864d09009b6b | C++ | AksanaKuzmitskaya/introductiontocpp | /transpose.cpp | UTF-8 | 428 | 3.6875 | 4 | [] | no_license | /*Write a function that returns the length of a string (char *), excluding the final NULL
character. It should not use any standard-library functions. You may use arithmetic and
dereference operators, but not the indexing operator ([]).*/
#include <iostream>
using namespace std;
int main()
{
const char *h = "he... | true |
be0630e3e0f9afecd48230cd4bfabce36d69fe4d | C++ | Adven00/ARender | /src/core/render_utils.h | UTF-8 | 1,245 | 2.578125 | 3 | [] | no_license | #ifndef UTILS_H_
#define UTILS_H_
#include "vertex.h"
namespace utils {
struct BoundingBox2D {
int x_min;
int y_min;
int x_max;
int y_max;
};
// square of screen triangle
float ScreenTriangleSquare(const Triangle &tri);
bool InTriangle(const std::array<float,... | true |
8bcf37ff3ccb1e219fba7609a4c21737402da769 | C++ | axard/Rubetek-Test-Assignment | /task_1/test/test_solver.cpp | UTF-8 | 1,446 | 2.84375 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <main.h>
TEST(test_has_variable, test_solver)
{
std::string input = "8 - 10 * x + 3";
Parser p(input);
auto ast = p.parse();
auto result = Solver::hasVariable(ast);
ASSERT_EQ(result, true);
}
TEST(test_has_not_variable, test_solver)
{
std::string input = "8 - ... | true |
b80ac5b16554dc30a56a95215404bc7180ac47f6 | C++ | nadavmarkus/advanced_programming_ex3 | /main.cpp | UTF-8 | 1,695 | 2.75 | 3 | [] | no_license | #include <cassert>
#include <string>
#include <iostream>
/* We resort to raw getopt since we don't have boost :( */
#include <getopt.h>
#include <stdlib.h>
#include "TournamentManager.h"
int main(int argc, char *const argv[])
{
struct option options[] {
{"threads", required_argument, nullptr, 0},
... | true |
496c1c93688ee944277ce189db7caa27d384ecfc | C++ | Mesywang/EPSILON_Noted | /EPSILON/core/common/inc/common/spline/polynomial.h | UTF-8 | 6,906 | 2.8125 | 3 | [
"MIT"
] | permissive | #ifndef _CORE_COMMON_INC_COMMON_SPLINE_POLYNOMIAL_H__
#define _CORE_COMMON_INC_COMMON_SPLINE_POLYNOMIAL_H__
#include <assert.h>
#include "common/basics/basics.h"
#include "common/math/calculations.h"
#include "common/spline/lookup_table.h"
namespace common {
/**
* @brief Polynomial class, coeffs are stored in reve... | true |
ee6cdd73d4fbf4b8967ee1f6b5a08121b5c58800 | C++ | venkatarajasekhar/tortuga | /packages/core/include/PropertySetDetail.h | UTF-8 | 6,021 | 2.640625 | 3 | [] | no_license | /*
* Copyright (C) 2009 Robotics at Maryland
* Copyright (C) 2009 Joseph Lisee <jlisee@umd.edu>
* All rights reserved.
*
* Author: Joseph Lisee <jlisee@umd.edu>
* File: packages/core/include/PropertySetDetail.h
*/
#ifndef RAM_CORE_PROPERTYSETDETAIL_H_04_11_2009
#define RAM_CORE_PROPERTYSETDETAIL_H_04... | true |
fbb8dc29d8120c0822a27e93c23d73eea1dfb873 | C++ | sebasutp/tests | /primes/my_sieve.cpp | UTF-8 | 1,940 | 3.546875 | 4 | [] | no_license | /**
* Finds how many prime numbers are there up to a certain value passed as
* parameter
*/
#include <iostream>
#include <vector>
#include <boost/program_options.hpp>
uint64_t map_sieve_ix(uint64_t ix) {
return (ix - 3) / 2;
}
struct Sieve {
std::vector<bool> sieve;
uint64_t limit;
uint64_t N;
bool is_... | true |
12ddd1b128836589560936341aa954639ff59216 | C++ | JennyChen9827/Calculate-pi-value-with-c- | /Collatz.cpp | UTF-8 | 570 | 3.375 | 3 | [] | no_license | #include<iostream>
#include <cstdlib>
using namespace std;
void collatz_demo(int n){
if(n == 0)
return;
if(n % 2 == 0){
n = n / 2;
if( n == 1)
cout << n << endl;
else {
cout << n << ", ";
collatz_demo(n);
}
}
else{
n = (n * 3) + 1;
cout << n << ", ";
collatz_demo(n... | true |
09cdd0997d63fdc578f16278a99f927aa02feea8 | C++ | walker-zheng/code | /concurrency/sender.h | UTF-8 | 354 | 2.921875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "queue.h"
namespace messaging {
class sender {
queue * q;
public:
sender() :
q(nullptr)
{}
explicit sender(queue * q_) :
q(q_)
{}
template<typename Message>
void send(Message const & msg)
{
if (q)
{
q->pus... | true |
a85c34c6eb724e5592e93eb7fc6a2b2e25b0ffdd | C++ | geosender/Cannon_Practice | /Cannon Practice/Game420Lab7/WoodenBox.cpp | UTF-8 | 1,771 | 2.734375 | 3 | [] | no_license | #include "WoodenBox.h"
WoodenBox::WoodenBox(b2World* world, float x, float y)
:GameObject(world)
{
CreateBox2dObject(x, y);
LoadTexture("images\\wood_box.bmp");
LoadTexture("images\\wood_box_mask.bmp", true);
}
WoodenBox::~WoodenBox(void)
{
}
void WoodenBox::CreateBox2dObject(float x, float y)
{
// Define the... | true |
cd4f858df3faebf3be5149eee32ff0b0249a201d | C++ | zsmountain/leetcode | /c++/convert_sorted_array_to_binary_search_tree.cpp | UTF-8 | 1,240 | 3.984375 | 4 | [
"Apache-2.0"
] | permissive | /*
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
*/
/*
* Similar to "Convert Sorted List to Binary Search Tree"
*/
#include "helper.h"
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : ... | true |
588d39ef0ddd7bad5a2f6c103c11f58a8ba54403 | C++ | hidoopos/cbf-ht | /hashtable.cpp | GB18030 | 7,301 | 2.9375 | 3 | [] | no_license | #include "hashtable.h"
#include <memory.h>
#include <assert.h>
#define TABLE_SIZE (1024*1024)
#define MAX_LOAD_FACTOR 0.5
// ӽڵ
void addChild(AuxTreeNode* nParent, AuxTreeNode* nChild) {
if (nChild == NULL){
printf("NULL\n");
return;
}
if(nParent == NULL){
printf("NUL... | true |
f500e254190d3eeba8d8a59c8a275ae4c2a1b251 | C++ | heyihong/algorithm-contest-solution | /topcoder/srm652 div1/500_WA.cpp | UTF-8 | 1,964 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
const int MAXN(1010);
const long long INF(1LL << 60);
class MaliciousPath {
public:
long long minPath(int N, int K, vector <int> from, vector <int> to, vector <int> cost);
};
int q[MAXN];
long long dist[MAXN], _dist[MAX... | true |
95c45a26d74cd15dfdc2954605482c6cf69a1edd | C++ | shike1239/autonomous_exploration-1 | /src/my_move_base/include/my_move_base/HybricAStar.h | UTF-8 | 3,063 | 2.828125 | 3 | [] | no_license | //
// Created by parallels on 2/10/20.
//
#ifndef SRC_HYBRICASTAR_H
#define SRC_HYBRICASTAR_H
#include <vector>
#include <nav_msgs/OccupancyGrid.h>
using namespace std;
class HybricAStar{
public:
class cell{
public:
cell(){};
cell(int x,int y,int index):x(x),y(y),index(index){} ;
cel... | true |
f80d4c95dfe4d27ae9c556937111cc4aa5e5c692 | C++ | zysundar/CPP_Programming | /structer.cpp | UTF-8 | 382 | 2.9375 | 3 | [] | no_license | #include<conio.h>
#include<iostream>
using namespace std;
int main()
{struct book
{char book[30];
int pages;
int price;
}b;
cout<<"enter the book name";
cin>>b.book;
cout<<"enter the pages";
cin>>b.pages;
cout<<"enter the price";
cin>>b.price;
cout<<"the element of the book are"<<endl;;
cout<<b.book<<en... | true |
4313753e3a4df3a36e8b61c43b5edb323799a0f5 | C++ | vvivek92/data-structures-and-algorithms | /trees/sum_less_than_k.cpp | UTF-8 | 1,868 | 3.65625 | 4 | [] | no_license | #include <queue>
#include <iostream>
using namespace std;
struct node {
struct node * left;
struct node * right;
int data;
};
node *newNode(int data)
{
node *temp = new node;
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
node * create_tree(void) {
int i=0;
... | true |
f40136711c0e87870f5ca2aacf7d40874b74b77e | C++ | Roagen7/3d | /usage/CollisionScene.cpp | UTF-8 | 3,760 | 2.53125 | 3 | [] | no_license | //
// Created by roagen on 26.08.2021.
//
#include "CollisionScene.h"
#include "../src/spatial/collider/SphereCollider.h"
CollisionScene::CollisionScene() {
this->initMaterials();
this->initObjects();
}
void CollisionScene::initMaterials() {
auto m1 = Material();
m1.getTextureFromFile("../ass... | true |
e11fb95a66ffdaad0ae823305cca910460e20f13 | C++ | HsuJv/Note | /Code/C/College/Algorithm/Ex4/RSA.cpp | GB18030 | 2,093 | 3.71875 | 4 | [] | no_license | #include <iostream>
using namespace std;
int ext_euclid(int a, int b, int f, int e){
// e * 0 + * 1 = (1)
// e * 1 + * 1 = e (2)
// e * (0 - 1 * ( / e)) + ..... = % e
// eͦջʣһijһʽҲĦ % e == 1
// ʱʽe˵ϵҪde^ (-1)
// (1)ʽe˵ϵaʾ(2)ʽe˵ϵbʾm = / e; n = % e
int m, n, t;
if (e == 1... | true |
77fa82ef6b01621264e83a76d105697bf9e08df1 | C++ | avatarbuss/dotnet-api-docs | /samples/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp | UTF-8 | 857 | 3.390625 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive |
//<snippet1>
// This example demonstrates the Console.Beep() method.
using namespace System;
int main()
{
array<String^>^args = Environment::GetCommandLineArgs();
int x = 0;
//
if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x ) == true) && ((x >= 1) && (x <= 9)) )
{
for ... | true |
d3de7ceefc9e4af008ca6f1876d0208ac2f0a401 | C++ | TopHK/fightcode | /ArrowOffer/find_special_numbers.cpp | UTF-8 | 1,109 | 3.5 | 4 | [] | no_license | #include<vector>
#include<iostream>
using namespace std;
int FindSpecialNumbers(const vector<int>& nums) {
int result = 0;
for (const auto& num : nums) {
result ^= num;
}
return result;
}
vector<int> FindSpecialNumbersV2(const vector<int>& nums) {
int flag = 0;
for (const auto& num : n... | true |
a825ee24f08a4488e2f2f996c28fd1bd7bb34189 | C++ | ahme5760/BasicGraphicsEngine | /Lighting and shading/a3_ahme5760/a3/src/a3.cpp | UTF-8 | 14,958 | 2.75 | 3 | [] | no_license | /**
* CP411 Assignment 3.
* Khaja Ali Ahmed
* 110425760
*
*/
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "World.hpp"
#include "Camera.hpp"
#include "Light.hpp"
GLint winWidth = 800, winHeight = 800;
GLfloat red = 1.0, green = 1.0... | true |
0fe3d5330c5ba53687c93dc5ea00f9a957b6d8a1 | C++ | cstollw/visionaray | /include/visionaray/math/detail/rectangle.inl | UTF-8 | 2,786 | 3.03125 | 3 | [
"MIT"
] | permissive | // This file is distributed under the MIT license.
// See the LICENSE file for details.
namespace MATH_NAMESPACE
{
//--------------------------------------------------------------------------------------------------
// rectangle : xywh_layout
//
template <typename T>
inline rectangle<xywh_layout, T>::rectangle()
{
... | true |
a38a2d32c6da10a6a72405f6173f671268970328 | C++ | Pinyupen/possumwood | /src/plugins/cgal/properties.h | UTF-8 | 2,298 | 3.109375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <algorithm>
#include <cassert>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include <boost/iterator/indirect_iterator.hpp>
#include "property.h"
namespace possumwood {
template <typename T>
class Property;
/// A simple container class designed to hold ... | true |
c3a6585816a87bae803af23e8ad34f084c5877da | C++ | shengxiaoyi1993/algorithm | /leetecode/combination_sum/main.cpp | UTF-8 | 718 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include"solution.hpp"
using namespace std;
int main(){
Solution tmp;
int vals[]={2,3,5};
int size_vals=3;
vector<int> candidates;
for (size_t i = 0; i < size_vals; i++) {
candidates.push_back(vals[i]);
}
int target=8;
for (size_t i = 0; i < ca... | true |
2bb2f5c91b5f19be02894f63d7d0053a08fb955c | C++ | schwadri/granular | /code/core/math/linalg/traits/detail/vector_traits_spec.hpp | UTF-8 | 3,017 | 2.9375 | 3 | [] | no_license | #ifndef _vector_traits_spec_hpp_
#define _vector_traits_spec_hpp_
/* \file vector_traits_spec.hpp Contains specializations of the field
* and dimension metafunctions
* \author Adrian Schweizer
* \created $Di 08 Jul 11:03:32 am CEST 2008 schwadri@guest-docking-hg-1-155.ethz.ch$
* \modified $Di 08 Jul 11:08:49 ... | true |
e848b1e069a47f55ddba503d9a7b96ca6e6f521e | C++ | geraldolsribeiro/contests | /ACM/2007/Regional/D-Mario/mario.cpp | UTF-8 | 2,192 | 3 | 3 | [] | no_license | /***************************************************************************
* D-Mario Maratona de Programacao - Regional 2007
*
* Autor: Vinicius J. S. Souza
* Data: 10/09/2009
* Tecnicas: busca binaria
* Complexidade: O(nlgn)
**************************************************************************/
#include<iostre... | true |
d15fa711ab8aa2343de640a88124db663574b46b | C++ | Barboros6167/IoT1929-Kampi | /1. Hafta Problem Setleri/Arduino Problem Seti 4/APS_4_Kod.ino | UTF-8 | 1,640 | 2.9375 | 3 | [
"MIT"
] | permissive | /*
* Yıldıray KARACA IoT1929 Kampı İçin Arduino Problem Seti 4 Çözümü.
* mail: yildiraykaraca@icloud.com
* github: https://github.com/yildiraykaraca
*/
#define POT A0 // A0 Pinini POT Adında Tutturdum.
#define DC 3 // 3. Pini DC Adında Tutturdum.
#define LED 2 // 2. Pini LED Adında Tutturdum.
int Pot... | true |
00ae6a7b22b53821506b162315bf0d41043a5772 | C++ | BarishNamazov/IOI | /ioi2014_wall.cpp | UTF-8 | 1,618 | 2.546875 | 3 | [] | no_license | #include "grader.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int maxx = 2000005;
#define mn first
#define mx second
pair <int, int> t[maxx << 2];
void relax(int v, int l, int r) {
if (l != r) {
int lc = v << 1, rc = v << 1 | 1;
t[lc] = {max(min(t[lc].mn, t... | true |
75687518a45b6e552ade764d37aefca25f7c31ea | C++ | congtrung2k1/Algorithms | /SPOJ/Some-Solutions/CPRMT.cpp | UTF-8 | 582 | 2.71875 | 3 | [] | no_license | //two strings given: say, abcad and ebada we have to find characters present in both as a subsequence, i.e., aabd in alphabetic order.
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN=1010;
char a[MAXN],b[MAXN];
int cnt[26];
void solve... | true |
afa0a5773024410ae91b9d783920f1f72e39f465 | C++ | ailyanlu1/Arithmetic | /Competition/Multi-University/4/1006.cpp | GB18030 | 2,780 | 2.546875 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <stdio.h>
using namespace std;
const int MAXN=100007;
int sa[MAXN];//SA飬ʾSnСź
//ĺĿͷλ˳ηSA
int t1[MAXN],t2[MAXN],c[MAXN];//SAҪмҪֵ
int ran[MAXN],height[MAXN];
//ַsУs[0]s[n-1],Ϊn,ֵСm,
//s[n-1]s[i]0r[n-1]=0
//... | true |
d921c4225e22d5e4b1642a909326ca1d8dd068d5 | C++ | ennis/graal-old | /include/graal/ext/geometry.hpp | UTF-8 | 5,261 | 2.609375 | 3 | [] | no_license | #pragma once
#include <graal/buffer.hpp>
#include <graal/ext/vertex_traits.hpp>
#include <graal/vertex_array.hpp>
#include <fstream>
#include <glm/glm.hpp>
#include <optional>
#include <tiny_obj_loader.h>
#include <vector>
#include <span>
#include <string_view>
namespace graal {
enum class topology {
points,
lin... | true |
b2b100e659461eee916eeb2895f31b368a144255 | C++ | mnksnz/aeplanner | /aeplanner/include/aeplanner/data_structures.h | UTF-8 | 1,937 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef DATA_STRUCTURES_H
#define DATA_STRUCTURES_H
#include <ros/ros.h>
#include <octomap/OcTree.h>
namespace aeplanner
{
class RRTNode
{
public:
Eigen::Vector4d state_;
RRTNode* parent_;
std::vector<RRTNode*> children_;
double gain_;
bool gain_explicitly_calculated_;
RRTNode() : parent_(NULL), gain_(0.... | true |
90ddc7d9fe4563f64ebd2002ecae2144dec57838 | C++ | mcu786/RCControl | /gps_receiver.cpp | UTF-8 | 8,042 | 3.21875 | 3 | [] | no_license | #include "gps_receiver.h"
/**
* Initialise the serial port used to talk to the GPS unit.
*/
GPSReceiver::GPSReceiver(void) {
serial = new SerialPort(GPS_PORT, 9600);
_connected = serial->connected();
memset(&time, sizeof(time), 0x00);
memset(&pos, sizeof(pos), 0x00);
lock = false;
_updateMutex = CreateMutex(... | true |
0a0b78e0e59f29c3c370d11a1bb28751a7782f25 | C++ | lord-przemas/learn_cpp | /boost_library/any/main.cpp | UTF-8 | 1,372 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <boost/any.hpp>
using boost::any_cast;
typedef std::vector<boost::any> many;
void append_int(many & values, int value)
{
boost::any to_append = value;
values.push_back(to_append);
}
void append_string(many & values, const std::string & value... | true |
41a070cb4f4021e55a2c37deadfe2d9cd06a4758 | C++ | jdelezenne/Sonata | /Sources/Engine/Graphics/Animation/NodeAnimationTrack.h | UTF-8 | 1,667 | 2.546875 | 3 | [
"MIT"
] | permissive | /*=============================================================================
NodeAnimationTrack.h
Project: Sonata Engine
Author: Julien Delezenne
=============================================================================*/
#ifndef _SE_NODEANIMATIONTRACK_H_
#define _SE_NODEANIMATIONTRACK_H_
#include "Core/Core.h... | true |
ee99f462a587404bba178883f12799679e23344b | C++ | halfhiddencode/cpp-code | /converdattype2.cpp | UTF-8 | 479 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class complex
{
int a,b;
public:
void setdata(int x,int y)
{
a=x;
b=y;
}
operator int()
{
return(a);
}
void showdata()
{
cout<<a<<" "<<b<<endl;
}
};
int main()
{
complex c1;
int x;
c1.setdata(7,4);
x=c1; //if you want change class to premitive then use oper... | true |
e7ee3025fc8dc5309f77b35725bbd32d0d3b527a | C++ | Miceroy/yam2d | /Tutorials/5_CustomMapCreation/source/main.cpp | UTF-8 | 2,699 | 2.6875 | 3 | [] | no_license | // Include OpenGL ES Engine utils
#include <es_util.h>
// Include map class
#include <Map.h>
// Camera class
#include <Camera.h>
#include <Tileset.h>
#include <Layer.h>
#include <TileComponent.h>
using namespace yam2d;
namespace
{
// Pointer to TmxMap-object
TmxMap* map = 0;
// Component Fa... | true |
b25ddf98f280cf7316b9a2dacf44bf76ce25c7fe | C++ | blackpc/ai-homework2 | /src/Board.cpp | UTF-8 | 3,995 | 3 | 3 | [
"MIT"
] | permissive | /**
* Filename: Board.cpp
* Author: Igor Makhtes
* Date: Dec 12, 2014
*
* The MIT License (MIT)
*
* Copyright (c) 2014
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software witho... | true |
abde20ec17a6fbc83d2ed6dee26e8d1115754457 | C++ | ishankhanna28/Data-Structures-and-Algorithms | /string/str_tok.cpp | UTF-8 | 396 | 3.078125 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<string>
#include<cstring> //for strtok()
using namespace std;
int main()
{ char s1[80], str[10];
cout<<"Input a string..."<<endl;
gets(s1);
cout<<"Enter delimiter string..."<<endl;
gets(str);
char *ptr=strtok(s1,str);
cout<<ptr<<endl;
while(ptr!... | true |
20ccd8ecaa26b85a0243dd94ddde4509e6362ac0 | C++ | X1XJoker/C-C-Qt-course | /DZ #11/dz11.cpp | UTF-8 | 3,496 | 3.15625 | 3 | [] | no_license | //Менеджер Страничной памяти
//Киселев И.
#include <iostream>
#include <time.h>
#include <vector>
#include <algorithm>
using namespace std;
#define MEMSIZE 500
//Проверка на свободную память для помещения в него нового эл-та
bool chk_is_free(vector <int> &a, int start, int size)
{
for (int i=0; i<size; i++)
... | true |
6f255b5ae100e0ec844d258c9342815c7b539ece | C++ | alexandraback/datacollection | /solutions_5708284669460480_0/C++/juho/b1.cpp | UTF-8 | 1,347 | 2.640625 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
void init();
void runCase();
int main()
{
init();
int T;
scanf("%d", &T);
for (int t = 1; t <= T; ++t) {
printf("Case #%d: ", t);
runCase();
}
}
// algorithms
int K, L, S;
char keys[101];
int keycnt[26];
... | true |
bba757ccdd72e66634080418b4b7618aa174afd2 | C++ | Rick-Huang/Smart-Connect | /support.cpp | UTF-8 | 14,539 | 3.484375 | 3 | [] | no_license | #include "support.h"
#include "provided.h"
#include <iostream>
#include <vector>
using namespace std;
int determineBestComputerMove(Scaffold& s, int color, int& rating, int nWin, int depth)
{
int otherRating = -2; // initialize otherRating variable that stores the rating of the best human move, intialize to -2, w... | true |
85dfa07fe1b4b0241e0a606588a1152ee7b57757 | C++ | 20SecondsToSun/NatureSystems | /AutonomousSystem/src/Vehicle.h | UTF-8 | 2,612 | 2.9375 | 3 | [] | no_license | #pragma once
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "FlowField.h"
#include "cinder/Rand.h"
#include "Path.h"
using namespace ci;
using namespace ci::app;
using namespace ci::gl;
using namespace std;
class Vehicle
{
public:
Vehicle(const double x = 0, const double y = 0)
:velocity(Ve... | true |
42bafd32648baabbe6cdedb14f6fb0ac80d894d8 | C++ | romeric/SoftComp | /function_space/one_d/Line.h | UTF-8 | 4,653 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef LINE_H
#define LINE_H
#include "quadrarure_rules/QuadratureRule.h"
namespace SoftComp {
class Line {
public:
vector<real> bases;
vector<real> grad_bases;
Line() = default;
SC_INLINE Line(integer C, real xi, boolean equally_spaced=false) {
auto n = C+2;
auto quad = Quadratu... | true |
764fa91a60d8b3e0713c19b8822019751e0f51c5 | C++ | Lingfei-Li/leetcode | /archive/45-Jump Game II - 2.cpp | UTF-8 | 2,241 | 2.78125 | 3 | [] | no_license | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<stack>
#include<set>
#include<map>
#include<iostream>
#include<fstream>
#include<sstream>
using namespace std;
struct ListNode {
... | true |
506ffa16000eccaa66e514cfb7ca337b63811964 | C++ | adevore3/Computer_Vision | /Project3/skeleton/PSM/src/Depths.cpp | UTF-8 | 4,402 | 3.046875 | 3 | [] | no_license | #include "Depths.h"
#include "CVector.h"
#include "CMatrixSparse.h"
#include "cg.h"
#define CGEPSILON .5
namespace {
void copyDepths(const CVector<double> & z,
const CIntImage & zind,
DepthImage * depths)
{
double minD=z(0);
double maxD=z(0);
for(int i=0;i<z.Length();i++)
{
maxD = max(z... | true |
6ab652762ff18b22dd40a7743edb564a0883ac39 | C++ | Vaa3D/vaa3d_tools | /hackathon/LLF/neuron_factor_tree/neuron_factor_tree_tools.cpp | UTF-8 | 32,147 | 2.734375 | 3 | [
"MIT"
] | permissive | /*neuron_factor_tree_tools.cpp
*funcs for neuron_factor_tree struct.
*/
#include "neuron_factor_tree_plugin.h"
#include <QtGlobal>
void calculate_branches(const NeuronTree &neuron, vector<V3DLONG> &branches)
{
//calculate a node's branch num;
V3DLONG neuron_siz = neuron.listNeuron.size();
branches = vec... | true |
7507992714db25e306f627e171e5e09b4065f3ab | C++ | coord-e/icsservo | /src/bin/get_id.cpp | UTF-8 | 451 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "ics-servo/ics.h"
#include <iostream>
int main(int argc, char **argv) {
if (argc != 3) {
std::cerr << "get_id <device> <en_pin>" << std::endl;
return 1;
}
const std::string device {argv[1]};
const std::uint8_t en_pin = static_cast<std::uint8_t>(strtol(argv[2], nullptr, 0));
auto sa = st... | true |
246c4405e08bb977e75896f3ad8775c59400de71 | C++ | NewieVentures/Obelisk | /src/app/colour.h | UTF-8 | 444 | 2.625 | 3 | [
"MIT"
] | permissive | #ifndef OBELISK_COLOUR_H
#define OBELISK_COLOUR_H
#include "Particle.h"
class Colour {
uint8_t mRed, mGreen, mBlue;
bool mIsValid;
public:
Colour(uint8_t, uint8_t, uint8_t);
Colour(String);
uint8_t getRed() const;
uint8_t getGreen() const;
uint8_t getBlue() const;
bool isValid();
String toString()... | true |
6b1946c91b47ef2fb57df916d6e06e30e6b6d879 | C++ | JBamberger/oberon0-compiler | /ast/include/Identifier.h | UTF-8 | 1,164 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright 2020 Jannik Bamberger
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | true |
d56cd961f1625873e8481e6731ec0d33b446a76f | C++ | gveenblade/testrepo | /CodeForces-103A.cpp | UTF-8 | 245 | 2.625 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main()
{
long long int n,sum=0;
cin>>n;
for(int i=1;i<=n;i++)
{
long long int t;
cin>>t;
if(t>1) sum+=i*(t-1)+1;
else sum+=t;
}
cout<<sum;
return 0;
} | true |
8256b7b880d88c3072d5d6ac5fcc4a63fd6f47b6 | C++ | DonRumata710/NetCowork | /Generator/function.h | UTF-8 | 481 | 2.625 | 3 | [
"MIT"
] | permissive | #ifndef FUNCTION_H
#define FUNCTION_H
#include "types.h"
#include "codeelement.h"
#include "parameter.h"
#include <vector>
class Function : public CodeElement
{
public:
explicit Function(const std::string& name);
void add_param(const Parameter& type);
const Parameter* get_param(size_t i) const;
s... | true |
f3701745118ec58178e6b152f3761a8527724317 | C++ | fms13/fauxpar | /fauxpar/Setting.h | UTF-8 | 585 | 2.984375 | 3 | [
"BSD-2-Clause"
] | permissive | /**
* \file FSetting.h
*
* \date Dec 22, 2015
* \author Frank M. Schubert
* \copyright BSD License
*/
#ifndef SETTING_H_
#define SETTING_H_
#include <memory>
#include <string>
#include <iostream>
namespace FauxPar {
class Setting {
public:
typedef std::shared_ptr<Setting> ptr;
Setting(std::string _name);
... | true |
a90f10252fe26d74785bc10dc0eb29fca22f3e67 | C++ | dkim828/MyGameEngine | /Game/w14 Engine/AlarmGlobals.h | UTF-8 | 433 | 2.75 | 3 | [] | no_license | #ifndef ALARMGLOBALS_H
#define ALARMGLOBALS_H
/**
\ingroup ALARM
<summary> Each of these flags are associated with which Alarm the user may want to interact
with through Alarmable::setAlarm(), Alarmable::cancelAlarm(), Alarmable::getTimeLeftOnAlarm(),
or Alarmable::addTimeToAlarm().
</summary>
*/
namespace Alarm
{
en... | true |
c543d213468fea7143881592ae9d90160d3b5a3d | C++ | JJungwoo/algorithm | /baekjoon/math1/11050.cpp | UTF-8 | 451 | 2.53125 | 3 | [] | no_license | /*
[boj] 11050. 이항 계수1
https://www.acmicpc.net/problem/11050
*/
#include <iostream>
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long ll;
int n, k;
ll factorial(int start, int reply){
ll res = 1;
for(int i=start;i>start-reply;i--){
res *= i... | true |
8b65d80d07f10e75256e1544cceb2be7a420c742 | C++ | OKullmann/oklibrary | /Experimentation/Investigations/RamseyTheory/GreenTaoProblems/plans/CountingProgressions.hpp | UTF-8 | 18,526 | 2.90625 | 3 | [] | no_license | // Oliver Kullmann, 10.5.2010 (Swansea)
/* Copyright 2010 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation and included in this library; either version 3... | true |
7077e45a12a0348fb7fe6f3fb2e6f25de16e0d23 | C++ | dandugula/leetcode_random | /find_replace_pattern.cpp | UTF-8 | 924 | 2.84375 | 3 | [] | no_license | class Solution {
public:
vector<string> findAndReplacePattern(vector<string>& words, string pattern) {
std::vector<string> res;
std::for_each(words.begin(), words.end(),
[&res, &pattern](auto& aWord) {
std::vector<int> letterMap(26, -1);
std::vector<bool> letterRec(26, false);
... | true |
40d298d579d0ea9b42520c6451c3c426d2668d33 | C++ | justinctlam/MarbleStrike | /game/code/common/engine/system/stringutilities.cpp | UTF-8 | 3,368 | 2.703125 | 3 | [
"MIT"
] | permissive | //////////////////////////////////////////////////////
// INCLUDES
//////////////////////////////////////////////////////
#include "common/engine/system/assert.hpp"
#include "common/engine/system/stringutilities.hpp"
#include <stdlib.h>
#include <string.h>
//////////////////////////////////////////////////////
// PUB... | true |
6f2c4a8b82761c196f79214cf91764dc0bbfe010 | C++ | UmmeHabiba-7119/Computer-Graphics | /Three/main.cpp | UTF-8 | 1,279 | 2.65625 | 3 | [] | no_license | #include<windows.h>
#ifdef __APPLE__
//#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
float x_position = -10.0;
int state = 1;
void init(){
glClearColor(0.0f,0.0f,0.0f,1.0f);
glOrtho(-10,10,-10,10,3,-3);
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
... | true |
2b006546ecec975f40664481bf2ab4100507166d | C++ | eunbin62/rep | /practice01/quiz.cpp | UTF-8 | 697 | 3.03125 | 3 | [] | no_license | # include <iostream>
#include <stdlib.h>
int main(int argc, const char * argv){
char buff[1000];
std::cout<<"Enter the expression. " << std::endl;
std::cin.getline(buff, 1000);
int i;
int j;
char k;
std::cout << i << k << j << std::endl;
std::cout<<buff[0]<<"k"<<buff[1] <<std... | true |
83f20037ede2970d9e0e80b03387cbf0ab38aabc | C++ | MuhammadSherifW/Competitive-Programming | /Graphs/Dijkstra/Dijkstra-K-Shortest-Path.cpp | UTF-8 | 1,311 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
#include <string>
#include <queue>
#include <ctime>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cstdint>
... | true |
21ab9fb349b32ba7028fe56a8e6f4d02b70c6f12 | C++ | aha4765/leetcode | /dynamic-programming/064.cpp | UTF-8 | 790 | 2.859375 | 3 | [] | no_license | class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
int nrow = grid.size();
int ncol = grid[0].size();
if ((nrow == 0) || (ncol == 0)) return 1;
vector<vector<int> > table(nrow, vector<int>(ncol, 0));
table[0][0] = grid[0][0];
for (i... | true |
e4cfbc85965c5634ebe9ef2cd757e30d62313e0d | C++ | cesarus777/mipt-mips | /simulator/infra/cache/t/unit_test.cpp | UTF-8 | 4,284 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Tests for CacheTagArray
* @author Oleg Ladin, Denis Los
*/
#include <catch.hpp>
// Module
#include "../cache_tag_array.h"
#include <infra/replacement/cache_replacement.h>
#include <infra/types.h>
#include <fstream>
#include <map>
#include <vector>
static const uint32 LINE_SIZE = 4; // why not 32?
static ... | true |
55b2a003b7f5c4298e8de1952c82fb1062c88dfe | C++ | Adil-sc/Batman-vs-Riddler-Adventure-Game | /Menu.cpp | UTF-8 | 2,939 | 3.328125 | 3 | [] | no_license | /*********************************************************************
** Author: Adil Chaudhry
** Date: Late December
** Description: Outlines the class functions for the Menu class
** Citation: Inspired by https://github.com/jessicaspeigel/cs162-fantasy-combat-game/blob/master/Menu.cpp
*******************************... | true |
ae96893b908e05712926c9d6a9f9d0593bdef026 | C++ | thiyaguleet/LeetCode | /Maximum Product of Three Numbers.cpp | UTF-8 | 1,009 | 3.171875 | 3 | [] | no_license | class Solution {
public:
int maximumProduct(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n=nums.size();
int max_1=nums[n-1]*nums[n-2]*nums[n-3];
int max_2=nums[0]*nums[1]*nums[n-1];
return max_1>max_2? max_1:max_2;
}
};
class Solution {
public:
i... | true |
84441896edf55b9079777e21d1ab6413293dbaf4 | C++ | tanishq1g/cp_codes | /GeeksForGeeks/Circular tour.cpp | UTF-8 | 1,110 | 2.734375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <vector>
#include <locale>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <climits>
#include <list>
#include <queue>
#include <stack>
#include <utility>
using namespace std;
#define INF 1e7
... | true |
7418a83a636a3e7665323dbc87bf6014eb05e8e2 | C++ | Etherealblade/CSAPP | /Chapter2/71/xbyte/xbyte/main.cpp | GB18030 | 1,014 | 3.6875 | 4 | [] | no_license | /*
4зֽڷװһ32λunsigned
xbyte(packet_t word, int bytenum)
ڶbytenumʲô˼
*/
#include <cstdio>
#include <stdio.h>
#include <assert.h>
typedef unsigned packet_t;
int error_demo(packet_t word, int bytenum)
{
// This func can't extract a negative
// byte number from word
int retval = (word >> (bytenum << 3)) & 0xff;
retu... | true |
f4d507989f8182381f402f02b6a7e11203246f94 | C++ | Zaktansnake/CS3201-HappyPotatoes | /source/PKB/Header/Modifies.h | UTF-8 | 585 | 2.59375 | 3 | [] | no_license | #ifndef MODIFIES_H
#define MODIFIES_H
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Modifies
{
public:
// add item to ModifiesTable
static void addModifiesTable(string varName, int stmtLine);
// get ModifiesTable
static std::vector<int> getModifiesTable(s... | true |
692bb94b09ecb3e8f7d8d1ff180161754c375c7d | C++ | NataliaAlonso/CS8 | /WordTest/word.h | UTF-8 | 2,653 | 3.4375 | 3 | [] | no_license | #ifndef WORD_H
#define WORD_H
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
class word
{
public:
word();
word(string &w, int &p, int &l, int &size);
/** Default destructor */
~word();
... | true |
33763aa82ffe7f8950996b5aba600a26656c84f2 | C++ | nier0525/SchoolAssignment | /Assignment/2학년 1학기/C++/0426/유저 캐릭터,아이템 관리_싱글톤/GameManager.cpp | UHC | 1,572 | 2.890625 | 3 | [] | no_license | #include "GameManager.h"
GameManager* GameManager::pthis = nullptr;
GameManager* GameManager::GetInstance() {
if (!pthis) {
pthis = new GameManager();
}
CharacterManager::GetInstance();
ItemStore::GetInstance();
return pthis;
}
void GameManager::Destory() {
if (pthis) {
delete pthis;
pthis = nullptr;
}... | true |
7f823db8953e1c34fe28f2a2673c82cc7bad2987 | C++ | Fjdklsajf/baseball-league-map | /graph_list.h | UTF-8 | 26,603 | 3.03125 | 3 | [] | no_license | /*********************************************
* Authors: Dacheng Lin
* Assig #7: MST & SHORTEST PATH ALOGRITHM
* Class: CS 008
* Section: MW 9:45-11:10 TTH 9:45-11:50
* Due Date: 05/01/2020
*********************************************/
#ifndef GRAPH_LIST_H
#define GRAPH_LIST_H
#include <iostream>
#includ... | true |
876c7560df4a9d44072b2cfd2cf2a867569851c5 | C++ | ngangwar962/C_and_Cpp_Programs | /practise/hackwithinfy/xor_question.cpp | UTF-8 | 514 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,k,n;
cin>>n;
int a[n];
int temp=0;
for(i=0;i<n;i++)
{
cin>>a[i];
temp=temp^a[i];
}
int b[n-1];
int temp2=0;
for(i=0;i<n-1;i++)
{
cin>>b[i];
temp=temp^b[i];
temp2=temp2^b[i];
}
cout<<temp<<"\n";
int temp3=0;
int c[n-2];
for(i=0;i... | true |
b4842d57be08b23b514e635523896766fb687f5f | C++ | chrisjakins/ice-cream | /src/test_customer.cpp | UTF-8 | 268 | 3 | 3 | [] | no_license | #include <iostream>
#include "customer.h"
int main() {
Customer cust("Bob", 9901050, "817-990-1050");
if (cust.name() != "Bob") {
std::cerr << "Bob test failed - expected Bob got: " << cust.name() << std::endl;
return 1;
}
return 0;
} | true |
f7b3e78e08f4f47141a6a4bb93828bc8c6ba4597 | C++ | TissueFluid/Algorithm | /LintCode/Sort Colors II.cc | UTF-8 | 1,071 | 3.84375 | 4 | [] | no_license | // Sort Colors II
#include <iostream>
#include <vector>
using namespace std;
class Solution{
public:
/**
* @param colors: A list of integer
* @param k: An integer
* @return: nothing
*/
void sortColors2(vector<int> &colors, int k) {
const int size = colors.size();
int start... | true |
b804feb2c144d8d52294efc01f35e2b6172312ce | C++ | sirAdarsh/CP-files | /CodeForces/1334-B.cpp | UTF-8 | 549 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
ll n,x;
cin >> n >> x;
ll arr[n]={};
ll p;
ll diff=0;
ll ans=0;
for(ll i=0;i<n;i++){
cin >> p;
if(p >= x ){
ans++;
diff += p-x;
}else{
arr[i] = p;
}
}
sort( arr,arr+n, ... | true |
8b0adbc6831f2575d7b082765abc7997dc01e68e | C++ | epw7856/CashFlowManager | /CashFlowManager/Income/salaryincometablemodel.cpp | UTF-8 | 3,713 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "currencyutilities.h"
#include "dateutilities.h"
#include "incomeinterface.h"
#include <QBrush>
#include <QFont>
#include "salaryincome.h"
#include "salaryincometablemodel.h"
SalaryIncomeTableModel::SalaryIncomeTableModel(IncomeInterface &localIncomeInterface, int localYear)
:
incomeInterface(localIncomeI... | true |
cbf6c0ec1b1f54bcd3b26cda82af53721e3f1c1e | C++ | Naryadchikov/CS-E5520-ACG-assignment-3 | /src/base/InstantRadiosity.cpp | UTF-8 | 5,497 | 2.75 | 3 | [] | no_license | #include "InstantRadiosity.hpp"
namespace FW
{
void InstantRadiosity::castIndirect(RayTracer* rt, MeshWithColors* scene, const LightSource& ls, int num)
{
// If the caller requests a different number of lights than before, reallocate everything.
// (This is OpenGL resource management stuff, do... | true |
057588ebd9c6dbc1df150f7f730b47750a3e043a | C++ | barmi/WindowsProgramming2016 | /Shape/Shape.cpp | UHC | 853 | 3.375 | 3 | [] | no_license | // Shape.cpp : ܼ α մϴ.
//
#include "stdafx.h"
class CShape {
protected:
int _x, _y; // ߽ ġ
public:
CShape() {}
CShape(int x, int y) : _x(x), _y(y) {}
~CShape() {}
virtual void draw() = 0;
};
class CRectangle : public CShape {
private:
int _width, _height;
public:
CRectangle() {}
CRectangle(int x, int y,... | true |
26ef2f379ac344017b84b4523623b9b42c931c4d | C++ | schiebermc/CP_Lib | /HackerRank/Practice/InterviewPrep/StringManipulation/CommonChild/code.cpp | UTF-8 | 1,305 | 2.796875 | 3 | [] | no_license | //#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <climits>
using namespace std;
typedef long long int ll;
ll best_from_here(string& a, string& b, ll i, ll j, unsigned long na, unsigned long nb, map<pair<l... | true |
db5f7840fe1e9cd4f91899b711b1f7ce9a488103 | C++ | AsderYork/ShortGame1 | /GameSimulation/LandscapeChunkController.h | UTF-8 | 9,682 | 2.8125 | 3 | [] | no_license | #pragma once
#include "LandscapeChunk.h"
#include "LandscapeMeshGenerator.h"
#include <LinearMath\btVector3.h>
#include <cstdint>
#include <vector>
#include <memory>
#include <functional>
#include <map>
#include <algorithm>
namespace GEM::GameSim
{
/**!
More text. Becouse I have no idea, how to implement this.
Let'... | true |