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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7e0d23766df5d12f94c2e6c8a3ac0753f530f233 | C++ | michaelmike25/Trab_Redes_I | /main.cpp | ISO-8859-1 | 8,950 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include<time.h>
using namespace std;
void somap1p2(int mat_dados[2][10], int vaium, int vet_resultado[10]){ // Soma P1 P2 CHECKSUM
int i;
for(i=9; i>=0; i--){
if(mat_dados[0][i] == 0 && mat_dados[1][i]... | true |
7d7291ff53de7bc7448b068a01802cb3a83d2925 | C++ | vincentbryan/Cpp | /DesignPatterns/Abstact Factory/main.cpp | UTF-8 | 2,156 | 3.59375 | 4 | [] | no_license | /*
* Date : 2017-07-15 11:25:11
* Author : Vincent Bryan
* Description : a demo for abstract factory
*/
#include <iostream>
using namespace std;
// Product A
class ProductA{
public:
ProductA(){};
~ProductA(){};
virtual void show() = 0;
};
class ProductA1 : public ProductA{
public:
ProductA... | true |
8ed25eb8902efcc4c27143c59abdc20491c9f2e9 | C++ | ccc9775/IGME209-02 | /HW5-TemplatedQueue/HW5-TemplatedQueue/queue.h | UTF-8 | 3,140 | 4.3125 | 4 | [] | no_license | #pragma once
using namespace std;
template<class T>
class Queue
{
public:
//default constructor of the queue
Queue() {
first = nullptr;
count = 0;
}
//copy constructor
/*Queue(const Queue& other) : data(new char[std::strlen(other.data) + 1]) {
std::strcpy(data, other.data);
}*/
//operator constructor
Que... | true |
c7d47342d2b6d188ae5d9b44499de92ebf606359 | C++ | Byeong-Chan/ByeongChan_PS_Note | /C:C++/2748.cpp | UTF-8 | 284 | 2.5625 | 3 | [] | no_license | #include <iostream>
using namespace std;
long long memo[100] = {0, 1, 0,};
long long f(int n) {
if(n == 0) return 0;
if(n == 1) return 1;
if(memo[n] != 0) return memo[n];
return memo[n] = f(n-1) + f(n-2);
}
int main() {
int n;
scanf("%d",&n);
printf("%lld",f(n));
return 0;
} | true |
d838b84645353547bfd41896086be44973de8cf2 | C++ | thomasLeMeur/00-piscine-cpp | /j02/ex02/Fixed.cpp | UTF-8 | 3,793 | 2.796875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.cpp :+: :+: :+: ... | true |
7f9874d2f78eb18360c8ee29bf27dc26c19e6fcc | C++ | Mishanyny/minesweeper | /minesweeper/main.cpp | UTF-8 | 7,447 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<ctime>
#include <conio.h>
using namespace std;
class unit
{
public :
unit()
{
key = 'x';
close_key = 0;
}
void set_bomb()
{
close_key = 9;
}
void set_flag()
{
key = '^';
}
void set_close_key()
{
close_key ++;
}
void unset_close_key()
{
cl... | true |
dde9438b7927e981cf4ef6de4d8b584f144c587a | C++ | Codedemons/Programing-C | /Basicos/SECUENCIA 2/Switch/Switch meses.cpp | UTF-8 | 606 | 3.234375 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
int main (void)
{
int Mes;
printf("Da un numero del 1 al 12");
scanf("%d",&Mes);
switch(Mes)
{case 1: printf("Enero"); break;
case 2: printf("Febrero"); break;
case 3: printf("Marzo"); break;
case 4: printf("Abril"); break;
case 5: printf("Mayo"); break;
case 6: printf("... | true |
77aa49f2517fa83c9eb535f323abda835a32c650 | C++ | cbrghostrider/Hacking | /leetcode/_001443_collectApples.cpp | UTF-8 | 1,011 | 2.765625 | 3 | [
"MIT"
] | permissive | class Solution {
// node -> (left, right) ;
unordered_map<int, vector<int>> tree;
vector<bool> apples;
vector<bool> visited;
// return value says (visit_me?, my_cost)
pair<int, bool> minCost(int node) {
visited[node] = true;
int stree_cost=0;
for (int n : tree[node]... | true |
e5a1510a9931a07d95cfca7360159c7f33b62e8a | C++ | liuyaqiu/LeetCode-Solution | /767-Reorganize-String.cpp | UTF-8 | 1,626 | 3.71875 | 4 | [] | no_license | /*
Reorganize String
Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.
If possible, output any possible result. If not possible, return the empty string.
Example 1:
Input: S = "aab"
Output: "aba"
Example 2:
Input: S = ... | true |
2d968c18a2e76b9730250dc3e93bbf4c4af6e4eb | C++ | rockyvon/opengl | /Breakout/src/object.h | UTF-8 | 1,433 | 2.75 | 3 | [] | no_license | #ifndef GAMEOBJECT_H
#define GAMEOBJECT_H
#include "sprite.h"
class GameObject
{
public:
GameObject();
GameObject(
Sprite* sprite,
bool solided = false,
vec2 velocity = vec2(0.0f),
bool destoryed = false);
GameObject(
Texture2D* tex,
const vec2 position,
const vec2 size,
const vec3 color = vec3(1... | true |
1c5a0cbe4c66582f87aed809150a9ae8dafd6594 | C++ | EvgenyLinev/mp1-2020-2021 | /LinevEvgeni/Lab2_Gausse/ConsoleApplication1/ConsoleApplication1.cpp | UTF-8 | 6,411 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
template<typename T>
class Vector
{
private:
int size;
T* data;
public:
Vector()
{
size = 0;
data = NULL;
}
Vector(int size_)
{
size = size_;
data = new T[size];
}
Vector(const Vector& second)
{
data = new T[second.size];
size = second... | true |
17c6df28db564dffce7440b2ea3e9bd466307bc0 | C++ | myqcxy/Freshman | /C语言/实验/程序/1113.递归调用的次数.cpp | WINDOWS-1252 | 295 | 3.5 | 4 | [] | no_license | #include<stdio.h>
int fib(int k);
int main(void )
{
int n;
scanf("%d", &n);
printf("%d\n", fib(n));
printf("ݹ%d\n", 2*fib(n)-1);
return 0;
}
int fib(int k)
{
if(k == 1 || k == 2)
return 1;
else
return fib(k-1) + fib(k-2);
}
| true |
fb1f00876fd364b8142ba40327203e1b52a93196 | C++ | Aichuanbaizhequn/Template | /03_DataStructrue/08_Others/02_静态区间k大划分树.cpp | UTF-8 | 2,079 | 2.578125 | 3 | [
"MIT"
] | permissive | // const int maxn = 100010;
int tree[20][maxn];
// 读入sorted并排序,赋值给tree的第0层
int sorted[maxn];
int toleft[20][maxn];
// 保存左子树的和
// ll sum[20][maxn];
// 1, n, 0
void build(int l, int r, int dep) {
if (l == r) return;
// sum[dep][0] = 0;
toleft[dep][0] = 0;
int mid = l + r >> 1;
int same ... | true |
ab4230d2daf7e6bb7a4cde6ef48c20f3b8a42d01 | C++ | arijit19/Code-Eval | /Decimal To Binary.cpp | UTF-8 | 640 | 2.96875 | 3 | [] | no_license | //
// main.cpp
// decimal to binary
//
// Created by ARIJIT CHANDRA on 06/04/14.
// Copyright (c) 2014 ARIJIT CHANDRA. All rights reserved.
//
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int main(int argc, char * argv[])
{
ifstream ifs(argv[1]);
string token;
while (... | true |
32649a239f3c08f4e80acdba69cc3cf33d2c1492 | C++ | portfolioExpert/BackJoon | /C++/문제_14650번.cpp | UTF-8 | 605 | 2.875 | 3 | [] | no_license | //문제 14650번 걷다보니 신천역 삼(Small) -> 백트래킹
int n;
long long sum = 0;
int cnt = 0;
void dfs(int index){
if(index == n){
if(sum % 3 == 0)
cnt++;
return;
}
for(int i = 0;i<=2;i++){
sum*=10;
sum+=i;
dfs(index + 1);
sum-=i;
sum/=10;
}
}
int main(... | true |
1cf8d9c57e795d1114bb7d33b2a88250ab0e7087 | C++ | nCine/nCine | /unit_tests/gtest_statichashset_string.cpp | UTF-8 | 3,592 | 3.265625 | 3 | [
"MIT"
] | permissive | #include "gtest_statichashset_string.h"
namespace {
class StaticHashSetStringTest : public ::testing::Test
{
protected:
void SetUp() override { initHashSet(strHashset_); }
nctl::StaticHashSet<nctl::String, Capacity> strHashset_;
};
TEST_F(StaticHashSetStringTest, Capacity)
{
const unsigned int capacity = strHa... | true |
eab062b421ce5bfd44f87cb7b900239679a1b07c | C++ | hyCpp/projecgt | /C++Test/struct/Stash/test.cpp | UTF-8 | 923 | 2.703125 | 3 | [] | no_license | #include"Stash.h"
#include<assert.h>
#include<stdio.h>
#define BUFFSIZE 80
int main() {
Stash intStash, stringStash;
int i;
FILE* file;
char buf[BUFFSIZE];
char* cp;
initialize(&intStash, sizeof(int));
printf("sizeof(int) = %d", sizeof(int));
for (i = 0; i < 100; i++) {
add(&... | true |
fe6530de512a4337d4d414ba41d8eb037ce4554f | C++ | LuckyGrx/PAT_Basic_Level | /C++/1009.cpp | UTF-8 | 366 | 3 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string str;
while(getline(cin,str)){
reverse(str.begin(),str.end());
unsigned i=0,j=i;
while(i<str.size()){
while(i<str.size()&&str[i]!=' ')
++i;
reverse(str.begin()+j,str.begin()+i);
j=++i;... | true |
7a4f8e16bdbecba6e89cca4fe782d1dc3157bc0e | C++ | htcoles/Vector-Math-Library | /source/constants.h | UTF-8 | 538 | 2.875 | 3 | [] | no_license |
#ifndef MATHLIB__CONSTANTS_H
#define MATHLIB__CONSTANTS_H
#define MATHLIB_INLINE __forceinline
namespace MathLib
{
const float MATHLIB_EPSILON = 0.05f;
const float MATHLIB_PI = 3.14159265358979323846264338327950288f;
const float MATHLIB_2PI = 2.0f * MATHLIB_PI;
__declspec(dllexport) inline float degreesToRadia... | true |
8968798a5821a289f92c91e6b7f2830aae84b553 | C++ | jhasudhakar/leetcode | /114_flaten_tree_to_list.cpp | UTF-8 | 655 | 3.4375 | 3 | [] | no_license | #include <stdlib.h>
//Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(NULL), right(NULL) {}
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
cla... | true |
e6891b42bbcb2f7742a0233f0aa053f04aa21a70 | C++ | Nfreewind/opencvTool | /readPicture/readPicture.cpp | UTF-8 | 580 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
void help()
{
cout << "\nThis program is used to read picture\n"
"Usage:\n"
"./readPicture image_name\n\n";
}
int main(int argc, char** argv)
{
Mat image;
string filename;
if ... | true |
71c2f683f27ca753c0e5c13a1e81188b52ebb412 | C++ | godot-addons/godot-sfs2x | /thirdparty/sfs2x/Requests/BanUserRequest.cpp | UTF-8 | 4,664 | 2.53125 | 3 | [
"MIT"
] | permissive | // ===================================================================
//
// Description
// Contains the implementation of BanUserRequest
//
// Revision history
// Date Description
// 30-Nov-2012 First version
//
// ===================================================================
#include "BanUserRequest.h"
... | true |
c1ea3b0b2f1e29260fe1721ad45741e96d8e099e | C++ | 0000duck/lansunController | /src/robot_class/ArcParser.cpp | GB18030 | 14,453 | 2.921875 | 3 | [] | no_license | /*
* ArcParser.cpp
*
* Created on: 2017628
* Author: deng
*/
#include "ArcParser.h"
#include "math.h"
#define PI 3.1415926
double ArcParser::divideLength = 4;
#include <iostream>
using namespace std;
ArcParser::ArcParser() {
// TODO Auto-generated constructor stub
}
ArcParser::~ArcParse... | true |
6d9a238f817871dbdbaa6711895db6811f9369dc | C++ | nzmgng/simple-game-engine | /Engine/Source/Events/Private/EventDispatcher.cpp | UTF-8 | 2,357 | 2.65625 | 3 | [] | no_license | #include "Events\EventDispatcher.h"
// engine includes
#include "Assert\Assert.h"
#include "Common\HelperMacros.h"
#include "Logger\Logger.h"
namespace engine {
namespace events {
EventDispatcher* EventDispatcher::instance_ = nullptr;
EventDispatcher::EventDispatcher()
{}
EventDispatcher::~EventDispatcher()
{
... | true |
815db529365d32461078dd7b3d21eb9bdb22443e | C++ | klyse/SudokuSolverCpp | /SudokuSolverTest/SudokuTest.cpp | UTF-8 | 4,198 | 2.9375 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "CppUnitTest.h"
#include "Sudoku.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace std;
namespace SudokuSolverTest
{
TEST_CLASS(SudokuTest)
{
public:
TEST_METHOD(ConvertToVector_ConvertFromSudokuToVector_IsCorrect)
{
// Arrange
Sudoku sudoku;
... | true |
456f26dd4b1bbdde9f488b97e04435d84a183b00 | C++ | zxlwbi199101/ACM | /Beginning algorithm/Volume 1. Elementary Problem Solving/Maths - Misc/107 - The Cat in the Hat.cpp | UTF-8 | 918 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
void display(int N,int x,int initHeight,int workers)
{
int sum_notworking=1,
sum_height=initHeight;
int current_notworking=1,
current_height=initHeight;
for(int i=1;i<x;i++)
{
current_notworking*=N;
current_height/=... | true |
fb7a089580603501673ca029778653c20473b961 | C++ | thatscoding/competitive-prgramming | /HCF.cpp | UTF-8 | 193 | 2.984375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int gcd(int a,int b)
{
if(a==0)
return b;
return gcd(b%a,a);
}
int main()
{
int a=36;
int b=48;
cout<<"GCD : "<<gcd(a,b)<<endl;
} | true |
54e56d8a675f3daa9b081bb78694cd73d625116f | C++ | polvallsortiz/ArduinoProjects | /Sorra/Sorra.ino | UTF-8 | 804 | 2.578125 | 3 | [] | no_license |
void setup() {
// put your setup code here, to run once:
for(int x = 2; x < 8; x++) {
pinMode(x,OUTPUT);
}
pinMode(8,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int EstadodelInterruptor = digitalRead(8);
if(EstadodelInterruptor == HIGH) {
int i = 2;
while(i < 8) {
... | true |
bd0394e43a2727adaf465331e937674332c12efe | C++ | alexOarga/PSConcurrentesDistribuidos16 | /practica4/ejercicio1.cpp | UTF-8 | 4,149 | 2.6875 | 3 | [] | no_license | ///////////////////////////////////////////////////////
// Oarga Hategan, Alexandru 718123
// Practica 4 - PSCD
// g++ -L/usr/X11R6/lib -L/usr/local/lib -lm -pthread -lcurl -lX11 -std=c++11 anuncio.o monitor.o ejercicio1.cpp -o ejercicio1
///////////////////////////////////////////////////////
#include "monitor.h"
#in... | true |
0dd7a14d9904fe4c03ce292190992d48902ed198 | C++ | Design-Enginnering/PrepBytes-questions | /Find The Leader1(Brute Force Approach).cpp | UTF-8 | 453 | 2.671875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
for(int i=n-1;i>=0;i--)
{
int flag=0;
for(int j=i;j<n;j++)
{
if(arr[i]<arr[j])
{
flag=1;
... | true |
4d1a518a2b750542bdfe7ce95f207cb1029dafc4 | C++ | zh325700/windowscpp | /Amadeus/Non-modifying sequence operations/find_end.cpp | UTF-8 | 663 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <memory>
#include <array>
#include <string>
using namespace std;
// find first of sub-sequence and last of sub-sequence
int main(){
vector<int> v = {1,2,3,4,5,7,1,2,3,0,1,2,3,8,9};
vector<int> t1 = {2,3};
vector<int>::iterator result;
// res... | true |
cf420ac1bafdf1c2f7f4fb8d8c56e88ad81c967a | C++ | moevm/oop | /8383/averina/labs/Unit/Attributes/Mana.cpp | UTF-8 | 394 | 3.203125 | 3 | [] | no_license |
#include "Mana.h"
void Mana::set(int mana)
{
this->mana_ = mana;
this->maxMana_ = mana;
}
void Mana::actRecovered(int recover)
{
this->mana_ += recover;
if (this->mana_ > this->maxMana_) this->mana_ = this->maxMana_;
}
void Mana::actReduced(int decrease)
{
this->mana_ -= decrease;
if (this->... | true |
205bc9013bcc17cf32d47b84bf1ea3329270166d | C++ | vmudinas/Bomberman-AI | /bomberman - sursa I .cpp | UTF-8 | 3,607 | 2.59375 | 3 | [] | no_license | #include "Player.h"
#include <iostream>
#include <unordered_map>
using namespace std;
// main.cpp is the only file you will be submitting for the contest
// HINT: before submitting this file, make sure to test compiling on Release
// and deactivating Debug mode from the Match Maker
// HINT: read the complete ru... | true |
ce83c7e7f666a8b6f193642c7ebd432675eff20d | C++ | tt9024/huan | /mts_src/util/histogram.cc | UTF-8 | 3,611 | 2.671875 | 3 | [] | no_license | //
// Created by Joren Gaucher 01/23/2023
//
#include <utility>
#include <cmath>
#include <bit>
#include "histogram.h"
Histogram::Histogram() noexcept:
max_(INT64_MIN),
min_(INT64_MAX),
name_("Histogram")
{
// nothing
}
Histogram::Histogram(std::string name) noexcept :
count_(0),... | true |
16919c123df763c8be004f5563ad67e20802ff8b | C++ | iLamStudy/project-c | /src/exts/tabtenn0.cpp | UTF-8 | 379 | 2.609375 | 3 | [
"MIT"
] | permissive | //tabtenn0.cpp -- simple base-class implements
#include "tabtenn0.h"
#include <iostream>
TableTennisPlayer::TableTennisPlayer (
const string &fn,const string &ln,bool ht)
: firstname(fn) ,lastname(ln),hasTable(ht)
{
//firstname = fn;
//lastname = ln;
//hasTable = ht;
}
void TableTennisPlayer::Name() const ... | true |
c0d8d4ed9a626efdbea7736eacfdbc40fa9193ee | C++ | mohitmp9107/Competitive-Programming- | /Additional/Longest_Increasing_Subsequence.cpp | UTF-8 | 505 | 2.765625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int lis(int a[],int n ){
int output[n]; output[0]=1;
for(int i=1;i<n;i++){
output[i]=1;
for(int j=i-1;j>=0;j--){
if(a[j]>a[i]) continue;
int possibleAns=output[j]+1;
output[i]=max(possibleAns,output[i]);
}
}
int b... | true |
6e7ab8993abf1d413d3bf43db044efb174476661 | C++ | epfl-lasa/robot-toolkit | /packages/core/mathlib/include/TVector.h | UTF-8 | 13,498 | 2.828125 | 3 | [] | no_license | /*
* Copyright (C) 2010 Learning Algorithms and Systems Laboratory, EPFL, Switzerland
* Author: Eric Sauser
* email: eric.sauser@a3.epf.ch
* website: lasa.epfl.ch
*
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* l... | true |
9b49f77f8c6765cb32095b6655d284d4a841dddf | C++ | chbaker0/gl-engine | /BasicRenderEngine/include/GLFWWindowContext.h | UTF-8 | 905 | 2.640625 | 3 | [
"MIT"
] | permissive | /*
* File: GLFWWindowContext.h
* Author: Collin
*
* Created on March 2, 2015, 9:24 PM
*/
#ifndef GLFW_WINDOW_CONTEXT_H_INCLUDED
#define GLFW_WINDOW_CONTEXT_H_INCLUDED
#include <utility>
#include <GL/glew.h>
#include <glfw/glfw3.h>
#include "GLContext.h"
class GLFWWindowContext : public GLContext
{
protecte... | true |
1363c35add6e5519f65b39246a67cc7fbc8daa4a | C++ | amcauley/DirectXGame | /Engine/VisualModels/TexText.cpp | UTF-8 | 10,388 | 2.515625 | 3 | [] | no_license | #include "TexText.h"
#include <fstream>
#include <sstream>
#include <string>
#include "../Util.h"
#include "../Logger.h"
TexText::TexText()
{
m_type = VISUAL_MODEL_TEX_TEXT;
m_pVs = NULL;
m_pPs = NULL;
m_pVBuffer = NULL;
m_pLayout = NULL;
m_pTexture = NULL;
m_pSampleState = NULL;
m_position = Pos3(0.0f... | true |
abfeec515bd8c34e3cad03aab55d6adb61ed6b1c | C++ | nbelin/7Wonders | /7WondersCommon/card.cpp | UTF-8 | 17,361 | 2.5625 | 3 | [] | no_license | #include "card.hpp"
#include <iostream>
const char * CardTypeToStr(CardType type) {
switch (type) {
case TypeResourceRaw: return "ResourceRaw";
case TypeResourceManufactured: return "ResourceManufactured";
case TypeCommerce: return "Commerce";
case TypeCivilisation: return "Civilisation"... | true |
acf69a6de3cd92666fef3facdd7452546bbceb43 | C++ | furkanusta/Competitive-Programming | /Codeforces/490D.cpp | UTF-8 | 1,722 | 3.203125 | 3 | [] | no_license | /****
URL: http://codeforces.com/contest/490/problem/D
Tag: math, greedy
Difficulty: Easy
Complexity: O(N??)
Description: make their 2 and 3 multipliers equal
****/
#include <cstdio>
#include <cstdlib>
long long int count2, count3;
long long int a, b, c, d, tmp, ans, tmp2;
int main()
{
... | true |