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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f909ed33faadeb3adff119cb594fe8ef2eed62a0 | C++ | WhiZTiM/coliru | /Archive2/2a/a5b7799708aa13/main.cpp | UTF-8 | 504 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <bitset>
int main()
{
std::bitset<8> b("00010010");
std::cout << "initial value: " << b << '\n';
// find the first unset bit
size_t idx = 0;
while (idx < b.size() && b.test(idx)) ++idx;
// continue setting bits until half the bitset is filled
while (idx < b... | true |
b3fdfce6535d7f7b3e1b55f21381448f93455d35 | C++ | sureshmangs/Code | /competitive programming/codeforces/1367A - Short Substrings.cpp | WINDOWS-1252 | 2,258 | 3.859375 | 4 | [
"MIT"
] | permissive | /*
Alice guesses the strings that Bob made for her.
At first, Bob came up with the secret string a consisting of lowercase English letters. The string a has a length of 2 or more characters. Then, from string a he builds a new string b and offers Alice the string b so that she can guess the string a.
Bob builds b fro... | true |
c0e2cd3402b85425820977815c2ffccf2132c8a6 | C++ | DanteRARA/STUST | /calender.cpp | BIG5 | 947 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int y, m, initDay, monthDay[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; //CѼ
cout << "пJ~B" << endl;
cin >> y >> m;
if(y % 4 == 0){ //P_O_|~
monthDay[1]++; //O|~hb2++
initDay = (((y - 1900) / 4) * 366 + ((y - 1900) - ((y - 1900) / 4)) * ... | true |
6d121a7251b186a60f5d41e7bd76d8ba2b3ea792 | C++ | computerphilosopher/BOJ | /10819/10819.cpp11.cpp | UTF-8 | 682 | 2.90625 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int get_sum(const vector<int> &v){
int ret = 0;
int n = v.size();
for(int i=0; i<n-1; i++){
ret += abs(v[i] - v[i+1]);
}
return ret;
}
int main(){
int n = 0;
... | true |
7c1fab42855837d60679e435d910db14f2b74661 | C++ | arewas-fasuoy/Data-Structures | /Array-List/assignment-1.cpp | UTF-8 | 1,683 | 3.96875 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Array_Operation{
private:
int *ptr1;
int *ptr2;
int length;
int *array;
int arr[8]={2,3,2,3,3,4,5,6};
public:
Array_Operation(){
ptr1=NULL;
ptr2=NULL;
length=0;
array= new int[15];
}
int * MostFrequentElementInSubArray(int left, int right,... | true |
59f1e338d817c36c300c4da36f5662eff33b9c3d | C++ | vermakriti/InterviewBit | /Tree/Path Sum/program.cpp | UTF-8 | 277 | 2.875 | 3 | [] | no_license | int Solution::hasPathSum(TreeNode* root, int B) {
if(!root)return 0;
if(!root->left && !root->right){
if(B==root->val)
return 1;
else return 0;
}
return hasPathSum(root->left,B-root->val) | hasPathSum(root->right,B-root->val);
}
| true |
5cfd6decc7677fb776babcd7963dec4e637c8be0 | C++ | oupjob/examples | /cpp/invalid_value_t/invalid_value_t.cpp | UTF-8 | 372 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
template <typename T>
struct InvalidValue
{
operator T () {return false;}
};
template <typename T> const T invalidValue()
{
return sqrt(-1);
}
int main() {
int i = (int)InvalidValue<int>();
string s = (string)InvalidValue<string>();
i... | true |
3968a4dec6d21c67c4d95766dd6a2ba2a07b5118 | C++ | prinick96/procesos_e_hilos_SO | /PromedioSinSemaforo.cpp | UTF-8 | 2,754 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
// Deinir funciones
int *crearArreglo();
void *promediarArreglo(void *arg);
// Tipo de dato pasado por parámetro a la función que manejan los hilos
typedef struct {
int rango[2]; //Rango asignad... | true |
84026206a56a0bc7e4e3da52eab9afe7335fbfb3 | C++ | nklemashev/phd | /uk/AxiomsPhD/AxiomsPhD/Backup/strfuns.hpp | UTF-8 | 279 | 2.703125 | 3 | [] | no_license | #include <vector>
#include <string>
namespace strfuns {
std::vector<std::string> split(const std::string& inStr, char sep);
std::string trim(std::string& inStr); //Removes spaces from the beginning and the ending of a string.
std::string int2str(int i);
}
| true |
3b33a8e595e4e602a449a9604ae00e75470c7fb4 | C++ | devedu-AI/Back_to_Basics | /c++_Functions/n_num_fact.cpp | UTF-8 | 261 | 3.265625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int fact(int a){
int ans;
if(a == 0){
return 1;
}
ans = fact(a - 1);
return a * ans;
}
int main()
{
int n;
cin>>n;
cout<<fact(n)<<endl;
return 0;
} | true |
6045bb42874c00108319f369abc3017f9d133dfc | C++ | benjaminhuanghuang/ben-leetcode | /0304_Range_Sum_Query_2D_-_Immutable/solution.cpp | UTF-8 | 1,303 | 3.453125 | 3 | [] | no_license | /*
304. Range Sum Query 2D - Immutable
Level: Medium
https://leetcode.com/problems/range-sum-query-2d-immutable
# 221. Maximal Square
*/
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <algorithm>... | true |
99a11ccc34121a80f2d5951f3f72fc396f6db9b5 | C++ | Ph0en1xGSeek/ACM | /POJ & HDU/LCM_Walk.cpp | GB18030 | 762 | 2.625 | 3 | [] | no_license | /**ѧƵ+ж**/
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
int ca, cc = 1;
long long x, y;
int ans;
scanf("%d", &ca);
while(ca--)
{
ans = 1;
scanf("%I64d%I64d", &x, &y);
while(x != y)
... | true |
2a107eeac19263edf9a93d7a2cdd1f472fb2b1ed | C++ | mihalyszekely/Snake2 | /include/options.h | UTF-8 | 596 | 2.546875 | 3 | [] | no_license | #pragma once
#include "SFML/Graphics.hpp"
#define MAX_NUMBER_OF_ITEMS 2
class Options
{
public:
Options(float width, float height);
~Options();
sf::RectangleShape hangnegyzett;
sf::RectangleShape hangnegyzetf;
bool hang=true;
void hangar(float width, float height,sf::RenderWindow &window);
void dra... | true |
0663d161eb5237ebdcff56b28d25d158af9c9f74 | C++ | mehulthakral/logic_detector | /backend/CDataset/reverseList/reverseList_4.cpp | UTF-8 | 1,085 | 3.5625 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
class ListNode{
... | true |
581120f30a2e0d9b7b6f77842599d49827a380e0 | C++ | ZakMaks/aip_semestr2 | /13nedela/HW1_13nedela/main.cpp | UTF-8 | 3,202 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
#include <fstream>
#include <ctime>
// 13неделя_1-5номер_
using namespace std;
int randArray[20] ;
int sless5=0;
int smore6=0;
int sless4=0;
int polojElem=0;
int otricElem=0;
int spol=0;
//int sotr=0;
float sredpol=0;
//float sredotr=0;
float s... | true |
d5d6606e4d5ee3efa2b02e1c8a45424e851b6687 | C++ | jianweiyao/Code | /c++/7/7-1.cpp | UTF-8 | 266 | 2.921875 | 3 | [] | no_license | // 默认参数值初探
#include <stdio.h>
int mul(int x = 0);
int main(int argc, const char *argv[]) {
printf("%d\n", mul());
printf("%d\n", mul(-1));
printf("%d\n", mul(2));
return 0;
}
int mul(int x) {
return x * x;
}
| true |
13b4fab5327f5039b683b5b13b9c042431d3bfd8 | C++ | E3798211/ProgLanguage | /Src/Tree.cpp | UTF-8 | 8,898 | 3 | 3 | [] | no_license | #include "../Head/Tree.h"
/*
*
* ============================================= NODE CLASS =============================================
*
*/
/*static*/ bool
Node::IsLast(const Node* check_node)
{
EnterFunction();
SAFE {
// Verificator
}
if (check_node->_left == nullptr && check_node->_r... | true |
9434766101b8aa255176bd6fc3e45209726475b1 | C++ | Lukinari/oop-vjezbe | /Vjezba 2/Vjezba 2 Zadatak 5/Zadatak 5.cpp | UTF-8 | 866 | 3.21875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int* fun(int& refsiz)
{
int siz = 0;
int j = 10;
int* arr;
int* temp;
arr = new int[j];
int i;
while(i)
{
cout << "Enter a number: ";
cin >> i;
if(i>0)
{
arr[siz] = i;
siz++;
}
if(si... | true |
be82c6600e73b568fc307860c06d390c705c79a5 | C++ | freem/SMOnline-v1 | /Crash/Linux/BacktraceNames.cpp | UTF-8 | 13,802 | 2.546875 | 3 | [
"MIT"
] | permissive | /* for dladdr: */
#define __USE_GNU
#include "../crashDefines.h"
#include "BacktraceNames.h"
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <unistd.h>
#include <cstring>
#include <cerrno>
#if defined(DARWIN)
#include "archutils/Darwin/Crash.h"
#endif
#if defined(HAVE_LIBIBERTY)
#include "libiberty... | true |
6911df4be4345396199385f9a7ccd63108aa39e2 | C++ | inbdni/Programmers | /level03/풍선터트리기.cpp | UTF-8 | 634 | 3.125 | 3 | [] | no_license | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> a) {
int answer = 0;
int i, l_min, r_min;
int size = a.size() - 1;
vector<int> left;
vector<int> right;
l_min = a[0];
left.push_back(l_min);
r_min = a[size];
right.push_back(r_min);
for (i = ... | true |
d73be32579eb508f663e6c1a5787062226927019 | C++ | hennin67/UMLWars | /project1\project1\Pause.h | UTF-8 | 459 | 2.8125 | 3 | [] | no_license | /**
* \file Pause.h
*
* \author Team Zuse
*
* Class that implements the pause screen.
*
*/
#pragma once
#include <memory>
#include "Screen.h"
#include "ImageObject.h"
/** The Class that implements Pause
*/
class CPause : public CImageObject
{
public:
/// Constructor
CPause(CScreen* screen... | true |
208782b4cecce7cdd23c8a52c86ca4f149d84518 | C++ | Moto0116/Library | /Library/Library/Library/EventManager/EventManager.h | UTF-8 | 2,091 | 2.84375 | 3 | [] | no_license | /**
* @file EventManager.h
* @brief イベント管理クラス定義
* @author morimoto
*/
#ifndef LIB_EVENTMANAGER_H
#define LIB_EVENTMANAGER_H
//----------------------------------------------------------------------
// Include
//----------------------------------------------------------------------
#include <vector>
#include <map>
... | true |
2343bbbe19c4fe4a6392e6087e7a575ad5201201 | C++ | HimalayaITSolutions/CPP_Vector | /Complex.cpp | UTF-8 | 1,338 | 3.109375 | 3 | [] | no_license | #include "pch.h"
#include "Complex.h"
#include <iostream>
Complex::Complex(double r, double i)
:re(r),
img(i)
{
}
Complex::Complex(double r)
: re{r},
img(r)
{
}
Complex::~Complex()
{
re = img = 0.0f;
}
Complex ... | true |
59300149d7b9e6d28abbfb4e76374dcdd677da30 | C++ | aajjbb/contest-files | /TC/500-DIV2-250.cpp | UTF-8 | 1,001 | 3 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class SRMCards {
public:
int maxTurns(vector <int> cards) {
sort(cards.begin(), cards.end());
int ans = 0;
for(; !cards.empty(); ) {
int acc = 10, index = 0, ind_prev = -1, ind_next = -1;
for(int j = 0; j < cards.size(); j++) {... | true |
e45b5053c6a4c10eee5724f82776fa24211c46c8 | C++ | SemaMolchanov/self_study | /useful/functions.cpp | UTF-8 | 1,190 | 3.328125 | 3 | [] | no_license | int sum_of_digits(int number){
int sum = 0;
if (number > 0){
while (number != 0){
sum = sum + number%10;
number = number/10;
}
}
return sum;
}
char to_upper(char c){
if (c >= 'a' && c <= 'z'){
c = c - 32;
}
return c;
}
bool is_prime(int x) {
... | true |
49752a980423176f7db756020634d9f9a69c08f2 | C++ | fanafree/CodingTest | /16235.cpp | UHC | 2,391 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, M, K;
int food[11][11] = { 5, };
int addFood[11][11] = { 0, };
int dir[8][2] = {
{-1, -1},
{-1 , 0},
{-1, 1},
{0, -1},
{0, 1},
{1, -1},
{1, 0},
{1, 1}
};
vector<int> treeList[11][11];
/*
: ڽ ̸ŭ 1 . ̸ŭ ٸ
: . ... | true |
9ae6df98374cb3e5fd6bee8ffeb846baeb769028 | C++ | divyang4481/mipt-hw | /anastasyev_daniil/task07_BFS/BFS_matrix.cpp | UTF-8 | 1,367 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
enum color {BLACK, GREY, WHITE};
struct TNode
{
color clr;
int dist;
int parent;
};
void BFS (vector < vector <bool> > &g, int s)
{
vector < TNode > v(g.size());
queue < int > q;
for (int i = 0; i < g.size(); ++i)
{... | true |
e524287219cec9c6ecccc6d3cfbaa962fffbe3b6 | C++ | gkastrinis/talk-material | /IO_tutorial/fstream2.cpp | UTF-8 | 391 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(void)
{
fstream tmp("data4.txt", ios::out);
tmp.close();
fstream file("data4.txt", ios::in | ios::out);
file << 1 << " www.photobucket.com" << endl;
file << 2 << " www.deviantart.com" << endl;
file.seekg(0, ios::beg);
int i;
... | true |
82a788db5986ca5a401fff2facfa8e73d8912a22 | C++ | TudorArnautu/ase_stuff | /ConsoleApplication11/ConsoleApplication11/Sas.cpp | UTF-8 | 6,660 | 2.734375 | 3 | [] | no_license | # include <iostream>
# include <string>
using namespace std;
class interviu
{
char *nume_candidat;
char *post;
int salariu;
float nota_1; // cele doua note reflecta rezultatul celor 2 teste sustinute de un candidat
float nota_2;
char *rezultat; // aceasta variabila va lua valoarea "acceptat/respins"
... | true |
0b10365e8db2c99d281a399572717bb5a229f3e7 | C++ | gomdorilla99/Nuyt | /Node.h | UTF-8 | 2,793 | 2.78125 | 3 | [] | no_license | #pragma once
#include <assert.h>
struct POINT
{
int x;
int y;
};
enum NodeType
{
NODE_TYPE_HOME,
NODE_TYPE_SINGLE,
NODE_TYPE_BRANCH,
NODE_TYPE_CROSS,
NODE_TYPE_READY,
NODE_TYPE_OUT,
NODE_TYPE_MAX
};
class Mal;
class Node
{
int mUpdateNum;
NodeType mType;
POINT mLocation;
No... | true |
6e8fc368bf8bc541083189ed77561f2378c11b33 | C++ | roche-emmanuel/nervOct | /sources/test_nervcuda/src/basics_spec.cpp | UTF-8 | 22,658 | 2.75 | 3 | [] | no_license | #include <boost/test/unit_test.hpp>
#include <iostream>
#include <nervcuda.h>
#include <windows.h>
#include <cuda_runtime.h>
#include <cuda_profiler_api.h>
#include <boost/chrono.hpp>
BOOST_AUTO_TEST_SUITE( basic_suite )
BOOST_AUTO_TEST_CASE( test_loading_module )
{
// For this test we try to load... | true |
12b71864b10386b6a25829b0af3562fa0813b0dc | C++ | ibiscum/fast_ber | /test/ber_types/TaggedType.cpp | UTF-8 | 1,494 | 2.859375 | 3 | [
"BSL-1.0"
] | permissive | #include "fast_ber/ber_types/All.hpp"
#include "fast_ber/ber_types/Identifier.hpp"
#include "fast_ber/ber_types/Integer.hpp"
#include <catch2/catch.hpp>
#include <array>
TEST_CASE("TaggedType: Assign")
{
using Tag = fast_ber::Id<fast_ber::Class::universal, fast_ber::Tag(5)>;
using TaggedInt = fast_ber:... | true |
748249d8b080d7b018753a3539c41c7a455e4f70 | C++ | Eplistical/1d_rate_double_well | /include/para/para.hpp | UTF-8 | 878 | 2.703125 | 3 | [] | no_license | #ifndef _PARA_HPP
#define _PARA_HPP
#include <cstdlib>
#include <string>
#include "ioer.hpp"
namespace
{
using std::string;
using ioer::keyval;
using ioer::input_t;
using ioer::output_t;
using ioer::STDOUT;
struct Para
{
int M;
int Ne;
double W;
Para() = ... | true |
469f7a35411b365b0608e82312f825e1b503411e | C++ | mirtaba/ACMICPC-INOI_Archive | /Olympiad Programs/SGU 397. Text Editor (2).cpp | UTF-8 | 844 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cmath>
using namespace std;
const int MAX = 100*100*100 + 25;
string s;
char p[MAX];
int f=1,la=1;
struct node
{
char ch;
int r,l;
node()
{
r = l = -1 ;
}
node(int i, int p)
{
r=i;
l=p;
}
} n[MAX];
int r=0,l=0;
int main()
{
ios::sync_with_stdio (false);
cin >> s;
int wh=... | true |
fcfd42770ca38c46038802e75d43107525481323 | C++ | Voley/Algorithmic-Problems | /Math/Toeplitz/main.cpp | UTF-8 | 415 | 3.03125 | 3 | [
"MIT"
] | permissive |
#include <iostream>
#include <vector>
bool isToeplitzMatrix(std::vector<std::vector<int>>& matrix) {
auto width = matrix[0].size();
auto height = matrix.size();
for (int i = 1; i < height; i++) {
for (int j = 1; j < width; j++) {
if (matrix[i][j] != matrix[i-1][j-1]) {
... | true |
749fbc1b3430c1baa62e9b036fdc280171246897 | C++ | plazmist/Cellular | /conway.h | UTF-8 | 3,084 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
class Conway
{
private:
int **Field, **FieldOld;
int FieldSize;
int breed = 1;
int cntNghbr(int i, int j){
int cnt=0;
int left = (j == 0) ? FieldSize-1 : j-1;
int right = (j == FieldSize-1) ? 0 : j+1;
int upper = (i =... | true |
a4ad69f1bf2b7ca9a7fd4afab9326751ebe214c2 | C++ | rhayatin/C-- | /JAVAC.cpp | UTF-8 | 915 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
char str[105];
while(scanf("%s",&str)>0)
{
int flag=0,flag1=0;;
int n=strlen(str);
for(int i=0;i<n;i++)
if(str[i]!=tolower(str[i]))
flag1=1;
if(str[0]!=tolower(str[0]))
cout<<"Error!";
else if(str[0]=='_')
co... | true |
2db07a39a9ee171cb5505e85fb55f5659c402b88 | C++ | satvikb/InteractiveContentFileFormat | /UI/Content/cButton.cpp | UTF-8 | 2,625 | 2.6875 | 3 | [] | no_license | #include "cButton.h"
cButton::cButton(cContainer* parent, struct Content* content, struct Style* style) : cStyledPanel((wxWindow*)parent, style, wxID_ANY) {
SetContent(content);
w = -1;
h = -1;
}
void cButton::interpretContent() {
if (content->data.size() > 0) {
std::vector<uint8_t> bytes = conte... | true |
10c62cb2286cc8a32c1126e3ef1d13cf85c75e3d | C++ | MirkoFerrati/Ascari | /plugins/monitor/dummy_agent.hpp | UTF-8 | 1,332 | 2.703125 | 3 | [] | no_license | #ifndef DUMMY_AGENT_HPP
#define DUMMY_AGENT_HPP
#include <stdio.h>
#include <mutex>
#include "agent_to_dummy_communicator.hpp"
#include "../agent/agent.h"
#include <types/dummy_state.h>
#include <string>
struct dummy_agent
{
dummy_agent(std::string agent_name,const std::pair<const std::string, std::unique_ptr<Parse... | true |
7e6b8a1e36924108fcf1858822aba537322736d7 | C++ | kartikdutt18/CPP-and-its-Algo-based-Problems | /To-Be-Restructured/Competitive/Berry_Jam.cpp | UTF-8 | 2,256 | 3 | 3 | [] | no_license | //
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int balance(vector<int> v){
int midLeft=v.size()/2-1;
int midRight=v.size()/2;
int berry=0;
int jam=0;
int berrymidLeft=0;
int berrymidRight=0;
int jammidLeft=0;
int jammidRight=0;
for(int i=0;i<v.size();i++){
... | true |
132945f42b7c3195bda4f7e96e9995825354019e | C++ | EnTaroYan/ExcelProgress | /ExcelProgress/ExcelProgress.cpp | GB18030 | 2,994 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <windows.h>
#include "libxl.h"
#include <algorithm>
#define COL_BARCODE 2
#define COL_NAME 3
#define COL_ID 4
#define COL_UNIT 8
#define COL_POSITION 16
#define COL_NUMBER 11
using namespace libxl;
using namespace std;
typedef s... | true |
175f8f2d2120cc145672ea21b86a6c1023f41bdb | C++ | agmt/ngram | /finder.cpp | UTF-8 | 3,341 | 2.515625 | 3 | [
"Unlicense"
] | permissive | #include <stdio.h>
#include <vector>
#include <iostream>
#include <fstream>
#include <ios>
#include <random>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <algorithm>
#define TRY(x) ... | true |
c7f8a4d85fac84072582578dfe2bc8b15753d2bc | C++ | changgezuo/leetcode | /1456/1456.cpp | UTF-8 | 911 | 2.984375 | 3 | [] | no_license | #include<string>
#include<unordered_set>
#include<vector>
#include<iostream>
using namespace std;
class Solution {
public:
int maxVowels(string s, int k) {
unordered_set<char>dic;
for(char c : vowels)dic.insert(c);
int l = 0, r = k;
int res = 0, curCnt = 0;
for(int i = 0; i < k; ++i){
if (dic.... | true |
e40ac36e366c420e186b7f9bd5350ca0464647b2 | C++ | DaniPreto/CG | /Ponto.h | UTF-8 | 441 | 2.78125 | 3 | [] | no_license |
#ifndef PONTO_H
#define PONTO_H
#include <iostream>
#include <vector>
#include "ObjGrafico.h"
#include<string>
class Ponto : public ObjGrafico {
public:
Ponto();
Ponto(const Ponto& orig);
virtual ~Ponto();
Ponto(double a, double b);
Ponto(double a, double b,std::string n);
Ponto(std::string n,... | true |
90c9f2e2cfcc7523066885d26e9e2e34ae7cd6e6 | C++ | dastyk/Radiant | /Radiant/Radiant/RandomBlink.cpp | UTF-8 | 2,708 | 2.71875 | 3 | [] | no_license | #include "RandomBlink.h"
#include "System.h"
RandomBlink::RandomBlink(EntityBuilder* builder, Entity player, vector<FreePositions> positions) : Power(builder)
{
_type = power_id_t::RANDOMBLINK;
_timeSinceLastActivation = 100;
_cooldown = 5.0;
_lightIntensity = 0.0f;
_powerLevel = 0;
_powerEntity = _builder->Ent... | true |
30a84cf3209986cafa8b00f697bb8bc6fd570f1c | C++ | Auruncus/tp-lab-6 | /include/Programmer.h | UTF-8 | 610 | 2.859375 | 3 | [] | no_license | #pragma once
#include "Engineer.h"
class Programmer : public Engineer
{
public:
Programmer() : Engineer() {};
Programmer(int id, string name, int worktime, int base, string project, int budget, double contribution) {
this->id = id;
this->name = name;
this->base = base;
this->project = project;
this->worktim... | true |
3f72d6379045aeb6dfe2dbad47561c76602b68cb | C++ | yuxineverforever/plinycompute | /pdb/src/storageManager/headers/PDBAbstractPageSet.h | UTF-8 | 972 | 2.796875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | //
// Created by dimitrije on 3/5/19.
//
#ifndef PDB_ABSTRATCTPAGESET_H
#define PDB_ABSTRATCTPAGESET_H
#include <PDBPageHandle.h>
namespace pdb {
class PDBAbstractPageSet;
using PDBAbstractPageSetPtr = std::shared_ptr<PDBAbstractPageSet>;
class PDBAbstractPageSet {
public:
/**
* Gets the next page in the pag... | true |
d806b346ee10e9f1e146eac30ec1676b6125ec2f | C++ | bobchin/self-study-cpp | /chapter3/prac3.4.1.cpp | UTF-8 | 1,667 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
class pr2;
class pr1
{
int printing;
public:
pr1() { printing = 0; };
void set_print(int status) { printing = status; }
friend int inuse(pr1 ob1, pr2 ob2);
};
class pr2
{
int printing;
public:
pr2() { printing = 0; };
void set_print(int status) { p... | true |
f752246645b195eb75a69f1d8ee7851a562edd42 | C++ | Reesing/learn | /cpp/cpp.primer/exercises/6.1/abs.cc | UTF-8 | 293 | 3.75 | 4 | [] | no_license | #include <iostream>
using namespace std;
int abs(int val)
{
if (val<0)
val = -1*val;
return val;
}
int main()
{
int ii;
cout << "Please input an integer: ";
cin >> ii;
cout << "The absolute value of " << ii << " is " << abs(ii) << endl;
return 0;
}
| true |
13cd0ca05f0899f8dd1ea8164cb87d76605274ec | C++ | fsuits/tapp | /ext/tapp_utils/MassSpectrometry/Isotope/Averagine.h | UTF-8 | 949 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2019, IBM Corporation
//
// This source code is licensed under the Apache License, Version 2.0 found in
// the LICENSE.md file in the root directory of this source tree.
#pragma once
#include <string>
#include <vector>
namespace TAPP::MassSpectrometry::Isotope
{
inline std::vector<std::pair<char, doub... | true |
68e2d0569291b2a05b4fbffa8eb061042894ae5d | C++ | naganath/SPOJ | /ABSYS.cpp | UTF-8 | 735 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main()
{
int t;
string s;
cin>>t;
getline(cin,s);
while(t--)
{
getline(cin,s);getline(cin,s);
//cout<<s;
int i,num1[3],j=0,k=0,m=0,l=0;
for(i=0;i<s.length();i++)
{ if(s[i] == '+' || s[i] == '=')
{
num1[k++] = j;j=0;
}
else
... | true |
548acbf12c993f725623bb987f87fd917e15deba | C++ | dglyzin/tracercore | /src/state.cpp | UTF-8 | 5,508 | 2.609375 | 3 | [] | no_license | /*
* state.cpp
*
* Created on: 10 окт. 2016 г.
* Author: frolov
*/
#include "state.h"
using namespace std;
State::State(ProcessingUnit* _pu, NumericalMethod* _method, double** _blockCommonTempStorages, int elementCount) {
pu = _pu;
method = _method;
mBlockCommonTempStorages = _blockCommonTempStorages;
... | true |
6cac80a365defe40363d5447624a92586832d1ea | C++ | mahesh001/Myds-program | /tree/Huffmann.cpp | UTF-8 | 2,528 | 2.921875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int g=100;
struct node
{
char tag;
int fq;
node* left;
node* right;
int mark;
};
class stack
{
public:
node* c[50];
int size;
int top;
stack()
{
top=-1;
size=50;
}
int isempty()
{
if(top==-1)
return 1;
else
return 0;
}
voi... | true |
c6040c12ee4ded3fa47ce0515764531d3cc42f2f | C++ | mrashidz/CXX_Course_Demo | /Day3/2_Access/acc.h | UTF-8 | 366 | 2.953125 | 3 | [] | no_license | #include <iostream>
class Bar;
class Foo {
int x = -1;
friend void externalPrint(const Foo&);
public:
void printBar(const Bar &_b); /*{
std::cout << _b.x << std::endl;//Forward declaration does not specify Bar's interal
}*/
Foo() = default;
};
class Bar {
friend class Foo;
int... | true |
7c48f233153116512c3ddcb9cd77f6185185e020 | C++ | Mbd06b/cpp-learn | /C++II/LowerCaseString02-29/src/LowerCaseString.cpp | UTF-8 | 520 | 2.53125 | 3 | [] | no_license | /*
* LowerCaseString.cpp
*
* Created on: Feb 29, 2016
* Author: mbd06b
*/
#include "LowerCaseString.h"
LowerCaseString::LowerCaseString(){
}
LowerCaseString::LowerCaseString (const WCS_String & Str): WCS_String (Str){ //here we are calling the parent copy constructor :WCS_String (Str)
ToLower (); //th... | true |
e8de023ffbec94bdca1e8b57c55bf47fc92e0e61 | C++ | LolloSpring/TwTool | /twitter_01.cc | UTF-8 | 2,893 | 3.140625 | 3 | [] | no_license | #include "twitter.h"
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
const int dim=256;
const int est=4;
void concatena (const char a[], const char estensione[], char c[], int len_a, int len_b);
int main (int argc, char* argv[]){
fstream my_in, my_out; //i due stream: i... | true |
dd1cdd1e5a57b7ea02f85660836c7fe6b392f970 | C++ | DeJuan/Kinect2.0ServerClient | /UDPServer.h | UTF-8 | 597 | 2.75 | 3 | [] | no_license | #ifndef UDP_SERVER_H
#define UDP_SERVER_H
#include <Windows.h>
#include <io.h>
#include <stdexcept>
namespace udp_server
{
class udp_server_runtime_error : public std::runtime_error
{
public:
udp_server_runtime_error(const char *w) : std::runtime_error(w){}
};
class udp_server
{
public:
udp_server(const s... | true |
810dcb97b469bb41e6c843c560ea6529383264fb | C++ | mugwhump/AIsteroids | /InputDirection.h | UTF-8 | 2,873 | 2.921875 | 3 | [] | no_license | #pragma once;
#include "EnumParser.h"
#include <vector>
/************************************************************************/
/* INPUT */
/************************************************************************/
namespace eInput{
enum... | true |
d578f1ce5e1eae0190da0ea00e56bad933667b5c | C++ | aparant777/AngryGameEngine | /MonsterChase/Player.cpp | UTF-8 | 2,340 | 2.921875 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
#include"HeapAllocator.h"
#include "Player.h"
#include"Vector3.h"
CPlayer::CPlayer() { }
/*initializes the Player class*/
void CPlayer::InitializePlayer() {
printf("Enter the name of the player: ");
scanf_s("%s", mName, 100);
printf("player name is %s. \n\n", mName);
printf("al... | true |
9b1385f32128f3cef1b7371afd77ce81b727a6c8 | C++ | robertsdionne/sacred | /sacred/softmax_test.cpp | UTF-8 | 683 | 2.734375 | 3 | [] | no_license | #include <gtest/gtest.h>
#include "softmax.hpp"
#include "tensor.hpp"
namespace sacred {
TEST(Softmax, Run) {
auto input = Tensor<>({8}, {0, 1, 2, 3, 4, 5, 6, 7});
auto op = Softmax<>();
auto output = Tensor<>({8}, {0, 0, 0, 0, 0, 0, 0, 0});
op(input, output);
EXPECT_FLOAT_EQ(0.00057661271, output.at({0}... | true |
3a3516a873aa5b3f60b25bc79989ed37ca45fba4 | C++ | KMR-86/number-theory-resources | /codes/seive/cf-17a.cpp | UTF-8 | 919 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int prime_map[1001]={0};
vector<int>primes;
int prime_count[1001]={0};
void seive(){
prime_map[0]=1;
prime_map[1]=1;
for(int i=2;i<1001;i++){
if(prime_map[i]==0){
for(int j=i*i;j<1001;j=j+i){
prime_map[j]=1;
}
... | true |
56c0b5074bc0d8a22e797f3ea5b69867db716f93 | C++ | Luftschlosser/ATmighty | /src/ATmighty/ATmighty/Utilities/LUTs/HardwareOwnerID.h | UTF-8 | 1,583 | 3.09375 | 3 | [] | no_license | /*
* This headerfile defines several string-literals and helper functions which are used by ATmighty to set
* senseful OwnerID's for hardware-allocations and retrieve a senseful description for each ID for logging.
*/
#ifndef ATMIGHTY_UTILITIES_LUTS_HARDWAREOWNERID_H_
#define ATMIGHTY_UTILITIES_LUTS_HARDWAREOWNERID... | true |
a3ef1d3f5b83c128b549e9e7c003b4806dd1e062 | C++ | aalessi18/FirstGame | /GameAssets/Map/Map.cpp | UTF-8 | 1,666 | 2.9375 | 3 | [] | no_license | /*
Implementation of Map Class
*/
#include "Map.hpp"
#include "Tokens.hpp"
#include <boost/graph/named_function_params.hpp>
using namespace std;
Map::Map() {
}
Map::~Map() {
}
void Map::printContents() {
for(int i=0;i<num_vertices(graphData);i++)
{
cout << "Vertex: " << graphData[i].getIndex... | true |
201eeb8f98a972942d899309d21d4034a8bf4006 | C++ | lwestjohn16/snakegame | /QTSnake-Cplusplus_Version1-master/snake.cpp | UTF-8 | 1,358 | 3.234375 | 3 | [] | no_license | #include "snake.h"
#include <iostream>
#include <iterator>
#include <list>
Snake::Snake(int x, int y, int growToSize): numQueuedSegments(growToSize) {
image.load(":/images/snake1.png");
QRect head;
head = image.rect();
head.moveTo(x, y);
putSegmentAt(image, head, x, y);
}
void Snake::putSegmentAt(... | true |
990ff7736e328794b39589c0094ebc21cc9f9892 | C++ | aksel26/TIL | /200615_C++/1_of_5/for/for.cpp | UTF-8 | 713 | 3.265625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int score;
cout << "점수 입력 : ";
cin >> score;
if (score < 0 || score > 100)
{
cout << "유효하지 않은 점수입니다" << score << endl;
}
else
{
switch (score / 10)
{
case 10:
case 9:
cout << "A학점... | true |
6fdaa0838955169175a28a3c03f954e3454b9053 | C++ | kamyu104/LeetCode-Solutions | /C++/delete-characters-to-make-fancy-string.cpp | UTF-8 | 379 | 3.09375 | 3 | [
"MIT"
] | permissive | // Time: O(n)
// Space: O(1)
// inplace solution
class Solution {
public:
string makeFancyString(string s) {
int cnt = 0, j = 0;
for (int i = 0; i < size(s); ++i) {
cnt = (i >= 1 && s[i] == s[i - 1]) ? cnt + 1 : 1;
if (cnt < 3) {
s[j++] = s[i];
}... | true |
adf837e0a9ef55944407d968bff5990abfb145d3 | C++ | project-s/P3Game | /database.cpp | UTF-8 | 6,427 | 2.8125 | 3 | [] | no_license | #include "database.h"
database::database(Hero *LegacyBoy, statistics *P3Stats)
{
fullPath = "./LegacyGame.db";
LegacyBoyDB = LegacyBoy;
P3StatsDB = P3Stats;
if (openDatabase())
{
std::cout << "* DB : OPENED*" << std::endl;
}
}
database::~database()
{
//dtor
if (closeDatabase()... | true |
99b9b0eefe32338abc53f3aec310616c2c4c43a6 | C++ | alexcui03/luogu-test | /luogu/P1149 火柴棒等式.cpp | UTF-8 | 530 | 3.0625 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int num_cnt[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
int cnt(int x);
int main() {
int n, sum = 0;
cin >> n;
n -= 4;
for (int a = 0; a < 1111; ++a) {
if ((cnt(a) << 1) + cnt(a << 1) == n) {
++sum;
}
for (int b = a + 1; b < 1111; ++b) {
if... | true |
2b7cea210f5143650ff6a815102f3dbd6c1ca390 | C++ | roym899/vector_graphics | /include/vector_graphics/Point.hpp | UTF-8 | 873 | 3.140625 | 3 | [
"MIT"
] | permissive | // Author: Leonard Bruns (2019)
#ifndef VECTOR_GRAPHICS_POINT
#define VECTOR_GRAPHICS_POINT
// STL
#include <memory>
// vector_graphics
#include "Primitive.hpp"
namespace vectorgraphics {
///////////////////////////////////////////////////////////////////////////////
/// \brief A point in 2D space.
class Poin... | true |
80992d22b5e00644420d723d4758245533bc80a5 | C++ | duckdb/duckdb | /extension/httpfs/crypto.cpp | UTF-8 | 841 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "crypto.hpp"
#include "mbedtls_wrapper.hpp"
namespace duckdb {
void sha256(const char *in, size_t in_len, hash_bytes &out) {
duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(in, in_len, (char *)out);
}
void hmac256(const std::string &message, const char *secret, size_t secret_len, hash_bytes &out) {
duck... | true |
bf7fe5ec76ae4e2a78e3ae50c3fca8922d83631f | C++ | adamcavendish/HomeworkGitShare | /DataStructures/Homework/09/No_14/No_14.cpp | UTF-8 | 1,183 | 3.8125 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <utility>
#include <string>
void
bubble_sort(int * array, int array_length) {
bool swap_flag = true;
for(int i = 0; i < array_length && swap_flag; i += 2) {
swap_flag = false;
for(int j = 0; j < array_length; ++j) {
if(array[j] > array[j+1]) {
std::swap(arr... | true |
93d925b31f378917f149f578122507caa446bd3f | C++ | Dhikigame/games | /宝探しゲーム/宝探し/FPS.cpp | SHIFT_JIS | 913 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "GV.h"
/*
FPSs
...̃W[͎lď̂ł͂ȂAقƂǎQl̂̃R[ĥ܂܂ł...
QlFhttp://dixq.net/g/03_14.html
*/
const int N = 60; //ςTv
const int FPS = 60; //ݒ肵FPS
bool Update(){
if (mCount == 0){ //1t[ڂȂ玞L
mStartTime = GetNowCount();
}
if (mCount == N){ //60t[ڂȂ畽ςvZ
int t = GetNowCount();
mFps = 1000 / ((t - mStar... | true |
4c674ebbca0236c7fc4c17655c686c72a11cab2b | C++ | NicKarlovich/bus_simulator | /project/src/stop.h | UTF-8 | 2,229 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* @file stop.h
*
* @copyright 2019 3081 Staff, All rights reserved.
*/
#ifndef SRC_STOP_H_
#define SRC_STOP_H_
#include <list>
#include <iostream>
#include "src/bus.h"
#include "src/passenger.h"
#include "src/data_structs.h"
class Bus;
/**
* @brief The main class for stops.
*/
class Stop {
public:
/**... | true |
bbc3a2471b4c372e269ac4641c922673c28a6c80 | C++ | wzj1988tv/code-imitator | /data/dataset_2017/dataset_2017_8_formatted_macrosremoved/Shuto/5304486_5697460110360576_Shuto.cpp | UTF-8 | 2,182 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef pair<long long int, long long int> PI;
typedef pair<long long int, long long int> PI;
inline bool ok_1(long long int x, long long int unit) {
x *= 10;
unit *= 10;
long long int near = x / unit;
if (x >= unit * near * 9 / 10 && x <= unit * near * 11 / 10) {
... | true |
a7fe317d2c7c936400e749bdeef887a972a0c783 | C++ | RasmusKarlsson/Raytracer | /raytrace/Objects.h | UTF-8 | 622 | 2.671875 | 3 | [] | no_license | #pragma once
#include "glm.hpp"
#include "Shape.h"
#include "Sphere.h"
#include "Plane.h"
#include <vector>
#include <iostream>
#include <iterator>
class Objects
{
public:
/*
std::vector<Sphere> spheres;
std::vector<Plane> planes;
*/
std::vector<Shape*> shapes;
Shape* s;
int objectID;
Objects(void);
bool... | true |
fcbbce27fa6557b207bf01464daca71ba4758ae1 | C++ | VB6Hobbyst7/vault_repo | /ezEnrollment/AdvancePCS/Recap2/Recap2/src/Matrix.cpp | UTF-8 | 2,154 | 2.515625 | 3 | [] | no_license | #include <client/Matrix.h>
#include <client/Messages.h>
//#include <client/StdAfx.h>
//#include <client/StringParser.h>
#include <wx/tokenzr.h>
SimpleVector::SimpleVector(wxString& str, wxString& colSeparator)
{
m_storage = new wxArrayString();
#if 1
wxStringTokenizer st(str, colSeparator, wxTOKEN_RET_EMPTY_AL... | true |
930e026d566eb64c410da731aba875cb151cf5ed | C++ | maicolknales/proyecto_progra_3 | /Menus/Menus.cpp | UTF-8 | 6,952 | 3.15625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
//Menu Administrador del Sistema
char opcion,subopcion;
do{
system("cls");
cout<<"|==============================================================|"<<endl;
cout<<"| MENU ADMINISTRADOR DEL SISTEMA |"<<endl... | true |
999dd19da78be0bab793636dbe87e82be0fd3dd4 | C++ | HCMY/UnCategoticalableAlgorithm | /Leetcode/BinarySearch/Medium/FindFirstandLastPositionofElementinSortedArray.cc | UTF-8 | 770 | 3.328125 | 3 | [] | no_license | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int left = 0;
int right = nums.size()-1;
bool left_flag = 1;
bool right_flag = 1;
int start = -1;
int end = -1;
vector<int> ans;
while((left_flag||right_flag) &&(left<right))){
... | true |
85eb22ba67d149adbd9559b2fcb1e28f0af72b2f | C++ | alandefreitas/Evolutionary_Computation_Course | /class_02/naive_EA.hpp | UTF-8 | 5,621 | 2.90625 | 3 | [] | no_license | //
// Created by Alan de Freitas on 12/04/2018.
//
#include "naive_EA.h"
template <typename problem, typename solution>
std::default_random_engine naive_EA<problem,solution>::_generator = std::default_random_engine(std::chrono::system_clock::now().time_since_epoch().count());
template <typename problem, typename sol... | true |
70bcf3b4e451aa4141e520cef9d41c765fd671f6 | C++ | exokitxr/aardvark | /src/tools/systools.cpp | UTF-8 | 2,091 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "tools/systools.h"
#include <windows.h>
#include <tools/logging.h>
#include <tools/stringtools.h>
namespace tools
{
static std::string formatWindowsError( LONG error )
{
LPWSTR buffer = nullptr;
FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, error, 0, (LPWSTR)&buf... | true |
2a1c90fc3295bd31f5d0c77347b5930083d62ad9 | C++ | Merna177/ProblemSolving | /Medium/MinPath_M.cpp | UTF-8 | 777 | 3.046875 | 3 | [] | no_license | //Medium
// solve-->https://leetcode.com/problems/minimum-falling-path-sum/
class Solution {
public:
int dp[101][101];
int minFallingPathSum(vector<vector<int>>& A) {
int value=1e9;
memset(dp,-1,sizeof dp);
for(int i=0;i<A[0].size();i++){
value = min(value,go(0,i,A));
}
... | true |
a89b856190dd43f4a768b58be82c3a2301a053c5 | C++ | rensfo/QtOrm | /QtOrm/Mappings/SubClassMap.cpp | UTF-8 | 1,751 | 2.75 | 3 | [
"MIT"
] | permissive | #include "SubClassMap.h"
namespace QtOrm {
namespace Mapping {
SubClassMap::SubClassMap(QObject *parent) : ClassMapBase(parent) {
}
QSharedPointer<ClassMapBase> SubClassMap::getSuperClass() const {
return superClass;
}
void SubClassMap::setSuperClass(const QSharedPointer<ClassMapBase>&value) {
superClass = valu... | true |
28ab823589f1900b0de4132e023ea40ae81491e0 | C++ | latusikl/pacman | /pacmanRemake/mapGeneratorModule/mapGeneratorPlacer.cpp | WINDOWS-1250 | 1,540 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "mapGeneratorPlacer.h"
Vector2f mapGeneratorPlacer::getPosition()
{
return rect.getPosition();
}
bool mapGeneratorPlacer::checkMovement()
{
return movable;
}
bool mapGeneratorPlacer::isBonus()
{
return bonus;
}
bool mapGeneratorPlacer::isSpecialBonus()
{
return specialBonus;
}
void mapGeneratorPlacer... | true |
8d7c988c7134c64f01e0d164f1d63cefbfca74a0 | C++ | leon-schi/iot-nixie-tube-clock | /time_server.h | UTF-8 | 5,001 | 2.75 | 3 | [] | no_license | #include <ESP8266WebServer.h>
#include "time_html.h"
#include "wifi_credentials.h"
#ifndef SERVER_H
#define SERVER_H
class ClockServer {
private:
ESP8266WebServer* server;
ClockController* controller;
int mode = clockMode;
public:
ClockServer(ClockController* c) {
... | true |
1996a1e01280a22a792d2761227bc4b3569f426e | C++ | SVilcaLim03/cc2-proyect | /src/game_object.cpp | UTF-8 | 852 | 2.609375 | 3 | [] | no_license | #include "game_object.hpp"
GameObject::GameObject(Object *&&object, int &&x, int &&y)
: object_(object), animation_(nullptr), location_(new Location(x, y)),
observer_(nullptr) {}
GameObject::~GameObject() {
delete animation_;
delete location_;
delete object_;
}
void GameObject::SetAnimation(
std::st... | true |
ed42c72550e56e8ca4c06158686f4039513fbfad | C++ | JianHangChen/LeetCode | /157. Read N Characters Given Read4.cpp | UTF-8 | 1,921 | 3.296875 | 3 | [] | no_license |
// !!! sol2, gy, O(n), O(1), read all 4 * times, and then use min(ibuf, n) to get the smallest size
class Solution {
public:
/**
* @param buf Destination buffer
* @param n Number of characters to read
* @return The number of actual characters read
*/
int read(char *buf, int n) {
... | true |
03aa7a4559a890b8b973d8e6619de95a606074a8 | C++ | khovanskiy/Rush | /common/bullet.h | UTF-8 | 1,023 | 2.75 | 3 | [] | no_license | #ifndef BULLET_H
#define BULLET_H
#include "physicsobject.h"
#include <QString>
class Bullet : public PhysicsObject
{
int bullet_type;
PhysicsObject* source;
double width, height;
double damage;
public:
static const int BULLET;
static const int MISSILE;
static const int CUT;
Bullet(i... | true |
48d89f24c6c1c90c1e1d4a2f7cca7c58fe3ca32b | C++ | andrei-toterman/oop_lab | /5-6/tests.cpp | UTF-8 | 6,820 | 2.96875 | 3 | [] | no_license | #include "tests.h"
#include "controller.h"
#include "dynamicarray.h"
#include "repository.h"
#include <cassert>
void test_dv_add() {
DynamicVector<int> vector;
assert(vector.size() == 0);
vector.add(1);
assert(vector.size() == 1);
assert(vector[0] == 1);
}
void test_dv_remove() {
... | true |
6a37d73a89f35a30fa74f74514e8fca71f88f00d | C++ | JaykayChoi/AlgorithmicProblem | /AlgorithmicProblem/Solved/Online Judge/USACO/1_3_MixingMilk.cpp | UTF-8 | 921 | 2.859375 | 3 | [] | no_license | /*
ID: jkchoik1
PROG: milk
LANG: C++11
*/
#include <fstream>
#include <iostream>
#include <map>
using namespace std;
//http://train.usaco.org/usacoprob2?a=qxjyGzruutH&S=milk
int buyMilk(multimap<int, int>& sellers, int needMilk)
{
int cost = 0;
int leftBuyingMilk = needMilk;
for (multimap<int, int>::iterator it =... | true |
46e507b4fd98a9dcc2fa70f3dac9572449973818 | C++ | krofna/uva | /10943.cpp | UTF-8 | 398 | 2.515625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int dp[101][101];
int f(int n, int k)
{
if (n == 0 || k == 1)
return 1;
if (dp[n][k])
return dp[n][k];
int sum = 0;
for (int i = 0; i <= n; ++i)
sum += f(n - i, k - 1) % 1000000;
return dp[n][k] = sum % 1000000;
}
int main()
{
i... | true |
50c4a89e595e6804eca8523a2bc7e73b00856fe6 | C++ | clean-code-craft-tcq-1/stream-bms-data-soundarya1112 | /Receive/test/bms-rx-test.cpp | UTF-8 | 1,451 | 2.59375 | 3 | [
"MIT"
] | permissive | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"
#include "bms-rx-data.h"
#include "stddef.h"
#include "string.h"
TEST_CASE("Test from Console - Valid data")
{
float tempCalc, ChrgRateCalc;
char str[100];
strcpy(str,"{'temperature': 37... | true |
41985a0f828210c83c86a15c47a755ac94e9d32b | C++ | aorura/qt_modeling_language | /qmlextensionplugins/timemodel.cpp | UTF-8 | 990 | 2.734375 | 3 | [] | no_license | #include "timemodel.h"
#include <QCoreApplication>
#include <QDebug>
int TimeModel::instances = 0;
MinuteTimer *TimeModel::timer = 0;
TimeModel::TimeModel(QObject *parent):
QObject(parent)
{
// By default, QQuickItem does not draw anything. If you subclass
// QQuickItem to create a visual item, you will n... | true |
86a36be27a95b1d86e3263677b947d67f3115b19 | C++ | chxj1980/orwell | /cpp/common/FrameUpdater.h | UTF-8 | 801 | 2.71875 | 3 | [] | no_license | #ifndef FRAMEUPDATER_H
#define FRAMEUPDATER_H
/*
Why create such a silly class? Well because I don't want XVideoWidget things
inside MediaStream because I don't want QT things there because I'm going to use
mediaStream on Android and iOS too. But I need to use the method updateData of
XVideoWidget and possibly other ... | true |
17c2eb9c40cab749c6d13bc986adadad684a6cc7 | C++ | snnmbb/lab_11 | /lab11_1.cpp | UTF-8 | 342 | 3.421875 | 3 | [] | no_license | #include<iostream>
using namespace std;
long long int fibonacci(long long int x);
int main(){
cout << fibonacci(50);
return 0;
}
long long int fibonacci(long long int x)
{
if(x>1)
{
return fibonacci(x-1)+fibonacci(x-2);
}
else if(x==0)
{
return 0;
}
else
{
... | true |
92b8938e37b598b3166e73d87f2ad729c72f97c7 | C++ | 543877815/algorithm | /leetcode/c++/557. Reverse Words in a String III.cpp | UTF-8 | 635 | 3.21875 | 3 | [] | no_license | // 时间复杂度:O(n)
// 空间复杂度:O(1)
class Solution {
public:
string reverseWords(string s) {
int n = s.size();
if (n == 0) return s;
int left = 0, right = 0;
while (right < n) {
if (s[right] != ' ') right++;
else {
reverse(s.begin() + left, s.begin() ... | true |
e5391854a5dec456ce9e55c911fb1828359c7257 | C++ | anil-adepu/HPC_lab | /OMP/pi.cpp | UTF-8 | 1,221 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <omp.h>
using namespace std;
#include <time.h>
#define ll long long
static int steps;
int N;
int32_t main(int count, char* cli[]) {
N = atoi(cli[1]); steps = atoi(cli[2]);
int i;
double increment = 1.0/steps;
double sum =0.0,x;
for(i=1;i<=N;i++) {
// ... | true |
bc525bc01f29abfdccd26af23d16bbaa9ccb4ee5 | C++ | Mukund-Raj/C-plus-plus-Programs | /pointer_example.cpp | UTF-8 | 1,000 | 3.3125 | 3 | [] | no_license | #include<iostream>
using namespace std;
/*
int main()
{
char *ptr = "GeeksQuiz";
printf("%s\n", *&*&ptr);
/*
int a;
char *x;
x = (char *) &a;
a = 512;
x[0] = 1;
x[1] = 2;
cout<<a<<endl;
//cout<<sizeof(int);
cout<<sizeof(x);*/
/*
float arr[5] = {12.5, 10.0, 13.5, 90.5, 0.5};
float... | true |
896350797e6329103c06ac28596047df5e04c72b | C++ | cbchoi/sit22005 | /2018/01.spring/02.final/Problem01/problem01.cpp | UTF-8 | 705 | 3.265625 | 3 | [
"MIT"
] | permissive | #include "problem01.h"
#include <iostream>
Student::Student(int _id, std::string _name, int _point)
:m_id(_id), m_name(_name), m_point(_point)
{
}
int get_id()
{
return _id;
}
std::string get_name()
{
return m_name;
}
int get_point()
{
return m_point;
}
void set_id(int _id)
{
m_id = _id;
}... | true |
6f2e867c1b3c0b733e1067653c9a53d7c9252dcf | C++ | jasonleakey/CrapCodes | /C++/FFT/main.cpp | UTF-8 | 1,637 | 2.59375 | 3 | [] | no_license | /*
* CPP_FFT - TODO
*
* Copyleft(R) by jasonleakey
* <jasonleakey@gmail.com>
* <QQ:174481438>
* --------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published... | true |
3a465990151237d43235108e37e71001e65e85bd | C++ | rg7000/Arrays | /ar_inp.cpp | UTF-8 | 730 | 3.34375 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
using namespace std;
class arr_op
{
int N;
int i;
public:
int get_n();
void set_n();
void initialize_arr(int a[], int size);
void print(int a[], int size);
};
int arr_op::get_n()
{
return N;
}
void arr_op::set_n()
{
cin>>N;
}
void arr_... | true |