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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9242f211e6ccc6774c15a7570a7adacec00e867c | C++ | yazyyyyy/Leetcode_Problems | /Array problems/threeSum.cpp | UTF-8 | 1,218 | 3.234375 | 3 | [] | no_license | //Problem link: https://leetcode.com/problems/3sum/
class Solution {
public:
vector<vector<int> > threeSum(vector<int>& nums) {
vector<vector<int> >ans;
sort(nums.begin(), nums.end());
for(int i=0; i<(int)nums.size()-2; i++){
if(i==0 || (i>0 && nums[i]!=nums[i-1])){
... | true |
ee8c1f1384c5ee5183cf6218439ad9131cd78e00 | C++ | openbmc/openpower-occ-control | /test/occ_dbus_test.cpp | UTF-8 | 2,151 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #include <occ_dbus.hpp>
#include <gtest/gtest.h>
using namespace open_power::occ::dbus;
TEST(OccDBusSensors, MaxValue)
{
std::string tmpPath = "/abc/def";
double maxValue = 100.00;
double retMaxValue = 0;
OccDBusSensors::getOccDBus().setMaxValue(tmpPath, maxValue);
retMaxValue = OccDBusSensors::... | true |
16e6b843ee2cc52e9775fa716b862155e93a8c8f | C++ | LogicFan/Project-OpenCLe | /src/memory/global_ptr_base.cpp | UTF-8 | 1,206 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "global_ptr_base.hpp"
#include "global_ptr_impl.hpp"
namespace opencle
{
global_ptr_base::global_ptr_base(std::unique_ptr<global_ptr_impl> &&impl)
: impl_{std::move(impl)}
{
}
global_ptr_base::global_ptr_base(size_t size, bool read_only = false)
: impl_{std::make_unique<global_ptr_impl>(size, read_on... | true |
6d3e58178d4eb88cb192f4ce4e599d8b493bac9e | C++ | AhmdNassar/problem-solving | /codeforces/Effective Approach.cpp | UTF-8 | 572 | 2.59375 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define lo(n) for(int k = 0; k<n; k++)
#define ll long long int
#define ull unsigned long long int
int main()
{
int n, m, q, temp;
ll leftCnt = 0, rightCnt = 0;
cin>>n;
int numbers[n]{-1};
fill_n(number... | true |
630ba2e4bb3f2db4368f0ed5418036713ea7e33c | C++ | jumbagenii/CP-DSA-Cpp-C | /April_Leetcode_challenge/Problem1_SingleNumber.cpp | UTF-8 | 327 | 2.5625 | 3 | [] | no_license | class Solution {
public:
int singleNumber(vector<int>& nums) {
long int i,j,flag;
sort(nums.begin(),nums.end());
for(i=0;i<nums.size()-1;)
{
if(nums[i]==nums[i+1])
i+=2;
else
break;
}
return nums[i];
... | true |
cd6c76521ec59018e4da881aa907c458ddc03d51 | C++ | mengdiwang/ROBDD | /nqueentest.cpp | UTF-8 | 638 | 2.578125 | 3 | [] | no_license | //
// main.cpp
// nqueentest
//
// Created by Mengdi Wang on 13-5-16.
// Copyright (c) 2013年 Mengdi Wang. All rights reserved.
//
#include <iostream>
#include <stdio.h>
#include "nqueen.h"
int main(int argc, const char * argv[])
{
int n = 8; /* board of size n*n */
Nqueen *nq = new Nqueen(n);
int r ... | true |
03de6d6c06e1c0b67990991914b51838520fbc6b | C++ | Evil-crow/platinum | /src/.1.0/src/http_response.cc | UTF-8 | 913 | 2.921875 | 3 | [
"MIT"
] | permissive | /*
* Created by Crow on 8/24/18.
* Description: the class http_response inherit from httpxx::ResponseBuilder
*/
#include <string>
#include <iostream>
#include "http_response.h"
bool PlatinumServer::http_response::set_header(std::string &&key, std::string &&val)
{
this->headers().insert(std::make_pair(std::move(... | true |
5120fe410c554ccd643423c3f482915ced497e1f | C++ | zachlambert/platform | /sceneManager.cpp | UTF-8 | 419 | 2.703125 | 3 | [] | no_license |
#include "scene.h"
#include <memory>
#include <string>
class SceneData{
public:
SceneData(){}
private:
std::string name;
std::unique_ptr<Scene> scene;
};
class SceneManager: public sf::Drawable{
public:
SceneManager(){}
virtual void handleEvent(sf::Event){}
virtual void update(float);
virtual void draw(sf::... | true |
87d862b55e81872701ac629f34692e2b899b6698 | C++ | jankroken/aoc2018 | /day4/cpp/accumulators.cpp | UTF-8 | 1,322 | 2.953125 | 3 | [] | no_license | #include "accumulators.h"
#include <set>
#include <list>
#include "sleeprecords.h"
using namespace std;
map<int,int> minutesAsleepByGuard(list<SleepRecord> records) {
map<int, int> result{};
for (auto rec: records) {
auto it = result.find(rec.guardId);
if (it != result.end()) {
i... | true |
1dab350f4ee1cabbfb28bf809c3ff7b09b1cf07b | C++ | jmhong-simulation/LithopiaOpen | /Engine/Geometry/StaticTriangle.h | UTF-8 | 3,004 | 2.84375 | 3 | [
"MIT"
] | permissive | // The Lithopia project initiated by Jeong-Mo Hong for 3D Printing Community.
// Copyright (c) 2015 Jeong-Mo Hong - All Rights Reserved.
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
#pragma once
#include "GENERIC_DEFINITIONS.h"... | true |
f4bc8ad26ee33bf4a563403f1ee530c16da2b710 | C++ | sebsprojects/CPHemeral | /rendering/src/opengl/ShaderProgram.h | UTF-8 | 830 | 2.59375 | 3 | [] | no_license | #ifndef SHADER_PROGRAM_H_
#define SHADER_PROGRAM_H_
#include <string>
#include <set>
#include "AttributeFormat.h"
namespace cph {
class ShaderProgram {
private:
GLuint vertHandle, fragHandle, programHandle;
bool initialized, linked;
std::set<AttributeFormat> attribFormat;
std::string shaderId, vertSource, fr... | true |
972d49ab180f7f97c30f19f0bd9fab4bbf27b580 | C++ | taetinn/Algo_BOJ | /ssibal/ssibal/boj16430.cpp | UTF-8 | 195 | 2.515625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int a, b, tmp=0;
cin >> a >> b;
tmp = b - a;
cout << tmp << ' ' << b << '\n';
return 0;
} | true |
3ff2be727a3486cefc6a2863c8355bab3e09803c | C++ | 2719896135/- | /NOIP-master/2008/drawing/drawing.cpp | UTF-8 | 2,410 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
#include <memory.h>
#include <string.h>
const char* block[] = {"+---+",
"/ /|",
"+---+ |",
"| | +",
"| |/",
"+---+"};
#define MAX_WIDTH 50
#define MAX_DEPTH 50
#define MAX_HEIGHT 100
ch... | true |
5b1aae430d5f2bd7c93b14d82eca0cdeddb82617 | C++ | ORNL-Fusion/xolotl | /xolotl/util/include/xolotl/util/Log.h | UTF-8 | 2,005 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
#include <iomanip>
#include <sstream>
#include <boost/log/attributes/named_scope.hpp>
#include <boost/log/sources/global_logger_storage.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/sources/severity_logger.hpp>
namespace xolotl
{
namespace util
{
/**
* @brief Serves as namesp... | true |
8ff46b6dd3efff81179366d1b93ee9ff356d28cc | C++ | misiekc/rsa3d | /rsa3d/shape/shapes/polydisk/Fibrinogen.cpp | UTF-8 | 2,356 | 3.09375 | 3 | [] | no_license | //
// Created by pkua on 04.09.2019.
//
#include <sstream>
#include "Fibrinogen.h"
/**
* @brief Initializes Polydisk class so it represents linear fibrinogen particle, consisting in medium disk connected
* with 2 large disks at the ends by chains of small disks.
* @param attr parameters in format: (radius of larg... | true |
381c29b5b4970e251abbcdb62cb8daf618f7b66a | C++ | djabraham/cordova-ionic-bean | /docs/sketches/BeanSDK/3.LowPower/EnableWakeOnConnection/EnableWakeOnConnection.ino | UTF-8 | 773 | 3.4375 | 3 | [
"MIT"
] | permissive | /*
This sketch shows how to use the enableWakeOnConnect() function.
In this example the LED is turned on when the Bean is awake.
To save power the Bean will be put to sleep when it's not connected to another device,
and woken up when it's connected to by using enableWakeOnConnect().
This example code i... | true |
e9376452811862222212ec2250bfbe99b0a4d570 | C++ | twxjyg/CarND-Extended-Kalman-Filter-Project | /src/tools.h | UTF-8 | 1,917 | 2.765625 | 3 | [
"MIT"
] | permissive | #ifndef TOOLS_H_
#define TOOLS_H_
#include <vector>
#include "Eigen/Dense"
class Tools {
public:
/**
* A helper method to calculate RMSE.
*/
static Eigen::VectorXd CalculateRMSE(const std::vector<Eigen::VectorXd>& estimations,
const std::vector<Eigen::VectorXd>& groun... | true |
c2f23bf11f11810862ad04d780801028f5bf11df | C++ | anjinhyuk/Algorithms | /Priority.cpp | UTF-8 | 3,166 | 2.984375 | 3 | [] | no_license | #include "stdafx.h"
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include<cmath>
#include <math.h>
#include<conio.h>
#include<limits>
using namespace std;
vector<int> A;
int numLines;
int heapSize;
//left heap
int Left(int i){
ret... | true |
083359623d175ea24edcd7af4bedeac2d26168cb | C++ | MotionPlanning-YC/ramp | /trajectory_generator/include/trajectory_generator_fixtureTest.h | UTF-8 | 2,289 | 2.609375 | 3 | [] | no_license | /*
* File: trajectory_generator_fixtureTest.h
* Author: Annaliese Andrews, PhD
* Author: Mahmoud Abdelgawad, PhD Candidate
* University of Denver
* Computer Science
* Created on December 9, 2015, 1:24 PM
*/
#ifndef TRAJECTORY_GENERATOR_FIXTURETEST_H
#define TRAJECTORY_GENERATOR_FIXTURETEST_H
// include goo... | true |
777e0ff55fc05a3d3d3e9aa84dc43190893e53a7 | C++ | AntonioHernandez28/InterviewUltimateGuide | /Intervals/Intervals.cpp | UTF-8 | 992 | 3.3125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
vector<vector<int>> MergeLists(vector<vector<int>> A, vector<vector<int>> B){
int s = INT_MIN, e = INT_MIN, i = 0, j = 0;
vector<vector<int>> res;
while(i < A.size() || j < B.size()){
vector<int> curr(2,-1);
if(i >= A.size()) cur... | true |
d554d00f7f22a46a1eac6db3957b831db51ad99a | C++ | alinabi/NRE | /nre/apps/vancouver/bus/bus.h | UTF-8 | 3,908 | 2.75 | 3 | [] | no_license | /** @file
* Bus infrastucture and generic Device class.
*
* Copyright (C) 2007-2009, Bernhard Kauer <bk@vmmon.org>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of Vancouver.
*
* Vancouver is free software: you can redistribute it and/or modify
* it under the terms of the G... | true |
8e24092172eb4321aed89910e2e6d360cc3d91a7 | C++ | ORNL-CEES/DataTransferKit | /packages/Utils/src/DTK_DBC.hpp | UTF-8 | 7,297 | 2.515625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | /****************************************************************************
* Copyright (c) 2012-2020 by the DataTransferKit authors *
* All rights reserved. *
* *
* This ... | true |
19b08f861ef3117442e4e75029473d875c8cf2ff | C++ | jk983294/Explore | /lsp/process/schedule/setscheduler.cpp | UTF-8 | 993 | 2.984375 | 3 | [] | no_license | #include <sched.h>
#include <stdio.h>
void get_current_scheduler() {
int policy = sched_getscheduler(0);
switch (policy) {
case SCHED_OTHER:
printf("policy is normal\n");
break;
case SCHED_RR:
printf("policy is round-robin\n");
break;
case... | true |
897bb37df119f5257abb6d96619893d848d613bd | C++ | kim-online/KIMKOEHLERCODE2 | /HW3/Ball.hpp | UTF-8 | 485 | 2.546875 | 3 | [] | no_license | //
// Ball.hpp
// myOOPS
//
// Created by Kim Köhler on 26/02/16.
//
//
#ifndef Ball_hpp
#define Ball_hpp
#include <stdio.h>
#include "ofMain.h"
class Ball{
public:
//constructor
Ball();
//variabels
float x, y, z;
float xSpeed, ySpeed, zSpeed;
float change;
int dim;
... | true |
b9dfd73f6cf785f37dfa7b16fa4c62f86de5d60e | C++ | liangzai90/Coding-Interviews | /02 替换空格.cpp | GB18030 | 751 | 3.890625 | 4 | [] | no_license | /*2ʵһһַеĿո滻ɡ%20
磬ַΪWe Are Happy.滻ַ֮ΪWe%20Are%20Happy*/
class Solution {
public:
void replaceSpace(char *str, int length) {
int OldLength = 0;
int NewLength = 0;
int BlankLength = 0;
while (str[OldLength] != '\0'){
if (str[OldLength] == ' '){
BlankLength++;
}
OldLength++;
}
Ne... | true |
ecdec4c1e688cd92e3a18cab8448e38e88f744ac | C++ | pablorecio/KGLT | /kglt/ui/label.h | UTF-8 | 845 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | #ifndef LABEL_H
#define LABEL_H
#include <tr1/memory>
#include "../generic/identifiable.h"
#include "element.h"
#include "types.h"
namespace kglt {
class Text;
class UI;
namespace ui {
class Label :
public Element,
public generic::Identifiable<LabelID> {
public:
typedef std::tr1::shared_ptr<Label> pt... | true |
3fd3767d06331d81aa0821a03128d6757a0be1d3 | C++ | hermann-p/segemehl-visual | /utils.cpp | UTF-8 | 1,403 | 2.96875 | 3 | [] | no_license | #include "utils.h"
#include "genome.h"
#include <iostream>
#include <vector>
#include <string>
#include <memory>
void log ( const std::string msg ) {
std::cout << msg << std::endl;
}
bool assume ( const bool isGood, const std::string msg, bool fatal ) {
if (!isGood) {
if (fatal) {
std::cerr << "Error... | true |
80b79ed7a367a787736527a626ebeef7da0879d0 | C++ | westlicht/performer | /src/platform/sim/sim/frontend/Common.h | UTF-8 | 1,908 | 2.96875 | 3 | [
"freertos-exception-2.0",
"MIT",
"GPL-2.0-or-later"
] | permissive | #pragma once
#include "Vector.h"
#include <SDL.h>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <iostream>
#include <functional>
#include <cstdint>
#include <cmath>
namespace sim {
static const float PI = 3.141592653589793f;
static const float TWO_PI = 6.283185307179586f;
class C... | true |
20234fa8bf74fa45e739c4072d39255b2b01a71a | C++ | episkipoe/Agents | /organism_libraries/common/shmem.cpp | UTF-8 | 1,411 | 2.78125 | 3 | [] | no_license | #include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
#include <string.h>
#include <string>
void push_to_shared_memory(int key, char * data, int size) {
printf("push %i := %i%i\n", size, data[0], data[1]);
int shmid = shmget(key, size, IPC_CREAT | 0666);
if(shmid<0) return ;
char * sh... | true |
a93857501514e12525a199a498524e979f78415c | C++ | ChrisJorisBol/CSD2 | /inheritance/winds.cpp | UTF-8 | 272 | 2.5625 | 3 | [] | no_license | //winds.cpp
#include "winds.h"
#include <iostream>
#include <string>
using namespace std;
Winds::Winds(string sound) : Instrument(sound)
{
// this->sound = timbre;
cout << "\nConstructor - Winds\n";
// cout << "\nThis sounds like = " << timbre << "\n";
};
| true |
8fef998ac1ed53ceebbfae735b8e7d031556b91d | C++ | alexandraback/datacollection | /solutions_2449486_1/C++/NilayVaish/B.cpp | UTF-8 | 1,140 | 2.546875 | 3 | [] | no_license | #include<cstdio>
#include<algorithm>
int G[105][105];
int H[105][105];
int main()
{
int T;
scanf("%d\n",&T);
for (int ii = 1; ii <= T; ++ii)
{
int N, M;
scanf("%d %d\n", &N, &M);
for (int i = 0; i < N; ++i) for (int j = 0 ;j < M; ++j)
{
scanf("%d", G[i]+j);... | true |
15e01bd4cde45f931245e11886871dc9a706ff5c | C++ | sympe/practice | /aizu/ITP/1_1/C.cpp | UTF-8 | 201 | 2.78125 | 3 | [] | no_license | #include <cstdio>
#include <math.h>
int main ()
{
int x;
int y;
int S;
int L;
scanf("%d", &x);
scanf("%d", &y);
S = x * y;
L = x * 2 + y * 2;
printf("%d %d\n", S, L);
return 0;
} | true |
058cabbca2c7ca96340da5414ab4e3ae9f38481a | C++ | HORSESUNICE/PATB | /1038.cpp | GB18030 | 1,502 | 3.125 | 3 | [] | no_license | //1038. ͳͬɼѧ(20)
//
//ʱ
//250 ms
//ڴ
//65536 kB
//볤
//8000 B
//
//Standard
//
//CHEN, Yue
//ҪNѧijɼijһѧ
//
//ʽ
//
//ڵ1и105Nѧ
//1иNѧİٷɼмԿոָ1иҪѯķKN
//KмԿոָ
//
//ʽ
//
//һаѯ˳÷ֵָѧмԿոָĩжո
//
//
//10
//60 75 90 55 75 99 82 90 75 50
//3 75 90 88
//
//3 2 0
//idea:
//1032
//ʼvectorcount-6ʱ
//ijͨ... | true |
c836e569e692c1add0c4edcf568c232a908652e3 | C++ | Samiatrix/Leetcode-Problems | /reorder-data-in-log-files/reorder-data-in-log-files.cpp | UTF-8 | 1,266 | 2.921875 | 3 | [] | no_license | class Solution {
public:
vector<string> reorderLogFiles(vector<string>& logs) {
vector<pair<string, string>> letter;
vector<pair<string, string>> digits;
for(auto s:logs){
string identifier = "";
string log="";
bool spaceFound = false;
for(int ... | true |
0ec08a651d79b733131093ceb4d03986088881e5 | C++ | fightingsleep/Pleasantville485 | /common/controls.cpp | UTF-8 | 6,516 | 2.640625 | 3 | [] | no_license | #include <GL/glew.h>
#include <glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <stdio.h>
#include "init.hpp"
#include "controls.hpp"
#include "window.hpp"
bool renderDepthTexture = false;
// Camera vectors
glm::vec3 position = glm::vec3(0, GROUND_Y_VALUE, -1);
glm::vec3 direction = gl... | true |
5eae319a27eec1b51ae1628c21e08dcbba22873f | C++ | tastelife/WX3000 | /WXMemDataVector.h | GB18030 | 1,914 | 2.796875 | 3 | [] | no_license | //WXMemDataVector.h
#pragma once
#include <vector>
template<class _Ty>
class CWXMemDataVector : public std::vector<_Ty>
{
public:
CWXMemDataVector()
{
}
~CWXMemDataVector()
{
}
inline void Add(const _Ty& tNewData)
{
push_back(tNewData);
}
//ɾ
inline int Delete(const _Ty& tCurrent)
{
int nRtn = 0;
... | true |
7dcd9ef5c1f7c07cdd3ea351bb296c7f266c6ad0 | C++ | cpprhtn/ML-DL-with-cpp | /Make_ML_Models/NaiveBayes_Model/naive_bayes.cpp | UTF-8 | 5,252 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <utility>
#include "naive_bayes.h"
using namespace std;
NaiveBayesClassifier::NaiveBayesClassifier() {
;
}
NaiveBayesClassifier::NaiveBayesClassifier(
int Max_n, int Min_p, const string& train_data,
const string& voca_data, cons... | true |
2dc9f9656913d769edd2b9426bcc40761d08af53 | C++ | lacrymose/3bem | /unit_tests/test_numbers.cpp | UTF-8 | 414 | 3.109375 | 3 | [] | no_license | #include "catch.hpp"
#include "numbers.h"
using namespace tbem;
TEST_CASE("Range", "[numbers]") {
auto nats5 = range(-1, 8);
double correct[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7};
REQUIRE_ARRAY_EQUAL(nats5, correct, 9);
}
TEST_CASE("Linspace", "[numbers]") {
auto vals = linspace(0.0, 1.0, 10);
REQUIRE(... | true |
b643cf42a1dd04da69364f6ce3c380046af636fe | C++ | RabbiAmin/Sudoku | /Suduku01.cpp | UTF-8 | 2,834 | 3.390625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define UNASSIGNED 0 // for unassigned value
#define N 9 //sudoku size N*N
bool UnassignedAddress (int cell[N][N],int &row, int &colum);
bool legal(int cell[N][N], int row, int colum, int number);// Checks its legal or not
bool solution(int cell[N][N])
{
int r... | true |
cddbcf80d63863da94582f2c169d469725a139be | C++ | zchen0211/topcoder | /cc/leetcode/035_search_insert.cc | UTF-8 | 380 | 3.03125 | 3 | [] | no_license | #include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int n = nums.size();
int i = 0, j = n;
while (i < j) {
int mid = (i + j) / 2;
if (nums[mid] > target)
j = mid;
else if (nums[mid] == target)
return mid... | true |
2b1df24386b669523b281a77f670dd7e9a9a86e6 | C++ | Dopiz/DesignPattern-Shape | /include/Circle.h | UTF-8 | 364 | 2.859375 | 3 | [] | no_license | #ifndef CIRCLE_H
#define CIRCLE_H
#include "Shape.h"
#include "Point.h"
class Circle : public Shape
{
private:
Point _center;
double _radius;
public:
Circle(double cx, double cy, double radius);
string description();
double perimeter() const;
double area() const... | true |
068099924d164bb986e6afb2edc3d52755f76710 | C++ | Petros89/Algorithms-CPP | /twosum/twosum.cpp | UTF-8 | 1,282 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
class TwoSum
{
public:
static pair<int, int> findTwoSum(const vector<int>&vector_input, int target)
{
unordered_map<int,int> set;
for (size_t i = 0; i < vector_input.size(); ++i)
... | true |
eb3e815cac46c317c456c0e5e8d8f5f4182c8195 | C++ | kpusmo/fem | /Headers/ResultsModel.h | UTF-8 | 783 | 2.515625 | 3 | [] | no_license | #ifndef MES_RESULTSMODEL_H
#define MES_RESULTSMODEL_H
#include <QAbstractTableModel>
#include <vector>
#include "Result.h"
class ResultsModel : public QAbstractTableModel {
public:
explicit ResultsModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &index = QModelIndex()) const override;
in... | true |
2305324f27cf8c513088a4bc1690ff5f60a14e82 | C++ | CarvalhoBarberino/cppAgit | /Vetor201904271215/main.cpp | UTF-8 | 2,733 | 3.890625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <memory>
//void imprimir(int a); //Cópia - C/C++
//void imprimir(int *a); //Endereço - C/C++
//void imprimir(int &a); //Endereço - C++
//void imprimir(int &&a); //Referencia RValue - C++ 11 >
using namespace std;
template <typename T>
class Vetor
{
T *m_elements;
... | true |
bbe8a1e585fd739beed6322e05d21eec7cca5f02 | C++ | awaybrave/leetcode_solution | /anagrams.cpp | UTF-8 | 651 | 3.515625 | 4 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
using namespace std;
class Solution{
public:
vector<string> anagrams(vector<string> &strs){
vector<string> result;
for(int i = 0; i < strs.size(); i++){
bool flag = true;
int s = strs[i].size();
for(int j = 0; j <= s/2; j++){
if(strs[i][j] != strs[... | true |
cd449ca3869ce2315f50f99192bc3b1c9194e29a | C++ | HargovindArora/Programming | /Stacks/reverse_stack_using_recursion.cpp | UTF-8 | 651 | 3.484375 | 3 | [] | no_license | #include<iostream>
#include<stack>
#define endl '\n'
using namespace std;
void insertAtBottom(stack<int> &s, int x){
if(s.empty()){
s.push(x);
return;
}
int y = s.top();
s.pop();
insertAtBottom(s, x);
s.push(y);
}
void reverseStackRec(stack<int> &s){
if(s.empty()){
... | true |
b78265236378bddc84b2c6141e6fa0bfd2f262e4 | C++ | rwols/gintonic | /lib/Graphics/OpenGL/Vertices.cpp | UTF-8 | 27,282 | 2.90625 | 3 | [] | no_license | #include "Graphics/OpenGL/Vertices.hpp"
#include "Graphics/OpenGL/utilities.hpp"
namespace gintonic
{
namespace OpenGL
{
vertex_P::vertex_P(const float px, const float py, const float pz)
{
position[0] = px;
position[1] = py;
position[2] = pz;
}
vertex_P::vertex_P(const vec3f& p)
{
position[0] = p.x;
... | true |
a3a61304bfe990aa9311a505e4a032895fea3a4c | C++ | lasradoVinod/Practice | /RDP/points.cpp | UTF-8 | 1,723 | 3.53125 | 4 | [] | no_license | #include <iostream>
#include "points.hpp"
#include <cmath>
points::points(preUnit xPos, preUnit yPos)
{
x = xPos;
y = yPos;
}
preUnit points::getX()
{
return x;
}
preUnit points::getY()
{
return y;
}
void points::getPoints(preUnit * const xPos, preUnit * const yPos )
{
*xPos = x;
*yPos = y;
}
preUnit poi... | true |
041962123786eca9ef857a13914d7a31fb0eb27a | C++ | roice3/Magic120Cell | /geometryLib/gl/displayList.cpp | UTF-8 | 969 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <stdafx.h>
#include "displayList.h"
CDisplayList::CDisplayList()
{
m_dl = (GLuint)-1;
}
CDisplayList::~CDisplayList()
{
clear();
}
// NOTE: We don't want to transfer control of our display list when copying or assigning.
CDisplayList::CDisplayList( const CDisplayList & )
{
m_dl = (GLuint)-1;
}
CDisp... | true |
0186c033d2818b52871c206fcfc7c6a2b5eb03ee | C++ | peizhang-cn/ComFluSoM | /Library/MLBM/MLBM.h | UTF-8 | 6,336 | 2.609375 | 3 | [] | no_license | #include "../HEADER.h"
#include <LBM.h>
class MLBM
{
public:
MLBM();
~MLBM();
MLBM(DnQm dnqm, CollisionModel cmodel, bool incompressible, int nx, int ny, int nz, double nu, double dc);
void Init(double rho0, double c0, Vector3d initV);
void Solve(int tt, int ts, int scale);
void WriteFileH5(int n, int scale);
... | true |
d3ab06d74b19a4e2bd9a6f16f2e23bceb622529c | C++ | animeshvaibhav/Dynamic-Programming | /LCS_usingIteration.cpp | UTF-8 | 990 | 3.34375 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
int main()
{
string s1,s2;
cout <<"Enter your first string : ";
cin>>s1;
cout<<"Enter your second string : ";
cin>>s2;
int m=s1.length();
int n=s2.length();
int M[m+1][n+1];
for(int i=0;i<=m;i++)
fo... | true |
c916eb4241f48cf7aae8793a1669abe69ff1b98e | C++ | hoboaki/oldcode | /textga/textga_cpplib/trunk/include/textga/tag/AbstractElement.hpp | SHIFT_JIS | 882 | 3.046875 | 3 | [] | no_license | /**
* @file
* @brief Element̒ۃNXLqB
*/
#pragma once
//------------------------------------------------------------
#include <textga/tag/IElement.hpp>
//------------------------------------------------------------
namespace textga {
namespace tag {
/**
* @brief Element̒ۃNXB
* Õ|C^Ɨvf̎... | true |
572ca93a8c65f7d827a0b568d8d69f2b10f7c981 | C++ | akramsameer/Problems | /Codeforces/IQ test.cpp | UTF-8 | 721 | 2.703125 | 3 | [] | no_license | //============================================================================
// Name : Working.cpp
// Author : Akram
// Version :
// Copyright : Your copyright notice
// Description : Code c++
//============================================================================
#include <iostream>
using ... | true |
c8013220ccda6840b556db1501b7a4352dee23cc | C++ | rahuls98/cpp-ladder | /Data-Structures/Linked-List/node_int_data_frequency.cpp | UTF-8 | 1,524 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include <unordered_map>
std::unordered_map<int, int> frequency = {};
class Node {
public:
int data;
Node* next;
Node(int data, Node* next){
this->data = data;
this->next = next;
}
};
void traverse(Node** head_ptr) {
Node* temp = (*head_ptr);
... | true |
6de355e466c07072f247306233a23a9e6f871a2d | C++ | RaphPich/gimenezpichonwernerxanh | /src/shared/state/Entite.cpp | UTF-8 | 1,003 | 3 | 3 | [] | no_license | #include "Entite.h"
using namespace state;
Entite :: Entite(Caracteristiques& caracteristiques, Position& position,
std::string& nom){
this->caracteristiques = caracteristiques;
this->position = position;
this->nom = nom;
//this->tileCode ;
}
Entite::Entite()
{
nom = "";
position.setX(0);
position.setY(... | true |
f429b48940c299daf1d0b8301d527cf5b6b6b644 | C++ | IdarV/Arduino | /Exam03/snake/sdreader.cpp | UTF-8 | 1,077 | 2.671875 | 3 | [] | no_license | #include "sdreader.h"
#define highscorefile_str "A.TXT"
#define notsd_str "!sd"
#define sd_str "sd"
#define nofile_str "no file"
#define file_str "file"
// Initialize sd card
void SDReader::init(int cspin){
if(!SD.begin(cspin)){
Serial.println(notsd_str);
} else{
Serial.println(sd_str);
}
}
// Reads hi... | true |
68941b6b1bb652af4a36ff8d3d2ac9aed9f11012 | C++ | jmrocco/Word-Fragment-Organizer | /Message.cpp | UTF-8 | 3,770 | 3.578125 | 4 | [] | no_license | //============================================================================
// Name : Message.cpp
// Author : Juliette Rocco
// Description : Message Ordering
//============================================================================
#include <iostream>
#include "Message.h"
#ifndef MARMOSET_TESTING... | true |
d40a8bc682dd600137be4eab5ec8c6f1461f5557 | C++ | honeytavis/cpp | /Cpp_Primer/5rd/0320/oriented_obj_thread_poll/src/ThreadPool.cc | UTF-8 | 1,224 | 2.8125 | 3 | [
"MIT"
] | permissive | #include "ThreadPool.h"
#include "WorkThread.h"
#include "Task.h"
#include <unistd.h>
#include <stdlib.h>
ThreadPool::ThreadPool(int threadNum, int bufSize)
: _active(true)
, _threadNum(threadNum)
, _bufSize(bufSize)
, _buf(_bufSize)
{
_vecThreads.reserve(_threadNum);
}
ThreadPool::~ThreadPool()
{
if (_active)
... | true |
b4820853583274ce1bb84c7bac41e81a647282ed | C++ | jiangyinzuo/icpc | /search/bfs/catch_that_cow.cpp | UTF-8 | 1,374 | 2.84375 | 3 | [] | no_license | #include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
int s, e;
bool visited[100002] = {false};
struct Step{
int location;
int count;
};
queue<Step> q;
void bfs()
{
Step step;
step.location = s;
step.count = 0;
q.push(step);
visited[step.location] = true;
while(!q.... | true |
0cf474f7348e9fdd82d8d965281d149c5c59cb42 | C++ | MRYoungITO/CPP_Learning | /Definition_Of_Pointers/指针的自减/指针的自减.cpp | GB18030 | 549 | 3.09375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char input[128];
int len;
char tmp;
scanf_s("%s", input, 128);
len = strlen(input);
//1
/*
for(int i=0; i<len/2; i++) {
tmp = input[len-i-1];
input[len-i-1] = input[i];
input[i] = tmp;
}
printf("%s\n", input);
*/
//2
/*
... | true |
fcae44b12de5be1fc7e5d5b65f50461019072786 | C++ | utkarsh235/CPP-Programming | /Filehandling4.cpp | UTF-8 | 317 | 2.953125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
using namespace std;
class name
{
int a,b,c;
public :
void get()
{
ifstream if2;
if2.open("myfile.txt");
char b;
while(if2.eof())
{
b = if2.get();
cout << b ;
}
if2.close();
}
} ;
int main()
{
name n1;
n1.get();
return 0 ;
}
| true |
5829c1a5b78ce93466c2c39164b0ed1cab2bc864 | C++ | delphix/bpftrace | /src/ast/pass_manager.h | UTF-8 | 1,825 | 3 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
namespace bpftrace {
class BPFtrace;
namespace ast {
class Node;
class SemanticAnalyser;
class Pass;
/**
Result of a pass run
*/
class PassResult
{
public:
static PassResult ... | true |
1d0d2a2922b112593032e036967feadf9b45927f | C++ | i20/raytracer | /headers/Vector.hpp | UTF-8 | 883 | 2.859375 | 3 | [] | no_license | #ifndef _VECTOR_HPP
#define _VECTOR_HPP
#include <cstdint>
class Point;
//__device__
class Vector {
private:
float v[4];
public:
static const Vector X;
static const Vector Y;
static const Vector Z;
Vector() = default;
Vector(const float x, const float y, c... | true |
7213b76224d20158966343fb614e6531e5bece6b | C++ | JJ-ing/osPro | /TASK1/CopyByProcesses/main.cpp | UTF-8 | 2,884 | 2.578125 | 3 | [] | no_license |
#include "head.h"
int main() {
//申请共享内存,创建信号灯并初始化
int shareMemIdA = shmget(KEY_SHARE_MEM_A, sizeof(struct ShareM),IPC_CREAT|0666);
int shareMemIdB = shmget(KEY_SHARE_MEM_B, sizeof(struct ShareM),IPC_CREAT|0666);
int semId = semget(KEY_LIGHT, 4, IPC_CREAT|0666);
if(semId==-1){
printf("SemG... | true |
5742b1e12c5968d3e149c6023a0324601a1c2fc2 | C++ | erfenjiao/test01 | /练习/class.cpp | UTF-8 | 1,318 | 3.703125 | 4 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
class Cube
{
public:
void setL(int L)
{
m_L = L;
}
int getL()
{
return m_L;
}
void setW(int W)
{
m_W = W;
}
int getW()
{
return m_W;
}
void setH(int H)
{
m_H = H;
}
int getH()
{
return m_H;
}
... | true |
cd6218d8d841448e04cda3afcfffc9f331d3b5d8 | C++ | shoumique/ai_codes | /dijkstra.cpp | UTF-8 | 3,650 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
#include<vector>
using namespace std;
#define SIZE 100
struct Priority_Queue
{
int node, dis;
bool flag;
} Q[SIZE];
struct node
{
int n, weight;
};
vector<node> adj[SIZE];
int node, edge;
int parent[SIZE];
int dis[SIZE];
int pop()
{
int min = 10000, index = -1;
... | true |
10d4aaacfa67c502eb75e24317bcb82b401558c0 | C++ | BaiGang/codeplex-archived-vrthesis-2010 | /Utils/math/ConvexHull2D.cpp | GB18030 | 4,494 | 2.875 | 3 | [] | no_license | #include "ConvexHull2D.h"
#include <iostream>
ConvexHull2D::ConvexHull2D(void)
{
}
ConvexHull2D::~ConvexHull2D()
{
}
ConvexHull2D::ConvexHull2D(PT2DVEC pts)
{
this->BuildConvexHull(pts);
}
void ConvexHull2D::BuildConvexHull(PT2DVEC pts)
{
int i,j,k=0,top=2;
Point2D tmp;
int inlen;
inlen = ... | true |
4c0a84d4f2648174ba2b565cd79dd9aa913b6b71 | C++ | lhuyuel/LC_CPP | /LC297_Serialize-and-Deserialize-Binary-Tree/solution.cpp | UTF-8 | 1,402 | 3.578125 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
string result = "";
q... | true |
f3823fca680172a9e5c767c8a899e29f5b74df86 | C++ | Noctivagus19/8INF259_Lab1 | /Data_structure_travail1/Dossier.cpp | ISO-8859-1 | 11,436 | 3.21875 | 3 | [] | no_license | //
// Dvelopp par:
// Jean-Michel Plourde PLOJ07029207
// Jean-Pilippe Lapointe LAPJ16078607
//
#include "Dossier.h"
#include <iostream>
#include <string>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
#define NOMPROF 0
#define ANCIENETE 1
#define COURS 2
#define ETUDIANTS 3
//Variable qu... | true |
0da1405cda7ed117571646660a603b9d1425bde1 | C++ | liuzixing/scut | /codechef/easy/Factorial.cpp | UTF-8 | 374 | 2.703125 | 3 | [] | no_license | #include <cstdio>
using namespace std;
int five[20];
int main()
{
int T,n,ans;
five[0] = 5;
for (int i = 1;i < 13;i++)
five[i] = five[i - 1] * 5;
scanf("%d",&T);
while (T--)
{
ans = 0;
scanf("%d",&n);
for (int i = 0;i < 13;i++)
ans += ... | true |
e585366b06ba35096adf51752777063df939ea9c | C++ | tistatos/Medusa | /src/texture.cpp | UTF-8 | 15,590 | 2.75 | 3 | [] | no_license |
#include "texture.h"
using namespace pcl;
pcl::texture_mapping::CameraVector Texture::mCameras;
/**
* @deprecated no longer used
* @brief Save file_name to .obj file
* @details long description
*
* @param file_name The desired file name.
* @param tex_mesh The mesh that you want to save.
* @param precision Set... | true |
f8e784eb680d04daeabd1cc4bd9698f083edb6bf | C++ | starmap0312/leetcode | /longest_substring_wo_repeating2.cpp | UTF-8 | 1,163 | 3.46875 | 3 | [] | no_license | /* - map<char, int> dict;
* - dict[key] = value ==> add if key not in dict, and override if key in dict
* dict[key] ==> if key not in dict, accessing dict[key] will set dict[key] = 0
* - key not in dict ==> dict.find(key) == dict.end()
* dict.count(key) == 0
* - min/max functions =... | true |
5b881580e5547833874a83897dd29bbe46729e2d | C++ | Omar-Radwan/UVA_Solutions | /Volume 114/11408 - Count DePrimes/11408 - Count DePrimes.cpp | UTF-8 | 3,267 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
#define SETPERCISION cout << fixed << setprecision(12)
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define f first
#define s second
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(l... | true |
a12a38f85a37b729d73ca13ccc17ba66e34dc57f | C++ | basant-kumar/Hackerrank | /Algorithm/pangrams.cpp | UTF-8 | 418 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <set>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string s;
// cin>>s;
getline(cin,s);
s.erase(remove(s.begin(), s.end(), ' '), s.end());
transform(s.begin(), s.end(), s.begin(), ::tolower);
set<char> a(begin(s),end(s));
if(a.size()==... | true |
f0aca7f2babdacfdc8d95386b9fede7c805257b3 | C++ | Ckins/c-sicily | /1152/main.cpp | UTF-8 | 3,264 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
struct horse_state {
int cur_pos;
int route[30];
int step;
horse_state() {
cur_pos = 0;
for (int i = 0; i < 30; i++) route[i] = -1;
step = 0;
}
// to construct the next state.
horse_state(int s, int next_pos, ... | true |
254d02eef6e51b95698fb73ed87f2bc31b83e5a7 | C++ | AswinJose8100/Algorithm-Design-and-Data-Structures | /assignment2/human.cpp | UTF-8 | 179 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include "human.h"
human::human(string input1){
choice1=input1;
}
string human::playerchoice(){
return choice1; //returns the choice entered by the player
} | true |
ec56d253562af9db87d158698798fc4bc5fe61df | C++ | Mosh-Bit/programmiersprachen-aufgabenblatt-2 | /source/Uhr.cpp | UTF-8 | 2,975 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "window.hpp"
#include <utility>
#include <cmath>
#include "rectangle.hpp"
#include "circle.hpp"
#include <vector>
#include "color.hpp"
int main(int argc, char* argv[])
{
Window win{std::make_pair(800,800)};
while (!win.should_close()) {
if (win.is_key_pressed(GLFW_KEY_ESCAPE)) {
win.close();
... | true |
59bfc8d226860c519d09999b8042e4d5ac88d464 | C++ | zraul/LeetCode | /FlattenBinaryTreeToLinkedList/FlattenBinaryTreeToLinkedList.h | UTF-8 | 445 | 2.578125 | 3 | [] | no_license | //
// Created by 郑巍 on 2020/4/1.
//
#ifndef LEETCODE_FLATTENBINARYTREETOLINKEDLIST_H
#define LEETCODE_FLATTENBINARYTREETOLINKEDLIST_H
#include <iostream>
#include <vector>
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x):val(x), left(NULL), right(NULL) {}
};
class FlattenB... | true |
0a7847b2d2a8bed855f75d26f3184b2ae2a94a8d | C++ | sundsx/RevBayes | /src/core/datatypes/phylogenetics/AbstractCharacterData.cpp | UTF-8 | 984 | 2.515625 | 3 | [] | no_license | #include "AbstractCharacterData.h"
#include <sstream>
using namespace RevBayesCore;
std::ostream& RevBayesCore::operator<<(std::ostream& o, const AbstractCharacterData& x) {
std::stringstream s;
// Generate nice header
o << std::endl;
s << x.getDatatype() << " character matrix with " << x.g... | true |
8bc209f08ffb547525d5df078cce83eb84ba7ea1 | C++ | tmittal98/CPP-codes | /binary trees/right_view_left_view.cpp | UTF-8 | 3,904 | 3.875 | 4 | [] | no_license | #include <iostream>
#include <queue>
#include <list>
using namespace std;
class node{
public:
int data;
node *left;
node *right;
node(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
node* preorderBuild(){
int data;
cin >> ... | true |
a635f453c1c5088ac9fe7728e6e0ebce3a679cdc | C++ | Rkrohit371/Codeforces-solutions | /Array_with_odd_sum.cpp | UTF-8 | 415 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){
int n;
cin>>n;
int total=0;
int arr[n],odd=0,even=0;
for(int i=0;i<n;i++){
cin>>arr[i];
if(arr[i]%2==0)
even=1;
else odd=1;
total+=arr[i];
}
if(total%2==0 && even==1 && odd==1)
cout<<"YES"... | true |
42c104e13e96321f394fcc98e982c6c9b3e19410 | C++ | ismacaulay/problems | /uva/challenges/CostCutting/TestCostCutting.cxx | UTF-8 | 393 | 2.5625 | 3 | [] | no_license |
#include <gtest/gtest.h>
#include "CostCutting.h"
TEST(TestCostCutting, testKeep)
{
EXPECT_EQ(1, keep(0, 1, 2));
EXPECT_EQ(2, keep(4, 2, 0));
EXPECT_EQ(3, keep(3, 7, 1));
EXPECT_EQ(2, keep(2, 2, 2));
}
TEST(TestCostCutting, testSampleInput)
{
EXPECT_EQ(2000, keep(1000, 2000, 3000));
EXPECT_EQ(2500,... | true |
a2c273cdf5c91f8324b7f87cac2fee2b4818adc9 | C++ | kryzthov/gooz | /store/arity.inl.h | UTF-8 | 1,191 | 2.78125 | 3 | [] | no_license | #ifndef STORE_ARITY_INL_H_
#define STORE_ARITY_INL_H_
namespace store {
// static
inline
Arity* Arity::Get(Value value) {
vector<Value> features(1, value);
return GetFromSorted(features);
}
// static
inline
Arity* Arity::Get(Value value1, Value value2) {
vector<Value> features;
features.push_back(value1);
... | true |
3c6929c4eafea392a121b171f3695d0ab84a73ff | C++ | JonJazd/CS162 | /final/Space.hpp | UTF-8 | 705 | 2.546875 | 3 | [] | no_license | #ifndef Space_HPP
#define Space_HPP
#include <string>
using std::string;
class Space{
public:
Space* n;
Space* w;
Space* e;
Space* s;
string entryLine;
bool examined;
bool solved;
bool endRoom;
virtual void examine()=0;
virtual void enter();
virtual int ... | true |
41dfa60c285172576d5f49fb3ff8737c78f9a85f | C++ | manuggz/TetrisSdl2 | /src/RandomGenerator.hpp | UTF-8 | 951 | 2.765625 | 3 | [] | no_license | //
// Created by manuggz on 16/12/16.
//
#ifndef TETRIS_RANDOMGENERATOR_HPP
#define TETRIS_RANDOMGENERATOR_HPP
#include <vector>
#include <random>
#include <algorithm>
#include "Tetromino.hpp"
class RandomGenerator{
public:
int getNextFormaTetromino(){
if(mFormaRegresadaIndice >= N_FORMAS){
... | true |
5c9eb2b97f85ba540e688936c7164253d295bbe8 | C++ | yueyy/PAT | /PAT-Basic/1003.cpp | UTF-8 | 1,107 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
void check(string word){
int p = 0;
int t = 0;
int left = 0;
int middle = 0;
int right = 0;
bool valid = true;
for (int i = 0; i < word.length(); i++){
if (word[i] != 'P' && word[i] != 'A' && word[i] != 'T')
{
valid ... | true |
18e5f04551ebaf66b40eea0002b03a64f452b4a2 | C++ | ArighnaIITG/DS-AL | /Algorithms/Greedy Algorithms/Job_Sequencing.cpp | UTF-8 | 2,519 | 4.1875 | 4 | [] | no_license | /*
Job Sequencing Problem :
Given an array of jobs where every job has a deadline and associated profit
if the job is finished before the deadline. It is also given that every job takes
single unit of time, so the minimum possible deadline for any job is 1.
How to maximize total profit if only one job can be sch... | true |
b58d26a6021d6e9bc4075f7c6271b78164ea8795 | C++ | fieldkit/firmware | /third-party/phylum/src/crc32.cpp | UTF-8 | 1,152 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #include "phylum.h"
namespace phylum {
static uint32_t crc_table[16] = { 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4,
0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
0x9b64c2b0, 0x86d3d2d4, 0xa00ae27... | true |
dbdf573a4d374e7ef25d3afd4043e163b3a9bef1 | C++ | tjel/infpro-5 | /GUI/src/Widget.cpp | UTF-8 | 924 | 2.890625 | 3 | [] | no_license | #include "include/Widget.hpp"
Widget::Widget()
{
}
void Widget::setPosition(int x, int y)//Ustawianie Pozycji na poctawie x i y;
{
mPosition.x = x;
mPosition.y = y;
}
void Widget::setPosition(SDL_Point Pos)//Ustawianie Pozycji na poctawie Vector2<int>
{
mPosition = Pos;
}
void Widget::setSize(int w, int h)
... | true |
13ab4d26a40d18b93eb06513128889ebe9719969 | C++ | wh-forker/game-programmer-road | /algorithms/temp/Code/JobDu_P1000.cpp | GB18030 | 404 | 3.34375 | 3 | [] | no_license | /*
ĿA+BעжǷķCC++Ҫ
*/
#include <iostream>
using namespace std;
int main()
{
int a,b;
while(std::cin >> a)
{
cin>>b;
cout<<a+b<<endl;
}
return 0;
}
/*
#include <stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
printf("%d\n",a+b );
return 0... | true |
4b2bb2d368c17e54713fe9e6465d7b8830ba42ed | C++ | xiaoqiang0/leetcode | /clone-graph.cc | UTF-8 | 3,141 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <limits>
#include <queue>
#include <map>
#include <set>
using namespace std;
/**
* Definition for undirected graph.
*/
struct UndirectedGraphNode {
int label;
vector<UndirectedGraphNode *> neighbors;
UndirectedGraphNode(... | true |
397251f93217707217ef1dd1795dd22576625da6 | C++ | gianmarcosilluzio/CompetitiveProgramming | /CompetitiveProgramming/code/PreorderTraversal.cpp | UTF-8 | 1,379 | 3.765625 | 4 | [] | no_license | /*
* PreorderTraversal.cpp
*
* Created on: 13 nov 2017
* Author: Gianmarco Silluzio
* Problem: http://practice.geeksforgeeks.org/problems/preorder-traversal-and-bst/0
* Description Solution:
* The idea is find next greater element and after finding next greater (using a stack), if w... | true |
873b1f732e9b268472e25d1967feebb0b5f034fa | C++ | kelvinismartian/algorithms | /Stackline.cpp | UTF-8 | 1,163 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
template <typename T>
class Stackline{
private:
int theSize;
int capacity;
T* Stack;
public:
Stackline(int size = 0, int capacity_temp = 10): theSize(size), capacity(capacity_temp){
Stack = new T[capacity_temp];
}
... | true |
26c4ea946db054808825fdb7334aa24140a6e7a2 | C++ | psdhanesh7/Competitive-Coding | /connectingDots.cpp | UTF-8 | 2,948 | 3.71875 | 4 | [] | no_license | // Connecting Dots
// Gary has a board of size NxM. Each cell in the board is a coloured dot. There exist only 26 colours denoted by uppercase Latin characters (i.e. A,B,...,Z). Now Gary is getting bore and wants to play a game. The key of this game is to find a cycle that contain dots of same colour. Formally, we cal... | true |
17bbda3d4c58e81ddb2c81de87c5136725c3264f | C++ | jinubb/Algorithm | /c++/세 수.cpp | UTF-8 | 401 | 3.078125 | 3 | [] | no_license | #include<stdio.h>
int compare1(int x,int y){
if (x>y)
return x;
else
return y;
}
int compare2(int x, int y, int z){
return (compare1(compare1(x,y),z));
}
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int sol;
if(a==compare2(a,b,c)){
sol = compare1(b,c);
}
else if(b==compare2(a,b,c)){
sol = com... | true |
f4c9e929ef78ddace66852e9a909ec697a7d1f26 | C++ | wangyongliang/nova | /poj/2619/POJ_2619_2974295_AC_0MS_88K.cpp | UTF-8 | 1,153 | 2.734375 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
void f(int &x,int &y,int n,int &flag,int &deep)
{
int xx;
xx=(int) sqrt((double)n);
if(xx*xx==n) xx--;
int sum=(xx)*(xx);
xx++;
deep=xx;
//x=xx;
x=(n-sum)/2+(n-sum)%2;
flag=(n-sum)%2;
if(flag) y=xx-x+1;
else y=xx-x;
... | true |
a83cea0182ee1c7b57caedeaad90be09632206e0 | C++ | grokitgames/giga | /Source/Engine/Render/OpenGL/OpenGLDeferredRenderPass.hpp | UTF-8 | 1,003 | 2.609375 | 3 | [] | no_license |
#ifndef opengldeferredrenderpass_hpp
#define opengldeferredrenderpass_hpp
/**
* Built-in deferred rendering pass (combination of previous g-buffer pass + lighting)
*/
class GIGA_API OpenGLDeferredRenderPass : public PostProcessPass {
public:
OpenGLDeferredRenderPass() = default;
~OpenGLDeferredRenderPass() ... | true |
22c3aa3b1881e23a3a5abd0a513a35ae4db3ab60 | C++ | James-Braun-SFU/reversi-with-AI | /Board.h | UTF-8 | 12,146 | 4.25 | 4 | [] | no_license | // Board.h
// To make it easier to keep track of and display various different piece types.
enum class Square : char {
empty = '.', human = 'o', computer = 'x'
};
// Keeps track of where two squares are in relation to one another.
struct Direction {
int dirRow;
int dirCol;
};
// Keeps track of where on the board ... | true |
280bc55173bad2abb5493d3cb3f3213a72986d89 | C++ | InternationalDefy/AdvenTri-Cocos | /Classes/ES_Dash.cpp | GB18030 | 1,830 | 2.625 | 3 | [
"MIT"
] | permissive | #include "Ref2EnemyState.h"
using namespace cocos2d;
CREATE_ENEMYSTATE(ES_Dash);
void ES_Dash::enterFrom(M_EnemyState* stateFrom)
{
getOwner()->getPhysicsBody()->setVelocityLimit(1400.0f);
getOwner()->dash();
}
/*
úڲexitúµstateTo֮
ͬʱжڴͷŲ
*/
void ES_Dash::exitTo(M_EnemyState* stateTo)
{
//run a standred end animat... | true |
cce314b5768e80fe5a94cad7907b1e4d8f3bdd05 | C++ | rueiminl/Leetcode | /Substring with Concatenation of All Words.cpp | UTF-8 | 1,075 | 2.8125 | 3 | [] | no_license | class Solution {
public:
bool check(string s, multiset<string>& comp) {
unsigned len = (*comp.begin()).length();
multiset<string> strs;
for (unsigned i = 0; i < s.length(); i += len) {
string sub = s.substr(i, len);
if (comp.find(sub) == comp.end())
... | true |