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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6d73493511a8ce0c2aedae1a7e8760623015881 | C++ | Josedm92/UD3 | /menu_calculadora.cpp | UTF-8 | 2,641 | 4.34375 | 4 | [] | no_license | //Programa que pide al usuario dos números y hace los cálculos básicos usando funciones.
#include <iostream> //Incluimos librería iostream que permite la entrada por teclado y la salida por pantalla.
using namespace std; //Sentencia obligatoria.
//Creación de las funciones.
double suma(double numero1, double numero2){... | true |
9390ca7984cac811db53abe8b12ea31cad6aaa57 | C++ | btcup/sb-admin | /exams/2558/02204111/1/midterm/2_2_714_5420502844.cpp | UTF-8 | 687 | 2.8125 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main (){
float A,B,C,F,G,c,N;
int x=55,y=80,z=90,m=17,n=32,o=50;
cout<<"wellcome to The fantastic Tilles !!"<<endl;
cout<<"Please enter room size in meter (H x W x D) :";
cin>>A>>B>>C;
cout<<"Please select floor tile...(A/B/C) :";
cin>>F;
... | true |
3797372c3b365afa5290fb2585d555eac03dffcf | C++ | dskut/junk | /map-alloc/test.cpp | UTF-8 | 5,645 | 3.203125 | 3 | [] | no_license |
#include <map>
#include <vector>
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
#include <sys/time.h>
#include <climits>
#include <boost/pool/pool_alloc.hpp>
using namespace std;
class Timer {
private:
timespec start_;
public:
Timer()
{
reset();
}
void reset() {... | true |
4cf7f64611324677b3025c7cd2d3048a674b0060 | C++ | villadox/PrimeWorldEditor | /src/Editor/Widgets/WTextureGLWidget.cpp | UTF-8 | 4,469 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "WTextureGLWidget.h"
#include <Common/Math/CTransform4f.h>
#include <Core/GameProject/CResourceStore.h>
#include <Core/Render/CDrawUtil.h>
#include <Core/Render/CGraphics.h>
#include <iostream>
#include <iomanip>
WTextureGLWidget::WTextureGLWidget(QWidget *pParent, CTexture *pTex)
: QOpenGLWidget(pParent)... | true |
0ad2a5e82db6136ea3b26b3ed34e8d0639fa8d09 | C++ | ojy0216/BOJ | /2156.cpp | UTF-8 | 688 | 2.6875 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
using namespace std;
#define MAX 10000
int wine[MAX + 1] = {0, };
int dp[MAX + 1] = {0, };
void f(int n){
int x = dp[n - 2] + wine[n];
int y = dp[n - 3] + wine[n - 1] + wine[n];
int z = dp[n - 1];
dp[n] = max(x, max(y, z));
}
int main(){
int n;
scanf("%... | true |
e62c0a2108ddb8f8486b70d673bf6c79c203b109 | C++ | ammarhusain/lost-robot | /particle_filter/src/MapData.h | UTF-8 | 2,441 | 2.96875 | 3 | [] | no_license | /** ----------------------------------------------------------------------
* Copyright 2014 < Ammar Husain (Carnegie Mellon University) >
*
* @file MapData.h
* @author Ammar Husain <ahusain@nrec.ri.cmu.edu>
* @date Tue Nov 11 15:39:00 2014
*
* @brief Declarations for MapData
* This class handles all m... | true |
13e02a821147536a278535aecb5c3292d388f942 | C++ | senior-sigan/omsu_cpp_course | /code/_sem_2/fantasy_asm/mem.h | UTF-8 | 776 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <map>
#include <stack>
#include <vector>
#include "ops.h"
#include "reg.h"
// НЕ редактируйте этот файл.
namespace fasm {
class Memory {
std::map<Register, int> registers{{r0, 0}, {r1, 0}, {r2, 0}, {line, 0}, {cmp, 0}};
std::vector<IOperation*> instructions{};
std::stack<int> stack{};
... | true |
b8f2ad5ae5520ac7f5b338532b2c40f50a777563 | C++ | cafel176/cafelRenderer | /cafelRenderer/includes/cafel/basic/matrix.hpp | UTF-8 | 4,804 | 2.90625 | 3 | [] | no_license | #pragma once
#if !defined(_CAFEL_MATRIX_HPP_)
#define _CAFEL_MATRIX_HPP_
#include <cafel/basic/vector.hpp>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <memory>
CAFEL_NAMESPACE_BEGIN
template<typename T, int row, int col>
class Matrix : public Basic
{
public:
Matrix(T t)
{
data = std:... | true |
c047320c2be18119600dac2d3a33694666d7790a | C++ | BDavidd/CppTraining | /CppPrimer/Chapter_3/3.1/3.1/2.41/1.23.cpp | UTF-8 | 1,117 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::map;
struct SalesData
{
string bookNo;
unsigned int unitsSold = 0;
double revenue = 0.0;
};
int main()
{
SalesData sale;
double price = 0.0;
... | true |
c287d73c209c5995dd1d4e9f311549dcde85107b | C++ | georgerapeanu/c-sources | /apropiate1/main.cpp | UTF-8 | 865 | 2.546875 | 3 | [] | no_license | #include <fstream>
using namespace std;
ifstream f("apropiate1.in");
ofstream g("apropiate1.out");
long long x,y,a,i,j,n,distx,disty;
short c;
int ifprim(long long nr)
{
long long l;
for(l=2;l<=nr/2;l++)
if(nr%l==0)
return 0;
return 1;
}
int main()
{
f>>n>>c;
for(i=1;i<=n;i++)
{
... | true |
a3d9d08d06b582ee803d933417b1e51a224cf971 | C++ | tbgeorge/putty_engine | /Renderer/TextRenderer.cpp | UTF-8 | 1,237 | 2.5625 | 3 | [] | no_license | //=================================================================================
// TextRenderer.cpp
// Author: Tyler George
// Date : June 10, 2015
//=================================================================================
#include <fstream>
#include <iostream>
#include "Engine/Renderer/TextRenderer.hpp"... | true |
f621645189fb635240b00040cbe307dcef53e2a1 | C++ | torehc/ProjectEuler | /274.cc | UTF-8 | 903 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <map>
#include <stdio.h>
#define SIEVE_RANGE (10000000)
#define PRIME_COUNT (664579)
bool sieve_visited[SIEVE_RANGE] = {};
std::map<int, int> aux_map;
void InitAuxMap()
{
aux_map[1] = 9;
aux_map[3] = 3;
aux_map[7] = 7;
aux_map[9] = 1;
}
long long GetDivisibilityMultiplie... | true |
5062f0dd4c10e9cf842133417862e0e84b3f8428 | C++ | 7182514362/leetcode | /026-050/048_旋转图像_M/main.cpp | UTF-8 | 1,278 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void rotate(vector<vector<int>> &matrix) {
int size = matrix.size();
if (size <= 1) {
return;
}
int n = (size + 1) / 2;
for (int i = 0; i < n; ++i) {
for (int j = ... | true |
ed4d993a3c2961b197864fe7d7727d819d1fbe01 | C++ | the-gooniest/lateral-controller | /src/CarConstants.cpp | UTF-8 | 1,472 | 2.921875 | 3 | [] | no_license | #include <CarConstants.h>
// Total mass of the the 2017 Chevy Bolt in kg.
// TODO: change mass with added weight from sensors, people, etc
const float CarConstants::mass = 1605.0f;
// Yaw inertia of the 2017 Chevy Bolt in kg*m^2.
// This value is not used for now.
const float CarConstants::yaw_inertia = 2045.0f;
// ... | true |
eb64d5444136e0f35e2d6c18643d69404e200e7a | C++ | jessicahe21/Software | /src/thunderbots/software/ai/hl/stp/evaluation/robot.cpp | UTF-8 | 1,404 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "ai/hl/stp/evaluation/robot.h"
#include <shared/constants.h>
bool Evaluation::robotOrientationWithinAngleThresholdOfTarget(const Point position,
const Angle orientation,
const Point t... | true |
fd79d486a928814136074f4cf2055b072dbfd6c1 | C++ | awtrix/AWTRIX2.0-Controller | /lib/LDR/LightDependentResistor.cpp | UTF-8 | 2,412 | 2.578125 | 3 | [
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-SA-4.0",
"LicenseRef-scancode-other-copyleft"
] | permissive | /*
* \brief et light intensity from Light dependent Resistor (implementation)
*
* \author Quentin Comte-Gaz <quentin@comte-gaz.com>
* \date 4 July 2016
* \license MIT License (contact me if too restrictive)
* \copyright Copyright (c) 2016 Quentin Comte-Gaz
* \version 1.0
*/
#include "LightDependentResistor.h"
... | true |
7b1e0cbb2274e92ba22627a90154ca1fe2a45378 | C++ | chronos38/exa | /exa/source/buffered_stream.cpp | UTF-8 | 6,794 | 2.96875 | 3 | [
"MIT"
] | permissive | #include <exa/buffered_stream.hpp>
#include <algorithm>
namespace exa
{
buffered_stream::buffered_stream(const std::shared_ptr<stream>& s, std::streamsize buffer_size)
: stream_(s), buffer_size_(buffer_size)
{
if (s == nullptr)
{
throw std::invalid_argument("Given stream fo... | true |
4477bc916ce9b354638838d2410d96a2468da1a9 | C++ | rpuntaie/c-examples | /cpp/memory_destroy_at.cpp | UTF-8 | 662 | 3.40625 | 3 | [
"MIT"
] | permissive | /*
g++ --std=c++20 -pthread -o ../_build/cpp/memory_destroy_at.exe ./cpp/memory_destroy_at.cpp && (cd ../_build/cpp/;./memory_destroy_at.exe)
https://en.cppreference.com/w/cpp/memory/destroy_at
*/
#include <memory>
#include <new>
#include <iostream>
struct Tracer {
int value;
~Tracer() { std::cout << value << "... | true |
f2a62179ea650b8f10a1fea9dd9d2e0e5679010b | C++ | Bambia/Algorithm | /2.Algorithm_study/2019.08.05/11965_Bessie_s_Dream.cpp | UTF-8 | 3,127 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <queue>
using namespace std;
struct POS{
int x,y;
int pDir;
int count,smell; // smell -> 1 orange, 0 no smell
};
const int MX = 1001;
int N,M,ans;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
int map[MX][MX],visited[MX][MX];
// statement
/*
0 can't go through
1 g... | true |
00a0f662e12295795d20043aa3bc00713a5befa5 | C++ | knightzf/review | /leetcode/3sum/learnedsolution.cpp | UTF-8 | 1,407 | 3.453125 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Solution
{
public:
vector<vector<int>> threeSum(vector<int>& nums)
{
std::vector<std::vector<int>> resultVec;
if(nums.empty())
{
return resultVec;
}
... | true |
9f74db35cf767734852e33650635882145dd7827 | C++ | lacretelle/42_cursus | /CPP/cpp_pool/day04/ex00/Victim.hpp | UTF-8 | 458 | 3.015625 | 3 | [] | no_license | #ifndef VICTIM_HPP
# define VICTIM_HPP
# include <string>
# include <iostream>
class Victim
{
public:
Victim(std::string name);
Victim(Victim const &);
Victim & operator=(Victim const &);
~Victim();
std::string getName() const;
void virtual getPolymorphed() c... | true |
744a13a5d998f3012caeaedb1b9612f30ebf4e67 | C++ | vasharm2/Homework | /PS2/zchen142/problem2.cpp | UTF-8 | 305 | 2.953125 | 3 | [] | no_license |
Created by Daniel Chen on 9/22/15.
Copyright (c) 2015 Daniel. All rights reserved.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
for (int i = 0; i < 3; i++) {
for (int j = 3; j > 0; j--) {
cout << pow(i, j) << endl;
}
}
return 0;
} | true |
12e298e9921c782caddbe49af9f94a1b68cf2d58 | C++ | jun094/Study-cpp | /Week3_Day2/Week2__/ex05_class2_sansungja2.cpp | UHC | 1,498 | 3.921875 | 4 | [] | no_license | //#include<iostream>
//#include<cstdio>
//
//using namespace std;
//
//// class ߰ϱ_
//// class ߰ϱ_ public ۿ
//
//int g_numStudent = 14000000; //
//
//class Student
//{
//
// int num; // public ۿ -> й ߺx, ȭx̴.
//
//public:
// char name[10];
// float grade;
//
// Student()
// {
// //ڴ
// // 1.ݵ ҷ
// // 2. ͺ ... | true |
49a2c13080888e3938e04582947d470074e428ad | C++ | rayray2002/cpl | /preview/function_preview/p44.cpp | UTF-8 | 338 | 3.1875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void commute_time (double, double=20, int=8);
int main( )
{
commute_time(40);
commute_time(30, 20);
commute_time(35, 30, 8);
}
void commute_time(double velocity, double distance, int num_lights)
{
cout<<"The commute time is " <<(distance/velocity + num_lights*0.01)
<<"... | true |
964d9a334146b037fd5cdee4dd140e8196242d91 | C++ | Leslie-Zhou/Group_Project_Mirrored | /Semester 1/Code/vectorClass.cpp | UTF-8 | 10,987 | 4.03125 | 4 | [] | no_license | #include <iostream>
#include "vectorClass.h"
#include <math.h>
vectorClass::vectorClass(){
}
vectorClass::~vectorClass(){
}
vectorClass::vectorClass(int id, float x, float y, float z) // Constructor
{
// Store values in respective indexes
this->x = x;
this->y = y;
this->z = z;
this->id = id;
}
... | true |
aae7476cbf0f3b8c5757dac4ee7bc2c7e8d41b26 | C++ | mart123p/INF1995 | /projet/lib/uart.h | UTF-8 | 3,962 | 3.0625 | 3 | [] | no_license | #ifndef UART_H
#define UART_H
/**
* Envoyer et recevoir diverses messages avec l'interface de communication UART.
* Ces messages peuvent être reçus à l'aide du programme sérieViaUSB. Certaines
* méthodes ont été conçues pour être utilisé avec les logiciels de diagnostique
* maison dont il est question dans readme.m... | true |
49fd1d306afef43d5aa47ee379b215d96e8bae3b | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/102/1218.c | UTF-8 | 892 | 3.046875 | 3 | [] | no_license |
int main()
{
int n;
double x;
double a[40];
double b[40];
int counta = 0;
int countb = 0;
cin >> n;
for(int i = 0; i < n; i ++)
{
char ch[10];
cin >> ch >> x;
if(ch[0] == 'm')
{
a[counta] = x;
counta ++;
}
else
{
b[countb] = x;
countb ++;
}
... | true |
a5dbd966e38feb8b6f03f1c0159d69d3fd0d62a8 | C++ | kaityo256/mdacp | /mdrect.cc | UTF-8 | 1,609 | 2.703125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #include <iostream>
#include "mdrect.h"
//----------------------------------------------------------------------
bool
MDRect::IsOverBoundary(int dir, double q[D]) {
switch (dir) {
case D_LEFT:
return (q[X] < s[X]);
case D_RIGHT:
return (q[X] >= e[X]);
case D_BACK:
return (q[Y] < s[Y]);
case D_FORW... | true |
77dc5dd3a434ec2cd2047867fc343f34c3cf197e | C++ | yashAgarwal41/Awesome-Projects-Collection | /Unique C++ Projects/Bookshop management system using file handling.cpp | UTF-8 | 8,174 | 3.40625 | 3 | [] | no_license | // C++ program to illustrate bookshop
// management system using File Handling
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
// Bookshop Class
class bookshope {
public:
void control_panel();
void add_book();
void show_book();
void che... | true |
10f4277600d972639db084443272d5473966f46b | C++ | Hekiat/Jikan | /src/ApplicationData.cpp | UTF-8 | 5,471 | 2.578125 | 3 | [
"Unlicense"
] | permissive | #include "ApplicationData.h"
#include <iostream>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
ApplicationData::ApplicationData(int argc, char** argv, QObject* parent) : QObject(parent)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
m_app = new QGuiApplication(argc, ar... | true |
79eae6e4993e29df96f61393dc6a9783dd5e89a4 | C++ | cwielgosz/CFDgrid | /CFD2dGrid.cc | UTF-8 | 3,210 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
using namespace std;
class Grid2d{
private:
const static int SIZE = 10;
double* g;
double* gf;
uint32_t rows;
uint32_t cols;
public:
Grid2d(uint32_t rows, uint32_t cols, double val = 0) : rows(rows), cols(cols){ //CONSTRUCTOR
g = new double[rows * cols];
... | true |
8b3aa3a67ad5c747466f94d87c2857690bf3cbb1 | C++ | wittekin/Ising2_Eclipse | /main.cpp | UTF-8 | 825 | 2.75 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Mark Wittekind
*
* Created on March 5, 2015, 6:03 PM
*/
#include <cstdlib>
#include "CLattice.h"
#include <fstream>
#include <streambuf>
#include <iostream>
#include <vector>
#include "CObject.h"
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
//CONSTANTS
cons... | true |
4bd1c6b57fe75027de857a29588ff1fa1f367b2d | C++ | goku1997/GenesisBlockZero | /ochotest.cc | UTF-8 | 766 | 2.515625 | 3 | [] | no_license | #include <stdio.h>
#include "sha256.h"
unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md) {
CSHA256 bob;
bob.Write(d,n);
bob.Finalize(md);
return md;
}
//msg: 00CDF9B24885C203B8F2C7939DABE2D5F6668C0C9C
//hsh: 0B49BA51CE57043361EB1DC5D7779DADE79D23C61F679A90EBABE48B39CFFBCC
//msg: 0B49BA... | true |
bd3f74eb00b44beda7eef287684e741f7cb05465 | C++ | zu8/COVID_contacts | /infected.h | WINDOWS-1251 | 2,246 | 2.796875 | 3 | [] | no_license | #ifndef INFECTEDH
#define INFECTEDH
#include<fstream>
#include<iostream>
#include<string>
#include<list>
#include<vector>
#include<regex>
#include<algorithm>
#include<iterator>
#include<iomanip>
using namespace std;
struct Tdate {
int day;
int month;
int year;
int daysFromPivot; // 01.01... | true |
42ab3e4dcb5ebb6ecb6ea6171fd7820d03e31861 | C++ | afawa/OI-problem | /codeforces/Hungarian.cc | UTF-8 | 717 | 2.71875 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
using namespace std;
int n;
int map[205][205];
int p[205];
int vis[205];
bool match(int i){
for(int j=0;j<n;++j){
if(map[i][j] && !vis[j]){
vis[j]=1;
if(p[j] == -1 || match(p[j])){
p[j] = i;
return true;
}
}
}
return false;
}
int Hu... | true |
ee27a97469ccfb07a0cfd39e119e82a24d187723 | C++ | losuffi/core | /test/test_container_slist.cpp | UTF-8 | 4,072 | 2.84375 | 3 | [] | no_license |
#include<ccdk/container/slist.h>
#include<stdio.h>
#include<string>
using namespace ccdk;
using namespace ccdk::mpl;
using namespace ccdk::ct;
void debug_slist()
{
DebugNewTitle("ctor");
{
DebugSubTitle("default");
{
slist<int> s1{};
slist<int> s2{ nullptr };
}
DebugSubTitle("fill ctor");
{
slis... | true |
c1a1c3a3bb5a802baef0fa20dfade2c5d543106e | C++ | Tass0sm/DataStructures | /Polynomial/polynomialMain.cpp | UTF-8 | 3,029 | 3.75 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
struct node {
int cData = 0;
int eData = 0;
node *next = NULL;
};
class LinkedList {
private:
int length = 0;
int item;
node *head, *previous, *current;
public:
void renew() {
length = 0;
head = NULL;
previous =... | true |
98b8d8937ff6b1f87adcf0617c7c7ae7cb60c3d0 | C++ | andreikl/gexplorer | /handlers/namespoolhandler.cpp | UTF-8 | 928 | 2.515625 | 3 | [] | no_license | #include "config.h"
#include "handlers/namespoolhandler.h"
NamesPoolHandler* NamesPoolHandler::handler = NULL;
NamesPoolHandler* NamesPoolHandler::createInstance()
{
if(!handler) {
handler = new NamesPoolHandler();
for(int i = 0; i < Config::getInstance()->getActiveDownloadCount(); i++) {
... | true |
de29e8c37a03644535a6d24bcd41bce771ee875a | C++ | Bingyy/Algorithms | /Tutorials/CSKaoyan/test.cpp | UTF-8 | 310 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
#define INF 100000
int main()
{
double sum = 0.0;
for(int i = 1; i < INF; i++ )
{
for(int j = 1; j < INF; j++)
{
sum += pow(-1,i+j) / (i + j);
}
}
cout << "Sum is : "<< sum << endl; // 0.193153,实际趋向值是:In2 - 1/2
return 0;
} | true |
7ebc25eed8e76441cba58d4fde3f25d3bde9b987 | C++ | samanseifi/Tahoe | /toolbox/src/C1functions/CubicSplineT.cpp | UTF-8 | 9,899 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | /* $Id: CubicSplineT.cpp,v 1.7 2004/07/20 23:23:33 rdorgan Exp $ */
/* created: paklein (12/02/1996) */
#include "CubicSplineT.h"
#include "dArray2DT.h"
#include "dMatrixT.h"
#include "TriDiagdMatrixT.h"
#include "iArrayT.h"
using namespace Tahoe;
const int kNumSplineCoeffs = 4;
/* constructor */
CubicSplineT::Cubic... | true |
f7c342628682a0abf704db382f3f7c3e92ed3669 | C++ | antisvin/MyPatches | /C++/DiscreteSummationOscillator.hpp | UTF-8 | 7,338 | 2.78125 | 3 | [] | no_license | #ifndef __DISCRETE_SUMMATION_OSCILLATOR_HPP__
#define __DISCRETE_SUMMATION_OSCILLATOR_HPP__
#include "ComplexOscillator.h"
enum DSFShape {
DSF1,
DSF2,
DSF3,
DSF4,
};
/**
* Quadrature oscillator based on Moorer's discrete summation formulas
*
* See The Synthesis of Complex Audio Spectra by Means of... | true |
13b6015a79e8fd5f00f05e5f0b01e3f3c09b9435 | C++ | ctrimble98/Solitaire | /source/heuristic.cpp | UTF-8 | 7,797 | 2.890625 | 3 | [] | no_license | #include "heuristic.h"
int Heuristic::run(Klondike game, Move move) {
return fcn(game, move, score);
}
int Heuristic::getScore() {
return score;
}
Heuristic::Heuristic(HeuristicType type, int score) : score(score) {
switch (type) {
case FOUNDATION:
fcn = foundationHeur;
br... | true |
90c84fc1f5f6b9b094a58cf17eb61ab5bd2d9e13 | C++ | quantumsteve/SpinWaveGenie | /libSpinWaveGenie/src/Containers/HKLDirections.cpp | UTF-8 | 724 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | //
// HKLDirection.cpp
// spin_wave_genie
//
// Created by Hahn, Steven E. on 5/22/14.
//
//
#include "SpinWaveGenie/Containers/HKLDirections.h"
namespace SpinWaveGenie
{
void HKLDirections::addDirection(double v0, double v1, double v2, double delta)
{
Axis direction;
direction.v0 = v0;
direction.v1 = v1;
... | true |
44cc7abc2b05dc5b810916d2662777ea1bbc4a13 | C++ | makio93/atcoder | /OtherSites/LeetCode/explore/challenge/february-leetcoding-challenge-2021/week-4-february-22nd-february-28th/Day27/main.cpp | UTF-8 | 923 | 2.90625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int divide(int dividend, int divisor) {
long long dividend2 = dividend, divisor2 = divisor;
if (divisor2 < 0) {
dividend2 = -dividend2;
divisor2 = -divisor2;
}
bool neg = (divid... | true |
ebbc59064a07362194705f3ca3147768c7a432f8 | C++ | ImagineMiracle-wxn/Book_Management_System | /图书馆管理系统/Book.cpp | GB18030 | 5,430 | 3.21875 | 3 | [] | no_license | #include "Book.h"
Book * Library = NULL;
Book::Book(const string name, const string id, const string press, const string author, const unsigned int num)
{
next = NULL;
Name = name;
ID = id;
Press = press;
Author = author;
Nums = num;
if (Library)
{
Book * p = Get_Library_Index();
while (p->Next())
{
... | true |
f09c9042b67983d3fc26bb3eb3fb3c9d41892e3b | C++ | acrord/algorithm_study | /iter/heap.cpp | UTF-8 | 837 | 2.921875 | 3 | [] | no_license | #include <string>
#include <vector>
#include <deque>
#include <queue>
#include <iostream>
#include <sstream>
#include <iterator>
using namespace std;
vector<int> solution(vector<string> operations) {
string str = "This is a string";
istringstream buf(str);
istream_iterator<std::string> beg(bu... | true |
8ff191181e84d516c30b6b0940826349e28f3e4c | C++ | vikram7599/Cpp-Codes | /SumKOrderN.cpp | UTF-8 | 653 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include<unordered_map>
using namespace std;
int countPairs(int *arr, int n, int k){
unordered_map<int, int> omap;
int i, twice_count =0 ;
for(i=0; i<n; i++){
omap[arr[i]]++;
}
for(i=0; i<n; i++){
twice_count += omap[k-arr[i]];
if(k-arr[i] == arr[i])... | true |
49bcd960c6e6c87552ded3d3cb7d135d6e404e5d | C++ | jt2603099/ThavisayJohnny_CSC5_42480 | /Hmwk/Assignment_4/Savitch_9thEd_Ch4_PracProg_3/main.cpp | UTF-8 | 2,168 | 3.6875 | 4 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.cpp
* Author: jt2603099
* Find out the value of your stock
* Created on April 7, 2018, 5:46 PM
*/
#include <i... | true |
155c5c403a0e0059f2c9c31c7a7a6c966626ff5c | C++ | AK2001/Video-management-application | /Management Application/main_runner.cpp | UTF-8 | 2,016 | 2.96875 | 3 | [] | no_license |
#include <cmath>
#include "videodata.h"
#include "vectordata.h"
#include "gui.h"
#include "functions.h"
int main() {
cout<<"----------------------------------------------CourseWork-----------------------------------------------\n"
<<endl;
//Note: don't force close
//The app saves in .txt when case... | true |
a103da65c5e694f6d51b1f7bd9d3d97cce036d9c | C++ | blambov/RealLib | /manual/harm.cpp | UTF-8 | 1,323 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <iomanip>
#include <ctime>
#include "Real.h"
using namespace RealLib;
using namespace std;
#define LENGTH 1000000
#define MACROTOSTRING2(x) # x
#define MACROTOSTRING(x) MACROTOSTRING2(x)
Real Harmonic(const long mcnt)
{
Real one(1);
Real s(0.0);
for (int i=1; i<=mcnt; ++i) {... | true |
ee327ac1f1d2e85e0b103937446d715c390a2b80 | C++ | TakuyaKimura/Leetcode | /259 3Sum Smaller/259.cpp | UTF-8 | 1,093 | 3.703125 | 4 | [] | no_license | /*
Given an array of n integers nums and a target, find the number of index triplets i, j, k
with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target.
For example, given nums = [-2, 0, 1, 3], and target = 2.
Return 2. Because there are two triplets which sums are less than 2:
[-... | true |
75d84b974199c0879d589226eabe672330b2f09a | C++ | afif95/Programming_problem | /SPOJ/ETF - Euler Totient Function.cpp | UTF-8 | 511 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int totient(int n)
{
int ret=n;
if(!(n%2)){
while(!(n%2))
{
n/=2;
}
ret-=ret/2;
}
for(int i=3;i*i<=n;i+=2)
{
if(!(n%i)){
while(!(n%i))
{
n/=i;
}
ret-=ret/i;
}
}
... | true |
4d003224b8392cacd4c072fbf68697047a009acf | C++ | AngelRodriguez319/CompetitiveProgramming | /Codeforces/GeneralProblems/200B.cpp | UTF-8 | 295 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
// Author: Angel Gabriel Rodriguez
// Date: March / 100 / 2021
// https://codeforces.com/problemset/problem/200/B
int main(){
int prov = 0, n, i;
float sum = 0;
cin >> n;
for(i = 0; i < n; i++){
cin >> prov;
sum += prov;
}
cout << sum/n << endl;
return 0;
} | true |
cdd765c437e626363799c283a4961c860156d46e | C++ | MrGodin67/New3d | /New3D/New3D/Player.h | UTF-8 | 1,917 | 2.515625 | 3 | [] | no_license | #pragma once
#include "Camera3D_2.h"
#include <DirectXMath.h>
struct PlayerAmmo
{
DirectX::XMVECTOR pos;
DirectX::XMVECTOR vel;
DirectX::XMVECTOR collisionPt;
DirectX::XMFLOAT3 mat_scale = {1.0f,1.0f,1.0f};
DirectX::XMMATRIX mat_rot;
float speed;
float lifeSpan = 1.0f;
float timer = 0.0f;
bool active = true;
... | true |
bdd44171dc524cd00832bdd99af2b4da6043dcda | C++ | geeklhem/spopdyn | /spopdyn/libpssa/libpssa/include/sampling/SamplingModule_PSSACR.h | UTF-8 | 1,089 | 2.5625 | 3 | [] | no_license | /**
* \file SamplingModule_PSSACR.h
* \copybrief SamplingModule.h
*
* \date 22.02.2011
* \author sanyi
*/
#ifndef SAMPLINGMODULE_PSSACR_H_
#define SAMPLINGMODULE_PSSACR_H_
#include "./SamplingModule_PDM.h"
#include "./CompositionRejectionSampler.h"
namespace pssalib
{
namespace sampling
{
/**
* \class... | true |
d63fa3dd6aad73ccbbfdafe1200b9a7f291b0e83 | C++ | DoctorLai/ACM | /leetcode/724. Find Pivot Index/724-2.cpp | UTF-8 | 466 | 3.03125 | 3 | [] | no_license | // https://helloacm.com/how-to-find-pivot-index-of-array/
// https://leetcode.com/problems/find-pivot-index/
class Solution {
public:
int pivotIndex(vector<int>& nums) {
int sum = 0;
for (const auto &n: nums) sum += n;
int psum = 0;
for (int i = 0; i < nums.size(); ++ i) {
... | true |
901614c592878b401ef6e921b14b2dea67f7615f | C++ | warcin/PRozSzafy | /structs.h | UTF-8 | 2,441 | 3.125 | 3 | [] | no_license | #ifndef STRUCTSH
#define STRUCTSH
#include <vector>
#include "consts.h"
using namespace std;
void incLamportTime(int received); // increments / updates lamportTime to the highest (received or our local) + 1
void updateRequestTime(int time); // updates our data variable - see requestTime in Data
// communication i... | true |
39433bd8f3aff429062a9dc107ac1af3b6433e73 | C++ | itsss/SASA_ComputingBasics | /2017-1-exam(08)/E.cpp | UTF-8 | 183 | 2.75 | 3 | [] | no_license | #include <stdio.h>
int main()
{
int a;
do
{
scanf("%d", &a);
}
while(a < 1 || a >= 10);
{
for(int i = 1; i < 10; i++)
{
printf("%d * %d = %2d\n", a, i, a*i);
}
}
}
| true |
cdc48b3668594f4c91d425b1e4084806421a4563 | C++ | mohamedabdelhakem1/problem-solving---competitive-programing | /C. Two TVs/main.cpp | UTF-8 | 827 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include<algorithm>
using namespace std;
int main() {
int n;
cin>>n;
pair <int,int > arr [n];
for(int i = 0 ; i < n; i++) {
cin>>arr[i].first>> arr[i].second ;
}
sort(arr,arr+n);
pair <int,int > tv1, tv2;
if(n <= 2) {
printf("YES");
} else {
... | true |
dbcc9588d24ee201e96c98e58b0a3c601ca667c3 | C++ | usiksan/SaliCAD | /src/windows/SdStringHistory.cpp | UTF-8 | 2,320 | 2.859375 | 3 | [] | no_license | /*
Project "Electronic schematic and pcb CAD"
Author
Sibilev Alexander S.
Web
www.saliLab.com
www.saliLab.ru
Description
Represent history of strings.
Support history limitation, recently used
*/
#include "SdStringHistory.h"
#include <QDebug>
SdStringHistory::SdStringHistory(int limit, int precision) :
... | true |
10487bd8c14402e17a9805d57d48345f75deded7 | C++ | XessWaffle/radiocontroller | /Transmitter/Manager.cpp | UTF-8 | 923 | 3.03125 | 3 | [
"MIT"
] | permissive | #include "Manager.h"
Manager::Manager(char* designator, int managedPin, bool sticky){
_designator = designator;
_managedPin = managedPin;
_reversed = false;
_sticky = sticky;
_updateDelay = millis();
}
Manager::Manager(){
char buff[20];
sprintf(buff, "DEFAULT");
_designator = buff;
_managedPin = 0... | true |
a94b524a8942847974fe69fecad85cbc3239bdd8 | C++ | ohz10/Dot-pp | /Dot++/tests/unit_test/Parser-ReadAttributeEqualState-UT.cpp | UTF-8 | 6,163 | 2.625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause",
"BSD-2-Clause"
] | permissive | #include "./platform/UnitTestSupport.hpp"
#include <Dot++/Exceptions.hpp>
#include <Dot++/NullConstructionPolicy.hpp>
#include <Dot++/lexer/TokenInfo.hpp>
#include <Dot++/parser/states/ReadAttributeEqualState.hpp>
#include <map>
#include <string>
#include <utility>
namespace {
using namespace dot_pp::lexer... | true |
43b5a28865681e6596e109d92ab12d4b35d9f3bc | C++ | JeckyllIsHyde/sim-methods-for-physics | /clase20171017/AutomatasContinuos.cpp | UTF-8 | 1,850 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
const int Lx=200;
const double p=0.5;
class LatticeGas {
private:
int v[2]; // V[i] con i=0, derecha y i=1 izquierda
double n[Lx][2], nnew[Lx][2]; // n[ix][i]: la probabilidad de q se encuentre una bolita en una posicion
public:
LatticeGas(void);
v... | true |
65bb88157c4a780221d588389a0833e1300e482a | C++ | jahnf/dcled-hidapi | /output.h | UTF-8 | 323 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
struct print {
template<typename T>
auto& operator<<(const T& a) const { return std::cout << a; }
~print() { std::cout << std::endl; }
};
struct error {
template<typename T>
auto& operator<<(const T& a) const { return std::cerr << a; }
~error() { std::cerr << std::endl; }
... | true |
8d24f0bf7039fe1c6dc75c2d167f1f9c7d4f1308 | C++ | xiongqiyu/c-firstyear | /C++ 2/1.cpp | UTF-8 | 9,675 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
void set_random_seed();
int randn(int n);
struct mm_code_maker{
void init(int i_length, int i_num){
length = i_length;
num = i_num;
}
void generate_sequence(){
for(int i = 0; i < length; i++){
seque... | true |
1bdaefc2c03cee6e17475a131d0f28799e2ea3fb | C++ | AcumenDev/DB | /Test/DataAccess/main.cpp | UTF-8 | 912 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include "DBEn/DBEntityTestDB.h"
#include <vector>
using namespace std;
int main() {
DBEntityTestDB dbEntity("../../TestDB.db","");
for(const auto& row :dbEntity.Test1.GetList() ) {
std::cout<<row.Id<<" "<<row.Name<<std::endl;
}
std::vector<Test1> vectorTest;
vectorTe... | true |
78fc1eafa11903ff357d32a3a3c7738b790ba2c1 | C++ | LXShades/comp140-worksheetc | /Pong/Player.h | UTF-8 | 603 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Object.h"
class Player : public Object
{
public:
void virtual init();
void virtual Move();
enum Side{Side_Undefined,Side_Left,Side_Right};
void SetSide(Side eSide);
void SetController(const class ArduinoController* controller);
inline float YToKnob(float Y) const;
inline float KnobTo... | true |
9a35ce6e51848daa0b53e6a0068171ad75ef17d2 | C++ | kth4540/cpp_study | /Ch_12/12-9/12-9/12-9.cpp | UHC | 922 | 3.625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Base
{
public:
int m_i = 0;
virtual void print()
{
cout << "i'm base" << endl;
}
};
class Derived : public Base
{
public:
int m_j = 1;
virtual void print() override
{
cout << "i'm derived" << endl;
}
};
void dosome(Base b)
{
b.print();
}
... | true |
0a92df566d4cdd57baf8b37d936815126c470ee7 | C++ | makodoJ/CLRS_cpp | /ch6/6.2.h | UTF-8 | 1,757 | 3.15625 | 3 | [] | no_license | //
// Created by Banana on 2020/12/3.
//
#ifndef ch6_2_h
#define ch6_2_h
#include "6.1.h"
#include "../Heap.h"
using std::swap;
namespace CLRS{
namespace CH6{
// - Time : O(lgn)
template <typename T>
void max_heapify(Heap<T>& A, int i){
int l = left(i);
int r = ri... | true |
8ea912aaa0bdd8f58778b97da7582fe85b5e20ab | C++ | nihalkun/programming | /sortedIpos.cpp | UTF-8 | 545 | 2.984375 | 3 | [] | no_license | //sorted insertion position
#include<bits/stdc++.h>
using namespace std;
int search(int a[],int l,int r,int x)
{
while (l<=r)
{
int mid=l+(r-l)/2;
if(a[mid]==x)
{
return mid;
}
else if(a[mid]>x)
{
r=mid-1;
}
else
{
... | true |
98e62773479641defe99ccfe6010c63b598af518 | C++ | Wolfasaurus1/Project8 | /Project8/Source.cpp | UTF-8 | 1,236 | 3.90625 | 4 | [] | no_license | #include <iostream>
//include c++ standard library as a prefix when necessary so that you don't have to repeat it manually and redundantly
using namespace std;
//create box class
class box
{
public:
//declare variables
int height;
int width;
int length;
//function to set the length of the box
int setLength(int... | true |
c7f48fae825f49aafc12c254abb200d82c388622 | C++ | IvoTod/tetrisPi | /src/SceneManager.cpp | UTF-8 | 3,448 | 2.640625 | 3 | [] | no_license | #include <SceneManager.h>
#include <ButtonManager.h>
#include <iostream>
#include <ali_colors.h>
#include <Button.h>
#include <Tetris.h>
#include <Text.h>
#include <NamePicker.h>
#include <vector>
#include <map>
#include <fstream>
#include <algorithm>
#include <Input.h>
void scoreboardPress() {
SceneManager* scene... | true |
f26cde95bd9c7e5a2f241dac321252ae3fc071b1 | C++ | Zbyl/terminal-editor | /text_ui/screen_functions.cpp | UTF-8 | 1,724 | 2.921875 | 3 | [
"CC0-1.0",
"MIT",
"BSL-1.0"
] | permissive | // Distributed under MIT License, see LICENSE file
// (c) 2018 Jakub Skowron, jskowron183@gmail.com
#include "screen_functions.h"
#include <cerrno>
#include <cstdio>
#include <system_error>
static void fputs_ex(const char* s, std::FILE* stream, const char* err_msg) {
int ret = std::fputs(s, stream); // DEC Priva... | true |
2ccfd06a445edda81fbb1b090e25b9a7bd8b0e03 | C++ | aimoonchen/easyeditor | /easyeditor/source/data/common/TPNode.cpp | UTF-8 | 4,835 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "TPNode.h"
#include <algorithm>
#include <stdio.h>
#include <assert.h>
namespace ee
{
TPNode::TPNode()
: m_used(false)
{
m_xmin = m_ymin = m_xmax = m_ymax = 0;
m_is_rotated = m_is_split_y = false;
m_next = m_child = m_parent = NULL;
m_remain_area = m_remain_len = m_remain_space = 0;
}
TPNode::TPNod... | true |
b99744dc5edc442e4ddf2e87c247d86e5021b97e | C++ | JWaters02/Year1-CPP-Project | /Stock.cpp | UTF-8 | 1,953 | 3.3125 | 3 | [
"MIT"
] | permissive | /*
* THIS CLASS MANAGES LOGGING OF EVENTS
* */
#include "Stock.h"
//region Constructor
//endregion
//region Functions
//endregion
//region Setters
/**
* Sets all items to have random numbers of stock.
*
* @return List of items.
*/
std::vector<Item> Stock::setRandomStock() {
// Get stock of amount of items... | true |
b8437d9b5e5c4d25c9a011932290b0bc61ce0166 | C++ | johnbower2012/devel | /old/old_bayes/prior/prior.cpp | UTF-8 | 2,460 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<random>
#include<chrono>
#include<fstream>
#include<string>
#include "time.h"
#include "memory.cpp"
#include "armadillo"
std::ofstream ofile;
int main(int argc, char* argv[]){
int i, j, k,
length, input_values, samples;
unsigned seed;... | true |
ba8f0c7e4a3d587d8415dce6d91e398d9834f2a0 | C++ | jariasf/Online-Judges-Solutions | /UVA/Volume 114 (11400 - 11499)/11494 - Queen.cpp | UTF-8 | 541 | 3.3125 | 3 | [] | no_license | /*****************************************
***Problema: Queen
***ID: 11494
***Juez: UVA
***Tipo: Ad hoc
***Autor: Jhosimar George Arias Figueroa
******************************************/
#include <stdio.h>
int abs( int x ){
if( x < 0 ) x = -x;
return x;
}
int main(){
int x1 , y1 , x2 , y2;
wh... | true |
bb62bd0118b341ee111eeaf3d7e99e26e34fd9b7 | C++ | Mikanwolfe/SodukuChecker | /SodukuChecker/main.cpp | UTF-8 | 2,557 | 3.796875 | 4 | [] | no_license | //Sudoku Checker
#include <iostream>
using namespace std;
bool checkRow(int lBoard[9][9], int rowIndex) {
int rowArray[9] = { 0 };
int element = 0;
bool isGood = true;
for (int i = 0; i < 9; i++) {
element = lBoard[rowIndex][i];
if (element != 0) {
rowArray[element-1]++;
if (rowArray[element - 1] > 1)... | true |
99af8110945635c2cbe9680cdbf10e9b8f655fbe | C++ | baslack/CS5310-a0 | /Tests/TEST_sorts.cpp | UTF-8 | 670 | 2.921875 | 3 | [] | no_license | /**
* Benjamin A. Slack
* CS5310, Summer 1 2017
* a0, Selection Sort
* 05.13.17
* benjamin.slack@wmich.edu
*/
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "../sorts.h"
TEST(selection_sort, reverse){
vector<int> test;
for (int i = 15; i >= 0; i--){
test.push_back(i);
... | true |
856f083d7ce211551ed16c28d0a3a5d23c113915 | C++ | if1live/cocos2d-x-ani | /Classes/xml_reader.cpp | UTF-8 | 3,240 | 2.734375 | 3 | [] | no_license | // Ŭnicode please
#include "stdafx.h"
#include "xml_reader.h"
#include "xml_node.h"
#include <iostream>
#include <memory>
#include "assert_include.h"
#include <sstream>
#include <tinyxml/tinyxml.h>
using namespace std;
namespace sora {;
// tinyxml based implementation
class XmlReaderImpl {
public:
... | true |
d11f30e13a34595a3692df61d7032c2f7b35183f | C++ | razmikTovmas/Graph | /include/impl/_graph_iterator.hpp | UTF-8 | 3,247 | 3.03125 | 3 | [
"MIT"
] | permissive | #pragma once
namespace impl
{
////////////////////////////////////////////////////////////////////////////////
///// graph::iterator
////////////////////////////////////////////////////////////////////////////////
graph::iterator::iterator(const graph& g, node* n, iter_type type)
: m_type(type)
, m_node(n)
... | true |
8a27d3f5d5f74487f734b20996ed16fff0f266e8 | C++ | BaiMoHan/AlgorithmUpCpp_ING_20200701 | /剑指Offer_II/23_EntryNodeInListLoop/code.cpp | UTF-8 | 1,197 | 3.328125 | 3 | [] | no_license | struct ListNode
{
int m_nValue;
ListNode* m_pNext;
};
ListNode* MeetingNode(ListNode* pHead)
{
if(pHead==nullptr)
return nullptr;
ListNode *pSlow=pHead->m_pNext;
if(pSlow==nullptr)
return nullptr;
ListNode *pFast=pSlow->m_pNext;
while (pFast!=nullptr&&pSlow!=nullptr)
... | true |
47fe7128cc784d71a83ef6fd730359e86d71c19e | C++ | corinrose/Intro-to-Programming-2013- | /Game of Life Folder/GameObject.h | UTF-8 | 379 | 2.71875 | 3 | [] | no_license | #ifndef GAMEOBJECT_H
#define GAMEOBJECT_H
#include <vector>
class GameObject
{
public:
GameObject(int xVal, int yVal, char dispVal);
void display(std::vector<std::vector<char> > &world);
void moveObj(int mx, int my, std::vector<std::vector<char> > &world);
protected:
int x;
... | true |
91ed510dc8b38d149ca3cdae187abbd1fc88d8f7 | C++ | huangshenno1/algo | /模板/Hungarian.cpp | UTF-8 | 583 | 2.875 | 3 | [
"MIT"
] | permissive | //Hungarian
#include <cstdio>
#include <cstring>
const int maxn = 505;
int un,vn;
int g[maxn][maxn];
int link[maxn];
bool vis[maxn];
bool dfs(int u)
{
for (int v = 0; v < vn; v++)
{
if (g[u][v] && !vis[v])
{
vis[v] = 1;
if (link[v]==-1 || dfs(link[v]))
{
link[v] = u;
retur... | true |
f35ccfc84ecccf79d09b07fd0bf86ecce1b1615b | C++ | janek-bieser/glsl-preview | /glsl-preview-app/glview/shaderuniformlist.h | UTF-8 | 1,496 | 2.828125 | 3 | [
"MIT"
] | permissive | #ifndef SHADERUNIFORMLIST_H
#define SHADERUNIFORMLIST_H
#include <QAbstractListModel>
#include <QHash>
#include "shaderuniform.h"
/*!
* \brief Represents the list of all found uniforms. The ShaderUniformList
* can be used as ListModel inside the QML User Interface.
*/
class ShaderUniformList : public QAbst... | true |
c6e9857318bbabd7ef30b72292063eb6303d5156 | C++ | FelixKimmerle/Informatik-II | /Blatt10/10_3_b.cpp | UTF-8 | 1,484 | 3.65625 | 4 | [] | no_license | #include <vector>
#include <iostream>
class tier
{
public:
tier(std::string p_art);
~tier();
virtual void hallo(std::string prefix);
private:
std::string art;
};
tier::tier(std::string p_art = "ein Tier")
{
art = p_art;
}
tier::~tier()
{
}
void tier::hallo(std::string prefix)
{
std::cout <<... | true |
93dbb6e4b777012ccd6f5766eccccd7c15f7f910 | C++ | liuzhenghuia/programming | /oj/leetcode/src/leetcode80.cpp | UTF-8 | 591 | 2.78125 | 3 | [] | no_license | #include <vector>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int n = nums.size();
if(n < 3) return n;
int repeatTimes = 1;
int curIndex = 0;
for(int i=1;i<n;i++){
if(nums[curIndex] == nums[i]){
if(repea... | true |
dfa0691537e32e4e16639b5b41fd8f43b4a95f97 | C++ | jfwyble/udacity-linux-sys-mon | /src/format.cpp | UTF-8 | 568 | 3.375 | 3 | [
"MIT"
] | permissive | #include <string>
#include <iomanip>
#include <sstream>
#include "format.h"
using std::string;
// INPUT: Long int measuring seconds
// OUTPUT: HH:MM:SS
string Format::ElapsedTime(long seconds)
{
long hours = seconds / 3600;
// To get the minutes, get the modulus of
int minutes = (seconds % 3600) / 60;
... | true |
698f252d19c32a52455bd85bb924cd307c189ff2 | C++ | wxx5433/USACO | /gift1.cpp | UTF-8 | 1,580 | 3.25 | 3 | [] | no_license | /*
ID: wxx54331
PROG: gift1
LANG: C++
*/
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
using namespace std;
struct personStruct {
string name;
int initialMoney;
int finalMoney;
};
ifstream fin("gift1.in");
int getIndex(string name, vector<personStruct> person, int number);
int distribu... | true |
7602d7214c02bcb8d80790fed2b36be80f62959b | C++ | 3IFBinomeB3121/TP_C-_Analog | /B3121/Log.h | UTF-8 | 5,190 | 2.8125 | 3 | [] | no_license | /*************************************************************************
Log - description
-------------------
début : 10/01/2018
copyright : (C) 2018 par Christophe ETIENNE & William Occelli
e-mail : christo... | true |
53fa8c70942dc85b97d55e398b31c257c1dbf26f | C++ | yangzhiye/Algorithm | /北大算法课/枚举/熄灯问题.cpp | UTF-8 | 1,057 | 2.765625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int puzzle[6][8],press[6][8];
bool guess(){
int c,r;
for(r = 1 ; r < 5 ; ++r)
for(c = 1 ; c < 7 ; ++c){
press[r+1][c] = (puzzle[r][c]+press[r][c]+press[r-1][c]+press[r][c-1]+press[r][c+1])%2;
}
for(c = 1 ; c < 7 ; ++c){
if((press[5][c-1]+press[5][c]+press[5][c+1]+... | true |
0ee8a9e9bde1793bf6f9573ab9f0493baf183a0c | C++ | zontar/ProjectEuler | /euler/task4.cpp | WINDOWS-1251 | 744 | 3.59375 | 4 | [] | no_license | #include "task.h"
const std::string taskName = "Task4";
/*
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
/*
100000a + 10000b + 1000c + 100c + 10b + a... | true |
ea4b828d85a867f8cb81a6068409751fbd287dfb | C++ | aartic88/msl | /tests/LinkedStack_test.cpp | UTF-8 | 979 | 2.859375 | 3 | [] | no_license | #include "LinkedStack.hpp"
#include "LinkedDeque.hpp"
#include "LinkedQueue.hpp"
#include <gtest/gtest.h>
using namespace std;
TEST(testIsLinkedList, StackTest) {
LinkedStack<int> greekGod;
greekGod.push(345);
greekGod.push(23);
greekGod.push(67);
greekGod.print();
greekGod.pop();
greekGod.print();
//gr... | true |
dbdc70e86c86cc7762628085838e712d41bf7e1a | C++ | tc-irl/GameEngine | /GameEngine/Triangle.cpp | UTF-8 | 5,752 | 3.046875 | 3 | [] | no_license | #include "Triangle.h"
Triangle::Triangle(GLuint shaderID, Particle *p1, Particle *p2, Particle *p3, int ID)
{
this->shaderID = shaderID;
this->p1 = p1;
this->p2 = p2;
this->p3 = p3;
this->ID = ID;
GenerateBuffer();
drawTriangle = true;
}
void Triangle::GenerateBuffer()
{
points.clear();
normals.push_bac... | true |
b4ebc2d907aebb89a60d55dd168f6e03048bc716 | C++ | bramwellandcompanyinc/GitPublic | /Navasim/WaveModel_v10/QuadTree.h | UTF-8 | 7,963 | 3.015625 | 3 | [] | no_license | #include <Geometry/Primitives.h>
class IQuadTreeNode
{
};
//we can implement this class later on to make the parameter passing for the quadtreenode constructor a little cleaner and limit the amount of
//stuff we need to pass on the stack. it will basically have left col, right col, top row, bottom row.
class QuadTr... | true |
e5291e975b32ba86a59595e6708ea6d04c31d33b | C++ | networkit/networkit | /networkit/cpp/centrality/LocalClusteringCoefficient.cpp | UTF-8 | 3,074 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <omp.h>
#include <networkit/centrality/LocalClusteringCoefficient.hpp>
namespace NetworKit {
LocalClusteringCoefficient::LocalClusteringCoefficient(const Graph &G, bool turbo)
: Centrality(G, false, false), turbo(turbo) {
if (G.isDirected())
throw std::runtime_error("Not implemented: Local cl... | true |
557dc0863ef145ab060b128f2662aef179fbc409 | C++ | leeroun/PS | /NoComment/1339.cpp | UTF-8 | 490 | 3.109375 | 3 | [] | no_license | //±×¸®µð
//Gold 5
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
int alphas[26] = { 0, };
string s;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
for (int j = 0; j < s.size(); j++) {
alphas[s[j] - 'A'] += pow(10, s.size() - j) / ... | true |
ef0e982b5aee8a287e88855b32824e085ad0bffb | C++ | webpigeon/miscellany | /ideas/opengl-world/world.cpp | UTF-8 | 2,309 | 2.984375 | 3 | [] | no_license | #include <GL/glut.h>
void setMaterial ( GLfloat ambientR, GLfloat ambientG, GLfloat ambientB,
GLfloat diffuseR, GLfloat diffuseG, GLfloat diffuseB,
GLfloat specularR, GLfloat specularG, GLfloat specularB,
GLfloat shininess ) {
GLfloat ambient[] = { ambientR, ambientG, ambientB };
GLfloat diff... | true |
7341c60f8c5be979447092a51661c4b303e3c581 | C++ | dSyncro/Yac | /Projects/Yac/Yac/Syntax/Statements/WhileStatement.h | UTF-8 | 577 | 2.984375 | 3 | [] | no_license | #pragma once
#include "Statement.h"
#include <Yac/Syntax/Expressions/Expression.h>
namespace Yac {
struct WhileStatement final : Statement {
public:
WhileStatement(Expression* condition, Statement* statement) : Statement(StatementType::While), _condition(condition), _statement(statement) {}
~WhileStatement()... | true |
ad78d98f43ead3b841a0d5d77384cb84af306bd6 | C++ | For-Bob/trunk | /note/design_mode/代码和描述/Observer/Observer/main.cpp | UTF-8 | 532 | 2.578125 | 3 | [] | no_license | #include "concreteobservera.h"
#include "concreteobserverb.h"
int main()
{
shared_ptr<ConcreteObserverA> ObA = make_shared<ConcreteObserverA>();
shared_ptr<ConcreteObserverB> ObB = make_shared<ConcreteObserverB>();
shared_ptr<Subject> sub = make_shared<Subject>();
sub.get()->addObserver(ObA.get());
... | true |