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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
00c9e064407e701320a469797d37f4cc5463546d | C++ | Wagenod/Yandex_C_plus_plus_development | /white_belt/week 2/MoveStrings.cpp | UTF-8 | 593 | 3.671875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
void MoveStrings(vector<string>& source, vector<string>& destination){
for (string s: source){
destination.push_back(s);
}
source.clear();
}
int main(){
vector<string> s = {"world"};
vector<string> d = {"hello"};
MoveStrings(s, d);
... | true |
7baff8cee78143d300b4aeb8bf6ff56f74c8c107 | C++ | qgolsteyn/CPP-Embedded-Application-Toolkit | /library/view/ButtonView.cpp | UTF-8 | 1,255 | 2.6875 | 3 | [] | no_license | #include "ButtonView.h"
#include "Log.h"
void ButtonView::onAttach() {
color = COLOR_BUTTON_DEFAULT;
focusedColor = COLOR_BUTTON_DEFAULT_FOCUSED;
View::addOnDownPressListener([](View* _view) -> int {
Log_Low("ButtonView", "On down press");
ButtonView* view = (ButtonView*) _view;
if(!view->focused) {
vie... | true |
85f0033cb0aad9c08e0cce4838db141c68b07037 | C++ | intact-software-systems/cpp-software-patterns | /MicroMiddleware/ComponentManager.cpp | UTF-8 | 1,985 | 3.0625 | 3 | [
"MIT"
] | permissive | #include "MicroMiddleware/ComponentManager.h"
#include "MicroMiddleware/ComponentBase.h"
namespace MicroMiddleware
{
ComponentManager* ComponentManager::componentManager_ = NULL;
ComponentManager::ComponentManager(string componentName)
: BaseLib::Thread(componentName)
, BaseLib::ObjectBase(componentName)
{
}
... | true |
d547f0a611549edcbf51808dc99dfe39932006b3 | C++ | chen-san/PAT | /A1042有些点要注意下.cpp | GB18030 | 889 | 3.359375 | 3 | [] | no_license | //A1042
//Ųǰڸƹȥһβе仯ĹҲһ
//һǣڲУñŴ滨ɫҪźͻɫ֮ĶӦϵ
#include <cstdio>
int main(){
int start[55], end[55], shuff[55];
int n;
scanf("%d", &n);
for (int i = 1; i < 55; i++){
start[i] = i;
}
for (int i = 1; i < 55; i++){
scanf("%d", shuff + i);
}
for (int i = 0; i < n; i++){
for (int j = 1; j < 55; j++){
end... | true |
26ceb0cde2d1cb3ae005c8e8f2b22b1ac0423517 | C++ | ngsky/walker | /src/com/ngsky/walker/leetcode/n91/A.cpp | UTF-8 | 830 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
class Solution {
public:
int numDecodings(string s) {
int n=s.length();
if(n==0) return 0;
// dp[i]:前i个字符解密方式数量
int dp[n+1];
// 空串代表一种
dp[0]=1;
for(int i=1;i<=n... | true |
4a43b125a7056e0f640d593670876166e923064f | C++ | KeremalpDurdabak/leetcode_solutions | /LC-1470.cpp | UTF-8 | 355 | 2.953125 | 3 | [] | no_license | class Solution {
public:
vector<int> shuffle(vector<int>& nums, int n) {
vector<int> result;
int k = 0;
for(int i = 0; i< n; i++){
int x = n-(n-k);
int y = n+i;
result.push_back(nums.at(x));
result.push_back(nums.at(y));
k++;
... | true |
ca382260dd2c1b16a2ef05d5ada8d18cd55f7555 | C++ | DangerInteractive/ArcticWolf | /src/GameStateManager.cpp | UTF-8 | 6,762 | 2.890625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | #include "../include/GameStateManager.hpp"
void aw::GameStateManager::pushState (const std::shared_ptr<GameState>& state) {
m_states.push_back(state);
state->onPush();
state->onActivate();
if (m_states.size() > 1) {
auto prev = m_states[m_states.size() - 2];
prev->onDeactivate();
... | true |
2a4557fb8ccfb31cd811eddb6b57d242cee6ad78 | C++ | josefutbult-music/DigitalSynth | /Synth-test/Oscillator.cpp | UTF-8 | 2,548 | 3.46875 | 3 | [] | no_license | //
// Created by josef on 2019-06-26.
//
#include "Oscillator.h"
#include <vector>
#include <cstdlib>
#include <math.h>
#include <iostream>
#include <algorithm>
Oscillator::Oscillator(double frequency, int _length) {
// Generates an array for holding sinuids
sinusoid = new Sinusoid[length];
length = _len... | true |
daaa8d34f57ce1d8d88d9a4aeddc79225d005c1a | C++ | arangodb/arangodb | /3rdParty/boost/1.78.0/boost/polygon/detail/voronoi_robust_fpt.hpp | UTF-8 | 14,746 | 2.828125 | 3 | [
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | // Boost.Polygon library detail/voronoi_robust_fpt.hpp header file
// Copyright Andrii Sydorchuk 2010-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for u... | true |
f8d78f3fc83615e60953659cb3d1a7c5a3e289c8 | C++ | RosinaGeorgieva/ObjectOrientedProgramming2021 | /Practicum/week 5/решения на самостоятелна работа/2/Rectangle.h | UTF-8 | 333 | 2.921875 | 3 | [] | no_license | #include <fstream>
#pragma once
struct Rectangle {
private:
double mA;
double mB;
public:
void initialize(double a, double b);
void print() const;
double enclosingCircleRadius() const;
double area() const;
double perimeter() const;
void readBinary(std::istream& in);
void writeBinary(std::ostre... | true |
01be4b0ce9678af3ee09c24e26e5906f300a81b7 | C++ | GhulamMustafaGM/C-Programming | /03-C++ Programing/50.cpp | UTF-8 | 458 | 3.84375 | 4 | [] | no_license | // An interesting benefits from implicity constructor conversion
#include <iostream>
using namespace std;
class myclass
{
int num;
public:
myclass(int i) { num = i; }
int getnum() { return num; }
};
int main()
{
myclass o(10);
cout << o.getnum() << endl; // displays 10
// now, use implicit... | true |
4639d6ef8f19528f2b5ea68c7f73274d93bb1e74 | C++ | Peque/micromouse-maze | /libMaze/maze.h | UTF-8 | 9,582 | 2.625 | 3 | [
"MIT"
] | permissive | /************************************************************************
*
* Copyright (C) 2017 by Peter Harrison. www.micromouseonline.com
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software ... | true |
5d8272358bb99eeae8bdbfb5aaa5330f64619a66 | C++ | zeos/signalflow | /source/src/node/envelope/envelope.cpp | UTF-8 | 3,966 | 2.703125 | 3 | [
"MIT"
] | permissive | #include "signalflow/core/graph.h"
#include "signalflow/node/envelope/envelope.h"
#include <limits>
namespace signalflow
{
Envelope::Envelope(std::vector<NodeRef> levels,
std::vector<NodeRef> times,
std::vector<NodeRef> curves,
NodeRef clock,
... | true |
b7f99f868648f70d7cb4659af8e22e7096b24575 | C++ | Jorgen-VikingGod/WiFiDuck32 | /esp_duck/src/led.h | UTF-8 | 616 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*!
\file leds.h
\brief helper class to highlight RGB leds with Neopixel library
\author Juergen Skrotzky
\copyright MIT License
*/
#pragma once
#include <Arduino.h> // String
namespace led {
void begin();
void update();
void setBrightness(uint8_t val);
void setColor(uint16_t n, uint8_t r, uint8_... | true |
eb57d3a95cd822a281d76bd036461dd61f575443 | C++ | fatihaslaan/Avoid-Bullets-Cocos2d-x- | /Classes/Bullet.cpp | UTF-8 | 2,105 | 2.84375 | 3 | [] | no_license | #include "Bullet.h"
#include "Definitions.h"
USING_NS_CC;
Bullet::Bullet()
{
visibleSize = Director::getInstance()->getVisibleSize();
origin = Director::getInstance()->getVisibleOrigin();
}
void Bullet::SpawnBullet(cocos2d::Layer* layer)
{
bullet = Sprite::create("HelloWorld.png");
bullet->setScale... | true |
1f08d3b3d30e90e9c7d4cd6b13e9072525814d67 | C++ | ijiangpeiyong/ijiang | /cpp/testJacobi.cpp | UTF-8 | 2,159 | 2.8125 | 3 | [] | no_license | #include <cstdio>
#include <cmath>
#include <iostream>
int main()
{
double tol = 1e-6;
int iter_max = 1e4;
const int n = 32;
const int m = 32;
int *A = new int[m, n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
/*
if (j < n / 3)
... | true |
566c7eeee07b9407d7fa4217cafb10c7d2036fb9 | C++ | scarlet2131/DSA-and-competitive-codes | /DSA/hackerearth/disjoint_set/marriage_problem.cpp | UTF-8 | 1,595 | 2.609375 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll getPar(ll x,ll par[]){
while(x!=par[x])
x = par[x];
return x;
}
ll find(ll x,ll y,ll par[])
{
return getPar(x,par) == getPar(y,par);
}
ll doUnion(ll x,ll y,ll par[],ll size[])
{
if( find(x,y,par) )
return -1;
ll... | true |
3e62a66b5776fbfca7587afc24b482a22d2103aa | C++ | vaishnaviawasthi01/lab5.5 | /lab5.5_q1.cpp | UTF-8 | 545 | 3.71875 | 4 | [] | no_license | //to write a program for arranging stars in box shape(k*l).
//include library
#include <iostream>
using namespace std;
//include function
int main (){
//introducing variable
int k, l;
//giving commands to take input.
cout <<"what is the number of rows : ";
cin >> k;
cout << "what is the number of ... | true |
badbe55b5c212ee81143bfac0a9f9f1f5b4d42af | C++ | WOOPICH/Structures-and-Algorithms | /Laba2/Laba2.cpp | WINDOWS-1251 | 1,549 | 3.5 | 4 | [] | no_license | #include "stdafx.h"
#include <iostream>
#include <vector>
using namespace std;
int n;
vector <int> newArray;
vector <int> deleted;
void fill(int n, vector <int> &array)
{
for (int i = 0; i < n; i++) {
array.push_back(rand() % 10000 + 1);
}
}
void display(vector <int> &array)
{
for (int i = 0; i < array.size();... | true |
292d8da0acc87891e4b2a36b3d5f0816fbb638f5 | C++ | hpc-cecal-uy/cursoAE | /MapColouring/malva/rep/SA/maxsat/SA.pro.cc | ISO-8859-1 | 45,254 | 2.765625 | 3 | [] | no_license | /************************************************
*** ***
*** Simulated Annealing Skeleton v1.0 ***
*** Provided classes and methods ***
*** Developed by: Carlos Cotta Porras ***
*** ***
****************************************... | true |
0446cdf8eb4c4901a3c64738a1f1e6feeb7be799 | C++ | tvanslyke/wasm-cpp | /include/vm/alloc/StackResource.h | UTF-8 | 9,691 | 2.734375 | 3 | [
"MIT"
] | permissive | #ifndef VM_ALLOC_STACK_RESOURCE_H
#define VM_ALLOC_STACK_RESOURCE_H
#include "vm/alloc/memory_resource.h"
#include <gsl/span>
#include <cstddef>
namespace wasm {
struct StackOverflowError:
public std::bad_alloc
{
StackOverflowError(const char* pos, std::size_t count):
std::bad_alloc(), at(pos), requested(count)
... | true |
259158cb2276beb8d4cfd90ea6926efb3db21633 | C++ | Shreya935/DS-A-Assignments | /ShreyaBansal_2013512/Day8/Q38.cpp | UTF-8 | 608 | 2.75 | 3 | [] | no_license | class Solution {
public:
string longestCommonSuffix(vector<string>& strs) {
int l=strs.size(),c=0;
for(int i=0;i<l;i++)
reverse(strs[i].begin(),strs[i].end());
for(int i=0;i<l;i++)
sort(strs.begin(),strs.end());
int m=min(strs[0].size(),strs[l-1].size());
... | true |
bc9666e7c8fd7f675128aef75ee2050b6b3ee096 | C++ | LinkItONEDevGroup/LASS_WaterBoxV2 | /ArduinoLibrary/libraries/DS18B20/examples/Multiple/Multiple.ino | UTF-8 | 1,216 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <DS18B20.h>
DS18B20 ds(2);
void setup() {
Serial.begin(9600);
Serial.print("Devices: ");
Serial.println(ds.getNumberOfDevices());
Serial.println();
}
void loop() {
while (ds.selectNext()) {
switch (ds.getFamilyCode()) {
case MODEL_DS18S20:
Serial.println("Model: DS18S20/DS1820");... | true |
52aac8e58175f6ffdc673356cd2e4e0f4d77f161 | C++ | stratigoster/UW | /cs343/a5/printer.cc | UTF-8 | 2,190 | 2.734375 | 3 | [] | no_license | #include "printer.h"
#include <iostream>
#include <sstream>
using namespace std;
string Printer::states[] = { "S", "V", "B", "U", "C", "F" };
Printer::Printer( unsigned int NoOfTasks, unsigned int quorum ) : N(NoOfTasks), Q(quorum), last_id((unsigned int)-1) {
buffer = new string[N];
for (unsigned int i=0; i<... | true |
7812e3b7330acccddd1cd143c891770b33ba72c7 | C++ | lorenzo-rovigatti/ashell | /lib/OutputObservable.h | UTF-8 | 987 | 2.515625 | 3 | [
"MIT"
] | permissive | /*
* OutputObservable.h
*
* Created on: 12 feb 2018
* Author: lorenzo
*/
#ifndef LIB_OUTPUTOBSERVABLE_H_
#define LIB_OUTPUTOBSERVABLE_H_
#include <vector>
#include <fstream>
#include <memory>
#include "computers/observables/Observable.h"
namespace ashell {
class InputFile;
class OutputObservable {
publi... | true |
13fa586133a8eee88753ea8f5b15ce6f56aca3c5 | C++ | PalashHawee/Data-Structures-and-Algorithms-My-Preparation-for-Software-Engineering | /Array ADT/Get_Set_Max.cpp | UTF-8 | 1,412 | 3.6875 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
struct Array
{
int A[10];
int size;
int length;
};
void display(struct Array arr)
{
int i;
printf("\nElements are: \n");
for(i=0;i<arr.length;i++)
printf("%d\n",arr.A[i]);
}
//Get method
int Get(struct Array arr,int index) //call by values
{
if(index>=0 ... | true |
042740c0832c8df79f1f9242775f94bccad37602 | C++ | CiarraMatthews/AntsNAnteaters | /Organism.cpp | UTF-8 | 3,270 | 3.078125 | 3 | [] | no_license | #ifndef _ORGANISM_CPP
#define _ORGANISM_CPP
#include <iostream>
#include <cmath>
#include "Organism.h"
using namespace std;
Organism::Organism() { };
Organism::Organism(World *world) {
m_world = world;
};
vector<int> Organism::vibeCheck() const {
vector<int> mapping;
if (m_world->rangeCheck(m_row - 1, m_colu... | true |
81a0e3ebaab16146819e8d760bb4f50a810fab17 | C++ | Mushfiqur719/Archive-Problem-Solving | /UVA/CP Book 4/Introduction/Getting Started The Easy Problems/1641 - ASCII Area.cpp | UTF-8 | 507 | 3.15625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int w,h,i,j;
while(cin>>h>>w)
{
char area[h][w];
int slash=0,dot=0;
for(i=0; i<h; i++)
{
for(j=0; j<w; j++)
{
cin>>area[i][j];
if(area[i][j]=='/' || area[i][j]=='\\')
... | true |
47187dca9e1a5475d85feb961a6c74c220201b36 | C++ | GuodongQi/LeetCode | /by_tags/暴力枚举法/1_Subsets.cpp | UTF-8 | 578 | 2.921875 | 3 | [] | no_license | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
sort(nums.begin(), nums.end());
vector<vector<int>> res;
vector<int> path;
subsets(nums,path,0,res);
return res;
}
void subsets(vector<int> &S, vector<int> &path, int step, vector<vector<int>> ... | true |
1ad037af81fd31f5ab5f1ddb273a176714e8a83a | C++ | wyf2123/paintDatFiles | /paintdat/algorithm.h | UTF-8 | 4,364 | 2.671875 | 3 | [] | no_license | #ifndef ALGORITHM_H
#define ALGORITHM_H
//#include "opencv2/highgui/highgui.hpp"
//#include "opencv2/core/core.hpp"
//#include "opencv2/imgproc/imgproc.hpp"
//#include "mysqlitepatients.h"
#include <stdio.h>
extern const double scaleRate;
//using namespace cv;
//using std::sort;
//using std::vector;
//struct PointD... | true |
b9ce8c031e617957039f8af09209a3064d435c96 | C++ | Shubhamag12/Data-Structures-and-Algorithms | /Leetcode/maximum_binary_tree.cpp | UTF-8 | 1,231 | 2.859375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define ll long long int
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(n... | true |
e1395f81520960f96e1cbeb6d218c36cae240fe0 | C++ | ashkan65/SyncThreads | /sync_threads_class/read.cpp | UTF-8 | 628 | 2.890625 | 3 | [] | no_license | #include "read.hpp"
void read::GetParam(int * _buffer, std::atomic<short>* _available, std::atomic<bool>* _NewFrame, bool* _running){
buffer = _buffer;
available = _available;
NewFrame = _NewFrame;
running = _running;
read_loc = 2;
};
void read::Run(){
while(*running){
if ((*NewFrame).load()){
... | true |
ea8aa9793d557ee73e002580a636a67f4f8c261f | C++ | blizmax/AntiradianceCuts | /Framework/OGLResources/COGLTextureBuffer.cpp | UTF-8 | 1,276 | 2.578125 | 3 | [] | no_license | #include "COGLTextureBuffer.h"
COGLTextureBuffer::COGLTextureBuffer(GLenum type, std::string const& debugName)
: COGLResource(COGL_TEXTURE_BUFFER, debugName), m_Type(type)
{
glGenTextures(1, &m_TextureBufferTexture);
glGenBuffers(1, &m_Resource);
CheckGLError(m_DebugName, "COGLTextureBuffer::COGLTextureBuffer()")... | true |
73f7e9b4bb24046146b3c8b00d773beab4853c8d | C++ | DeadTSAR/otTeacher | /ЛЕКЦИИ (пятницы)/count, count_if.cpp | UTF-8 | 1,275 | 3.09375 | 3 | [] | no_license | //// ConsoleApplication71.cpp: определяет точку входа для консольного приложения.
////
//// ConsoleApplication71.cpp: определяет точку входа для консольного приложения.
////
#include "stdafx.h"
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
setlocale(LC_CTYPE, "Rus");
const int N = 10;... | true |
df7568fbd0855803395b4531636dcba05a963087 | C++ | zmh009/Xieyi | /Xieyi/ZUdp.h | UTF-8 | 823 | 2.546875 | 3 | [] | no_license | #ifndef ZUDP_H
#define ZUDP_H
#include <iostream>
#include "ITransport.h"
struct UdpForm
{
u_char mSrcPort[2];
u_char mDesPort[2];
u_char mDataLen[2];
u_char mCheckSum[2];
u_char mData[0];
};
class ZUdp : public ITransport
{
public:
ZUdp();
~ZUdp();
const u_char *transportContent() c... | true |
ce4e699d85ab3e2ff4b7ec0a38aae59721ca7f84 | C++ | leobesen28/VendingMachine_STM32F4 | /Src/AdControl.cpp | ISO-8859-1 | 6,878 | 3 | 3 | [] | no_license | /*
-----------------------------------------------------
| FEDERAL UNIVERSITY OF SANTA CATARINA |
| C++ FOR EMBEDDED SYSTEMS |
| PROJECT: VENDING MACHINE |
| PROFESSOR: EDUARDO AUGUSTO BEZERRA |
| LEONARDO AURLIO BESEN |
| JOO BATISTA CORDEIRO NETO |
-----------------------------... | true |
cf0381f5b7e1257c981817aca0cc62931d15f359 | C++ | micmr0/SpaceWar | /src/GKiW_Lab6/Space.cpp | WINDOWS-1250 | 1,722 | 2.59375 | 3 | [] | no_license | #include "StdAfx.h"
#include "Space.h"
CSpace::CSpace(void) : CSceneObject()
{
}
CSpace::~CSpace(void)
{
}
void CSpace::Initialize(void)
{
_displayListId = glGenLists(1);
glNewList(_displayListId, GL_COMPILE);
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_... | true |
1e28ca1517f266746bdf0ae1d01ef1f3431cc49a | C++ | BluesHaru/Practice | /BOJ/10807_개수 세기.cpp | UHC | 984 | 3.1875 | 3 | [] | no_license | /*---------------------------------------------------
10807
迭
: N ־ , v ϴ α ۼϽÿ.
:
Input) ù° ٿ N(1 N 100) ־. ° ٿ еǾִ.
° ٿ ã ϴ v ־. Է ־ v -100 ũų , 100 ۰ų .
Output) ù° ٿ Է ־ N ߿ v Ѵ.
----------------------------------------------------*/
#pragma warning(disable:4996)
#include <stdio.h>... | true |
75cd42db7f1a57c8e314c77c649db7b95ffb0a3d | C++ | rovinbhandari/Programming_Scripting | /ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/E/cpp/00013096_E_SEQUENCES_amicpc120839.cpp | UTF-8 | 2,690 | 2.734375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
#include<math.h>
template<class T>
class SegmentTree
{
int *A,size;
public:
SegmentTree(int N)
{
int x = (int)(ceil(log2(N)))+1;
size = 2*(int)pow(2,x);
A = new int[size];
for(int i=0;i<N;i++)
A[i]=... | true |
ac5a4e5729ccacb780c4e262529543219a934dd4 | C++ | pedris11s/coj-solutions | /lmm-p2171-Accepted-s552992.cpp | UTF-8 | 567 | 2.8125 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int freq[1000001];
int main()
{
int N;
cin >> N;
int min_a = (1 << 30), max_b = 0;
for(int i = 1; i <= N; i++)
{
int a, b;
cin >> a >> b;
freq[a]++;
freq[b + 1]--;
min_a = min... | true |
b4cd6880e05c0a8750dff6ba1f6ed588fd7c9b3f | C++ | bluemellophone/JTM-Protocol | /atm.cpp | UTF-8 | 18,927 | 2.75 | 3 | [] | no_license | /**
@file atm.cpp
@brief Top level ATM implementation file
*/
#include "util.h"
int getch()
{
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &t_new);
ch = ... | true |
eb6b02ac5b6dcd0a05c0adf78accd0a7a0353d2f | C++ | pbssarath/excitonic_drift_diffusion | /include/initial_guess.h | UTF-8 | 6,809 | 2.890625 | 3 | [
"MIT"
] | permissive | /*
Copyright 2016-2017 Baskar Ganapathysubramanian
This file is part of TALYFem.
TALYFem is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 2.1 of the
License, or (at your option) ... | true |
17b782180c38c11eb39e659c853fccaf263572a2 | C++ | eightnoteight/compro | /spoj/factcg.2.cc | UTF-8 | 4,925 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int32_t primes[65] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 2... | true |
2bb6d736efd8cfa735cf57016cc11466f5fc6b0d | C++ | dastyk/SE | /SluaghEngine/includes/Utilz/Delegate.h | UTF-8 | 4,752 | 2.9375 | 3 | [] | no_license | #ifndef SE_UTILZ_DELEGATE_H_
#define SE_UTILZ_DELEGATE_H_
#include <functional>
namespace SE
{
namespace Utilz
{
template <typename T> class Delegate;
template<typename RET, typename... PARAMS>
class Delegate<RET(PARAMS...)>
{
std::function<RET(PARAMS...)> invoker;
//size_t uniqueIdentifier;
public:
... | true |
5ade1992446ac0d43f1d31461dfeab74e1464937 | C++ | FahimCC/Problem-Solving | /Hackerearth/Linear Search/Min-Max.cpp | UTF-8 | 445 | 2.765625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n;
long a[100000],sum = 0,max,min,ans;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum = sum + a[i];
}
max = 0;
min = 10000000000000;
for(int i=1;i<=n;i++)
{
ans = sum - a[i];
if(max < an... | true |
a5b567091ad2da91c6cdad360064e26326657378 | C++ | tud-zih-energy/nitro | /tests/string_test.cpp | UTF-8 | 5,249 | 3.9375 | 4 | [
"BSD-3-Clause"
] | permissive | #include <nitro/lang/string.hpp>
#include <catch2/catch.hpp>
TEST_CASE("String join works", "[lang]")
{
std::vector<std::string> str;
str.emplace_back("Hello");
str.emplace_back("World");
SECTION("using the vector overload")
{
REQUIRE(nitro::lang::join(str) == "Hello World");
}
S... | true |
fc94ee2d4b37e832ae1ddbcf2d257e3733253df5 | C++ | dksem12gh/winApi-MapTool | /winApi/enemy.cpp | UHC | 1,747 | 2.59375 | 3 | [] | no_license | #include "stdafx.h"
#include "enemy.h"
enemy::enemy() : _currentFrameX(0),
_currentFrameY(0),
_x(0.0f),
_y(0.0f),
_rc(RectMake(0, 0, 0, 0)),
_worldTimeCount(0.0f),
_rndTimeCount(0.0f)
{
}
HRESULT enemy::init(void)
{
return S_OK;
}
HRESULT enemy::init(const char * imageName, POINT posi... | true |
6c360d5a0518124ad0e81b141467fcebe1f82f87 | C++ | m0hitbansal/Competitive-Programming | /Strings/string reverse indivual word.cpp | UTF-8 | 560 | 3.25 | 3 | [] | no_license | #include<iostream>
using namespace std;
void reverse(char *s,int begin,int end){
int i=begin;
while(i<=end){
char temp=s[end];
s[end]=s[i];
s[i]=temp;
i++;
end--;
}
}
int main(){
char str1[100]="32 0121 3421 543 abcd";
int i=0;
int num=0;
while(str1[i]!='\0'){
if(str1[i]!=' '){
... | true |
d5ec65f4ecc0839e02ddb242b74a6c9fe463133f | C++ | chihyang/CPP_Primer | /chap13/Exer13_22_HasPtr.h | UTF-8 | 1,265 | 3.59375 | 4 | [
"Apache-2.0"
] | permissive | #ifndef HASPTR_H
#define HASPTR_H
#include <iostream>
#include <string>
class HasPtr{
public:
HasPtr(const std::string &s = std::string()) : ps(new std::string(s)), i(0) { i = ps->size(); }
// here, we can use private members directly! Because this is a member
// function of class HasPtr. They can access an... | true |
a1f9c27d1877ab376d190438dfc97194aafe1676 | C++ | harshg0910/Graphics | /Assignment 4/sol-opengl.cpp | UTF-8 | 4,321 | 2.71875 | 3 | [] | no_license | #include <stdio.h>
#include <GL/glut.h>
#include <iostream>
using namespace std;
#define VIEWING_DISTANCE_MIN 3.0
static GLfloat g_fViewDistance = 3 * VIEWING_DISTANCE_MIN;
static GLfloat g_nearPlane = 1;
static GLfloat g_farPlane = 1000;
static int g_Width = 600; // Initial window width
sta... | true |
e35d25bf162d8452fc84c7dc70335997f0ad49c1 | C++ | xiaoqixian/Wonderland | /code/kruskal.cpp | UTF-8 | 3,262 | 3.421875 | 3 | [] | no_license | /**********************************************
> File Name : kruskal.cpp
> Author : lunar
> Email : lunar_ubuntu@qq.com
> Created Time : Fri 07 Aug 2020 06:42:20 PM CST
**********************************************/
#include <iostream>
using namespace std;
/*
* Kruskal算法原理:
* 我们假设一个图有m个节点,n条边。
* 首先... | true |
ce66496171988ac30fc16565bdfccfe0afdc1abf | C++ | fszhaoholo/SmartScript | /test/map_clear.cpp | UTF-8 | 340 | 2.53125 | 3 | [] | no_license | #include "stdio.h"
#include <map>
using namespace std;
int main()
{
map<int, int> map_clear;
int i = 0;
int j = 0;
while(1)
{
map_clear.insert(pair<int, int>(i,i));
i++;
if (i == 10737400)
{
// map_clear.clear();
map<int, int>().swap(map_clear);
printf("+++++++++%d+++++\n", j);
i = 0;
j++;
... | true |
a7045a39e52218a3d5e7e6d0dc5bd89b0e759814 | C++ | PowerTravel/handmade | /code/intrinsics.h | UTF-8 | 2,517 | 2.75 | 3 | [] | no_license | #pragma once
// TODO: Replace math.h with cpu specific instructions
#include <cmath>
#include "types.h"
inline u32 GetThreadID()
{
// Read the pointer to thread local storage.
u8* ThreadLocalStorage = (u8*) __readgsqword(0x30);
u32 ThreadID = *(u32*) (ThreadLocalStorage + 0x48);
return ThreadID;
}
inline b32... | true |
d0ee194fa86334c3ed7f9ec188c7ad44ecb68f78 | C++ | billsioros/genetic-cpp17 | /include/genetic.ipp | UTF-8 | 2,043 | 3.15625 | 3 | [
"MIT"
] | permissive |
#pragma once
#include <cstdlib>
#include <type_traits>
template <typename T, typename Arithmetic>
Genetic<T, Arithmetic>::Genetic
(
std::function<T(const T&, const T&)>&& crossover,
std::function<void(T&)>&& mutate,
std::function<Arithmetic(const T&)>&& fitness
)
:
crossover(crossover),
mutate(mutate),
f... | true |
fb4c7787d213da3d9ae5bf23c4f6ee721a4ec59b | C++ | theShroo/HexCraft | /Assignment 2 FPS/Assignment 2 FPS/Shader.cpp | UTF-8 | 9,595 | 2.5625 | 3 | [] | no_license | #include "Shader.h"
// static lite shader manager.
std::unordered_map<std::string, Shader*> Shader::m_shaders;
bool Shader::LoadShader(std::string ID, LPWSTR vertexShaderPath, LPWSTR pixelShaderPath, DirectX::XMFLOAT3 colour, ID3D11Device* Renderer) {
if (m_shaders.count(ID) > 0) {
delete m_shaders[ID];
m_shade... | true |
3e5d66a1787a91901b75f3d353d66a8b819829fb | C++ | aenoskov/RankLib | /indri/tags/release-1.0/src/NotNode.cpp | UTF-8 | 1,536 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive |
//
// NotNode
//
// 26 August 2004 -- tds
//
#include "indri/NotNode.hpp"
#include "indri/Annotator.hpp"
#include <cmath>
NotNode::NotNode( const std::string& name, BeliefNode* child )
:
_name(name),
_child(child)
{
}
// for convenience, the not node never actually matches
int NotNode::nextCandidateDocument()... | true |
ac934db597792940fad742f9652997bd6ddee51c | C++ | EvolvingMonkee/Team11_ProjectOne_01 | /main.cpp | UTF-8 | 304 | 2.8125 | 3 | [] | no_license | #include "infixEvaluator.h"
#include <iostream>
using namespace std;
int main()
{
string s("(-4 + -5) +++25");
string t("(4 >= -5) + 25");
string u("4 <= -5 + 25");
InfixEvaluator i;
cout << i.eval(s) << endl;
cout << i.eval(t) << endl;
cout << i.eval(u) << endl;
char wait = getchar();
}
| true |
bb61406f39b5c821beaff29d5a90ccc0b7192373 | C++ | ArtemKravchenko/Collision-Detection-Framework | /GeometricFramework/CollisionDetectionAlgorithms/CDParticlesCollisionDetection2DLogic.cpp | UTF-8 | 11,275 | 2.546875 | 3 | [] | no_license | #include "CDParticlesCollisionDetection2DLogic.h"
#include <cmath>
//--------------------------------------------------------------------
// Constructor and destructors
//--------------------------------------------------------------------
CDParticlesCollisionDetection2DLogic::CDParticlesCollisionDetection2DLogic(CDPa... | true |
164fe5b92cf169ab2de4b74c7df69ce834cb4f95 | C++ | vietduy1512/nachos-examples | /code/userprog/stable.h | UTF-8 | 833 | 2.546875 | 3 | [
"MIT-Modern-Variant"
] | permissive | #ifndef STATE_H
#define STATE_H
#include "synch.h"
#include "bitmap.h"
#include "sem.h"
#define MAX_SEMAPHORE 10
class STable
{
private:
BitMap* bm; // Quan ly slot trong.
Sem* semTab[MAX_SEMAPHORE]; // Quan ly toi da 10 doi tuong Sem.
public:
// Khoi tao size doi tuong Sem de quan ly 10 Semaphore. Gan gia tri ... | true |
d94aafb7a0e42c4098ff530f88aaade62f4e6fe4 | C++ | Aguirregzz97/TareasFundamentosDeProgramacion | /FuncionesConCondiciones9/main.cpp | UTF-8 | 677 | 3.5625 | 4 | [] | no_license | // Andres Aguirre Gonzalez A01039656
#include <iostream>
using namespace std;
char Calculatebig(int a, int b, int c)
{
char BiggestNumber;
if(a >= b && a>= c)
{
BiggestNumber = 'a';
}
if(b >= a && b>= c)
{
BiggestNumber = 'b';
}
if(c >= a && c >= b)
{
Bigg... | true |
fb79c829c694fa74233c63bbff6d1dad42199f02 | C++ | derekzhang79/TopCoder | /151/prefix.cpp | UTF-8 | 708 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
bool prefix(string str1,string str2){
if(str2.length()<str1.length()) return 0;
int i,length = str1.length();
for(i=0;i<length;i++){
if(str1[i] != str2[i]) return 0;
}
return 1;
}
string isOne(vector<string> words){
strin... | true |
d2cb935c3b504f75daf0a572ad8695e762791737 | C++ | bluenote10/EPI | /test/14_08.cpp | UTF-8 | 596 | 3.28125 | 3 | [] | no_license | #include "convenience.hpp"
void Blockify(vector<int>& A, int max_idx) {
if (max_idx <= 0) return;
int pivot = A[0];
A[max_idx] = A[0];
int i = 0;
int j = max_idx - 1;
int k = 1;
while (i < j) {
cout << A << " " << i << " " << j << " " << k << endl;
if (A[k] != pivot) {
... | true |
8cfc60e6c68e7d6d07a3ad07f8848a8b4d654ff9 | C++ | bmikaeli/CPP-Pool-42 | /Rush00/AAlien.class.cpp | UTF-8 | 1,010 | 2.71875 | 3 | [] | no_license | #include "AAlien.class.hpp"
#include <unistd.h>
void AAlien::takeDamage() {
this->hp -= 1;
}
AAlien::AAlien() {
}
AAlien::~AAlien() {
}
void AAlien::drawDeath(WINDOW * win) {
wattron(win, COLOR_PAIR(2));
mvwprintw(win, this->Y, this->X, "W");
mvwprintw(win, this->Y + 1, this->X - 1, "WWW");
wat... | true |
e124b2b29f3f93586855fc31ca143a79a445a45d | C++ | ymarcov/Chili | /include/Request.h | UTF-8 | 3,065 | 2.796875 | 3 | [] | no_license | #pragma once
#include "InputStream.h"
#include "Protocol.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
namespace Chili {
/**
* An HTTP request.
*/
class Request {
public:
Request() = default;
Request(std::shared_ptr<InputStream> input);
~Request();
... | true |
b552485bb6504a6cdf3a9f94a13209892ccba9ec | C++ | GabrielOarga/cpp-workshop | /Advanced_C++_Training/advcpp_personal/15_TemplateClassesAndFunctions/15_TemplateClassesAndFunctions/main.cpp | UTF-8 | 1,098 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include "RingBuffer.h"
using namespace std;
template <typename T>
void foo(T t)
{
cout << "generic" << endl;
}
/*
template <> //if template specialisation exists, it will be called rather then the normal template
void foo(int i)
{
cout << "specialised ... | true |
b5fa8ff06c2e26b5dd1c4043231ce4198b147a15 | C++ | Stephen1993/ACM-code | /hdu2159.cpp | GB18030 | 934 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<iomanip>
#define INF 99999999
using namespace std;
const int MAX=101;
int dp[MAX][MAX];//dpʾiɱjֵֻõľֵ.
int value[MAX][MAX];
int main(){
int n,m,k,s;
wh... | true |
6035ee569f68ee29864885c8eb3622e0ff1b54d3 | C++ | arilow/TallerTPGrupal | /Game/src/server_src/collisions/QuadNode.cpp | UTF-8 | 5,078 | 3.265625 | 3 | [] | no_license | #include "Quadtree.h"
#include "Collidable.h"
#include <iostream>
#include <math.h>
#include <vector>
//se creaa un nodo raiz vacio
QuadNode::QuadNode(int x_, int y_, int w_, int h_, std::string n, size_t l, int cW):
bounds(x_,y_,w_,h_), data(0)
{
cellWidth=cW;
lvl=l;
name=n;
this->NW = nullptr;
... | true |
a0b27f68e712d7c6699652ee20f5dcbcf5db0aa2 | C++ | Ambition111/OJ | /exchange.cpp | GB18030 | 1,247 | 3.4375 | 3 | [] | no_license | // Ŀӣhttps://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/
// һ
class Solution {
public:
vector<int> exchange(vector<int>& nums) {
vector<int> ret(nums.size(), 0);
int i = 0, j = nums.size() - 1;
for (const auto& e : nums)
{
... | true |
99016574bee6636cfe3d5816472578febf30e1dd | C++ | michaelmathen/pyscan | /src/TrajectoryCoreSet.cpp | UTF-8 | 24,513 | 2.53125 | 3 | [
"MIT"
] | permissive | //
// Created by mmath on 9/28/18.
//
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include "appext.h"
#include "Point.hpp"
#include "Disk.hpp"
#include "FunctionApprox.hpp"
#include "TrajectoryCoreSet.hpp"
namespace pyscan {
/*
* Compute the lower leftmost corner... | true |
12781b10165927a59e3fc8771ceafb6d101f2ae6 | C++ | misovi/tira | /gameoflife/life.h | UTF-8 | 704 | 2.734375 | 3 | [] | no_license | #include<vector>
#include<string>
//const int maxrow = 20, maxcol = 60; // grid dimensions
class Life {
private:
int maxrow = 20;
int maxcol = 60;
std::vector<std::vector<int>> grid;
//int grid[maxrow][maxcol]; // allows for two extra rows and columns
int neighbor_count(int row, int col);
public:
void... | true |
687b167b3d35980e9920ee831518d20841e84c6f | C++ | giacomogaregnani/MasterProject | /SDECode/InverseProblemsTests/testParameterV2.cpp | UTF-8 | 3,372 | 2.75 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <iomanip>
#include "generateObservations.hpp"
#include "computeHomogeneous.hpp"
#include "computeEstimators.hpp"
// Remark: epsilon = p(0)
double gradV0(double x)
{
return x;
// return -x + x*x*x;
}
double V1(double x)
{
return std::cos(x);
}
double gradV1... | true |
b83bb5d5434cad3e9efa12c05738dfd3f0cd2caf | C++ | BlackBlackSoul/II-UWr | /C++/zadanie10/10/funkcja.h | UTF-8 | 1,787 | 2.9375 | 3 | [] | no_license | #ifndef FUNKCJA_H
#define FUNKCJA_H
#include "symbol.h"
#include <map>
namespace kalkulator
{
class funkcja : public symbol
{
public:
//typ wyliczeniowy (dziala jak int tylko mamy wygodne nazwy)
enum rodzaj
{
// f_ dodane przed nazwa,... | true |
ce14ff7c77b1ae9218de8de53e2b5d19678c0ec1 | C++ | dqmcdonald/GardenLabMain | /Rain.ino | UTF-8 | 1,397 | 2.734375 | 3 | [] | no_license | //#include "Sensor.h"
//#define DEBUG_RAIN 1
const unsigned long int RAINFALL_COUNT_PERIOD = 20 * 1000l; // Update rainfall every 20 seconds
volatile int rainfall_count = 0; // Incremented in the interrupt function
// Tipping Bucket Rainfall Sensor
RainfallSensor::RainfallSensor( const String& id, const int& pi... | true |
bdfdaf5b98223c2b7fab1df0ae1edd30e4c1a4a5 | C++ | gursangat22/git-test | /letusc++/unaryOOFRIEND.cpp | UTF-8 | 449 | 3.515625 | 4 | [] | no_license | #include<iostream>
using namespace std;
class item
{
int a,b;
public:
void get(int a,int b)
{
this->a=a;
this->b=b;
}
void display()
{
cout<<"a="<<a<<endl<<"b="<<b<<endl;
}
void friend operator -(item &m)
{
m.a=-m.a;
m.b=-m.b;
}
};
int main()
{
... | true |
f2d675542a2523296894810a511d20da18dc4da6 | C++ | beatriz-ag/feup-cal | /TPS/TP10/ex1.cpp | UTF-8 | 1,620 | 3.25 | 3 | [] | no_license | #include "exercises.h"
#include <vector>
#include <iostream>
#include <fstream>
void computePrefixFunction(std::string pattern, int* pi){
int m = pattern.size();
int k = -1;
pi[0] = -1;
for (int q = 1; q < m; q++){
while(k >= 0 and pattern[k+1] != pattern[q])
k = pi[k];
if (pattern[k+1] == p... | true |
041b993de19ec5d02fca53d3680538dce0845be7 | C++ | danalrds/OOP | /Proiect/Repo.h | UTF-8 | 406 | 2.53125 | 3 | [] | no_license | #pragma once
#include "Classes.h"
#include <vector>
class Repo
{
private:
std::vector<Question> questions;
std::vector<Participant> participants;
public:
Repo();
~Repo() {};
std::vector<Question> getQ() const { return this->questions; }
std::vector<Participant> getP() const { return this->participants; }
void ad... | true |
9bb5e690900aaa62d0362cd099a5e3127d86cea5 | C++ | techyharshit123/DSA | /Data Structures/Graphs/01-Graph-representation.cpp | UTF-8 | 1,525 | 3.609375 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void printGraph(vector<int> adj[], int V) //V is number of vertices
{
for (int v = 0; v < V; ++v)
{
cout << "\n Adjacency list of vertex "
<< v << "\n head ";
for (auto x : adj[v])
cout << "-> " << x;
printf("\n");
}
}
// *****************************... | true |
277ba9e9925e2881e4de5beb0d4c06aa6f1ced98 | C++ | dream-overflow/o3d | /src/image/imgformat.cpp | UTF-8 | 2,313 | 2.546875 | 3 | [] | no_license | /**
* @file imgformat.cpp
* @brief
* @author Frederic SCHERMA (frederic.scherma@dreamoverflow.org)
* @date 2005-10-06
* @copyright Copyright (c) 2001-2017 Dream Overflow. All rights reserved.
* @details
*/
#include "o3d/image/precompiled.h"
#include "o3d/image/imgformat.h"
using namespace o3d;
// copy const... | true |
0c2dca43f72d0e0ea863a90f54e8558ddf8bfdc2 | C++ | janpawlowskiof/aisd | /Lista 3/zad1/merge_sort.cpp | UTF-8 | 1,596 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <cmath>
#include "ex1.hpp"
void merge_sort (data* d, stats* s, int p, int q) {
int index; //Index of middle element.
if (p < q) {
index = p + (q - p) / 2; //Compute index of middle element.
merge_sort (d, s, p, index); //Resursive merge sort of left half of array.
... | true |
e6a901e02a32c46692af6bb2159ddd0e1aa71942 | C++ | snosscire/Block-World | /Source/Engine/Sprite.cpp | UTF-8 | 1,959 | 3.109375 | 3 | [] | no_license | #include "Sprite.h"
#include "Animation.h"
#include "Engine.h"
#include <iostream>
namespace BadEngine {
Sprite::Sprite() :
m_animations(),
m_currentAnimation(NULL),
m_currentAnimationName(NULL),
leftFlipped(false)
{
}
Sprite::~Sprite()
{
map<const string, Animation*>::iterator it;
it = m_animation... | true |
a034c02c9594097b1be9eac4397b4025b5b1fffb | C++ | yuushimizu/ufo | /ufo/rect.hpp | UTF-8 | 2,018 | 3.390625 | 3 | [] | no_license | #ifndef ufo_rect
#define ufo_rect
#include <iostream>
#include "coord.hpp"
#include "sequence/range.hpp"
namespace ufo {
template <typename T>
class rect final {
public:
constexpr rect(coord<T> origin, coord<T> size) noexcept : origin_(std::move(origin)), size_(std::move(size)) {
}
... | true |
939e6d20974e9a17f63b1f7ba0dc0fd15da4e352 | C++ | xuyunhao/LFS | /flash/flash.h | UTF-8 | 931 | 2.71875 | 3 | [] | no_license | #ifndef LFS_FLASH_FLASH_H_
#define LFS_FLASH_FLASH_H_
#include "util/defs.h"
namespace lfs {
typedef uint32_t FlashSectorNum;
//abstract Flash class
class Flash {
public:
FlashSectorNum nsector(void) const { return this->nsector_; }
uint32_t noctet_sector(void) const { return this->noctet_sector_; }
vir... | true |
711bf5f0ea2347eb2a0d91b196aaf47c431efa07 | C++ | cpecoraro18/Game | /src/TextureManager.cpp | UTF-8 | 1,180 | 2.890625 | 3 | [] | no_license | #include "TextureManager.h"
#include "SDL_image.h"
#include <stdio.h>
void TextureManager::LoadTexture(std::string filename, const char* name, SDL_Renderer* renderer) {
const char* charFilename = filename.c_str();
SDL_Surface* tempSurface = IMG_Load(charFilename);
if (tempSurface == NULL) {
printf("Unable to open... | true |
21e28aa63fcafd1d0d6c7066245d4ad80c90c512 | C++ | GarvitV957/LeetCode | /longest-palindromic-substring/longest-palindromic-substring.cpp | UTF-8 | 1,038 | 2.875 | 3 | [] | no_license | class Solution {
public:
string ans="";
string solve(string &s, int i, int j){
string temp = "";
if(i==j) return temp+s[i];
if(s[i] == s[j]){
string temp = s[i]+solve(s,i+1,j-1)+s[i];
ans = ans.length()>=temp.length() ? ans:tem... | true |
d5bfb18ce3d7072ca393c8e4205d1f6f51db778f | C++ | wCmJ/Algorithm | /Heap.h | UTF-8 | 1,558 | 3.6875 | 4 | [] | no_license | #pragma once
template<class T>
void Heap_Maximum_Node(T *data, int i, int len) {
int max = i;
if (2 * i + 1 < len && data[2 * i + 1] > data[max]) {
max = 2 * i + 1;
}
if (2 * i + 2 < len && data[2 * i + 2] > data[max]) {
max = 2 * i + 2;
}
if (max != i) {
T tmp = data[max];
data[max] = data[i];
data[i] ... | true |
ff6216ed80cde232df9dc2840c951b20b97b6509 | C++ | necromaner/C- | /c-primer/Chapter Four/4.1.2/4.2/main.cpp | UTF-8 | 295 | 2.90625 | 3 | [] | no_license | //4.2 根据4.12节中的标,在下述表达式的合理位置添加括号,使得添加括号后运算对象的组合顺序与添加括号前一致。
//(a) *vec.begin() (b) *vec.begin() + 1
//(a) *(vec.begin()) (b) *(vec.begin()) + 1
#include <iostream>
int main() {
return 0;
} | true |
1801a39c5f0bf1fba8e19fc458998af6ff90e0c0 | C++ | D1egood/CompetitiveProgramming | /coj/3800.cpp | UTF-8 | 837 | 2.609375 | 3 | [] | no_license | # include <bits/stdc++.h>
using namespace std;
size_t m = size_t(1e9+7);
size_t fast_exp(size_t b, size_t p)
{
size_t r = size_t(1);
for(size_t i = (size_t(1) << 60); i; i >>= 1)
{
r *= r;
r %= m;
if(p & i){
r *= b;
r %= m;
}
}
return r;
}
size_t sol(size_t b, siz... | true |
9f4112b63b505c6f290014ee71ff5c5794e2b474 | C++ | RiyaMathew-11/hacktoberfest-1 | /STLs/vector_implementation.cpp | UTF-8 | 2,581 | 4.4375 | 4 | [
"MIT"
] | permissive | // Self implementation of
// the Vector Class in C++
#include <bits/stdc++.h>
using namespace std;
class vectorClass {
// arr is the integer pointer
// which stores the address of our vector
int* arr;
// capacity is the total storage
// capacity of the vector
int capacity;
// current is the number of elemen... | true |
4e4788c4c5f3f995b347dd29be82ffaab383d667 | C++ | ttiimm2214/leetcode | /23_Merge_k_Sorted_Lists/23_M_K_S_L.cpp | UTF-8 | 1,811 | 3.296875 | 3 | [
"MIT"
] | permissive | /*
* Leetcode 23_Merge_k_Sorted_Lists
*
* Compile: g++ 23_M_K_S_L.cpp -o result
* Execute: ./result
*/
/*
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
*/
#include <iostream>
#include <ve... | true |
b11bf1d0b36af87a81d551c4761f7e01e0906c1e | C++ | abaran803/DSA-by-Narsimha | /Graph/Topological Sort.cpp | UTF-8 | 1,172 | 3.421875 | 3 | [] | no_license | #include<iostream>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
struct Graph
{
int V;
int E;
vector<int> *Adj;
};
queue<int> q;
vector<int> indegree;
Graph* CreateNewNode()
{
Graph* G = new Graph();
if(!G)
{
cout << "Memory not Allocated" << endl;
return NULL;
}
cin >> G->V >> G-... | true |
105912a327d83d62cfdea4ae9342e08906aace21 | C++ | buzyaba/SimEngine | /Tests/src/SmartThingScheduleTest.cpp | UTF-8 | 2,965 | 2.8125 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include "gtest/gtest.h"
#include "SimEngine/common.h"
#include "SimEngine/SmartThing.h"
#include "SimEngine/SmartThingSchedule.hpp"
class DummyActuator: public TActuator {
public:
DummyActuator(std::string _name) : TActuator(_name) {}
virtual void SetDataPacket(TDataPacket* packet)
{
f... | true |
6e5baf0b2ae2bdaf4d197a849d7bd3e1fcf06bd6 | C++ | himamsuvavil/NCRworks | /CPP_Assignment1/swap_9/Source.cpp | UTF-8 | 587 | 3.8125 | 4 | [] | no_license | #include<iostream>
using namespace std;
void swap_reference(int &a, int &b)
{
int t = a;
a = b;
b = t;
cout << "after swapping:" << a << " " << b;
}
void swap_value(int a, int b)
{
int t = a;
a = b;
b = t;
cout << "after swapping:" << a << " " << b;
}
int main()
{
int a,b;
cout << "Enter a,b:";
cin >> a >> ... | true |
a1800e1c21c306bf3bfe22e816ea53fe43c557f7 | C++ | dlswer23/cpp | /C++/함수 템플릿.cpp | WINDOWS-1252 | 402 | 3.328125 | 3 | [] | no_license | #include<iostream>
template <typename T>
T TestFunc(T a) {
std::cout << "Ű a : " << a << std::endl;
return a;
}
int main() {
std::cout << "int \t" << TestFunc(3) << std::endl;
std::cout << "double \t" << TestFunc(3.3) << std::endl;
std::cout << "char \t" << TestFunc('A') << std::endl;
std::cout << ... | true |
a91cbeac70c6e000e29ef50323ffabdce7a63563 | C++ | bill20509/leetcode-practice | /cpp/array/easy/1752. Check if Array Is Sorted and Rotated.cpp | UTF-8 | 494 | 2.71875 | 3 | [] | no_license | class Solution {
public:
bool check(vector<int>& nums) {
for(int j = 0; j < nums.size(); j++){
bool f = true;
int temp = nums[j];
for(int i = 0; i < nums.size(); i++){
if(temp > nums[(j + i) % nums.size()]){
f = false;
... | true |
58ceb6418062370fc10c60de173503fcca52dcb9 | C++ | claytongreen/Compiler | /Source/Compiler/loop_node.cpp | UTF-8 | 418 | 2.78125 | 3 | [] | no_license | // Author: Clayton Green (kgreen1@unbc.ca)
//
//
#include "ast_node.h"
LoopNode::LoopNode(StatementNode *statement) {
statements_ = statement;
}
LoopNode::~LoopNode() {
delete statements_;
}
void LoopNode::Accept(ASTNodeVisitor *visitor) {
visitor->Visit(*this);
}
void LoopNode::set_statements(StatementNode ... | true |
2ac952f55edb175ff5a88078360325f8e1edbcb8 | C++ | rgrig/rgrig-hp | /static/programs/spoj/ascirc.cpp | UTF-8 | 1,965 | 2.640625 | 3 | [] | no_license | #define verbose 0 \
#define foreach(i,c) for(typeof((c) .begin() ) i= (c) .begin() ;i!=(c) .end() ;++i) \
#define in(e,c) ((c) .find(e) !=(c) .end() ) \
/*2:*/
#line 37 "./ascirc.w"
#include <map>
#include <set>
#include <queue>
#include <stdio.h>
#include <assert.h>
using namespace std;
/*7:*/
#line 113 "... | true |
e98b600122fca8ff469aabd23edffa81200dfe3c | C++ | chiha8888/Code | /Confusing Date Format.cpp | UTF-8 | 749 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int A[3];
int answer;
int D[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int n;
char c;
scanf("%d",&n);
for(int i=1;i<=n;i++){
answer=0;
scanf("%d-%d-%d",&A[0],&A[1],&A[2]);
if(A[0]==4&&A[1]==5&&A[2]==1){
printf("Case #%d: %d\n",i,1);
continu... | true |
9c159f1df8fe360f6c7e2a1b8f20075de92c2c2e | C++ | lmh760008522/ProgrammingExercises | /王道/159-1.cpp | UTF-8 | 192 | 2.625 | 3 | [] | no_license | #include<cstdio>
int main(){
int n;
scanf("%d",&n);
int a[21];
a[0]=0;
a[1]=1;
a[2]=2;
for(int i=3;i<=n;i++){
a[i]=a[i-1]+a[i-2];
}
printf("%d\n",a[n]);
return 0;
}
| true |
69a11108ad6ef8c0b928623a2ab4521d9077658a | C++ | Qrisno/UniProjects-CPP | /RestaurantManagment/Base.h | UTF-8 | 888 | 3.203125 | 3 | [] | no_license | #pragma once
#include <iostream>
using namespace std;
class Employee {
protected:
int employee_id;
char employee_position;
int employee_salary;
int emp_profit_share;
string employee_name;
public:
int getEmpID();
char getPosition();
int getWage();
int getProfShare();
string getEmpName();
void dispEmp();
vi... | true |
9cd7f6a0caadd057fa9a43ec9a7d37441c828f0b | C++ | qianfei11/ACEveryday | /Data Structure/Double Linked List.cpp | GB18030 | 1,812 | 3.4375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
typedef struct doublelinked
{
int val;
struct doublelinked *pre;
struct doublelinked *next;
}db, *pdb;
int size = 0;
pdb init()
{
int n;
pdb head, p, q;
scanf("%d", &n);
size = n;
head = (pdb)malloc(sizeof(db));
if(head == NULL)
{
printf("Memory allocation failed!\n");... | true |