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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3c3f1f60fb6313e14637f9752b8080efd83a5f5d | C++ | xGreat/CppNotes | /src/algorithms/data_structures/hashmap/unique_number_of_occurrence.hpp | UTF-8 | 1,585 | 3.484375 | 3 | [
"MIT"
] | permissive | #ifndef UNIQUE_NUMBER_OF_OCCURRENCE_HPP
#define UNIQUE_NUMBER_OF_OCCURRENCE_HPP
/*
https://leetcode.com/problems/unique-number-of-occurrences/
Given an array of integers arr, write a function that returns true if and only if the number of
occurrences of each value in the array is unique.
Example 1:
Input: arr = [1,2,... | true |
dcf1b50d7c7a42eca08ae575baa490c92cbf189f | C++ | sheilsarda/SoC_Programming | /vitis_tutorials/bloom/fpga/hls_stream_utils.h | UTF-8 | 1,327 | 2.734375 | 3 | [
"MIT"
] | permissive | #pragma once
#include<ap_int.h>
#include<hls_stream.h>
namespace hls_stream {
template<typename T>
void buffer(hls::stream<T> &stream_o, T* axi_i, unsigned int nvals) {
axiToStreamLoop: for (int i = 0; i < nvals; i++) {
stream_o.write(axi_i[i]);
}
}
template<typename T>
void buffer(T* axi_o, hls::stream<T> &stre... | true |
9023921512edfd489c85a00a847d5f31eca87ec4 | C++ | Predelnik/Toolbox | /src/macros/remap_rvalues_for.h | UTF-8 | 771 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <utility>
// useful for chaining functions. Just write original chaining function ref
// qualified Then write REMAP_RVALUES_FOR (function name) it will add
// appropriate overload for ref-ref-qualified case. Preserving reference
// category of return type.
#define REMAP_RVALUES_FOR(MEMBER_FUNC_N... | true |
b641a79dd2f14127e6d9a0e09154c53baa8f39e5 | C++ | mylvoh0714/BOJ | /10942.cpp | WINDOWS-1252 | 831 | 3.109375 | 3 | [] | no_license | //BOJ 10942 Ӹ?
#include <iostream>
#include <vector>
using namespace std;
int dp[2001][2001]; // dp[start][end] = Check if arr[start]~arr[end] is palindrome, return 1 else 0
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> arr(n + 1);
for ( int i = 1; i <= n; i++ )
{
... | true |
2403863157d33d54f638d2e12ceeda12eb1da1fc | C++ | MrScriptX/Vulkan-Tile-Engine | /VulkanInstance.cpp | UTF-8 | 2,876 | 2.546875 | 3 | [] | no_license | #include "VulkanInstance.h"
VulkanInstance::VulkanInstance(std::shared_ptr<extensions> extensionsObj, std::shared_ptr<settings> settingsObj, std::shared_ptr<graphic> graphicObj)
{
m_pExtensions = extensionsObj;
m_pSettings = settingsObj;
m_pGraphic = graphicObj;
VkApplicationInfo app_info = getApplicationInfo()... | true |
d0eb4627990e103a27fcbf8818bb7c27103a1b66 | C++ | HashMac/aadc2016 | /aadcUser/include/adtf2OpenCV.h | UTF-8 | 3,798 | 2.859375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <adtf_platform_inc.h>
#include <adtf_plugin_sdk.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
// Convert an ADTF cImage to an OpenCV Mat.
cv::Mat cImageToCV(const cImage& c)
{
const tInt16 format = c.GetFormat()->nPixelFormat;
/*std::cout... | true |
1b79121b4c75b6c11bd188c80e7f4d47c98cd8ac | C++ | stanleychen86/Hanoi | /Hanoi/workingSFML/player.h | UTF-8 | 339 | 2.703125 | 3 | [] | no_license | #ifndef PLAYER_H
#define PLAYER_H
#include "entity.h"
class Player : public Entity
{
private:
int pointer_index;
sf::RenderWindow& win;
GameEntities& ge;
void drawPointer(bool draw = true);
public:
Player(const std::vector<int>& p_order, sf::RenderWindow& p_win, GameEntities& ge);
int select();
void tak... | true |
c3fe73fb652131043d6838d04983cec81e31b96b | C++ | wowoto9772/Hungry-Algorithm | /BOJ/9465/solution.cpp | UTF-8 | 885 | 2.5625 | 3 | [] | no_license | #include <stdio.h>
#include <memory.h>
int n;
int I[2][100003];
int dp[2][100003];
int M(int a, int b){ return a < b ? b : a; }
int dy(int i, int j){
if (dp[i][j] != -1)return dp[i][j];
dp[i][j] = 0;
if (j < n){
if (i)dp[i][j] = I[i][j] + dy(0, j + 1);
else
dp[i][j] = I[i][j] + dy(1, j + 1);
}
for (in... | true |
d08611159b118f23753f1698ac605a8c74920cf0 | C++ | sagrudd/amos | /src/Align/simple-overlap.cc | UTF-8 | 12,920 | 2.609375 | 3 | [
"Artistic-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // A. L. Delcher
//
// File: simple-overlap.cc
//
// Last Modified: Thu May 27 08:24:56 EDT 2004
//
// Compute overlaps among an input set of sequences by
// direct all-pairs alignment.
#include "simple-overlap.hh"
static string Bank_Name;
// Name of read bank from which reads are obtained
static double ... | true |
6c3848d5b7051a126af06ded87ef6e4016e61c14 | C++ | TsurumiMasayuki/MyDirectXLib | /MyDirectXLib/Project1/Source/Math/RectF.cpp | UTF-8 | 188 | 2.515625 | 3 | [] | no_license | #include "RectF.h"
RectF::RectF()
: RectF(0, 0, 0, 0)
{
}
RectF::RectF(float x, float y, float width, float height)
: x(x), y(y), width(width), height(height)
{
}
RectF::~RectF()
{
}
| true |
9254db48c6231dae061c71cbc9fdace504d84ba9 | C++ | geneotech/Singularity | /misc/randval.h | UTF-8 | 681 | 2.578125 | 3 | [] | no_license | #pragma once
#include <random>
#include <utility>
extern int randval(int min, int max);
extern unsigned randval(unsigned min, unsigned max);
extern float randval(float min, float max);
extern float randval(float minmax);
extern unsigned randval(std::pair<unsigned, unsigned>);
extern float randval(std::pai... | true |
e08772f07a3c9c8c67ffa934ff20ab7d1c94208e | C++ | chufucun/rocana-impala-udfs | /median-test.cc | UTF-8 | 3,335 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2015 Rocana, Inc.
//
// 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 agreed to in wri... | true |
cb0de8b266b63684fa7a83418391669f18f15421 | C++ | slowriot/libtelegram | /include/libtelegram/types/video.h | UTF-8 | 2,145 | 2.90625 | 3 | [
"MIT"
] | permissive | #ifndef TELEGRAM_TYPES_VIDEO_H_INCLUDED
#define TELEGRAM_TYPES_VIDEO_H_INCLUDED
#include "libtelegram/config.h"
#include "helpers/optional.h"
namespace telegram::types {
struct video {
/// See https://core.telegram.org/bots/api#video
std::string file_id; ... | true |
5f3651269ae5e219661ecf7a8319147f1137887d | C++ | Parkyunhwan/CodePlus_Basic | /Exemplary_solution/Seven_Dwarfs.cpp | UTF-8 | 782 | 2.90625 | 3 | [] | no_license | //9개 중 7명의 키를 합했을 때 100 이 되는 경우를 찾는 문제
//9C2 이므로 36가지 경우가 발생 2중 포문을 통한 완전 탐색을 실시 한다.
#include <iostream>
#include <algorithm>
using namespace std;
int arr[10];
int n,result = 0;
#define MAX 987654321;
bool check = false;
int main()
{
for(int i = 1; i < 9; i++)
{
cin >> arr[i];
result += arr[i... | true |
84f34aefb9e509c38b15740534a3a88276471b21 | C++ | ChauDinh/cpp_dummies | /Preprosessor.cpp | UTF-8 | 195 | 2.6875 | 3 | [] | no_license | #include <iostream>
#define TOREPLACE REPLACEWITH
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
int main() {
rep(i, 0, 5) {
cout << i << endl;
};
return 0;
}
| true |
474467e2c9fed46ad396a8ea3f3a3a0a9ebd7b48 | C++ | kalimfaria/Conference-Manager | /Dijkstra.h | UTF-8 | 12,268 | 3.5 | 4 | [] | no_license | # ifndef DIJKSTRA_H
# define DIJKSTRA_H
#include <limits.h>
#include <iostream>
#include <vector>
# include <string>
using namespace std;
void printPath (vector<int>a , vector <int> b, vector<int> c, int );
struct AdjListNode // node in an adj list
{
int dest; // destination
double weight; //... | true |
52dffc0605d9e62d5dc99dff6bc85b6cb9ee8580 | C++ | szaialt/CppGeometry | /bolyongas2/main.cc | UTF-8 | 7,474 | 2.75 | 3 | [] | no_license | #include <SDL.h>
#include <SDL_gfxPrimitives.h>
#include <SDL_keyboard.h>
#include <SDL_events.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include "wander.h"
using namespace std;
int min(int a, int b){
if (a < b) return a;
... | true |
bbedffb48b06a431f8079e29e5a472b99358cb65 | C++ | hexen2k/cppio | /CPP2/CPP2/zadanie8.cpp | UTF-8 | 761 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "zadanie8.h"
using namespace std;
void zadanie8(void) {
char inbuff[1000];
char inchar;
char * wynik = NULL;
cout << "Podaj ciag znakowy do przeszukania: " << endl;
cin >> inbuff;
cout << "Podaj wyszukiwany znak: " << endl;
cin >> inchar;
wynik = znajdz(inbuff,... | true |
b88c72c2df2ba7e0e62d4efb007ee715f9e606f6 | C++ | SapphireSuite/Sapphire | /Engine/Include/Sapphire/Core/Debug/Log.hpp | UTF-8 | 2,306 | 2.84375 | 3 | [
"MIT"
] | permissive | // Copyright 2020 Sapphire development team. All Rights Reserved.
#pragma once
#ifndef SAPPHIRE_CORE_LOG_GUARD
#define SAPPHIRE_CORE_LOG_GUARD
#include <ostream>
#include <Core/Time/DateTime.hpp>
#include <Core/Debug/LogLevel.hpp>
#include <Core/Debug/LogChannel.hpp>
namespace Sa
{
/**
* \file Log.hpp
*
* \br... | true |
f77ebf5822e281d7e591500dc442d481a67cdabe | C++ | sasaki-seiji/ProgrammingLanguageCPP4th | /part3/ch19/19-4-list/src/List.h | UTF-8 | 476 | 2.9375 | 3 | [] | no_license | /*
* List.h
*
* Created on: 2016/08/19
* Author: sasaki
*/
#ifndef LIST_H_
#define LIST_H_
class List;
class List_iterator {
List* cur;
public:
List_iterator(List* p) : cur{p} { }
void reset(List* p) { cur = p; }
int *next();
};
class List {
int value;
List* next;
public:
List(int v) : value{v}, ... | true |
5a1220a9d90c56e94a8ad8193df3f859d74df2a7 | C++ | demarrem29/MOBA | /Source/MOBA/EquipmentComponent.cpp | UTF-8 | 25,312 | 2.5625 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#include "EquipmentComponent.h"
#include "MOBACharacter.h"
#include "MOBAAttributeSet.h"
#include "AbilitySystemComponent.h"
void UItem::SetCurrentStacks(int32 NewStackCount)
{
// Destroy item if new stack count is 0
if (NewStackCount =... | true |
8baccf87a0f547a4b824d2ac291bd1eb51dc958e | C++ | SurroKun/Algo | /2 - Order Statistic Tree/Order Statistic Tree/commandline.h | UTF-8 | 1,345 | 2.71875 | 3 | [] | no_license | #pragma once
#include "store.h"
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
class CommandLine {
public:
void run() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
string fileName;
SetConsoleTextAttribute(hConsole, 14);
cout << "Give me the name of the file with data... | true |
0d1ebe4e94e7e443346638795375f72494918d25 | C++ | CubeDr/Bakejoon | /CLion/P2413.cpp | UTF-8 | 612 | 2.703125 | 3 | [] | no_license | #include <cstdio>
int n;
int ns[50000]; // 현재 상태
int pos[50001]; // 원본의 위치
int main() {
scanf("%d", &n);
for(int i=0; i<n; i++) {
scanf("%d", &ns[i]);
pos[ns[i]] = i;
}
for(int i=0; i<n; i++) {
// 한번 바뀐 숫자면 더 바꾸지 않음
if(pos[ns[i]] != i) continue;
if(ns[i] == 1) ... | true |
1fa03c40e83aad8600118288e9dcfdbb1e7beb81 | C++ | prajapati-sachin/COP290-Assignment1 | /cop/Common_functions.cpp | UTF-8 | 1,153 | 3.109375 | 3 | [] | no_license | #include "Common_functions.h"
using namespace std;
//void print_Vertex2d(Vertex2d v){
// cout << "{" << v.x << "," << v.y << "}" <<"\n";
//}
//void print_Vertex2d_List(Vertex2d_List v_list){
// cout << "Vertices : ";
// for(int i=0;i<v_list.V.size();i++){
// print_Vertex2d(v_list.V[i]);
// }
//}
//void print_Ver... | true |
8d77a933cd4dea9b40fe0eeb69033f2f7607fbf6 | C++ | dmtan90/QualityAssessor3 | /example/CVStatisticsWindow.h | UTF-8 | 28,851 | 2.609375 | 3 | [] | no_license | #pragma once
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
class CVStatisticsWindow {
public:
explicit CVStatisticsWindow( int max = 100, float font_scale = 0.5 ) : m_max( max ), m_font_scale( font_scale ),m_color(0,0,0) {
... | true |
15853ebebc4249fcf41de3486ce9d3f758a8b10e | C++ | idahoenigmann/eprog | /serie08/university/University.cpp | UTF-8 | 634 | 3 | 3 | [] | no_license | //
// Created by ida on 02.12.20.
//
#include "University.h"
std::string University::getName() {
return name;
}
std::string University::getCity() {
return city;
}
unsigned int University::getNumStudents() {
return num_students;
}
void University::setName(std::string new_name) {
name = new_name;
}
... | true |
3c5d94c3eaaf46ba7b5cf7705c15c5c81f9db30a | C++ | sagarsingla14/Codechef | /650LC.cpp | UTF-8 | 1,442 | 2.71875 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll checkprime(ll n) {
if(n == 2 || n ==3) {
return 1;
}
ll flag = 1;
for(ll i = 2 ; i <= sqrt(n) ; i++) {
if((n % i) == 0) {
flag = 0;
break;
}
}
if(flag) {
return 1;
... | true |
ae158a31c8621aaa9da84398609f7918515b328a | C++ | uzbit/allegprogs | /evector/evector.h | UTF-8 | 1,232 | 3.34375 | 3 | [] | no_license | #include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#ifndef _VECTOR_H
#define _VECTOR_H
template<class itype>
class evector
{
public:
evector();
evector(int size);
~evector();
int size(){return mysize;}
itype& operator[](int index);
void resize(int newsize);
protecte... | true |
d35dd353a41e054a110d74399e7651639cf71c6d | C++ | polinasand/Sockets-Alarm | /SocketClient/main.cpp | UTF-8 | 3,488 | 2.828125 | 3 | [] | no_license | #include <winsock2.h>
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;
void print();
int printInterval();
int printAlarm();
void process(int, int, int, int);
int alarmCount = 0;
int main()
{
print();
return 0;
}
void print()
{
cout<<"Set time interval and 3 alarms\n";
for (... | true |
63111533c00067f1fbaa3fb14b274a03e5914b88 | C++ | LoveWX/OJ_mycoder | /hdu/2387.cpp | UTF-8 | 1,137 | 2.71875 | 3 | [] | no_license | #include<iostream>
using namespace std;
struct price
{
long shops[5];
};
struct shop
{
long prices[5];
};
price p[5];
shop s[5];
int pn,sn,m;
int cmp1(const void *a,const void *b)
{
return ((price*)a)->shops[m]-((price*)b)->shops[m];
}
int cmp2(const void *aa,const void *bb)
{
int i;
shop *a=(shop*)aa;
shop *b... | true |
4d029a008b3c4dbb54d6ae6e86dfe3fb784eaea0 | C++ | avpdiver/ETEngine | /Engine/source/EtMath/Vector.h | UTF-8 | 8,599 | 3.078125 | 3 | [
"MIT"
] | permissive | #pragma once
#pragma warning(disable : 4201) //nameless struct union - used in math library
#include "MathUtil.h"
#include <initializer_list>
#include <array>
namespace et {
namespace math {
enum ctor { uninitialized };
//Generic vector
//**************
// n = dimensions
// T = data type
// In 3D cartesian coo... | true |
81f7aa0095cebc82aa97b3e4d4752cba5ee832ca | C++ | dfs-minded/solving_algos | /Practicing/CyclesViaEdges.h | UTF-8 | 2,005 | 3.109375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <tuple>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
vector<vector<int>> Read(int& edges_num) {
ifstream input;
input.open("input.txt");
vector<vector<int>> graph;
if (input.is_open()) {
... | true |
5d478f062f7f9a9222804cd1f0e4e78eb0914bac | C++ | Frangalante24/AURORA-3.0 | /MAIN/SENSORES/MPU.ino | UTF-8 | 625 | 2.578125 | 3 | [] | no_license |
// Biblioteca para a comunicacao I2C
#include<Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
float AcX,AcY,AcZ;
void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.setClock(400000);
mpu.initialize();
mpu.setFullScaleAccelRange(3);
mpu.setXAccelOffset(769);
mpu.setYAccelOffset(1115);
mpu.s... | true |
23ef0b8c49080121c712e481ac033f744a526ef7 | C++ | saturnerianis/satsolver | /HannahSatSolver/more2sat.cpp | UTF-8 | 9,234 | 3.4375 | 3 | [] | no_license | /*
* Hannah Christenson
*
* Functions to solve 2sat in linear time
*
*/
#include <stack>
#include <list>
#include <unordered_map>
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
typedef unordered_map<int, list<int> > graph;
typedef vector<vector<int> > bool_formula;
typedef unorder... | true |
34b745739e4137bd0db742811589edecce5b1463 | C++ | bshah016/CS_Projects | /Put_Vector_in_Order.cpp | UTF-8 | 1,324 | 3.953125 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
void SortVector(vector<int>& myVec) {
for (unsigned int i = 0; i < myVec.size(); ++i) {
for (unsigned int j = i + 1; j < myVec.size(); ++j) {
if (myVec.at(i) != 0) {
if (myVec.at(i) > myVec.at(j)) {
s... | true |
c39dfd602359fc4ff332c6a5b64faec4351829e8 | C++ | Ionsto/CBR-CS-A | /Wolf hunt/Wolf hunt/EntityPlayer.cpp | UTF-8 | 1,666 | 2.84375 | 3 | [] | no_license | #include "EntityPlayer.h"
#include "World.h"
#include <math.h>
#include <iostream>
EntityPlayer::EntityPlayer(World * world,Vector pos) : EntityLiving(world,pos)
{
MousePosition = Vector(0, 0);
this->MaxForce = 25;
this->WalkForce = 10;
this->CurrentMaxForce = MaxForce * (Health / 100);
this->CurrentWalkForce = ... | true |
0215b88217b6467f3cd8c00ba46b488048f4a595 | C++ | yururyuru00/programing | /programing/Compirer_training/R4/r4_4.cpp | UTF-8 | 1,764 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <assert.h>
class stack {
protected:
int sp;
int max;
int* data;
public:
stack() {stack(10);}
stack(int sz) {sp=0; max=sz; data=new int[max];}
~stack() {delete [] data;}
void push(int d) {assert(sp<=max); data[sp++]=d;}
void pop() {assert(0<sp)... | true |
2c9b1d46a10c43a4dbddecaee83eedf3df5cd874 | C++ | WhiZTiM/coliru | /Archive2/39/1783603a7223b1/main.cpp | UTF-8 | 5,694 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <typeinfo>
#include <memory>
struct person
{
// struct visitor { virtual ~visitor() = default ; } ;
virtual ~person() = default ;
virtual std::string name() const = 0 ;
virtual int age() const = 0 ;
virtual std::shared_ptr<person> best_fri... | true |
5553d60433a0b83fcf5eceb90cbcecf90f96be3e | C++ | alexander-budanov/image_segmentation | /adjacency_operator.cpp | UTF-8 | 3,463 | 2.84375 | 3 | [] | no_license | #include <vector>
#include "adjacency_operator.h"
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
class AdjacencyOperator::GradientThresholdImpl
{
int threshold;
std::vector<cv::Mat> channels;
cv::Mat gradX, gradY, gradNorm;
public:
GradientThresholdImpl( int threshold ) : threshol... | true |
4339526acc153f01b039d1584fde45869d7684d7 | C++ | wonny-Jo/algorithm | /알고리즘 문제 풀이/BOJ/단계별 기초 연습/큐, 덱/1021_회전하는 큐/1021.cpp | UTF-8 | 821 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<deque>
using namespace std;
deque<int> dq;
void MoveRight(int pos)
{
for (int i = 0; i < pos; ++i)
{
dq.push_back(dq.front());
dq.pop_front();
}
}
void MoveLeft(int pos)
{
for (int i = 0; i < pos; ++i)
{
dq.push_front(dq.back());
dq.pop_back();
}
}
int... | true |
b894c8bf70b31eed793523c77026ca8be9444467 | C++ | KjeldSchmidt/buzzer_games | /arduino/src/main.cpp | UTF-8 | 2,603 | 2.953125 | 3 | [] | no_license | #include <Arduino.h>
#include <HardwareSerial.h>
const int buzzer1_in = 12;
const int buzzer1_out = 2;
const int buzzer2_in = 11;
const int buzzer2_out = 3;
bool pressed = false;
uint8_t current_player;
enum class State {
IDLE,
WEBCAM_GAME,
LIGHT_UP,
FREEPLAY_WAIT_BUZZER,
};
State state = State::IDLE;
void set... | true |
05dff772473b3b1d379b23b0c290b0ee348bf7d8 | C++ | mohitkumarraj/cpp-programs | /Dynamic Programming/MCQS.cpp | UTF-8 | 208 | 2.734375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int m=10; //it cannot be constant value
int &n=m; //reference to other variable .. refer to single address
//n=6;
cout<<m<<n;
return 0;
}
| true |
7015e1e63a0993d5a8acb4afd26e46601457b114 | C++ | alindsharmasimply/CompetitivePractice2 | /Fifth.cpp | UTF-8 | 521 | 2.734375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, d, y;
cin >> n;
int s1 = 0, s2 = 0;
int x = n / 1000;
while (x != 0) {
d = x % 10;
s1 += d;
x = x/10;
}
while (s1 != s2) {
... | true |
9d8e63150f89fff87e4de26bb91f9d3f8bd76f5b | C++ | rafasu4/Ex4--pandemic--CPP | /sources/Player.cpp | UTF-8 | 7,135 | 3.09375 | 3 | [] | no_license |
#include "Player.hpp"
#include <iostream>
using namespace std;
namespace pandemic {
bool Player::removeCards(size_t indexStart, size_t indexEnd, int n) {
int counter = 0;
//going over the given indexes
for (size_t i = indexStart; i < indexEnd; i++) {
if (cityCards.at(i)) {
... | true |
f50e3e7b85668c428a05fe139edce8092cded4a5 | C++ | Mr-Phoebe/ACM-ICPC | /OJ/Leetcode/Algorithm/137. Single Number II.cpp | UTF-8 | 340 | 2.796875 | 3 | [] | no_license | class Solution {
public:
int singleNumber(vector<int>& nums) {
int ans = 0;
for(int i = 0; i < 32; i++)
{
int cnt = 0;
for(auto num : nums)
if((num>>i)&1)
cnt++;
if(cnt%3)
ans |= 1<<i;
}
r... | true |
b031d4f35aeb8d8a556ac1b0b691c0ad9f739312 | C++ | yuukidach/OnlineJudge | /LeetCode/dfs/Q131_PalindromePartitioning.cpp | UTF-8 | 974 | 3.203125 | 3 | [] | no_license | class Solution {
public:
bool checkPalindrome(string &s, int l, int r) {
for (int i = l; i < (l+r) / 2; ++i) {
if (s[i] != s[r+l-i-1]) return false;
}
return true;
}
vector<vector<string>> getList(string &s, int l, int r) {
vector<vector<string>> mat;
if ... | true |
ac16773c5df6e1ba6d5684f865d8623d5835089a | C++ | ravibitsgoa/Implementations_of_various_algorithms_and_data_structures | /dp/card_game.cpp | UTF-8 | 1,079 | 3.59375 | 4 | [] | no_license | //https://www.geeksforgeeks.org/dynamic-programming-set-31-optimal-strategy-for-a-game/
//story: you and another person are playing a game to take a card from either end
//of a card pile. Usual game rules apply. Try to maximize your sum of cards.
#include <iostream>
using namespace std;
int maxSum(int array[], int n,... | true |
0f7950bbb107a5b66376421466ff90c36f9aa69b | C++ | ravi-ojha/competitive-sport | /codeforces/822a.cpp | UTF-8 | 805 | 2.9375 | 3 | [] | no_license | #include <bits/stdc++.h>
// Some constants that are frequently used
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
// Something to print to console and debug
#define DEBUG false
#define CONSOLE(x) if(DEBUG) {cout << '>' << #x << ':' << x << endl;}
using namespace std;
long long... | true |
7751e898a78d89bbf3ed5abd3eb41dcc2df696be | C++ | AbhishekPanta8/Albanero_hack_week | /1stday/two.cpp | UTF-8 | 496 | 3.140625 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int max(int a,int b){
if(a>b){
return a;
}
else
return b;
}
int maxdepth(string st){
string:: iterator it;
int curr=0;
int mdepth=0;
for(it = st.begin();it!=st.end();it++){
if(*it == '('){
curr++;
mdepth = max(mdepth,... | true |
3aa2b7ec101e64330dcdf993ff7d1d01c446536e | C++ | mohitsingla123/Computer-Graphics | /2d_transform.cpp | UTF-8 | 4,023 | 2.890625 | 3 | [] | no_license | #include<GL/glut.h>
#include<iostream>
using namespace std;
void init(void)
{
glClearColor(1,1,1,1);
glMatrixMode(GL_PROJECTION);
glClear(GL_COLOR_BUFFER_BIT);
gluOrtho2D(-200,200,-200,200);
glFlush();
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
cout<<"Press t to translate"<<"\n"<<"Press r to rotate"<<... | true |
bf9372d4288b3d0ef167dda38c7ff4ccc8111ee1 | C++ | wcsjdzz/duduo | /duduo/net/Reactor/EventLoopThread.h | UTF-8 | 872 | 2.984375 | 3 | [] | no_license | #ifndef EVENTLOOPTHREAD_H
#define EVENTLOOPTHREAD_H
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
class EventLoop;
class EventLoopThread
{
using ThreadInitCallback = std::function<void(EventLoop *)>;
private:
const std::string name_;
ThreadInitCallback initCallback_; //... | true |
2b83c30f57bf3cf1942bdf998c03f889d605c04f | C++ | CalebWalls/FinalExamCalculator | /FinalCalculator/FinalCalculator/Source.cpp | UTF-8 | 5,334 | 3.90625 | 4 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
/*This function will determine the average of a arbitrary number of grades*/
void averageGrade(int numtest) {
float testval;
//set max rediculously high
float arr[1000];
float result = 0.0;
//loop to have th euser enter the test values
for (int i = 0... | true |
207de77e1379eca9fbb038b18bcb591587375fdc | C++ | Yann4/Final-Year-Project | /Octree.h | UTF-8 | 6,771 | 3.078125 | 3 | [] | no_license | #pragma once
#include <array>
#include <vector>
#include <DirectXMath.h>
struct AABB
{
DirectX::XMFLOAT3 centre;
DirectX::XMFLOAT3 hSize;
AABB() :centre(DirectX::XMFLOAT3(0, 0, 0)), hSize(DirectX::XMFLOAT3(0, 0, 0))
{}
AABB(DirectX::XMFLOAT3 centre, DirectX::XMFLOAT3 hSize) :centre(centre), hSize... | true |
f6f884c8aa90552feed5e0c4528022b6383f5c4c | C++ | yular/CC--InterviewProblem | /LeetCode/leetcode_find-two-non-overlapping-sub-arrays-each-with-target-sum.cpp | UTF-8 | 1,056 | 3.171875 | 3 | [] | no_license | /*
*
* Tag: Sliding Window + Hash
* Time: O(n)
* Space: O(n)
*/
class Solution {
public:
int minSumOfLengths(vector<int>& arr, int target) {
if(arr.size() < 2) {
return -1;
}
unordered_map<int,int> sumDic;
sumDic[0] = -1;
int ans = INT_MAX;
... | true |
c5c15bb5c82f8b1b02793c6f06e85faa0ca81496 | C++ | Simon-Fuhaoyuan/LeetCode-100DAY-Challenge | /addBinary/main.cpp | UTF-8 | 1,644 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
string addBinary(string a, string b)
{
string ans;
int pos_a = a.length() - 1;
int pos_b = b.length() - 1;
bool curr_a, curr_b;
bool carry = false;
while (pos_a >= 0 || pos_b >=... | true |
2c19c44841519c39deb211cb635d3fd59a8f1702 | C++ | rohit0000/Sorting | /Sorting/PROJECT/Untitled1.cpp | UTF-8 | 19,886 | 2.984375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct user{
char name[129];
char password[129];
int id;
int money;
};
struct admin{
char name[129];
char password[129];
int id;
};
struct smartphone{
char name[129];
char brand[129];
int price;
char description[200];
};
void user_editor(struct use... | true |
f9da09d5d5abf8482240b4c71328343ecf35de93 | C++ | darkeclipz/cpp-virtual-machine | /cpp-assembler/LexicalAnalyzer.cpp | UTF-8 | 4,834 | 2.828125 | 3 | [] | no_license | #include "LexicalAnalyzer.h"
#include "sstream";
#include "../cpp-utils/utils.cpp"
LexicalAnalyzer::LexicalAnalyzer(SourceFile& source) {
this->vm = new VirtualMachine(1);
this->source = &source;
init_mnemonic_table();
init_symbol_table();
init_function_table();
init_register_table();
}
LexicalAnalyzer::~Lexica... | true |
d73187971e057bf62d5f45be17290d5cc2f40f8e | C++ | manjurrashed/coding-solution | /c_plus_plus/Algorithm_expert/Easy/Easy_RunLength_Encoding.cpp | UTF-8 | 709 | 2.921875 | 3 | [] | no_license | using namespace std;
string runLengthEncoding(string str) {
// Write your code here.
#if 0
int slow = 0;
int fast = 0;
int cnt = 0;
string result = "";
for (; fast < str.length(); fast++) {
if (str[slow] == str[fast] && cnt < 9) {
cnt++;
} else {
result += std::to_string(cnt) + str[slow];
slow = f... | true |
2dc5ed7a78e0646983ee9b04c3721ebe44c0c033 | C++ | mardelgabo/Ejercicios-sin-arreglos | /Ejercicio 17.cpp | UTF-8 | 794 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
main() {
int e,c;
float b,potencia=1;
printf("Ingrese un valor entero para el exponente \n");
scanf("%d",&e);
printf("Ingrese un valor real para la base \n");
scanf("%f",&b);
if (e==0) {
printf("La potencia de %f elevado a %d es 1 \n",b,e);
getche();
... | true |
3ce99d46428fd5e18dc944b041c627ac2654c218 | C++ | biqar/interviewbit | /Hashing/Hash search/2 Sum/two_sum.cpp | UTF-8 | 1,363 | 3.5 | 4 | [
"MIT"
] | permissive | //
// Created by Islam, Abdullah Al Raqibul on 5/29/20.
//
// update the index_1 and index_2 according to the folllowing rule:
// - If multiple solutions exist, output the one where index2 is minimum.
void update_interval(int &cur_1, int &cur_2, int new_1, int new_2) {
if(new_2 < cur_2) {
cur_1 = new_1;
... | true |
b49bd91a17299f08ff3da0859a1e3aecfd9219ac | C++ | aaryan6789/cppSpace | /Matrix/rotate_matrix.cpp | UTF-8 | 1,968 | 3.9375 | 4 | [] | no_license | #include "_matrix.h"
/**
* CTCI
* Rotate Matrix:
* Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes,
* Write a method to rotate the image by 90 degrees. Can you do this in place?
*
* Examples :
Input
1 2 3
4 5 6
7 8 9
Output:
3 6 9
2 5 8
1 4 ... | true |
5211b7a9ed46c23c2a25cd9e92843fd7bc9645c9 | C++ | imalerich/imDX11 | /imDX11/Model.h | UTF-8 | 510 | 2.640625 | 3 | [] | no_license | #pragma once
#include <stdlib.h>
#include <memory>
#include <vector>
#include "Material.hpp"
#include "d3dutil.h"
#include "Mesh.h"
class Model {
public:
Model();
Model(const char * Filename);
/**
* Release all buffers stored by this model.
*/
void Release();
/**
* Loops through each mesh in the model, ... | true |
4fece38ba0d203fd4ec894d3cc93bff5e50a2b09 | C++ | feverzsj/jkl | /include/jkl/util/concepts.hpp | UTF-8 | 4,117 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <jkl/config.hpp>
#include <jkl/util/type_traits.hpp>
#include <jkl/util/std_concepts.hpp>
#include <memory>
#include <tuple>
#include <climits>
namespace jkl{
// In Most Cases:
// for type traits, apply std::remove_cv_t on the tested type;
// for concepts, apply std::remove_cvref_t on the... | true |
d0058ac078d3f670a47883aca90ef746f42cec57 | C++ | graceyangfan/Leetcode | /整数拆分.CPP | UTF-8 | 1,147 | 3.234375 | 3 | [] | no_license | class Solution {
public:
int integerBreak(int n) {
if (n <= 3) {
return n - 1;
}
int quotient = n / 3;
int remainder = n % 3;
if (remainder == 0) {
return (int)pow(3, quotient);
} else if (remainder == 1) {
return (int)pow(3, quotie... | true |
742e783ee42ccec54bd781afe386af5d45dcc289 | C++ | hasbegun/BiometricLib | /src/Iris/Iris/AlignLRPupilPos.h | UTF-8 | 1,890 | 3.1875 | 3 | [] | no_license | /*********************************************************
** @file AlignLRPupilPos.h
** Functions for aligning the left and right eye position.
**
**********************************************************/
#ifndef ALIGN_LR_PUPIL_POS_H
#define ALIGN_LR_PUPIL_POS_H
#include "ImageUtility.h"
class AlignLRPupilPo... | true |
a48171c7556fe6177388a52150d98a1d40a88ebc | C++ | MatteoMorisoli/MultiTreeRouting | /MultiTreeRouting/MultiTreeRouting/DataAnalyser.cpp | UTF-8 | 9,615 | 2.5625 | 3 | [] | no_license | //
// DataAnalyser.cpp
// MultiTreeRouting
//
// Created by Matteo Morisoli on 26.04.18.
// Copyright © 2018 MatteoMorisoli. All rights reserved.
//
#include "DataAnalyser.hpp"
//
// main.cpp
// DataAnalyzer
//
// Created by Matteo Morisoli on 12.04.18.
// Copyright © 2018 MatteoMorisoli. All rights reserved.
... | true |
439e56229ef3e3ee6bed09605ca826da9706ced9 | C++ | zecrotic/CoffeeKing | /displaySugarDigit.ino | UTF-8 | 3,052 | 2.59375 | 3 | [] | no_license | void displaySugarDigit(int digit)
{
switch (digit) //Case number will be the displayed digit
{
case 0:
digitalWrite(a_sugar, HIGH);
digitalWrite(b_sugar, HIGH);
digitalWrite(c_sugar, HIGH);
digitalWrite(d_sugar, HIGH);
digitalWrite(e_sugar, HIGH);
digitalWrite(f_sugar, HIGH);... | true |
7f434bbed2c963aad8ffb5181722d4f74f60eb81 | C++ | KwintenSchram/Frogger | /src/Level.cpp | UTF-8 | 11,024 | 2.625 | 3 | [] | no_license | /*
* Level.cpp
*
* This object will execute the playing part of the game.
* It creates and manages the entities by moving them and checking for collision.
*
* Created on: 8-apr.-2016
* Author: Kwinten
*/
#include <Level.h>
#include <levelGenerator/levelProperties.h>
#include "levelGenerator/R... | true |
5a6f3e891c33ccf1e8e4f334e395244c0819ffd6 | C++ | abhinavkshitij/scicomp | /ch6/arrayAssign.cpp | UTF-8 | 488 | 3.703125 | 4 | [] | no_license | // Exmaple from pg 164
class Array
{
public:
Array(int n){}; // Single-argument constructor
Array(const Array&){}; // Copy array
Array& operator=(const Array&){return *this;}; // Assign array
Array& operator=(const int){return *this;};
operator int() const {return 0;};
};
#include <iostream>
using namesp... | true |
6fda5a6cdf3e6ab288511af260b44c4c18c07e3a | C++ | sxxlearn2rock/HODRep | /HOD/Processors/DenoiseStrategies/Localshannon.cpp | GB18030 | 2,261 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #include "./Processors/DenoiseStrategies/Localshannon.h"
#include "math.h"
#include "string.h"
//ྲ̬.cppļ
Localshannon* Localshannon::mSingleton = NULL;
void Localshannon::denoise(const Mat& srcImg, Mat& desImg)
{
unsigned char* cvtImg = mat2GrayImgPointer(srcImg, desImg);
localshannon( cvtImg, desImg.rows, desImg... | true |
658117782b30980b11192718d93eb0e756cac028 | C++ | chenhongbo-topscomm/gitlernen | /hallo.cpp | UTF-8 | 278 | 2.765625 | 3 | [] | no_license | #include"iostream"
using namespace std;
int main()
{
cout<<"Hallo!"<<endl;
int wuhu=0;
cout<<"Ein Num giben Sie bitte!"<<endl;
cin>>wuhu;
if(wuhu>=10||wuhu<0)
{
cout<<"Du bist Scheisse!"<<endl;
}
else
{
cout<<"Fantastisch und Ausgezeichnet!"<<endl;
}
return 0;
}
| true |
cc8dd2af2557bfb873eed89d31feea0ce75c81e7 | C++ | GoogleBing/Led_RGB | /Led_RGB.cpp | UTF-8 | 10,590 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "Led_RGB.h"
//--------------------------------------------------------------------------------------------------------------------------------------
led_RGB::led_RGB(){}
//-------------BEGIN SETUP------------------------------------------------------------------------------------------------------------... | true |
e3067d7066954f2c4bddb28618cb14a68f7f621d | C++ | libcxxrt/libcxxrt | /test/test_demangle.cc | UTF-8 | 1,720 | 3.03125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #include "test.h"
#include <cxxabi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <typeinfo>
void test(const char* mangled, const char* expected, int expstat, int line) {
int status = 0;
using abi::__cxa_demangle;
char* demangled = __cxa_demangle(mangled, NULL, NULL, &status);
printf("mang... | true |
4ed4579a35764d4271d51a25762ac0ff53de77c3 | C++ | isysoi3/Programming | /c++/1 сем/Stack/Stack/Stack.h | UTF-8 | 3,417 | 3.359375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <list>
using namespace std;
template<typename T>
class Stack {
public:
virtual ~Stack() {};
virtual void push(T smth) = 0 ;
virtual void pop() = 0 ;
virtual T top() const = 0 ;
virtual int size() const = 0 ;
virtual bool isEmpty() const = 0 ;
};
template<typename T>
cl... | true |
88eb67635d70320fd33b8e125aa6fa5e05b9aabe | C++ | gtu-homeworks-and-projects/CSE-241-Object-Oriented-Programming-2017-Fall | /HW6/GTUMap.cpp | UTF-8 | 615 | 2.640625 | 3 | [] | no_license | //
// Created by cecen on 12/13/2017.
//
#include "GTUMap.h"
#include "GTUSet.cpp"
namespace containers{
template<class K, class V>
GTUMap<K, V>::GTUMap(): GTUSet<std::pair<K,V> >::GTUSet () {}
template<class K, class V>
V >UMap<K, V>::operator[](const K& k) {
shared_ptr<DataNo... | true |
5f4cad0cf07107afb5d762253555eddbc75e6731 | C++ | virovets64/Hadronium | /Engine/Vector.h | UTF-8 | 1,452 | 3.609375 | 4 | [] | no_license | #pragma once
#include <array>
template<typename Number, int Dim>
struct Vector
{
std::array<Number, Dim> Data;
Vector()
: Data{}
{}
Number LengthSquared()
{
Number result{};
for (auto d : Data)
result += d * d;
return result;
}
Number Length()
{
return sqrt(LengthSquared())... | true |
4358588047d6d605a7b0d9a2806a1efb1f4daa51 | C++ | wangwshuai/t2h | /src/common/utility/thread_pool.hpp | UTF-8 | 3,373 | 3.078125 | 3 | [] | no_license | #ifndef THREAD_POOL_HPP_INCLUDED
#define THREAD_POOL_HPP_INCLUDED
#include <vector>
#include <boost/thread.hpp>
#include <boost/noncopyable.hpp>
#include <iostream>
namespace utility {
namespace details {
class default_policy {
public :
typedef std::size_t size_type;
default_policy() : lock_(), threads_(), threa... | true |
f11fb6ee39ea34f14d0c5b8a14e15df9379bdf09 | C++ | merelmourik/Webserver | /srcs/Cluster/serverCluster.hpp | UTF-8 | 776 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef SERVERCLUSTER_HPP
# define SERVERCLUSTER_HPP
# include "../Server/server.hpp"
# include "../Utils/defines.hpp"
# include "../webserv.hpp"
# include <algorithm>
class serverCluster {
public:
fd_set readFds;
fd_set writeFds;
private:
std::vector<server*> _servers;
int _nrOfServers;
long _highestFd... | true |
c0a67692ae91c260daa474fbc9ba8ebdef08d01c | C++ | ucas-joy/my_leetcode | /315Count of Smaller Numbers After Self.cpp | WINDOWS-1252 | 2,058 | 3.6875 | 4 | [] | no_license | /*
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of
smaller elements to the right of nums[i].
Example:
Given nums = [5, 2, 6, 1]
To the right of 5 there are 2 smaller elements (2 and 1).
To the right of 2 there is only 1... | true |
e4b179614257075ce71a6e3d89c4691b17e4277f | C++ | mohammadVatandoost/SplayTree | /splaytree.cpp | UTF-8 | 819 | 3.171875 | 3 | [] | no_license | #include "splaytree.h"
SplayTree::SplayTree(int value)
{
// root = {value, null, nullptr, nullptr}; // has problem
root = new node();
root->value = value;
}
node *SplayTree::findNearest(node *headNode, int value)
{
if(headNode->value == value) {
return headNode;
} else if(headNode->right == ... | true |
df6311bee35b8ea834ca1dc91ec8d708c8d8de56 | C++ | zhuhuijia0001/leetcode | /219-Contains Duplicate II.cpp | UTF-8 | 835 | 2.984375 | 3 | [] | no_license | class Solution
{
public:
bool containsNearbyDuplicate(vector<int>& nums, int k)
{
int i;
map<int, int> mymap;
map<int, int>::iterator mapitr;
for (vector<int>::iterator itr = nums.begin(); itr != nums.end(); ++itr)
{
mapitr = mymap... | true |
1689acf37e4884de5e41198cdd823c80e3594bb1 | C++ | vandersonmr/ProgrammingContest | /URI/1521.cpp | UTF-8 | 499 | 2.765625 | 3 | [] | no_license | #include <cstdio>
int main() {
while(true){
int n;
scanf("%d\n", &n);
if (n == 0) return 0;
int alunos[n];
char rest[10000];
scanf("%[^\n]", rest);
for(int i=0; i < n; i++) {
int who;
sscanf(rest, "%d %[^\n]", &who, rest);
alunos[i] = who;
}
int start;
scanf(... | true |
1558f7639b79bcceaecde5d81e02a93d40d3afb8 | C++ | Vitor-Mendes/TP2_Solar_System_CG | /src/Camera.cpp | UTF-8 | 1,207 | 2.8125 | 3 | [] | no_license | #include <GL/glu.h>
#include "Camera.h"
void Camera::use() {
gluLookAt(position[Vector3d::X], position[Vector3d::Y], position[Vector3d::Z],
target[Vector3d::X], target[Vector3d::Y], target[Vector3d::Z],
up[Vector3d::X], up[Vector3d::Y], up[Vector3d::Z]);
}
void Camera::... | true |
69ce51febb04fc61caf4a4fcfa30f0b032128d17 | C++ | supercaracal/game-programmer-book-build | /src/08_2DCollision/Reaction2/main.cpp | SHIFT_JIS | 2,576 | 2.671875 | 3 | [] | no_license | #include "GameLib/Framework.h"
class Square{
public:
void set( int x, int y, int halfSize ){
mX = x;
mY = y;
mHalfSize = halfSize;
}
bool isIntersect( const Square& b ) const {
int al = mX - mHalfSize; //left A
int ar = mX + mHalfSize; //right A
int bl = b.mX - b.mHalfSize; //left B
int b... | true |
809b9eb39dadc7789313666a9d17ae861c8c8a73 | C++ | luismgg86/Lista | /src/Lista.cpp | UTF-8 | 2,843 | 3.609375 | 4 | [] | no_license | #include "Lista.h"
using namespace std;
Lista::Lista(){//contructor vacio
this->H=NULL;
this->T=NULL;
}
Lista::Lista(int dato){//constructor con un dato
Nodo *m=new Nodo(dato);
this->H=m;
this->T=H;
}
bool Lista::IsVacio(){ //metodo que verifica si la lista esta vacia
return(this->T==NULL && this->... | true |
c65c050090effc6c760b15ba02780a8f9530f357 | C++ | THLEE-KR/Baekjoon-Online-Judge_THLEE | /20200830_13023/main.cpp | UTF-8 | 1,203 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
bool a[2010][2010]; // 인접 행렬
vector<int> g[2000]; // 인접 리스트
vector<pair<int,int>> edges; // 간선 리스트
int main() {
int N, M;
cin >> N >> M; // 5 4
for(int i=0; i<M; i++){
int from, to;
cin >> from >> to;
... | true |
7a1dd26d71a385df1c382805eb7992342e6e6eb2 | C++ | cugbacmbsworks/ALGORITHMS | /第7章/7.1-4.cpp | UTF-8 | 608 | 3.46875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int PARTITION(int* arr,int l,int r)
{
int t = l;
for(int i = l;i < r;++i)
if(arr[i] > arr[r])
swap(arr[i],arr[t++]);//用了stl的swap()函数
swap(arr[t],arr[r]);
return t;
}
void QUICK_SORT(int* arr,int l,int r)
{
if(l < r)
{
int n... | true |
1ce458cbf5a11fd050ff1f2fac15e042e7e987bf | C++ | hunkabhicupid/General | /rowmajor/main.cpp | UTF-8 | 201 | 3.125 | 3 | [] | no_license | #include <stdio.h>
int main ()
{
unsigned int M,N;
// construct a 2D array say M*N
cin >> M >> N;
int * arr = new int[M*N];
// input as row major
return 0;
}
| true |
b56bd446a99ab4c79820299df0074f7d18d8a23d | C++ | qeedquan/challenges | /codingtrain/4-purple-rain.cpp | UTF-8 | 3,327 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdarg>
#include <cstdint>
#include <chrono>
#include <random>
#include <vector>
#include <SDL.h>
using namespace std;
struct Drop
{
float x, y, z;
float yspeed;
float len;
void init(float width);
void fall(float height);
void draw(SDL_Renderer *... | true |
348d8082a9f38433dcf9314b54cb53d832796891 | C++ | frankylin1111/1081ML | /Cpp_ex/C_ex/ch11/ch11 hw07.cpp | BIG5 | 299 | 2.859375 | 3 | [] | no_license | #include <stdio.h>
#include <cstdlib>
#include <cstring>
/*
2018/07/01 ߱o
ch11 }C ------------------ HW 7
ϥΦr}CCXr
*/
int main()
{
int i=10,j,sum;
int a[i]={'C',' ','L','a','n','g','u','a','g','e'};
for (int j=0;j<10;j++)
{
printf("%c",a[j]);
}
}
| true |
7035a27711b675b8084c72268dff306a0a6c5019 | C++ | n-jing/njinglib | /src/rational_number.cpp | UTF-8 | 4,106 | 2.796875 | 3 | [] | no_license | #include "rational_number.h"
#ifdef RN
RationalNumber::RationalNumber(const RationalNumber &a)
{
mpq_init(p);
mpq_set(p, a.p);
}
RationalNumber::RationalNumber(double a)
{
mpq_init(p);
mpq_set_d(p, a);
}
RationalNumber::RationalNumber(int a)
{
mpq_init(p);
mpq_set_d(p, double(a));
}
RationalNumber::Rat... | true |
08d726e04c78e93c51815c232e723d9d8f06b0b4 | C++ | waynezhangw/some-sorting-algorithms | /daily_sorting/wayne_sortThem.cpp | ISO-8859-9 | 5,737 | 3.390625 | 3 | [] | no_license | #include "wayne_sortThem.h"
#include <utility> // std::swap
#include<iostream>
#include <algorithm>
using namespace std;
wayne_sortThem::wayne_sortThem(void) {
}
wayne_sortThem::~wayne_sortThem(void) {
}
bool wayne_sortThem::ascending(double& x, double& y) {
return x < y;
}
bool wayne_sortThem::descending(dou... | true |
0ef3a65a1e6365f7e8ccf743fd455dae887c29cb | C++ | chjon/InfiniteChess | /src/io/inputHandler.h | UTF-8 | 1,297 | 2.65625 | 3 | [] | no_license | #ifndef CHESS_INPUT_HANDLER_H
#define CHESS_INPUT_HANDLER_H
#include <SFML/Graphics.hpp>
#include "../renderer.h"
// Forward declarations
class Game;
class Renderer;
class WindowLayer;
// Class declaration
class InputHandler {
private:
// Configuration constants
const float MOVE_STEP_SIZE = 0.005f;
// Movement... | true |
4889b38dd388b46c52c4f2aaadd8fd39deda9c54 | C++ | Tvorobey/BINSGUI | /Utilities/lock.h | UTF-8 | 698 | 2.84375 | 3 | [] | no_license | #ifndef LOCK_H
#define LOCK_H
#include <QMutex>
#include <memory>
/*!
* \brief Класс - Lock
* \details Класс служит для того, чтобы можно было
* не беспокоиться о том, что забудешь открыть заново мьютекс
* Достаточно создать объект этого класса, в параметр бросить
* указатель на мьютек. При выходе из функции фун... | true |
1808e3edaad76561cf89b83ce436b081f5275306 | C++ | ThaiNhatMinh/Math | /Helper.cpp | UTF-8 | 924 | 3.078125 | 3 | [] | no_license |
#include "Helper.h"
#pragma once
// Remove the quotes from a string
void RemoveQuotes( std::string& str )
{
size_t n;
while ( ( n = str.find('\"') ) != std::string::npos ) str.erase(n,1);
}
// Get's the size of the file in bytes.
int GetFileLength( std::istream& file )
{
int pos = file.tellg();
file.... | true |
04ec045548071f7dc8b0b5de0c923f72599f7067 | C++ | AviadKlein1/Cpp-basic-2021 | /תרגיל בית 6 שאלה 5 - בודק אוטומטי/Source.cpp | UTF-8 | 1,218 | 3.71875 | 4 | [] | no_license | //Aviad Klein ID 315552679
//Intro to computer science
//6.5.
//the program prints the difference between two groups of numbers.
#include <iostream>
using namespace std;
void diff(int* s1, int* s2, int*dif)
{
bool flag = false;
int counter = 0;
for (int i = 0; i < 6; i++)
{
flag = false;
for (... | true |
337faee0896156a5cd10437d7075f706af33596d | C++ | alesegdia/secs | /src/lib/secs/systemmanager.h | UTF-8 | 1,602 | 2.59375 | 3 | [] | no_license | #pragma once
#include "entityobserver.h"
#include "system.h"
#include "entitysystem.h"
#include "componentflagsmanager.h"
#include <unordered_map>
namespace secs
{
typedef size_t SystemGroupIndex;
class SystemManager : public EntityObserver
{
public:
static constexpr SystemGroupIndex MaxSystemGroups = 32;
... | true |
186bea618e4397ff8cb0b2a1fd24f413838e5934 | C++ | mark-borg/CheckProductLabel | /qvcore/ContainerAreaFinder.h | UTF-8 | 2,257 | 2.5625 | 3 | [] | no_license |
#ifndef __CONTAINER_AREA_FINDER_H__
#define __CONTAINER_AREA_FINDER_H__
#include "common.h"
///EXPIMP_TEMPLATE template class DLL_EXPORT std::vector< CvRect >;
///EXPIMP_TEMPLATE template class DLL_EXPORT std::vector< IplImage* >;
///EXPIMP_TEMPLATE template class DLL_EXPORT std::vector< CvPoint3D32f >;
class D... | true |
96cdf8aaeb25e448a16996fd7b80122a290d0948 | C++ | EKISUKE/GitHubTest | /GameEngine/src/gmAABBTree.h | SHIFT_JIS | 5,508 | 2.734375 | 3 | [] | no_license | //-----------------------------------------------------------------------------
//!
//! @file gmAABBTree.h
//! @brief AABB-Tree
//! @author YukiIshigaki
//!
//-----------------------------------------------------------------------------
#pragma once
//! C̕` (Flat)
//! @param [in] p1 W1
//! @param [in] p1 W2
//! @par... | true |
60cc0978111b06071c46976683e99b236de4655d | C++ | thienphucst92/algorithm-training | /Blue/ss1-dynamic-array/Codeforces_L01P01_691A.cpp | UTF-8 | 649 | 3.328125 | 3 | [] | no_license | // Problem from Codeforces
// http://codeforces.com/problemset/problem/691/A
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
bool isFastenedRightWay(const vector<int> a) {
if (a.size() == 1 && a[0] == 0) return false;
if (a.size() == 1 && a[0] == 1) return true;
... | true |