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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d66f1157c39f6030f67ca81640e3288df0bb62fc | C++ | ChenLinL/Bin-packing-research | /main.cpp | UTF-8 | 5,937 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include "next_fit.cpp"
#include "first_fit.cpp"
#include "best_fit.cpp"
#include "first_fit_decreasing.cpp"
#include "best_fit_decreasing.cpp"
#include <fstream>
#include <ctime>
#include <chrono>
#include <random>
#include <vector>
#include <math.h>
using namespace std;
struct timing{
int n;
... | true |
ccb19fa223fc092e4cdb34a3e848d61f5163ef88 | C++ | aczoo/Algorithms | /traveling.cpp | UTF-8 | 3,316 | 3.609375 | 4 | [] | no_license | //Annie Zhu
//acz2npn
//4.23.2020
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
#include "middleearth.h"
float computeDistance(MiddleEarth me, const string& start, vector<string> dests);
void printRoute(const string& start, const vector<string>& dests);
/**
* @brief the main method... | true |
ebf090acffa2ac7ea1ff5771cda4a1f9fc611db7 | C++ | jcmana/playground | /cpp/interface_extension/composite/composite_rectangle.h | UTF-8 | 510 | 2.671875 | 3 | [] | no_license | #pragma once
#include "indexable_impl.h"
#include "element_impl.h"
#include "rectangle_impl.h"
class composite_rectangle :
public indexable_impl,
public element_impl,
public rectangle_impl
{
public:
class factory
{
public:
static std::shared_ptr<composite_rectangle> make_composite(int x, int y, int width, int... | true |
32d546ac9ab390213351a85ea340f4dc03a3bee3 | C++ | aMammoth/CustomPuzzleLeague | /cocos2d/cocos/base/RepetitionClock.h | UTF-8 | 1,478 | 2.65625 | 3 | [] | no_license | #ifndef __cocos2d_custom__RepetitionClock__
#define __cocos2d_custom__RepetitionClock__
#include "platform/CCPlatformMacros.h"
#include <chrono>
NS_CC_BEGIN
class CC_DLL RepetitionClock
{
public:
using Milli = std::chrono::milliseconds;
using Instant = std::chrono::steady_clock::time_point;
//Basic constructor
... | true |
cfaab158a13016de496e21dcc3095f6fe709b406 | C++ | Maveldous/All_labs_C---1-course- | /5Lab.C/Middlelvl/ConsoleApplication2/ConsoleApplication2.cpp | UTF-8 | 1,293 | 2.828125 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <fstream>
#include <Windows.h>
//Задание: создать текстовый файл в текстовом редакторе. Организовать просмотр содержимого файла и выполнения действий в соответствии с услови-ем индивидуального задания. Обеспечить сохранение всех полученных результатов в новый файл
//Дан ф... | true |
2728b0765087e2d75efeb11cff8ae77b5385f8eb | C++ | mayurdw/Pong_Game | /c++/Pong.cpp | UTF-8 | 4,013 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
Author: Mayur Wadhwani
Created: Nov 2018
*/
#include <string>
#include "abs_layer.h"
#include "error.h"
#include "ball.h"
#include "player.h"
using namespace Players;
using namespace Balls;
using namespace std;
static const int iWidth = 40;
static const int iHeight = 20;
static inline int iPaddleHeight()... | true |
6c0c6229cffede1b9a9feab5cc0e1318f93688b3 | C++ | klasing/MnistExample | /CppConcurrencyInAction/listing_2_2.cpp | UTF-8 | 847 | 3.75 | 4 | [] | no_license | // Listing 2.2
// Waiting for a thread to finish
#include <iostream>
#include <thread>
using namespace std;
namespace ns_listing_2_2 {
struct func {
int& i;
func(int& i_) : i(i_) {}
void operator() () {
cout << "-> [listing 2.2] loop started" << endl;
for (unsigned j = 0; j < 1000000; ++j)
do_somethi... | true |
d7cdf20ff1dbabff48d1f48cac5e06df3b2a81c1 | C++ | nicolechu/AssignmentFive | /DoublyLinkedList.h | UTF-8 | 5,860 | 3.9375 | 4 | [] | no_license | /* Nicole Chu
* 2290152
* nichu@chapman.edu
* 350-01
* Assignment #5
*/
/*
* This is my Doubly-Linked List template class. It contains functions to insert and remove elements to my list,
print my list, find or remove specific elements in my list, and return the size of my list.
*/
#ifndef DOUBLYLINKEDLIST_H... | true |
dbc342a05b75b4e82bcec5e53f4bcebb074e0522 | C++ | bashok001/XmlParser | /InputParser/InputParser.cpp | UTF-8 | 2,015 | 2.703125 | 3 | [
"Unlicense"
] | permissive | //*************************************************************************//
// InputParser.cpp - Parses input provided to the project from file or string//
// ver 1.0 //
// ----------------------------------------------------------------------- //
// cop... | true |
32532c93f082e0535e52b764e672b0b9ace2fb63 | C++ | zitmen/bachelor-thesis--sw-metrics | /src/ASTM/DataDefinition.h | UTF-8 | 807 | 3.15625 | 3 | [] | no_license | /*!
* \file
* DataDefinition.h
*
* \author
* Martin Ovesný (<a href="mailto:ovesnmar@fel.cvut.cz">ovesnmar@fel.cvut.cz</a>)
*/
#ifndef _ASTM_DATA_DEFINITION_H_
#define _ASTM_DATA_DEFINITION_H_
#include <vector>
#include "Definition.h"
#include "Expression.h"
/*!
* \brief
* Definitions involving data.
*
* ... | true |
8e4b88eb1a31ee2a6db5a9ebd09c606094bef7b1 | C++ | abhi7544/cp | /bit-manipulation/subsequence.cpp | UTF-8 | 633 | 3.53125 | 4 | [] | no_license | #include <iostream>
using namespace std;
//generate the all subsequence of a string
void subsequence(char str[],char out[],int i,int j)
{
//base case
if(str[i]=='\0')
{ out[j]='\0';
if(out[0]=='\0')
{cout<<" NUll";}
else cout<<out<<",";
return;
}
// recursive case
out[j]=str[i]; //including ch... | true |
89672f20150fedb16c1e4d4c49d00e10e2f8f5ae | C++ | Ryanel/Blazar | /src/Blazar/Blazar/Platform/OpenGL/OpenGLBuffer.h | UTF-8 | 863 | 2.78125 | 3 | [] | no_license | #pragma once
#include <cstdint>
#include "Blazar/Renderer/Primitives/Buffer.h"
namespace Blazar {
class OpenGLVertexBuffer : public VertexBuffer {
public:
OpenGLVertexBuffer(float* verticies, size_t size);
virtual ~OpenGLVertexBuffer();
virtual void Bind() const;
virtual void Unbind() const;
... | true |
c7602e9e621992df5720342b38ff1a088f6ab0ac | C++ | rikine/Algorithms-and-DS-ITMO | /Semester 1/Lab 2/B.cpp | UTF-8 | 1,496 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
using namespace std;
/*stable_sort(v.begin(), v.end(), [](const auto& l, const auto& r) {
return l.first < r.first;
});
*/
void mergesort(vector<pair<string, string>> &a, int start, int end) {
if (end - start <... | true |
d9f5d9811c285e03510fa8b572445391d43b88e7 | C++ | Shurimian/me101-programming | /Assignments/Assignment 1/square.cpp | UTF-8 | 458 | 3.078125 | 3 | [] | no_license | /*
Chamath Wijesekera
ME101 - Assignment 1
*/
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
int side_length = 2;
int a = 0;
cout << "Provide a Value : ";
cin >> a;
cout << "The square of " << a << " is " << a * a << endl;
cout << "& the cube of " << sid... | true |
e1433cd7204810e0d0bae5cc9bcb5ca9825a6b83 | C++ | alexandraback/datacollection | /solutions_5634697451274240_0/C++/Squarefk/a.cpp | UTF-8 | 597 | 2.765625 | 3 | [] | no_license | #include <cstdio>
#define REP(i,n) for (int i=1;i<=n;++i)
using namespace std;
int T;
int x,aa,ans;
int a[10];
bool check(int x) {
while (x) {
if (!a[x % 10]) {
a[x%10] = true;
++aa;
}
x/=10;
}
return aa == 10;
}
int calc(int x) {
REP(i,1000) {
if (check(x * i)) return i;
}
return -1;
}
int mai... | true |
3ac10f36ffb57807e75601d17e9593553f480fb9 | C++ | siamcodes/c | /odd.cpp | UTF-8 | 179 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
main(){
st:
int x;
printf("Input:");
scanf("%d", &x);
for(int i=1; i<=x ; i++){
if(x%i==0){
printf("%d \t",i);
}
}
printf("\n");
goto st;
}
| true |
5a5f283f664189272cc87500c2d8b80b423da843 | C++ | bdliyq/algorithm | /misc/google/find-first-missing-positive-integer.cc | UTF-8 | 596 | 2.875 | 3 | [] | no_license | // Question: Find first missing positive integer.
int solve(vector<int> nums) {
if (nums.empty()) {
return 1;
}
int len = nums.size();
for (int i = 0; i < len; ++i) {
if (i+1 == nums[i]) {
continue;
}
while (nums[i] > 0 && nums[i] <= len && i+1 != nums[i] &... | true |
bddec78a859221252930b5756052dd98c6f55dcc | C++ | RomanovAleksandr/oop | /lab5/Complex/Complex/CComplex.cpp | UTF-8 | 2,600 | 3.265625 | 3 | [] | no_license | #include "CComplex.h"
#define _USE_MATH_DEFINES
#include <cmath>
#include <exception>
#include <limits>
#include <stdexcept>
CComplex::CComplex(double real, double image) : m_real(real), m_image(image)
{
}
double CComplex::Re() const
{
return m_real;
}
double CComplex::Im() const
{
return m_image;
}
double CCompl... | true |
36f31f18ddeeab8e0a7f3364e3adc478ae7b9155 | C++ | Alvarogd6/AceptaElReto | /165.cpp | UTF-8 | 399 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool impar(unsigned short i) {
return i % 2 == 1;
}
int main() {
string num;
cin >> num;
while(num[0] != '-') {
if(*(find_if (num.begin(), num.end(), impar)) == '\0') {
cout << "SI\n";
} else {
... | true |
37ff92a3b34ac41a7eaa0413acc59fcdf6a05965 | C++ | ryryrymyg/cpp_ryuseiGai | /cpp_practice/EZOE/examples/pointer/p_subobject.cpp | UTF-8 | 293 | 2.890625 | 3 | [] | no_license | struct Object
{
//サブオブジェクト
int subobject;
};
int main()
{
//クラスのオブジェクト
Object object;
//サブオブジェクトへのポインタ
int * pointer = &object.subobject;
*pointer = 123;
int read = object.subobject;
std::cout << read <<std::endl;
}
| true |
01feb510b158d5a96c5fdaf4c3724fd971d24508 | C++ | dipayandutta/datastructure | /LinearSearch/LinearSearch.cpp | UTF-8 | 941 | 4.15625 | 4 | [] | no_license | #include <iostream>
class LinearSearch {
public:
void linearSearch(int array[],int value , int i , int n){
int found = 0;
for(i=0;i<n;i++){
if (value == array[i]){
found = 1;
break;
}
}
if(found == 1){
std::cout << "Elemet is present in the ... | true |
99a60510ab0257f6774d0fb8c084504f08451ccb | C++ | kzhereb/knu-is-ooop2018 | /code-demo/oopTests/classes.h | UTF-8 | 2,558 | 3.15625 | 3 | [] | no_license | /*
* classes.h
*
* Created on: Nov 8, 2018
* Author: KZ
*/
#ifndef CODE_DEMO_OOPTESTS_CLASSES_H_
#define CODE_DEMO_OOPTESTS_CLASSES_H_
class AccessModifiersSUT {
friend class FriendlyClass;
friend int sum_of_all_fields(const AccessModifiersSUT & sut);
public:
AccessModifiersSUT(int pub, ... | true |
1a6df95f6cd96d6ccaeb25e9430e85ed502e38d8 | C++ | chimamedia/Xtion2Sample | /Xtion2Sample/Xtion2Sample/main.cpp | SHIFT_JIS | 3,086 | 2.640625 | 3 | [] | no_license | // Windows̏ꍇReleaseRpC
// Iȑxœ삵܂B
using namespace std;
#include "openni2.h"
#include "opencv.h"
#include <iostream>
void PleaseBottom()
{
system("pause");
}
int main(int argc, char **argv)
{
try
{
//hCȍ
openni::Status rc = openni::STATUS_OK;
//foCX
openni::Device device;
//ZT... | true |
986995932a2d2c64d3c768791a6bc8f7b5662ecd | C++ | rcory/drake | /geometry/frame_id_vector.cc | UTF-8 | 1,690 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "drake/geometry/frame_id_vector.h"
#include <string>
#include <unordered_set>
#include <utility>
namespace drake {
namespace geometry {
using std::vector;
FrameIdVector::FrameIdVector(SourceId source_id) : source_id_(source_id) {}
FrameIdVector::FrameIdVector(SourceId source_id, const vector<FrameId>& ids... | true |
4d5c4fccd3863adcb099cf27ad41e753c8ed7e4e | C++ | peanut-buttermilk/fun-run | /Google/FractionToRecDec.cc | UTF-8 | 1,915 | 3.46875 | 3 | [] | no_license | /**
166. Fraction to Recurring Decimal My Submissions QuestionEditorial Solution
Total Accepted: 29736 Total Submissions: 197126 Difficulty: Medium
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
If the fractional part is repeating, enclose the repea... | true |
b452100935a8245e1205b932670e29a2b5660bed | C++ | juanmrq95/ee149_104 | /serialSender/serialSender.ino | UTF-8 | 1,519 | 2.53125 | 3 | [] | no_license | /*
Emic 2 Text-to-Speech Module: Basic Demonstration
Author: Joe Grand [www.grandideastudio.com]
Contact: support@parallax.com
Program Description:
This program provides a simple demonstration of... | true |
523062588f054a78dd1a6c8366ea746821a7f011 | C++ | fmi-lab/up-2018-kn-group3-sem | /Exercises/Exercise 13/ourQuicksort.cpp | UTF-8 | 774 | 3.640625 | 4 | [] | no_license | #include<iostream>
using namespace std;
void swap2(double& num1, double& num2){
double num3;
num3 = num1;
num1 = num2;
num2 = num3;
}
int partition1(int lo, int hi, double* arr){
double pivot = arr[hi];
int i = lo - 1;
for(int j = lo; j<hi; j++){
if(pivot > arr[j]){
i++... | true |
bb84b6cf0323c63586fe195548b8c9b4f45bff18 | C++ | pabloh1995/clash_reversioned | /back_up_funcionando/main.cpp | UTF-8 | 7,386 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <SDL.h>
#include <SDL_image.h>
#include <string>
#include <fstream>
#include "juego.h"
#include "moneda.h"
#include "casillero.h"
#include "tren.h"
#include "mina.h"
#include "estacion.h"
using namespace std;
/* PARAMETROS
S: Segundos que dura un intervalo.
P: cantidad máxima que puede p... | true |
59cdacd27165df8990de743a360bd0fe9b90a466 | C++ | SchwyzerDose/dhbw-objektorientierung | /Beispielprojekt/Beispielprojekt.cpp | UTF-8 | 1,108 | 2.640625 | 3 | [] | no_license | #include "stdafx.h"
#include <Gosu/Gosu.hpp>
#include <Gosu/AutoLink.hpp>
#include <vector>
#include <string>
#include <iostream>
#include "Planet.h"
#include "Vektor2d.h"
class GameWindow : public Gosu::Window
{
public:
Gosu::Image Bild;
GameWindow()
: Window(800, 600), Bild("planet3.png")
{
set_captio... | true |
6ea7bae53b8ba7f476a95fcf6a96ebfb6f27f80d | C++ | XWwanwan/li_xiao_wan | /homework618/main.cpp | UTF-8 | 274 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include<cmath>
using namespace std;
double integerPower(double base,int exponent)
{
double result=1;
for(int i=0;i<exponent;i++)
{
result*=base;
}
return result;
}
int main()
{
cout<<integerPower(2,3);
return 0;
}
| true |
b5dcc0a2739e5d5ec9cf1cbede7707a3a82d52ad | C++ | ogglO/Incubator | /src/hwInterfaces.cpp | UTF-8 | 6,609 | 2.5625 | 3 | [] | no_license | #include <Arduino.h>
#include "hwInterfaces.h"
#include "definitions.h"
#include "controller.h"
#include "menu.h"
#include "appHelpers.h"
//set all hw states except TFT
//heater
//lights
//fan
bool statusLight = LIGHT_ON_START_ENABLE;
uint16_t timeSinceLightsOn = 0;
//encoder
bool encoderALast;
int16_t encoderValue;... | true |
baa51e570cf9d8558427660952cbae0ec0f9be08 | C++ | alanijohnson/DotsnBoxes_CISC220Lab3 | /Game.cpp | UTF-8 | 19,078 | 4.09375 | 4 | [] | no_license | #include "Game.hpp"
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
/*Game() - sets up the game
ask the user for board size, number of players, number of computer
players. If the user enters 6 or more for the number of the computers
asks for a new input.
... | true |
67f16d4fa5171957143e5fa1d36c597b42246087 | C++ | zellyn/project-euler | /cc/077.cc | UTF-8 | 226 | 2.796875 | 3 | [] | no_license | // Project Euler Problem 077
//
// What is the first value which can be written as the sum of primes
// in over five thousand different ways?
#include <cstdio>
int main(int argc, const char* argv[]) {
printf("%d\n", 0);
}
| true |
93b3ae3d8f9aee868239c5f2d3d76f51b99a1676 | C++ | SiluPanda/competitive-programming | /leetcode/product_lastk.cpp | UTF-8 | 1,520 | 3.203125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class ProductOfNumbers{
public:
vector <int> arr, prefix;
int last_seen = -1;
ProductOfNumbers(){
arr.clear();
prefix.clear();
}
void add(int num){
if(num == 0){
last_seen = arr.size();
}
arr.push_... | true |
c5bfe11eac33bbc9c317dfd9d4e397c194affd27 | C++ | KudeGit/elments_of_programming_interview | /first_pass/ch14/es8.cpp | UTF-8 | 1,503 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <set>
#include <unordered_map>
#include "../utils.hpp"
struct Interval {
int left;
int right;
};
std::ostream& operator<< (std::ostream& out, const Interval& I)
{
out << "(" << I.left << ", " << I.right << ")";
return out;
}
struct CompareLeft
{
boo... | true |
af85a7c32970dc53fdbd689aff6e1bba5790eb25 | C++ | superman2211/ekx | /ekx/core/src/ecxx/ecxx.hpp | UTF-8 | 3,688 | 2.53125 | 3 | [
"ISC"
] | permissive | #pragma once
#include "impl/world.hpp"
#include "impl/view_forward.hpp"
#include "impl/view_backward.hpp"
namespace ecs {
/**
* NULL entity value
*/
template<typename ...Component>
inline auto view() {
return ViewForward<Component...>{the_world};
}
/** special view provide back-to-front iteration
and all... | true |
e3e5e10696659ac132755b874331a9891df3d34d | C++ | cohennadi/BlackWidow | /BlackWidow/Agent.h | UTF-8 | 1,622 | 2.796875 | 3 | [] | no_license | #pragma once
#include "Ultrasonic.h"
#undef main
#include <array>
#include <filesystem>
#include <Cryptopp/aes.h>
class Agent final
{
public:
// ctor
// param[in] encryption_root_path root path for the files encryption.
Agent(std::filesystem::path encryption_root_path);
// dtor
~Agent();
// Executes the age... | true |
dc76a8dbe623f17720a9b548391b42fd9aed6fcb | C++ | mateusfavarin/HP1-PS1-Tools | /src/extract.cpp | UTF-8 | 3,400 | 3.484375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <fstream>
#include <string>
#include <filesystem>
#include "extract.h"
using namespace std;
namespace fs = std::filesystem;
bool check_dir(fs::path file_path) {
// Creating path for current folder
fs::path folder(file_path);
bool dir = false;
bool dat = false;
// Ch... | true |
0b04fcb80e523489617e4e5df4cbbe76dedfaf54 | C++ | xxqxpxx/CodeForces-Solutions | /27/A[ Next Test ].cpp | UTF-8 | 540 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.in" , "r" , stdin);
//freopen("out.out" , "w" , stdout);
#endif
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin >> arr[i];
sort (arr , arr + n);
for (int i = 0 , z = 1 ; i < n... | true |
b8afe063ec1694f07f4bae3989610839eb18384b | C++ | sekihan02/Arduino_Storage | /Ltika/source/Ltika.cpp | UTF-8 | 925 | 2.53125 | 3 | [] | no_license | //---------------------------------------------------------------------------
#include "mariamole_auto_generated.h"
//---------------------------------------------------------------------------
void led_blink(int interval, int count);
//---------------------------------------------------------------------------
void... | true |
5506a00138b4f3760d1b852de386cdf93767897c | C++ | HuTongsama/learn | /Practice/ch07/Screen.cpp | UTF-8 | 420 | 3.21875 | 3 | [] | no_license | #include "Screen.h"
void Window_mgr::push(const Screen & s)
{
m_screens.push_back(s);
}
Screen Window_mgr::get(ScreenIndex index) const
{
if (index >= 0 && index < m_screens.size())
{
return m_screens[index];
}
return Screen();
}
void Window_mgr::clear(ScreenIndex index)
{
if (index >= 0 && index < m_screens... | true |
848256f5bec195198f5c77d3bb48336f82095c1a | C++ | uriqishtepi/uvaonlinejudge | /algo_class_dijkstra.cpp | UTF-8 | 6,535 | 3.421875 | 3 | [] | no_license | /* shortest path from a node n to every other node, known as
* Dijkstra's algorithm. This is for graphs that have no negative cycles
* start from the origin node, and expand via BFS updating shortest path as you go
*/
#include <stack>
#include <queue>
#include <assert.h>
#include <vector>
#include <map>
#include <s... | true |
39c5c866caf8acb18c94aef30976aa19be7a8131 | C++ | ggm6/Parallel-Processing | /Lab4/barrier.cc | UTF-8 | 3,154 | 2.875 | 3 | [] | no_license | // barrier.cc
// Implementations of barrier functions.
//
// developed from the following C source code:
// http://athena.univ-lille1.fr:8888/ab2/coll.45.4/MTP/@Ab2TocView/
//
// Y. Wu, McMaster University, Sept. 2000
#include <thread>
#include <mutex>
#include <condition_variable>
#include "barrier.h"
//------------... | true |
54e15de609299a01b0c6c4b167f8691e3194b00c | C++ | Nikhil569/InterviewBit | /RotatedArray.cpp | UTF-8 | 809 | 3.734375 | 4 | [] | no_license | /*Problem:
Suppose a sorted array A is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
The array will not contain duplicates.
*/
/**
* @input A : Read only ( DON'T MODIFY ) Integer array
* @input n1 : Integer array's ( A ) length
* ... | true |
5da7bd13fcf5a9b5112a4b78b510bac60bf9f026 | C++ | idiliev18/cpp_essentials_oop_module_2_exam | /problem_5/problem_5.cpp | UTF-8 | 238 | 3.140625 | 3 | [] | no_license | #include <iostream>
using namespace std;
class A {
public:
A() :val(0) {}
int val;
int inc() { ++val; return val--; }
};
void Do(A* a) {
a->val = a->inc();
}
int main()
{
A a;
Do(&a);
cout << a.inc();
return 0;
}
// Answer: 2
| true |
a338071b4b9c6ebf0ce6d1e7683745392329e0e4 | C++ | rmosolgo/sorbet | /dsl/OpusEnum.h | UTF-8 | 553 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef SRUBY_DSL_OPUSENUM_H
#define SRUBY_DSL_OPUSENUM_H
#include "ast/ast.h"
namespace sorbet::dsl {
/**
* This class makes it easier to use Opus::Enum in `typed: strict` files:
*
* class MyEnum < Opus::Enum
* X = new
* Y = new('y')
* end
*
* becomes
*
* class MyEnum < Opus::Enum
* X = ... | true |
b194468a9d6f264aacf5df363be7ab2cb2b25e8a | C++ | subr809/CSCE121 | /Linked List/starter_code/level_2/LinkedList.h | UTF-8 | 1,447 | 3.703125 | 4 | [] | no_license | #ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <iostream>
#include <stdexcept>
#include <string>
class LinkedList {
struct Node {
int data;
Node* next;
Node(int data) : data(data), next(nullptr) {}
};
Node* head;
Node* tail;
unsigned int size;
public:... | true |
172533c2800bf23155a146b936ac124820f3c1d6 | C++ | oneseedfruit/UTMSPACE_2019-2020-sem2_SCSJ2013_Data_Structures_-_Algorithm | /lab_02/BubbleSort2.cpp | UTF-8 | 3,033 | 3.734375 | 4 | [
"MIT"
] | permissive | // Prepared by : Pn Nor Bahiah Hj. Ahmad
// Prepared by : Nor Bahiah Hj. Ahmad
// School of Computing, Faculty of Engineering
// Universiti Teknologi Malaysia
// e-mail : bahiah@utm.my
//
// Reference : data Structure & Problem Solving with C++
// Frank M. Carrano, Pearson International Edition
// IMPROVED BUBB... | true |
c941aeb3c57a8a00e0bcd6f17b2acf497beb3332 | C++ | shirleymbeyu/OOP1-MCS1.2 | /CON(de)STRUCTORS/const-param/main.cpp | UTF-8 | 444 | 3.515625 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*constructor parameters-> parameters used for setting
initial values for certain member attributes*/
class Car{
public:
string brand;
string model;
int year;
car(string x, string y, int z){
brand = x;
model = y,
year = z;
}
};
int main... | true |
d9801296c57373a26717d0b313695a6f48fb2e37 | C++ | jhnnnmcstr/Experiment-3 | /Exp3_Prb2.cpp | UTF-8 | 1,412 | 3.75 | 4 | [] | no_license | // Create a C++ Program that store temperature of Province A, Province B and Province C
// for a week (seven days) and display it
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
const int a = 3;
const int b = 7;
char prov;
int main ()
{
cout << "Enter all temperature f... | true |
fb80bc8b03161f9593f470e0641c9ed52aee0942 | C++ | SaveliyLipaev/Homework-1-course | /test/ZachetTest/zachetTest_1/zachetTest_1/ListForSort.h | UTF-8 | 581 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <string>
struct List;
struct ListNode;
//returns the address of the selected memory cell for the List structure
List* createList();
//return true if list pustoy
bool isEmpty(List *list);
//Adds an item to the top of the list
void push(List *list, const std::string &str);
//Removes the entire... | true |
c68401c2497112f62f2f81af8579778d21ff2916 | C++ | Hariamy/projeto_metodosII | /modelo/vetor.h | UTF-8 | 575 | 2.671875 | 3 | [] | no_license | #ifndef VETOR_H
#define VETOR_H
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
class vetor{
public:
int tam;
std::vector <double> *valores;
vetor (int novoTam, double valIncial = 0);
double& operator [] (int pos);
void operator = (vetor novosValores);
void operator = (veto... | true |
7b48b91e5731b8de59f4dbd7cd93e12e2a63090f | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/11_23462_28.cpp | UTF-8 | 1,240 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;
vector<string> board;
int r;
int c;
bool cover(int row, int col)
{
if (row+1 == r || col+1 == c)
return false;
if ( (board[row+1][col] != '#') || (board[row][col+1] != '#') || (board[row+1][col+1] != '#') ... | true |
eba8494045e1b7856d50bd67a84af71e18d6c25f | C++ | SwarnenduGanguli25/Code-Asylums | /RecursionPractice/PrintStringsOfLengthK.cpp | UTF-8 | 960 | 3.9375 | 4 | [] | no_license | /*
Given a set of characters and a positive integer k,
print all possible strings of length k that can be formed from the given set.
Input:
set[] = {'a', 'b'}, k = 3
Output:
aaa
aab
aba
abb
baa
bab
bba
bbb
*/
#include<iostream>
using namespace std;
void printSt... | true |
928a8e5129981965819cd9344fcc0103c3f04c78 | C++ | lishuhuakai/Parser | /LR(1)/ActionGoto.h | GB18030 | 1,225 | 2.71875 | 3 | [] | no_license | #pragma once
#include "Common.h"
#include "Status.h"
/*
* ActionGotoҪڼ¼,ƽ,ǹԼ.
*/
class ActionGoto
{
friend class FiniteStateAutomaton;
public:
ActionGoto(Grammar&);
public:
~ActionGoto();
public:
struct Action {
enum Type { kShift, kReduce};
Type type;
rulePtr rule;
Action() :
type(kShift)
{}
Acti... | true |
a6e95248c2249f9596315fa12d9b36b31e2ff22f | C++ | Codes-iiita/UVa | /UVa-Solutions-master/608.cpp | UTF-8 | 1,541 | 2.984375 | 3 | [] | no_license | //Steven Kester Yuwono - UVa 608 - Counterfeit Dollar
#include <iostream>
#include <string>
using namespace std;
int main(){
int up[100];
int down[100];
for(int i=0;i<100;i++){
up[i]=0;
down[i]=0;
}
string temp;
string command[3];
char ans;
bool heavy=true;
int n;
cin>> n;
getline(cin,temp);
while(n--... | true |
d2c2599d8f783e07d6c46e542358f7f6b288ff3b | C++ | zhushiqi123/ios- | /C++语言程序设计 郑莉 第四版(课件、课后答案、例题源代码)/C++语言程序设计案例的源代码和目录/10852C++案例教程源代码/case05/5_11.cpp | GB18030 | 627 | 3.75 | 4 | [] | no_license | #include <iostream>
using namespace std;
class FunClass
{ static int count; //̬ݳԱ
public:
FunClass() { count++; cout << "Constructing object " <<count << endl; }
~FunClass() { cout << "Destroying object " << count << endl; count--; }
static int GetCount() { return count; } //̬Ա
};
in... | true |
b1deabf763ab8f7801036fdd52be86485a2500c1 | C++ | MrFICAX/StrukturePodataka | /Tudji labovi/LabPraktikum/struktureLAB/StrukturePodataka(Lab1)-zad8MATRICA/StrukturePodataka(Lab1)-zad8MATRICA/Node.cpp | UTF-8 | 304 | 2.90625 | 3 | [] | no_license | #include "Node.h"
Node::Node()
{
info = -1;
i = 0;
j = 0;
linkk = NULL;
linkv = NULL;
}
Node::Node(int a, int b, int c, Node* p1, Node* p2)
{
i = a;
j = b;
info = c;
linkv = p1;
linkk = p2;
}
void Node::print(){
cout << "[" << i << "," << j << "]" << "=" << info << " ";
}
Node::~Node()
{
} | true |
2baa1b40396e7d6705959cb2b23dc25373322049 | C++ | CRoberts245/CPlusPlusProjects | /CS2_Assignment2.cpp | UTF-8 | 2,079 | 3.515625 | 4 | [] | no_license | //============================================================================
// Name : Chapter8ProgrammingAssignment.cpp
// Description : Sorting & Searching functions
// Author : Cameron Roberts
// Extra Credit: No.
// Date : 02/03/2017
// OS : Windows
// IDE : Eclipse Neon
//================... | true |
7612662ec5648e377490decc2eb2178431971abf | C++ | luoxiaojian/dany | /type_index.h | UTF-8 | 1,140 | 2.84375 | 3 | [] | no_license | #ifndef TYPE_INDEX_H_
#define TYPE_INDEX_H_
#include <string>
enum TypeIndex {
TIUNKNOWN,
TIVOID,
TICHAR,
TII32,
TII64,
TIU32,
TIU64,
TISTRING,
TIPVOID,
TIPCHAR,
TIPI32,
TIPI64,
TIPU32,
TIPU64,
};
template <typename T>
TypeIndex type_index() {
return TIUNKNOWN;
}
template <>
TypeIndex... | true |
e227904bf7cdd6cb31980fe80aef23badd5bb98f | C++ | peauc/RType | /server/src/Engine/Zone.cpp | UTF-8 | 2,531 | 2.578125 | 3 | [] | no_license | //
// Created by romain on 21/01/18.
//
#include <Components/Zone/ZoneComponent.hpp>
#include "Zone.hpp"
#include "Game.hpp"
Engine::Zone::Zone(const Vector2d &topLeftCoords, const Vector2d &bottomRightCoords)
{
this->_topLeftCoords = topLeftCoords;
this->_bottomRightCoords = bottomRightCoords;
}
void Engine::Zone... | true |
4f3f9b294043b3087003d6cd41e455961203c700 | C++ | paopaoshuiqiang/c-learning | /chapter4/class_test/screen.h | UTF-8 | 261 | 2.5625 | 3 | [] | no_license | #pragma once
#include<iostream>
using namespace std;
class screen
{
public:
screen(void);
screen &move(int i,int j);
screen &set(string s)
{
return *this;
}
screen &display(ostream &os)
{
return *this;
}
~screen(void);
private:
int i,j,k;
};
| true |
0ec4e777269708a670eb20efc0d0ab54f22cf7bd | C++ | nuts-ilyam/Machine-Learning | /Affinity-propagation/affinity_propagation.cpp | WINDOWS-1251 | 2,224 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <ctime>
#include <cstdlib>
#include "Functions.h"
using namespace std;
//choose cluster labels
int main() {
int iteration = 0, Maxiteration = 600;
using Vector_of_edge... | true |
0c3887a97c652b69f223d3b695f6b17665142ed3 | C++ | anveshh/cpp-book | /src/Interview-Problems/FAANG/apple_min-time.cpp | UTF-8 | 1,340 | 3.5 | 4 | [] | no_license | /*
Problem Statement:
The computing cluster has multiple processors, each with 4 cores. The number of tasks to handle is equal to the
number of cores in the cluster. Each task has a predicted execution time and each processor has a specified time
when its core becomes available. Assuming that exactly 4 tasks are assi... | true |
1bb473cba2e0b43c0757aa76ff142b40344b2bc9 | C++ | jjzhang166/BOSS_ExternalLibs | /BOSS/RawFile/RawFileWriter.cxx | UTF-8 | 498 | 2.703125 | 3 | [] | no_license | #include "RawFile/RawFileWriter.h"
RawFileWriter::RawFileWriter(const std::string& fname)
{
m_wfs = raw_ofstream::instance(fname);
}
RawFileWriter::~RawFileWriter()
{
raw_ofstream::release();
}
int RawFileWriter::writeEvent(const uint32_t* pevt)
{
const char* pbuf = reinterpret_cast<const char*>(pevt);
i... | true |
35b511ab2de052c04d4ac1ea11fe398a6207e8b4 | C++ | alansam/CF.STL_Containers_Stack | /CF.STL_Containers_Stack/stacks.cpp | UTF-8 | 9,942 | 2.890625 | 3 | [] | no_license | //
// stacks.cpp
// CF.STL_Containers_Stack
//
// Created by Alan Sampson on 4/10/21.
//
// MARK: - Reference.
// @see: https://en.cppreference.com/w/cpp/container/stack
// #see: https://en.wikipedia.org/wiki/Brainfuck
//
#include <iostream>
#include <iomanip>
#include <string>
#include <string_view>
#include <a... | true |
8b2b212df2cb09cf3400e084a35511c3dd5c57a3 | C++ | kotwys/stx-gimp-plugin | /src/gimp_interop.cpp | UTF-8 | 2,205 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <babl/babl.h>
#include "gimp_interop.h"
#include "stx/structure.h"
stx::Result<gint32> to_gimp(const stx::Image &data) {
using Result = stx::Result<gint32>;
gint32 image_id = gimp_image_new(
data.geometry.width,
data.geometry.height,
GIMP_RGB
);
gint32 layer_id = gimp_layer_new(
ima... | true |
9e3ddf87161c865d8250d8c5a09e14cc0cc1a14c | C++ | amazonsx/archives | /leetcode/minimum_path_sum/cpp/solution.cc | UTF-8 | 1,154 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <limits>
#include <assert.h>
#include <vector>
#define DEBUG
using namespace std;
class Solution {
public:
int minPathSum( vector<vector<int> > &grid);
};
int Solution::minPathSum( vector<vector<int> > &grid) {
assert(grid.size() > 0);
int m = grid.size(),... | true |
6670bcd9a13e6715295c4e0a398406a76b7b56b2 | C++ | hank19960918/Image_Processing | /image_morphology/Source.cpp | UTF-8 | 2,882 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
void readImage(unsigned char *image, string path, int height, int width)
{
const char *s = path.c_str();
FILE *f = fopen(s, "rb");
fread(image, sizeof(unsigned char), height * width, f);
fclose(f);
}
void image... | true |
364f8e458c159d690180022062fc0299d28c06a7 | C++ | limdor/quoniam | /src/viewpoint-measures/KullbackLeibler.h | UTF-8 | 405 | 2.53125 | 3 | [] | no_license | #ifndef KULLBACK_LEIBLER_H
#define KULLBACK_LEIBLER_H
//Project includes
#include "Measure.h"
/// Class that implements the kullback leibler distance [Sbert et al. 2005]
class KullbackLeibler : public Measure
{
public:
explicit KullbackLeibler(const std::string &pName);
/// Method that computes the measure
... | true |
829e83275c84f0fd012b5fea48e1c7a036bf6799 | C++ | bhrgv/MissionRnD-C-Strings-Worksheet | /src/commonWords.cpp | UTF-8 | 1,849 | 3.6875 | 4 | [] | no_license | /*
OVERVIEW: Given two strings, find the words that are common to both the strings.
E.g.: Input: "one two three", "two three five". Output: "two", "three".
INPUTS: Two strings.
OUTPUT: common words in two given strings, return 2D array of strings.
ERROR CASES: Return NULL for invalid inputs.
NOTES: If there are no... | true |
a4addbe91884a7d4917c1c1f3279ad3c8b77ce09 | C++ | bryanedds/ax | /src/cpp/ax/math.cpp | UTF-8 | 5,035 | 2.96875 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include <functional>
#include <cmath>
#include "ax/math.hpp"
namespace ax
{
float ax::saturate(float value, float max)
{
return std::max(0.0f, std::min(max, value));
}
ax::v2 get_ortho(const ax::v3& vector)
{
return ax::v2(vector.x, vector.y);
}
ax::... | true |
3a8796227ccf0154d0acd9f4308276ce535d58b8 | C++ | tectronics/minerstatemachine | /src/game/algorithms/flocking.cpp | UTF-8 | 11,502 | 2.75 | 3 | [] | no_license | #include "flocking.h"
#include "../vehicle.h"
#include "../stages/ingame.h"
#include "../entitymanager.h"
#include <cassert>
using std::string;
using std::vector;
//------------------------- ctor -----------------------------------------
//
//------------------------------------------------------------... | true |
ed65fb36a01f80864513d9210b4de13609ec93d1 | C++ | iamsourav37/DataStructure | /C++/Linear_data_structure/dynamic_stack.cpp | UTF-8 | 2,942 | 4.15625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Stack
{
private:
int top;
int length;
int *stack_array;
void initArray()
{
stack_array = new int[1];
length = 1;
}
void doubleArray()
{
int *temp = new int[length * 2];
if (temp == NULL)
{
... | true |
66b1c8b3ae9980c63fe9b2e9d046b4856ae41686 | C++ | rilex001/College | /Vezbe/for/v5zad1.cpp | UTF-8 | 177 | 2.578125 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int main() {
int n, suma= 0;
scanf("%d", &n);
for(int i = 0; i < n; i++) {
suma += pow(i, 2);
}
printf("Suma %d", suma);
return 0;
}
| true |
e7ae5cf6ec7d2d2e22f114376e51a8fc5a10319d | C++ | hqber/Huffman-Decompression | /main.cpp | GB18030 | 3,047 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include"Extract.h"
using namespace std;
int main()
{
int n;//Чֽ
HuffNode hufftree[512];//511
for (int a = 0; a < 512; a++)
{
hufftree[a].parent = -1;
hufftree[a].ch = NULL;
hufftree[a].count = -... | true |
f5426d456af2bd79b00f6ee52d5ccefe73588a3f | C++ | pawan941394/CPP-Programming | /function/ex13.cpp | UTF-8 | 207 | 2.890625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int sum(int num){
int total =num*(num+1)/2;
cout<<total<<endl;
return total;
}
int main(){
int n;
cin>>n;
sum(n);
return 0;
} | true |
8e709cef4a114b081a1d929bcf578b479aea9c58 | C++ | glebshapa/Algorithms | /pref_func.cpp | UTF-8 | 896 | 3.421875 | 3 | [] | no_license | // Дана строка s[0 \ldots n-1]. Требуется вычислить для неё префикс-функцию, т.е. массив чисел \pi[0 \ldots n-1], где \pi[i] определяется следующим образом: это такая наибольшая длина наибольшего собственного суффикса подстроки s[0 \ldots i], совпадающего с её префиксом (собственный суффикс — значит не совпадающий со в... | true |
40ac4efa0a24d6ff7279e9fa596baecd166464d3 | C++ | Jiaqi07/Usaco-Bronze-Silver-XCamp-Practice-Cpp | /XCamp200/XCamp 200 Midterm/nthnumber.cpp | UTF-8 | 369 | 3.25 | 3 | [] | no_license | /*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main()
{
int n, out;
cin >> n;
int *s;
s = new int[n];
s[0] = 0;
s[1] = 1;
s[2] = 1;
for(int i = 3; i < n; ++i){ //1: M, 2: O, 3: O, 4: D
s[i] = s[i - 3] + 2 * s[i-2] + s[i... | true |
661e2a725286e0751e7e1f50f75d134d10958c48 | C++ | harrylyx/forPat | /leetcode/daily/minimumLengthEncoding.cpp | UTF-8 | 2,769 | 3.71875 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string.h>
#include <vector>
using namespace std;
class Trie
{
private:
bool is_string = false;
Trie *next[26] = {nullptr};
public:
Trie() {}
void insert(const string &word) //插入单词
{
Trie *root = this;
for (const auto &w : word)
... | true |
7baa4562501d8cacc9ab5e9a2bd71372e2be020d | C++ | ariannmichael/PLP-Dirlididi | /PalavrasIngratas/PalavrasIngratas.cpp | UTF-8 | 483 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main() {
int cont = 0;
bool ingrata = true;
string entrada;
while(cont < 3) {
cin >> entrada;
ingrata = true;
for(unsigned int i = 0; i < entrada.length(); i++) {
if(entrada[i] == 'a' || entrada[i] == 'e' || entrada[i] == 'i' || entrada[i] ==... | true |
077b8fd1664dfb8f416a4c54a5608bc4be300424 | C++ | JoanStinson/SpaceInvaders | /Space Invaders/Space Invaders/ModuleAudio.h | UTF-8 | 614 | 2.53125 | 3 | [
"MIT"
] | permissive | #ifndef _MODULEAUDIO_H_
#define _MODULEAUDIO_H_
#include "Module.h"
#include <vector>
struct Mix_Chunk;
typedef struct _Mix_Music Mix_Music;
class ModuleAudio : public Module
{
public:
ModuleAudio(bool start_enabled = true);
~ModuleAudio();
bool Init() override;
bool CleanUp() override;
public:
bool PlayMusi... | true |
ea14283c4bb9b8651ed2adac865d6c334cdb84ea | C++ | SimulationEverywhere-Models/RT-DEVS-CAN-BUS | /data_structures/can_structure.hpp | UTF-8 | 1,502 | 2.78125 | 3 | [] | no_license | #ifndef __CAN_STRUCTURE_HPP__
#define __CAN_STRUCTURE_HPP__
#ifndef RT_ARM_MBED
#include <memory.h>
#include <iostream>
enum CANFormat {
CANStandard = 0,
CANExtended = 1,
CANAny = 2
};
typedef enum CANFormat CANFormat;
enum CANType {
CANData = 0,
CANRemote = 1
};
typedef enum CANType CANType;
st... | true |
809bf0fe30c030e5de7d7e455b2c48aae5e7bc8e | C++ | TenFifteen/SummerCamp | /spw/174-dugeon-game/dungeon_game.cc | UTF-8 | 1,822 | 3.15625 | 3 | [] | no_license | #include <cstdio>
#include <climits>
#include <vector>
using namespace std;
#define min(a, b) ((a) < (b) ? (a) : (b))
/**
* Problem: Find the minimum health the knight should have, then when he pass
* the dugeon, he will always have health point more than one.
* Sovle: see detail in the discuss board.
* ... | true |
c8de4af4ba426e39db16081e551c1fcb5327e6ea | C++ | oguzkaran/Arcelik-Eskisehir-Cpp-Dec-2020 | /src/SampleCpp/Date.hpp | UTF-8 | 681 | 3.203125 | 3 | [] | no_license | #ifndef DATE_HPP_
#define DATE_HPP_
#include <iostream>
class Date {
friend std::ostream& operator <<(std::ostream& os, const Date& r);
friend std::istream& operator >>(std::istream& is, Date& r);
private:
int m_day, m_month, m_year;
int m_dayOfWeek;
public:
Date() {}
Date(int day, int month, int year)
{
//.... | true |
989cae3a60c7badf38567af4b45b1fe7e6fe5a6b | C++ | MLCGEE/carduino | /firmware/firmware.ino | UTF-8 | 2,154 | 2.546875 | 3 | [] | no_license | // CARDUINO v0.0.1
// github.com/bitlabio/carduino
void setup() {
// initialize the serial communication:
Serial.begin(115200);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}
int lastv = 0;
unsigned long count = 0;
unsigned long lasttime = 0;
void loop() {
// sen... | true |
ab296b845c550ac49b005d98bb543e6750d8b753 | C++ | EmersonLucena/algorithms | /algorithms/Hash.cpp | UTF-8 | 1,396 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
#define MAXN 250250
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
struct myhash {
ll chash[MAXN][2];
ll mult[MAXN][2];
ll b1, M1, b2, M2;
myhash(ll b1 = 311, ll M1 = 1000000021, ll b2 = 317, ll M2 = 1000000009) :
b1(b1), M1(M1), b2(b2), M2(M2) { calc();}
voi... | true |
2d061d668de58863960307e330c54ff7ab74ba69 | C++ | mohmahkho/competitive-programming | /src/graph/get_connected_components.cc | UTF-8 | 665 | 2.8125 | 3 | [] | no_license | auto get_connected_components(const vector<vector<int>>& g) {
int n = (int) g.size();
int ncc = 0; // number of connected components
vector<int> cc(n, -1); // cc[u] = connected component id of u
vector<int> id(n); // id[u] = id of u in its cc
vector<int> sz; // sz[t] = size of connected component t
int id... | true |
dcac9cf2e020c1679f49be9c68f83a792d004d00 | C++ | codegrande/syscall_exploit_CVE-2018-8897 | /io.cpp | UTF-8 | 2,114 | 2.53125 | 3 | [] | no_license | /*
* Module Name:
* io.cpp
*
* Abstract:
* Generic file I/O routines.
*
* Authors:
* Nick Peterson <everdox@gmail.com> | http://everdox.net/
* Nemanja (Nemi) Mulasmajic <nm@triplefault.io> | http://triplefault.io/
*
*/
#include "stdafx.h"
#include "io.h"
#include "mm.h"
/*
* Maps a PE file from disk into m... | true |
2bb3eca0a3025eb05ba38daa8b45fe234c9fc0fd | C++ | mpm-msc/snow | /src/core/rendering/GLFWWindow.cpp | UTF-8 | 2,564 | 2.703125 | 3 | [] | no_license | #include "GLFWWindow.hpp"
GLFWWindow::GLFWWindow() {
// GLFW INIT: ORDER IS IMPORTANT
glfwSetErrorCallback(error_callback);
if (!glfwInit()) exit(EXIT_FAILURE);
window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "OpenGL Project", NULL,
NULL);
if (!window) {
glfwTerminate()... | true |
271efcc75e6c2f305868a96e6836933e7a9abc5d | C++ | anik-chy/OnlineJudges | /UVA/11936 The Lazy Lumberjacks.cpp | UTF-8 | 341 | 2.625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
int t;
cin>>t;
while(t--)
{
int x,y,z;
cin >> x >> y >> z;
if(x+y>z && y+z>x && z+x>y)
cout << "OK" << endl;
else
cout << "Wrong!!" << endl;
... | true |
70fac86709c2a2c5079bba319a2f4fe93b389a46 | C++ | lijiaxin-dut/leetcode | /leetcode_train/Solution_6.cpp | GB18030 | 1,224 | 3.34375 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<set>
#include<algorithm>
#include<vector>
using namespace std;
//The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of
//rows like this: (you may want to display this pattern in a fixed font for better legibility)
//
//P A H N
//A P L S I I... | true |
61e14fe3421877344dd516fe823de7a893e2fcb5 | C++ | gcohara/greesy | /src/peripherals/gpio.cpp | UTF-8 | 3,039 | 2.84375 | 3 | [] | no_license | #include "../../inc/peripherals/gpio.hpp"
#include "../../inc/peripherals/rcc.hpp"
#include <cstdint>
GPIO_PORT::GPIO_PORT(GPIOPortLetter const pl):
port_letter{ pl },
letter_number{ static_cast<int>(pl) },
base{ GPIOA_BASE + (0x100 * letter_number)},
port_mode_register{ base },
output_type_registe... | true |
6b857b723708d33b3746161cfd5dc1f8d0f824bc | C++ | antman88/ExamExtraTasks | /ExamExtraTasks/MyVector.h | UTF-8 | 1,011 | 3.5 | 4 | [] | no_license | #pragma once
#include <iostream>
using namespace std;
//
class IteratorMyList
{
public:
virtual bool hasNext() = 0;
virtual int current() = 0;
virtual int begin() = 0;
virtual int end() = 0;
virtual void reset() = 0;
};
//
class MyVector : public IteratorMyList
{
private:
int size;
int *pArr;
int currIndex... | true |
57eeda78f332eca885071dad95991b4d9fb9fc0b | C++ | mamunhpath/leet-code | /merge-k-sorted-lists-16.cpp | UTF-8 | 1,049 | 3.234375 | 3 | [] | no_license | // https://leetcode.com/problems/merge-k-sorted-lists/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
typedef ListNode LN;
ListNode* mergeKLists(vector<ListNode*>& lists) {
... | true |
cbb114ea68e443cc7262fd86da804b297351f409 | C++ | myCigar/Cpp-Primer | /ch03/ex3_40.cpp | UTF-8 | 322 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
int main()
{
const char cstr1[] = {'h', 'e', 'l', 'l', 'o', '\0'};
const char cstr2[] = {'w', 'o', 'r', 'l', 'd', '!', '\0'};
char cstr3[20] = { };
strcat(cstr3, cstr1);
strcat(cstr3, " ");
strcat(cstr3, cstr2);
cout << cstr3 << endl;
return 0;
}... | true |
706b4a55b63ee1ebc5333855055a711919216f9d | C++ | alexyena/Cpp_term_application_tetris | /CppTermApplicationTetris/CppTermApplicationTetris/Board.h | UTF-8 | 506 | 2.640625 | 3 | [] | no_license | #pragma once
#include <bitset>
#include <iostream>
#define B_WIDTH 10
#define B_DEPTH 20
class Board
{
std::bitset<B_WIDTH> board[B_DEPTH];
public:
Board();
void setBoardPieceByCoordinate(int i, int j, bool value);
bool getBoardPieceByCoordinate(int i, int j);
bool isLineFull(int row_id);
boo... | true |
5f0ff18483bbf9929109e6d69c88fb087b2b533a | C++ | spadapet/ffcore | /util/Types/FixedInt.h | UTF-8 | 7,528 | 3.28125 | 3 | [] | no_license | #pragma once
namespace ff
{
// 24 bits of whole number and 8 bits of fraction
class FixedInt
{
public:
inline FixedInt() = default;
inline FixedInt(const FixedInt& rhs) = default;
inline FixedInt(int data);
inline FixedInt(float data);
inline FixedInt(double data);
inline FixedInt(bool data);
inline ... | true |
e153362150657331201c7d5466527b418f330e6e | C++ | dhk1349/C_plusplus-Programing-study | /Kaprekars_Constant.cpp | UHC | 2,107 | 3.625 | 4 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
/*
*/
int kap(int n);
int lower(int n);
int higher(int n);
void main() {
while (true) {
int n;
cout << "Type any 4digit number: ";
cin >> n;
if (n==0) {
break;
}
cout << "Untill above number reaches Kaprekars Constant, " <<... | true |
65be504b7f8e5544302e05c0133609f422232338 | C++ | alexandretannus/aula-ed1-2021-2 | /aula02-alocacao-dinamica/07-malloc_calloc.cpp | UTF-8 | 496 | 3.25 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int main() {
char *p, *pc;
int np = 5;
p = (char *) malloc(np * sizeof(char));
pc = (char *) calloc(np, sizeof(char));
printf("\n --- Malloc \n\n");
for (int i=0; i<np; i++) {
printf("endereco p[%d] = %d\n", i, &p[i]);
printf("valor p[%d] = %c\n\n", i, p[i]);
... | true |