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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9f605c409e74a8e5594d57dc7156e7318bbf5579 | C++ | luisthmn/ED_Parcial3 | /Graficas/funciones_lista_arcos.cpp | UTF-8 | 3,614 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include "Clases.cpp"
using namespace std;
//////////////////////////
// Lista Arcos
//////////////////////////
lista_arcos::lista_arcos(){
principio = NULL;
anterior = NULL;
siguiente = NULL;
Lugaragregado = NULL;
encontrado = NO;
donde = VACIO;
c... | true |
df53ccef2f1dfbbd45a886b6e09f1c274ddd4247 | C++ | jonaszell97/tblgen | /include/tblgen/Support/StringSwitch.h | UTF-8 | 1,158 | 3.1875 | 3 | [
"MIT"
] | permissive |
#ifndef TBLGEN_STRINGSWITCH_H
#define TBLGEN_STRINGSWITCH_H
#include "tblgen/Support/Optional.h"
#include <cassert>
#include <cstring>
namespace tblgen {
template<class T>
class StringSwitch {
private:
std::string strToMatch;
support::Optional<T> result;
public:
explicit StringSwitch(std::string_view str... | true |
c487ce3f26d9c2d71d8ec7e6a42db8c2c60cb62d | C++ | vbhv17/DSA-Questions | /Array/28. Find the triplet that sum to a given value.cpp | UTF-8 | 1,926 | 3.78125 | 4 | [] | no_license | Naive Approach : Find all possible triplets using 3 nested for loops
bool find3Numbers(int A[], int n, int X)
{
for (int i = 0; i < n - 2; i++)
{
for (int j = i + 1; j < n - 1; j++)
{
for (int k = j + 1; k < n; k++)
{
if (A[i] + A[j] + A[k] == X)
return true;
}
}
}
... | true |
67d75dcc03efa83a04efdc00bb0b454b57826c6a | C++ | neilkakkar/NewBeginning | /618A.cpp | UTF-8 | 462 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define sz 1e6+6
int main()
{
int k;
cin>>k;
vector<int> ans;
ans.push_back(1);
k--;
while(k--)
{
ans.push_back(1);
while(ans[ans.size()-1]==ans[ans.size()-2])
{
ans[ans.size()-2]++;
//cout<<ans... | true |
8a08097783e0d17afc48ad195d797a8f8b0c3e0f | C++ | tyanmahou/Re-Abyss | /Re-Abyss/app/modules/Sfx/DeadEffect/DeadEffect.cpp | UTF-8 | 634 | 2.546875 | 3 | [] | no_license | #include <abyss/modules/Sfx/DeadEffect/DeadEffect.hpp>
namespace abyss::Sfx
{
constexpr ColorF defaultColor(1, 0, 0, 0.8);
DeadEffect::DeadEffect():
m_isValid(false)
{
m_shader
.setBlendMode(BlendMode::Color)
.setColor(defaultColor)
;
}
DeadEffe... | true |
8ffe9aa08ad26ddb968a94cf4b8a8a9ec78bcb6d | C++ | NikitaSTORM/ComplexNumber | /Source.cpp | UTF-8 | 1,757 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <clocale>
#include <vector>
#include <string>
#include <fstream>
#include <map>
#include <algorithm>
#include <cstdlib>
using namespace std;
class complex
{
public:
int a,
b;
void display();
void insert();
complex operator+(complex c2);
comp... | true |
987a74eb5876b30c8e59158df0e13a9317c042c6 | C++ | EhODavi/INF110 | /Aula 22/horariostruct.cpp | UTF-8 | 779 | 3.703125 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <iomanip>
using namespace std;
struct Horario {
int horas, minutos;
};
void le(Horario &t) {
cin >> t.horas >> t.minutos;
}
void escreve(Horario t) {
cout << setfill('0') << setw(2) << t.horas << ":"
<< setfill('0') << setw(2) << t.minutos;
}
//Calcula a diferenca entre dois ho... | true |
c981fd2a5d55b5b63f56c5a844f6c92257cf39f6 | C++ | szamberlan/unipd_project | /P2_Project/ColiseumQT/pozione.cpp | UTF-8 | 1,054 | 2.890625 | 3 | [] | no_license | #include"pozione.h"
pozione::pozione(string n, int c, double a, int s, int d)
:oggettoAiuto(n,1,1,c,a), scelta(s), durata(d){}
pozione::~pozione(){}
int pozione::getCosto() const
{
if(durata)
return oggetto::getCosto();
else
return 0;
}
int pozione::getScelta() const {return scelta;}
int po... | true |
62484e60337efc8008f705f274598cf10a1bb028 | C++ | Gusyatnikova/SFML_study | /Snake/snake.cpp | UTF-8 | 4,941 | 2.9375 | 3 | [] | no_license | #include "snake.h"
Snake::Snake(int blockSize) {
m_size = blockSize;
m_lives = 3;
m_bodyCircle.setRadius(1.0f * m_size / 2);
Reset();
}
Snake::~Snake() {}
void Snake::Reset() {
m_snake_body.clear();
m_snake_body.push_back(SnakeSegment(15, 15));
m_snake_body.push_back(SnakeSegment(14, 15));
m_s... | true |
4632d4cbe4078ceba44e52dc473a72e9cdd0fe4c | C++ | nallicock/CustomerInventoryOrders | /CustomerOrder.h | UTF-8 | 924 | 2.890625 | 3 | [] | no_license | /*
Name: Nicholas Allicock
Date: Dec 1 2019
Section: NFG
Email: nallicock@myseneca.ca
Student ID: 103099164
*/
#ifndef CUSTOMERORDER_H
#define CUSTOMERORDER_H
#include <string>
#include <iostream>
#include "Item.h"
struct ItemInfo
{
std::string m_itemName;
unsigned int m_serialNumber = 0;
bool m_fillState = false... | true |
71788ff4d9313eec53ba5fd8656d36181003c538 | C++ | reverse-dusk/Game-Tank | /game-tank/TankFighting/PlayerTank.cpp | GB18030 | 2,902 | 2.90625 | 3 | [] | no_license | #include "PlayerTank.h"
PLAYERTANK::PLAYERTANK()
{
if (map.get_info(8, 18) == CMAP::GRAPH_BLACK)
{
set_coord(8, 18);
set_direction(OBJ_UP);
}
else
{
set_coord(12, 18);
set_direction(OBJ_UP);
}
write_coord_info(CMAP::PLAYERTANK_UP);
pBul... | true |
ba70f91040c51c6c47854324bcc202880a6de22c | C++ | Dheeraj-cyber/OpenGL-Samples | /ShadowMap.cpp | UTF-8 | 2,528 | 2.984375 | 3 | [] | no_license | #include "ShadowMap.h"
ShadowMap::ShadowMap()
{
FBO = 0;
shadowMap = 0;
}
bool ShadowMap::Init(GLuint width, GLuint height)
{
shadowWidth = width; shadowHeight = height;
glGenFramebuffers(1, &FBO); //Generates the frame buffer. A frame buffer is basically the screen. We will be creating another frame buffer ... | true |
8d68e03b579c4d0663235cda365afec050b7f387 | C++ | bogea-cis/testusblib | /source/common/CBasicStringList.h | UTF-8 | 5,574 | 3.109375 | 3 | [] | no_license | ///////////////////////////////////////////////////////////////////////////////
// Descricao:
// Autor: Amadeu Vilar Filho / Luis Gustavo de Brito
// Data de criacao: 11/12/2007
//
// Alteracoes:
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _CBASIC_STRING_LIST_H_
#define _... | true |
c845b0bda0f50041e898f86263def236edc2429a | C++ | Fockewulf44/HeaterOperator | /src/HeaterOperator.cpp | UTF-8 | 6,289 | 2.578125 | 3 | [
"MIT"
] | permissive |
#include "HeaterOperator.h"
#include <Servo.h>
#include <Arduino.h>
#include "ArduinoJson.h"
// Servo servo1;
HeaterOperator::HeaterOperator(uint16_t servoPin, uint16_t dthPin)
{
this->servoPin = servoPin;
this->dthPin = dthPin;
this->servo1 = Servo();
this->isHeaterEnabled = false;
this->isHeaterHigh =... | true |
96613c2a0df361141b219bcc83483221ae596d82 | C++ | TomStevens7533/Europa | /Europa/src/Europa/structs.h | UTF-8 | 753 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <glm/glm.hpp>
#include <vector>
namespace Eu {
struct VertexInput
{};
struct ChunkVertexInput : VertexInput
{
glm::vec3 Position{};
int tex{};
int UV{};
};
struct Vertex_Input
{
Vertex_Input() = default;
Vertex_Input(glm::vec3 position, glm::vec3 color, glm::vec2 uv, glm::vec3 n... | true |
21100ddbe784474f6a15598139a22616e5ef3990 | C++ | SunInTeo/ImageEditor-Parser | /Header Files/Exceptions.h | UTF-8 | 2,322 | 3.0625 | 3 | [] | no_license | /** @file Exceptions.h
* @brief Provides different exceptions.
*
* @author Teodor Karushkov
* @bug No known bugs.
*/
#pragma once
#include <iostream>
class NoFileOpened : public std::exception
{
const char *what() const throw()
{
return "No file is opened now.";
}
};
class InvalidOpenFunc... | true |
d201a1277a21945b2206e18c3a996cb72682d9ce | C++ | scott0129/raytracer | /objectCollection.cpp | UTF-8 | 6,739 | 2.953125 | 3 | [] | no_license | #include "objectCollection.h"
#include <limits>
#include <stdlib.h>
void recInsert(BVH::BVHNode* subroot, Hittable* object) {
//every node it enters, if the object is bigger than the node, expand the node
for (int i = 0; i < 3; i++) {
if (object->hiCorner()[i] > subroot->hiPoint->get(i)) {
s... | true |
751e0ca950017276b7b5286c0cdfc6fe569572c6 | C++ | yussgrw/Code | /20181012/1.cpp | UTF-8 | 1,375 | 2.5625 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
using namespace std;
typedef struct {
int last;
int num;
} s;
s a[1000000+5],b[1000000+5];
int N,p[1000000+5],q[1000000+5];
int cnt=0;
const int P = 99999997;
inline int readin() {
register int x=0;
register char c=getchar();
while(c<'0'||c>'9') {
c=getchar();
}
while(c... | true |
82fd506e1926d9aead11cd454514cdfcfa50c3a9 | C++ | timrobot/Tachikoma-Project | /robot/tachikoma/motiongraph.h | UTF-8 | 6,484 | 3.328125 | 3 | [
"MIT"
] | permissive | /*
* File: motiongraph.h
* ------------------
* MotionGraph.cpp is based on Standford's opensource
* graph.c by Marty Stepp
*/
#ifndef _motiongraph_h
#define _motiongraph_h
#include <string>
#include "graph.h"
#include "grid.h"
#include "observable.h"
#include "set.h"
/*
* Forward declarations of Vertex/Edge s... | true |
d074da97bd540cb5ebaad108502ee2d4cd9bb719 | C++ | hexu1985/cpp_book_code | /boost.intro/variant/demo6.cpp | UTF-8 | 1,434 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include "boost/variant.hpp"
class stream_output_visitor :
public boost::static_visitor<void> {
std::ostream& os_;
public:
stream_output_visitor(std::ostream& os) : os_(os) {}
template <typename T> void operator()(T& t) const {
o... | true |
a70dee233a9b544120150a9989852b62ac033970 | C++ | merskip/kek-lang | /Source/main.cpp | UTF-8 | 2,946 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <fstream>
#include "Lexer/Lexer.h"
#include "Utilities/ParsingException.h"
#include "Utilities/Console.h"
#include "ParserAST/NodeASTParser.h"
#include "Printer/ASTPrinter.h"
#include "Utilities/Arguments.h"
#include "Compiler/LLVMCompiler.h"
#include "BuiltinTypes.h"
#include "Compiler/Bac... | true |
68d79063d7234b014dc4033fca0cc6a7f310d06c | C++ | ming037/algorithm | /baekjoon/백준 2163번 초콜릿자르기.cpp | UTF-8 | 425 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string.h>
using namespace std;
int dp[90001];
int solve(int num)
{
if (num == 1) return 0;
if (num == 2) return 1;
int &val = dp[num];
if (val != -1) return val;
val = 1+ solve(num / 2) + solve(num - num / 2);
return val;
}
in... | true |
b077eb7c12a821fdcdf6b479a472d28daed91310 | C++ | wingkitlee0/nbody-opengl | /src_c++2/window.cpp | UTF-8 | 2,242 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "log.h"
#include "window.hpp"
bool init_opengl() {
// Initialize Projection Matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Check for error
if(glGetError() != GL_NO_ERROR) {
return false;
}
//Initialize Modelview Matrix
glMatrixMode(GL_MODELVIEW... | true |
f042d69e3108a99f01e63505776b975614dcf09b | C++ | sailfishos-mirror/kconfigwidgets | /src/kcommandbar.h | UTF-8 | 2,309 | 2.53125 | 3 | [] | no_license | /*
* SPDX-FileCopyrightText: 2021 Waqar Ahmed <waqar.17a@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef KCOMMANDBAR_H
#define KCOMMANDBAR_H
#include "kconfigwidgets_export.h"
#include <QMenu>
#include <memory>
/**
* @class KCommandBar kcommandbar.h KCommandBar
*
* @short A hud styl... | true |
f9f3ffc5ea22460e90c04214aac6c1604c481afb | C++ | GugaDozero/observer-exercicio | /feedobserver.cpp | UTF-8 | 508 | 2.71875 | 3 | [] | no_license | #include "feedobserver.h"
#include "subject.h"
#include "feedsubject.h"
#include <iostream>
using std::cout;
using std::endl;
FeedObserver::FeedObserver() :
m_state()
{
}
FeedObserver::~FeedObserver()
{
}
void FeedObserver::update(Subject *subject, string feedName = "")
{
FeedSubjec... | true |
e38e363a3a481f5a8335ea2cf156746560b670e6 | C++ | tetat/Codeforces-Problems-Sol | /Difficulty900/160A.cpp | UTF-8 | 512 | 2.765625 | 3 | [] | no_license | /// Problem Name: Twins
/// Problem Link: https://codeforces.com/problemset/problem/160/A
#include <bits/stdc++.h>
using namespace std;
int A, B;
int a[101];
int b[101];
int main()
{
int n, sum = 0;
scanf("%d", &n);
for (int i = 0;i < n;i++){
scanf("%d", &a[i]);
sum += a[i];
}
s... | true |
28877f8b5fd2b27eacaa2f218fc610eb9525c5fc | C++ | Raylands/Algorithms-and-datastructures-in-object-oriented-programming | /Midterm Exercise/Moving Average/Moving Average.cpp | UTF-8 | 4,318 | 2.875 | 3 | [] | no_license | #include "Global.hpp"
#include "Vector_implementation.hpp"
#include "Deque_implementation.hpp"
using namespace std;
extern deque<float> Deque::file_data;
extern vector<float> Vector::file_data;
int main(int argc, char** argv) {
START:
string file_location;
cout << "File name of input file (leave empty for data.tx... | true |
6195252297097d3c79308d82120d6cc0a96ee78b | C++ | YaoQian670/c_plus_plus_practice | /ListNode/ListNode/Source.cpp | UTF-8 | 2,064 | 3.59375 | 4 | [] | no_license |
#include <iostream>
#include <set>
using namespace std;
template <class T>
class ListNode {
public:
ListNode(T t) {
value = t;
next = NULL;
}
T value;
ListNode<T>* next;
};
template <class T>
void iterateList(ListNode<T>* head) {
ListNode<T>* tmp = head;
while (tmp != NULL) {
cout << tmp->value << "\t";
... | true |
d490439548a3fda2b1f3e1251fc25d420ef026b8 | C++ | RexCYJ/EECS2040-Data_Structure | /HW5/ShortestPath/ShortestPath.cpp | UTF-8 | 5,281 | 3.015625 | 3 | [] | no_license | #include "ShortestPath.h"
#include <deque>
#define INF 999999999
using std::deque;
Graph::Graph(int vertice = 0): n(vertice) {}
void Graph::Dijkstra(const int v)
{
int *s = new int [n];
int *dist = new int [n];
for (int i = 0; i < n; i++) {
s[i] = false;
dist[i] = edge[v][i];
}
int u; // the vertex that ... | true |
201e5677fb60683f96893caa842fad062c3e3b37 | C++ | 892944774/C-plus-plus | /202010-14/202010-14/202010-14.cpp | GB18030 | 2,596 | 3.703125 | 4 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#if 0
class Test
{
public:
Test()
{
cout << "Test():" << this << endl;
}
~Test()
{
cout << "~test():" << this << endl;
}
private:
int _t;
};
void TestFunc()
{
//ҪڶϿһڴռ,Test͵Ķ
Test* pt = (Test*)malloc(sizeof(Test));
free(pt);
}
... | true |
921a987d32a1d23a9de55903144e426e50103b08 | C++ | kees-jan/cpp11training | /cpp11training/cpp11training/3.class_design.cpp | UTF-8 | 1,318 | 3.046875 | 3 | [] | no_license | #include "stdafx.h"
#include <gtest/gtest.h>
#include "class_design/Thing.h"
#include "class_design/Instrument.h"
#include "class_design/Piano.h"
#include "class_design/Vehicle.h"
#include "class_design/MyBike.h"
// TODO:
// visit Thing.h, and rename Thing::size_in_cm to size_in_m.
// The code still compiles. That'... | true |
92cd8eef49c804ecb6dd1ec1b111b0a4d420c35c | C++ | WinstonLy/MyMazeMap | /MazePerson.cpp | GB18030 | 4,452 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <Windows.h>
#include "MazePerson.h"
#include "MazeMap.h"
using namespace std;
int CMazePerson::count = -1;
//******* ĬϹ캯ʼԳʼλ *******//
CMazePerson::CMazePerson():m_cPerson('T'),m_cDirection('W')
{
// ĬԹijʼλ
m_iCurrentPositionX = 0;
m_iCurrentPositionY = 15;
m_iPreviousPositionX = 0;
... | true |
773bf43e05def089e984045751e89886c7e44b39 | C++ | emmanuelfils435/C-C-_memory | /每日一题/糖果/糖果/Main.cpp | UTF-8 | 679 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#if 0
int main()
{
int x1, x2, x3,x4;
cin >> x1 >> x2 >> x3>>x4;
int a = (x1 + x3) / 2;
int b = (x2 + x4) / 2;
int c = x4 - b;
if (x1 == (a - b) && x2 == (b - c) && x3 == (a + b) && x4 == (b + c))
{
cout << a << " " << b << " " << c... | true |
b797b8c10f4fec6ca136f4f52dab24d80475db4c | C++ | elissandro13/Problems-Solved | /Roteiros Ufmg/Roteiro 3/MEGADAMA.cpp | UTF-8 | 1,880 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n,m,score = 0;
int board[21][21];
bool move(int i,int j,int dx,int dy){
if(dx >= 0 && dy >= 0 && dx < n && dy < m){
if(board[i][j] == 2 && board[dx][dy] == 0){
return true;
}
}
return false;
}
void play(int i,int j,int num){
... | true |
5ad3f200259af244cd27b07ac36cbe53514f457e | C++ | AnthonySuper/Experimental-2D-Engine | /src/component.cpp | UTF-8 | 584 | 2.796875 | 3 | [] | no_license | #include "component.hpp"
namespace NM {
Component::Component(EntityRef entity) : parentEntity(entity) {}
Component::Component() : parentEntity(nullptr, -1) {}
Entity& Component::getEntity() {
return parentEntity.get();
}
void NullComponent::receive(NM::Message &m) {
... | true |
192bbc44e635c117a71c98e0fee9d8619deaaaa1 | C++ | NirobNabil/LFR | /main_archived/sensorReadings.ino | UTF-8 | 491 | 2.546875 | 3 | [] | no_license |
int ir_array[6];
char sensor_s[6];
int sensor;
void readData() {
ir_array[0] = analogRead(A0);
ir_array[1] = analogRead(A1);
ir_array[2] = analogRead(A2);
ir_array[3] = analogRead(A3);
ir_array[4] = analogRead(A4);
ir_array[5] = analogRead(A5);
sensor = 0;
for( int i=0; i<6; i++ ) ... | true |
1e54e5d3605c5fa437dca3bbef1f7f4d7e884c4b | C++ | brianrhall/Assembly | /Chapter_11/Program_11.2_AVR_blink/Program_11.2_AVR_blink.ino | UTF-8 | 2,134 | 2.65625 | 3 | [
"MIT"
] | permissive | // Program 11.2
// Arduino Uno Blink Program in AVR Assembly
// Copyright (c) 2017 Hall & Slonka
#define LEDPort PORTB // Arduino pin 13 is bit 5 of port B
#define LEDPort_Direction DDRB // DDRB is the port B direction register (0=input, 1=output)
#define LEDBit 5 // Constant for bit 5
#defin... | true |
314f41aa7b011108438404eac4847ac4c759b287 | C++ | stranker/BackGE | /Clase1/Triangle.cpp | UTF-8 | 416 | 2.640625 | 3 | [] | no_license | #include "Triangle.h"
Triangle::Triangle(Renderer* renderer) : Entity(renderer)
{
}
Triangle::~Triangle()
{
}
void Triangle::Draw()
{
if (shoulDispose)
{
renderer->DrawBuffer(bufferID, vtxCount);
}
}
void Triangle::SetVertices(float * vertices, int _vtxCount)
{
vertex = vertices;
vtxCo... | true |
3c6b6eeb94d676facc815d0d855de5422dbd1afb | C++ | Alipashaimani/Competitive-programming | /Codeforces/336A.cpp | UTF-8 | 455 | 2.828125 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int x, x2, y, y2;
int main(){
int a ,b; cin >> a >> b;
if((a < 0 && b > 0) || (a > 0 && b < 0)){
x = 0 ;
y = -a + b;
x2 = a + -b;
y2 = 0;
}
else{
x = 0 ;
y = a + b;
x2 = a + b;
y2 = 0;
}
... | true |
1a0324b72c744689669d3807a78f5ae611f507de | C++ | jzx0614/Course | /acm/Summation of Polynomials.cpp | UTF-8 | 265 | 2.609375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(void){
long long num[50000];
long n;
num[0]=1;
for(long long i=1;i<50000;i++)
{
num[i]=num[i-1]+((i+1)*(i+1)*(i+1));
}
while(cin >> n)
{
cout<<num[n-1]<<endl;
}
}
| true |
c54d19278eca4b5184e276afa800b7ef16a13fa6 | C++ | Abuenameh/Canonical-Transformation-Gutzwiller-Cusimann | /complex.hpp | UTF-8 | 1,509 | 2.71875 | 3 | [] | no_license | /*
* complex.hpp
*
* Created on: Sep 11, 2014
* Author: Abuenameh
*/
#ifndef COMPLEX_HPP_
#define COMPLEX_HPP_
//#include <complex>
//using std::complex;
#include "cudacomplex.cuh"
//#ifdef __CUDACC__
//#else
//#endif
template<class T>
struct complextype {
typedef T type;
__host__ __device__ static in... | true |
e54ed9c1f96790090224c60529e78eb74283e6f8 | C++ | Liew211/nbody | /window.cpp | UTF-8 | 677 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <stdexcept>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
GLFWwindow *initializeOpenGL()
{
/* Initialize the library */
if (!glfwInit())
throw std::runtime_error("GLFW not initialized");
/* Create a windowed mode window and its OpenGL context */
GLFWwindow *window = glfwCreateWind... | true |
b1620e96598371577c36ef629767ca7ad0349fae | C++ | Ujwalgulhane/Data-Structure-Algorithm | /Algorithms/NumberTheory/binaryExponentiation.cpp | UTF-8 | 625 | 2.921875 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
long long binaryExponentiation(long long a,long long b){
if(b==0)
return 1;
long long c=binaryExponentiation(a,b/2);
if(b%2)
return c*c*a;
else
return c*c;
}
long long binaryExponentiationFast(long long a,long long b){
long long r=1;
while(b>0){
if(b&1)
... | true |
92e16e7ce909718e99ab040312280d9da706f1b5 | C++ | JayThakkar17/DataStructuresAndAlgorithms | /Basic/Quotent&Remainder.cpp | UTF-8 | 381 | 3.15625 | 3 | [] | no_license | #include<iostream>
int main()
{
int dividend,divisour,remainder,quotent;
std::cout<<"Enter Dividend:";
std::cin>>dividend;
std::cout<<"Enter Divisour:";
std::cin>>divisour;
quotent = dividend / divisour;
remainder = dividend % divisour;
std::cout<<"Quotent is "<<quotent<<std::endl;
std::cout<<"Remainder... | true |
825758d913ff33fcc74421cf8215ce4a807890c6 | C++ | QuinnRong/cplusplus | /interview/03_HIKVISION/2_MidNumber.cpp | UTF-8 | 456 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
#define MaxOfThree(a,b,c) ((a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c)))
#define MidOfThree(a,b,c) ((a)>(b)?((b)>(c)?(b):((a)>(c)?(c):(a))):\
((a)>(c)?(a):((b)>(c)?(c):(b))))
#define MinOfThree(a,b,c) ((a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c... | true |
62bbe412f253430b312bcab5b0a006f4b76cdad2 | C++ | Arui1/shadow | /shadow/operators/roi_pooling_op.hpp | UTF-8 | 1,022 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef SHADOW_OPERATORS_ROI_POOLING_OP_HPP
#define SHADOW_OPERATORS_ROI_POOLING_OP_HPP
#include "core/operator.hpp"
namespace Shadow {
class ROIPoolingOp : public Operator {
public:
ROIPoolingOp(const shadow::OpParam &op_param, Workspace *ws)
: Operator(op_param, ws) {
pooled_h_ = get_single_argument<i... | true |
3bccf5c6f1d1d77693cf888116246e0875ae3d38 | C++ | ktekchan/Summer | /HackerRank/staircase.cpp | UTF-8 | 674 | 3.15625 | 3 | [] | no_license | /*-----------------------------------------------------------------------------
* Author: Khushboo Tekchandani
* Staircase problem
------------------------------------------------------------------------------
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using nam... | true |
7733fa25d07c1820d552439ba192b91a1baf346d | C++ | zv-proger/ol_programms | /acmp/0570.cpp | WINDOWS-1251 | 1,147 | 2.578125 | 3 | [] | no_license | /*
: (zv.proger@yandex.ru)
0570 acmp.ru
*/
#include<bits/stdc++.h>
using namespace std;
bool calc() {
char pl[1000][1000];
int l, r, t, b, n, m; cin >> n >> m;
l = m, r = 0, t = n, b = 0;
for (int i = 0; i < n; i++) {
cin >> pl[i];
for (int j = 0; j < m; j+... | true |
7685d3c9c2e0ed14be2d89e6e44fe8be0ca1b40d | C++ | uwe-creative-technology/generative_systems | /session_1_visual_expression/activeDrawing/src/ofApp.cpp | UTF-8 | 2,846 | 3.140625 | 3 | [] | no_license | /*
Project Title: Active Drawing
Description:
©Daniel Buzzo 2020
dan@buzzo.com
http://buzzo.com
https://github.com/danbz
adapted from reas and fry 'processing' acive drawing
*/
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
numLines = 500;
currentLine ... | true |
1b10f9427fbbcde90cf05bc69f716b2a6da62ff1 | C++ | petru-d/leetcode-solutions-reboot | /problems/p1123.h | UTF-8 | 1,682 | 3.046875 | 3 | [] | no_license | #pragma once
#include "util_binary_tree.h"
#include <unordered_map>
namespace p1123
{
class Solution
{
public:
TreeNode* lcaDeepestLeaves(TreeNode* root)
{
if (!root)
return nullptr;
auto depth = build_map(root, 0);
return search(root, ... | true |
0e6278390e5caf755ab1db51a24aa5c6c2190d50 | C++ | MikeMei/CSE335 | /CSE335_CompositeAndVisitorPattern/CSE335_inclass_CompositeAndVisitorPattern/EvaluationVisitor.h | UTF-8 | 2,175 | 2.96875 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: EvaluationVisitor.h
* Author: laptop-pc
*
* Created on March 3, 2016, 1:14 PM
*/
#ifndef EVALUATIONVISITOR_H
#defi... | true |
121ad9721a0eb105ac744bd64a7eb308e07b100e | C++ | kkuchar2/libmpeg7 | /sources/DESCRIPTORS/TEXTURE/TextureBrowsing/TextureBrowsing.h | UTF-8 | 874 | 2.609375 | 3 | [] | no_license | /** @file TextureBrowsing.h
* @brief Texture Browsing descriptor data,
* method for loading parameters, read and wirte to XML,
* modify and access data.
*
* @author Krzysztof Lech Kucharski
* @bug No bugs detected. */
#ifndef _TEXTUREBROWSING_H
#define _TEXTUREBROWSING_H
#includ... | true |
09f8c8058043ae325a740855c83c7cefa00f8ad0 | C++ | iintSjds/classical-lattice-monte-carlo | /src/old/oldlattice.h | UTF-8 | 5,348 | 3.390625 | 3 | [] | no_license | /********--Definitions of different lattice type--********/
/*
* Copyright (C) 2018 Xiansheng Cai. All rights reserved.
*/
#include <iostream>
#include <vector>
#include <cmath>
// a generic definition of Bravais Lattice
// Site_Type is provided outside by the required system. TBD in Model.
// all the rest of lattic... | true |
945fd1ee06412a990f7e17a4a54411079fc6ed92 | C++ | cyberreefguru/WifiNeoPixels | /client/NeopixelWrapper.cpp | UTF-8 | 32,741 | 2.890625 | 3 | [
"MIT"
] | permissive | /*
* NeoPixelWrapper.cpp
*
* Created on: Sep 12, 2015
* Author: tsasala
*/
#define FASTLED_ALLOW_INTERRUPTS 0
#define FASTLED_ESP8266_RAW_PIN_ORDER
//#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#include "NeopixelWrapper.h"
CLEDController *ledController;
/**
* Constructor
*/
NeopixelWrapper::NeopixelWrapp... | true |
f224897387fc8aeb89b49b4b8fa72e1880bf41c6 | C++ | rex0yt/MyCods | /题解/POJ 3253 Fence Repair.cpp | GB18030 | 671 | 3.109375 | 3 | [] | no_license | /* ֱӶѽȶУ*/
#include <iostream>
#include <queue>
#include <string>
using namespace std;
const int NN = 20000 + 100;
struct cmp
{
bool operator ()(int &a,int &b)
{
return a>b;//Сֵ
}
};
priority_queue <int, vector<int>, cmp> pq;
int n;
long long sum = 0;
int main()
{
int x;
int a, b;
c... | true |
180d720cd46b6b58f80adc324f0d8e88cd81c768 | C++ | annlie/oop | /hw1/hw01.cpp | UTF-8 | 3,721 | 3.9375 | 4 | [] | no_license | //
// Annlie Nguyen
// hw01
//
// Program for a medieval times game where warriors battle
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
struct Warrior {
string name;
int strength;
};
void createWarrior(vector<Warrior>& warVec, const string& name, const int... | true |
8055f05c5157e528a520d1365caeb519f07e84ce | C++ | Solpatium/LogicGame | /LogicGame/LogicPlaything.cpp | UTF-8 | 2,982 | 3.15625 | 3 | [
"MIT"
] | permissive | #include "LogicPlaything.h"
LogicPlaything::LogicPlaything(short int difficulty)
: difficulty(difficulty) {
generatePlaything();
}
LogicPlaything::~LogicPlaything() {
delete root;
}
string LogicPlaything::toString() {
int n = 0;
string toReturn = root->orderedSentences(n) + "\n";
n = 0;
toRet... | true |
67b49776a49dc94e60e9345fdaef457585d9727e | C++ | Nalepa/2d_adventurer_game | /2d_game/Game_Saving.h | UTF-8 | 962 | 2.6875 | 3 | [] | no_license | #pragma once
#include "Main_Character.h"
#include "Environment.h"
#include <string>
#include <fstream>
#include "Exceptions.h"
class Game_Saving
{
protected:
Character_Stats* character_stats;
Main_Character* main_character;
Environment* environment;
std::string file_name;
std::ofstream file;
sf::Text text;
sf::F... | true |
658515fb673a8b6642169b0d667d0e92744261ec | C++ | dbousque/_test | /piscine_cpp/d02/ex04/List.hpp | UTF-8 | 343 | 2.953125 | 3 | [] | no_license |
#ifndef LIST_H
# define LIST_H
#include <string>
class List
{
public:
List();
List(List &other);
~List();
List &operator=(List &other);
void add(void *elt);
size_t length();
void *get(size_t n);
void *pop();
void *getTop();
private:
void **_elts;
size_t _len;
size_t _size;
void _doubl... | true |
1b771432c90f732bc1debcb0dfe4439bfaf6aef8 | C++ | Siwwyy/3_Studying_Year | /ARTIFICIAL_INTELLIGENCE/!NEURAL_NETWORKS/Fourth/Fourth/main.cpp | UTF-8 | 5,749 | 2.921875 | 3 | [
"LicenseRef-scancode-other-permissive",
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <fstream>
#include <istream>
#include <iterator>
#include <time.h>
#include <random>
#include <iomanip>
#include <math.h>
#include <cstdint>
#include <windows.h>
#define NEW_LINE '\n'
//const __int16 const* const* Read_Inputs(const char * file_name, size_t & width, size_... | true |
6afe8965052be855cc2783d640ecc044c8381122 | C++ | azakhary/cnc-firmware | /CNCProject.ino | UTF-8 | 8,777 | 2.890625 | 3 | [] | no_license | /*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control
For use with the Adafruit Motor Shield v2
----> http://www.adafruit.com/products/1438
*/
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "u... | true |
a4aacb8ba8572789370fffce81fb1740b13f8626 | C++ | NickGhezzi/GameEngineProject | /AltProject/Game/Source/SceneDonkeyKong/ElevatorObject.cpp | UTF-8 | 1,484 | 2.640625 | 3 | [] | no_license | #include "GamePCH.h"
#include "ElevatorObject.h"
#include "Scenes/BaseScene.h"
ElevatorObject::ElevatorObject(BaseScene* pScene, std::string name, vec3 pos, vec3 rot, vec3 scale, Mesh* pMesh, Material* pMaterial)
: GameObject( pScene, name, pos, rot, scale, pMesh, pMaterial )
{
m_Sensor = nullptr;
}
ElevatorObj... | true |
c1ee4066abbde7972f9954f60f6a16d9310f72f9 | C++ | kkoon9/algorithm | /Graph/MST/BOJ1197_MST.cpp | UTF-8 | 2,201 | 3.359375 | 3 | [] | no_license | // 크루스칼 알고리즘
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct edge {
int src, dest, weight;
bool operator <(const edge& rhs) const { // 가중치 비교하기 위한
return weight < rhs.weight;
}
};// 간선 정보
const int MAX = 10000 + 1;
vector<edge> vt;
int parent[MAX];
int v, e, k;
int find(in... | true |
d431cecc8d8fee0f94872a4e38004ef376e9dcea | C++ | DyllanM/CS370 | /Framework/src/ImRecipe.h | UTF-8 | 1,433 | 2.90625 | 3 | [] | no_license | /*
* ImRecipe.h
*
* Created on:
* Author: wylder
*/
#ifndef IMRECIPE__H
#define IMRECIPE__H
#include "ImStage.h"
#include <vector>
//A recipe is a list of images and fx to apply to them.
class ImRecipe
{
public:
ImRecipe(ImageId source);
virtual ~ImRecipe();
//Excute the recipe
void Execute();
... | true |
502d2e2185abf8f539c7ca8b1c39704a3159b952 | C++ | ddk992001/khang | /Project Euler/Problem 1.cpp | UTF-8 | 593 | 3.765625 | 4 | [] | no_license | // MULTIPLES OF 3 OR 5
#include <iostream>
using namespace std;
long long sumOfThree(long long n) {
long long index = ((n - 1) / 3);
return index * (2 * 3 + (index - 1) * 3) / 2;
}
long long sumOfFive(long long n) {
long long index = ((n - 1) / 5);
return index * (2 * 5 + (index - 1) * 5) / 2;
}
long long sumO... | true |
dbc7050d7bb4a396f15b0ca8751f6125ff7602b0 | C++ | Cecenio/Programmering-1 | /2019-03-28/övning3.cpp | UTF-8 | 365 | 3.390625 | 3 | [] | no_license | #include <iostream>
using namespace std;
void areacirkel(double &tal);
int main()
{
double diameter;
cout << "Ange diametern på din cirkel: " << endl;
cin >> diameter;
areacirkel(diameter);
return 0;
}
void areacirkel (double &tal)
{
double area = (3.14*(tal*tal))/4;
cout << "Arean på din cirk... | true |
c8991ff840e100f0ff31b5fbdc5a82b39e07e0de | C++ | turingcompl33t/cpp-playground | /boost.asio/streambuf.cpp | UTF-8 | 1,058 | 2.828125 | 3 | [] | no_license | // streambuf.cpp
// Basic operations with boost::asio::streambuf.
//
// Build
// cl /EHsc /nologo /std:c++17 /W4 /I %CPP_WORKSPACE%\_Deps\Catch2 /I %CPP_WORKSPACE%\_Deps\Boost streambuf.cpp
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#define BOOST_ALL_NO_LIB
#include <boost/asio.hpp>
namespace net = boost::asio... | true |
8244feb3987f236a8a4251e0e3f550dd5bb4b167 | C++ | zhuohengfeng/Algorithm | /selectSort/Student.h | UTF-8 | 721 | 3.375 | 3 | [] | no_license | //
// Created by hengfeng zhuo on 2019-03-27.
//
#ifndef ALGORITHM_STUDENT_H
#define ALGORITHM_STUDENT_H
#include <iostream>
#include <string>
using namespace std;
class Student {
public:
string name;
int score;
public:
// 重载操作符
bool operator>(const Student& otherStudent){
return this->sc... | true |
d5c8db888f2a821316a04899a4d44a6aac77d4df | C++ | Viredery/RegexEngine | /src/SyntacticTree.h | UTF-8 | 869 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef SYNTACTIC_TREE_H_
#define SYNTACTIC_TREE_H_
#include <vector>
#include <string>
#include <memory>
#include "Node.h"
namespace Regex {
class SyntacticTree
{
public:
SyntacticTree(std::string pattern);
~SyntacticTree() = default;
void toString();
void scan();
void constructTree();
std::sha... | true |
a679b704a00606bd81f2fc46a5b531771d46671e | C++ | WShiBin/Notes | /Languages/C++/Code/preprocessor/03Source_file_inclusion.cpp | UTF-8 | 492 | 2.96875 | 3 | [] | no_license | #if __has_include(<optional>)
#include <optional>
#define have_optional 1
#elif __has_include(<experimental/optional>)
#include <experimental/optional>
#define have_optional 1
#define experimental_optional 1
#else
#define have_optional 0
#endif
#include <iostream>
int main()
{
if (have_optional)
std::cout... | true |
e956b31d024da36ff9bd6965e49c393e56747e0e | C++ | RagingRoosevelt/eecs560-Data_Structures_Labs | /Lab06/hash_open.h | UTF-8 | 825 | 2.875 | 3 | [] | no_license | #ifndef HASH_OPEN_H
#define HASH_OPEN_H
#include <iostream>
using namespace std;
class HashTableOpen
{
private:
// entry structure
struct Node
{
long int value;
bool flag;
Node(long int v, bool f):
value(v), flag(f) {}
};
// for calculati... | true |
ec78d065e919ea645a0c52590397c7381c3e9eeb | C++ | atgchan/CPP_LAB | /TrainStation/TrainStation/Queue.h | UTF-8 | 511 | 3.265625 | 3 | [] | no_license | #pragma once
template <class T>
class Queue
{
public:
Queue(int maxSize);
~Queue();
void enQueue(T* t);
T* deQueue();
bool isFull();
bool isEmpty();
int size();
int nextPosition(int n);
T* get(int i)
{
if (i >= mCurrentSize)
{
return nullptr;
}
else
{
int tmp = mFirstPosition;
for (int j... | true |
05bccfe62ff03f6b1f00b19118810d58bf11c0d0 | C++ | Lali67/Cpp_Snippet | /06-PR1 Prüfungsaufgaben/02-Pizza/Pizzabude/Pizzabude/pizza.h | UTF-8 | 1,921 | 3.375 | 3 | [
"MIT"
] | permissive | #ifndef PIZZA_H
#define PIZZA_H
#include <iostream>
#include <string>
#include <vector>
#include <exception>
#include "topping.h"
using namespace std;
class Pizza {
private:
vector<Topping> toppings;
public:
Pizza ()
{
Topping Tomato_sauce{ "Tomato sauce" };
Topping Cheese{ "Cheese", "G" };
toppings.push_b... | true |
cfec4a24e7711588d994e6202dbc042524a684a8 | C++ | Youosun/CPP | /log4cpp/Log4cpp/Mylog.cc | UTF-8 | 1,440 | 2.625 | 3 | [] | no_license | #include "Mylog.h"
#include <log4cpp/Priority.hh>
#include <log4cpp/PatternLayout.hh>
#include <log4cpp/OstreamAppender.hh>
#include <log4cpp/FileAppender.hh>
#include <sstream>
#include <iostream>
#include <string>
Mylog * Mylog::_pInstance = NULL;
Mylog::Mylog()
: _root(log4cpp::Category::getRoot())
{
log4cpp::Pa... | true |
5799db1a168d871e5914988da2212a63c6d55127 | C++ | oury-fln/gl_test | /test2/main.cpp | GB18030 | 6,760 | 2.953125 | 3 | [] | no_license | #include <windows.h>
#include <gl/gl.h>
#include <gl/glut.h>
#include "plant.h"
#include "values.h"
/*
* ϰ1
* ľ
*/
//ĻȣĻ߶
GLfloat winWidth,winHeight;
//
GLfloat x1 = 100.0f,y1 = 150.0f;
//δС
GLsizei rsize = 10;
//仯
GLfloat xstep,ystep = xstep = 1.0f;
//һȾ
void ghRender(void);
//һߴıص
void ghReshape(int width,int heig... | true |
b783a5380295899b1fa6de59f8aeabc260e27615 | C++ | Elathorn/Wozek-widlowy | /KCK/KCK/GraphicManager.cpp | UTF-8 | 3,195 | 2.734375 | 3 | [] | no_license | #include "GraphicManager.h"
#include <SFML/System.hpp>
GraphicManager::GraphicManager()
{
TextureManager* TM = new TextureManager(); //stworzenie managera textur
SI = new ScriptInterpreter();
//stworzenie mechaniki i mapy
mechanic->mapCreator(TM);
//stworzenie okna i jego podzialu
createWindow(WINDOW_WIDTH, WI... | true |
3545664056ce85f752e9266d4933b8ef03430b05 | C++ | exgs/ft_CPP | /cpp6/ex02/Base.cpp | UTF-8 | 1,079 | 3.3125 | 3 | [] | no_license | #include "Base.hpp"
Base *generate(void)
{
timeval time;
int idx;
gettimeofday(&time, NULL);
idx = rand() % 3;
idx = time.tv_usec % 3; // 0,1,2 중 하나
if (idx == 0)
return (new A);
else if (idx == 1)
return (new B);
else if (idx == 2)
return (new C);
return (new C);
}
void identify_from_pointer(Base *p)
... | true |
0a3145d4a586981bc2294c447fa28875a7a91ecc | C++ | devanshdalal/CompetitiveProgrammingAlgos | /dddlll/codechef/CHEFINV/CHEFINV-4733034.cpp | UTF-8 | 3,990 | 2.609375 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
typedef long long ll;
typedef unsigned long long ul;
typedef double d;
using namespace std;
const ll mod = 1000000007;
int f[200003],n,m;
int read(int idx){
int val=0;
while(id... | true |
3b0b5cf1814135692bf5827e6c8465597a1f8fc2 | C++ | L1l1thLY/DataStructure | /ShellsSort.cpp | UTF-8 | 1,117 | 3.71875 | 4 | [] | no_license | #include <iostream>
void swapInt (int* a, int* b) {
*a = *a ^ *b;
*b = *b ^ *a;
*a = *a ^ *b;
}
void newSwap (int *a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
void shellInsert (int* arrayToSort, int increment, int count) {
for (int i = increment; i < count; i++) {
if (arrayT... | true |
93329416f09ed3e52b8202f7d23e3be5ab048c7d | C++ | analgorithmaday/analgorithmaday.github.io | /code/cpp/Stack.cpp | UTF-8 | 734 | 3.1875 | 3 | [
"MIT"
] | permissive | const int SIZE=10;
template<class T>
class Stack
{
T arr[SIZE];
int top_idx;
int top() const { return top_idx; }
bool stack_empty() const { return (top_idx == -1); }
bool stack_full() const { return (top_idx+1 > SIZE-1); }
public:
Stack() {
top_idx = -1;
}
... | true |
652f9061db7cfc2ffc2aa5a39c1e69f8e48912f8 | C++ | AnneLivia/Competitive-Programming | /Online Judges/URI/1222/main.cpp | UTF-8 | 1,848 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
int main()
{
// Variable respectively: number of words, maximum lines per page, maximum chars per line
// iterator variable, number of lines, numbers of pages, number of chars, number of spaces and number of words.
int n, l, c, i, nl, np, nc, ns, ... | true |
7e235df3911c7dba8b766632f2530c67680b3b9f | C++ | sepulchralraven/memor-koluchkaa | /programming 1.1/LABS 21/LABA 21.7.cpp | UTF-8 | 862 | 3.1875 | 3 | [] | no_license | // LABA 21.7.cpp
// Дана строка-предложение. Зашифровать ее, поместив вначале все символы, расположенные на четных позициях строки,
// а затем, в обратном, все символы, расположенные на нечетных позициях (например, строка «Программа» превратится в «ргамамроП»).
#include <iostream>
#include <string>
#include <Windows... | true |
912948b9ecd6bd880e4c81e859d3703d60ab4fe4 | C++ | dtucker21/CS172 | /HW1.cpp | UTF-8 | 4,886 | 3.046875 | 3 | [] | no_license | // HW1.cpp : Defines the entry point for the console application.
//
//EX01_01: /20
//EX01_02: 20/20
//EX01_03: 18/20
//EX01_04: 19/20
//EX01_05: 18/20
//PT -- Why include stdafx? I don't think you need it.
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#i... | true |
a413f804bd1facab29e07b6ece6575a61c665cbf | C++ | GMHDBJD/leetcode_solution | /62.unique-paths.cpp | UTF-8 | 513 | 2.625 | 3 | [] | no_license | /*
* @lc app=leetcode id=62 lang=cpp
*
* [62] Unique Paths
*/
/*
attention to precision
*/
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int uniquePaths(int m, int n)
{
return Cmn(m - 1 + n - 1, n - 1);
}
int Cmn(int m, int n)
{
n = min(n, m - n);
... | true |
2df5031fb6dffa6a4a6007ef7cdaa5ab13b6fea7 | C++ | hd-code/TicTacToe | /src/models/Game.hpp | UTF-8 | 488 | 2.578125 | 3 | [] | no_license | #pragma once
#include "Board.hpp"
// -----------------------------------------------------------------------------
enum EPlayer { ONE, TWO, NUM_OF_PLAYERS };
struct SGame {
SBoard board;
SPlayer players[NUM_OF_PLAYERS];
EPlayer playerOnTurn;
};
// -------------------------------------------------------... | true |
faa9d29e4c9d61812e67999db738afdda337850b | C++ | jpoffline/seqcode | /source/simplecheck.cpp | UTF-8 | 4,260 | 2.96875 | 3 | [] | no_license | #include "simplecheck.h"
// Checks the state of the system after every timestep
void SimpleCheck::checkstate (const double data[], const double time, IntParams ¶ms, Output &output, const double status[]){
// We want to check the following conditions:
// Error in Friedmann equation sufficiently small
// Equation... | true |
276709aae483cfbd6f7a8e311100d3b506e967d3 | C++ | zhaomasha/panda_new | /test/server.cpp | UTF-8 | 434 | 2.625 | 3 | [] | no_license | // Hello World server
#include "panda_zmq.hpp"
#include "panda_head.hpp"
using namespace zmq;
int main (void)
{
// Socket to talk to clients
context_t ctx(16);
socket_t s(ctx,ZMQ_REP);
s.bind ("tcp://*:5556");
while (1) {
char buffer [10];
s.recv(buffer,10);
cout<<"Receive... | true |
0125f3f23eecb2fe7042c4546a1e8c872bc352dd | C++ | Crasader/GLEXP-Team-Chimple-goa | /goa/Classes/util/Speaker.cpp | UTF-8 | 4,818 | 2.5625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | //
// Speaker.cpp
//
//
// Created by Karim Mirazul on 28-08-2017.
//
//
#include "../util/Speaker.h"
#include "editor-support/cocostudio/CocoStudio.h"
#include "SimpleAudioEngine.h"
#include "../lang/LangUtil.h"
#include "../menu/StartMenuScene.h"
#include "../lang/TextGenerator.h"
#include "ui/CocosGUI.h"
#inclu... | true |
27f5d1f8c3d6727311360b24cc5e223ed3c1273a | C++ | martva383/prog1 | /binfa.cpp | UTF-8 | 3,340 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<new>
#include<vector>
#include<math.h>
using namespace std;
struct elem
{
int adat;
elem* bal;
elem* jobb;
};
int input (vector<int> &t)
{
cout<<"input adatok:\n";
int k=0;
if(t.size()<=1000)
{
for (int i=0; i<t.size() ; i++)
{
k++;
... | true |
19810209883b7706bc09eb3ae7f890833585c603 | C++ | du-yang/code_repository | /word_sim/word_sim.cc | UTF-8 | 1,951 | 2.984375 | 3 | [] | no_license | /*
* word_sim.cc
* Copyright (C) 2018 app <app@VM_36_54_centos>
*
*/
#include "word_sim.h"
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <map>
#include <math.h>
using namespace std;
WordSim::WordSim(){
if(Init()){
cout<<"初始化完成"<<endl;
}el... | true |
88b4111b2a5d257336ce1b710ab2b86c2cd159dc | C++ | blacksea3/leetcode | /cpp/leetcode/462. minimum-moves-to-equal-array-elements-ii.cpp | WINDOWS-1252 | 447 | 3 | 3 | [] | no_license | #include "public.h"
//16ms, 93.81%
//ҵλ
class Solution {
public:
int minMoves2(vector<int>& nums) {
sort(nums.begin(), nums.end());
int nsize = nums.size();
int res = 0;
int midv = nums[nums.size() / 2];
for (int i = 0; i < nums.size(); ++i)
res += abs(nums[i] - midv);
return res;
}
};
/*
int main(... | true |
2b08a52ba1fc11f8acd0d8626aea6f588fbc77c9 | C++ | mjoshi3/CS140 | /lab7/BST2.h | UTF-8 | 4,290 | 3.609375 | 4 | [] | no_license | #ifndef BST2_H
#define BST2_H
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>
/* BST2.h
Author: Marvin Joshi
Date: November 14,2017
This program reads in a text file that contains numbers that
will be inserted into a binary tree. The program inserts each
node and inserts the node to its... | true |
10fea27d50560810e7875526c0da0d448b8381f7 | C++ | nscooling/pipeandfilter | /src/Buffer.cpp | UTF-8 | 3,173 | 2.5625 | 3 | [] | no_license | // ----------------------------------------------------------------------------------
// Buffer.cpp
//
// DISCLAIMER:
// Feabhas is furnishing this item "as is". Feabhas does not provide any
// warranty
// of the item whatsoever, whether express, implied, or statutory, including,
// but
// not limited to, any warranty ... | true |
5e88dd485ee78cf56e0c986087f9ed7831b7bbd7 | C++ | AristoChen/LeetCode-AC-Solution | /273. Integer to English Words/Solution.cpp | UTF-8 | 4,082 | 3.640625 | 4 | [] | no_license | /*
Submission Detail:{
Difficulty : Hard
Acceptance Rate : 22.84 %
Runtime : 5 ms
Testcase : 601 / 601 passed
Ranking : Your runtime beats 84.01 % of cpp submissions.
}
*/
class Solution {
public:
string numberToWords(int num) {
if(num == 0)
return "Zero";
... | true |
c3c0b26579fbe17835b87017aee6eaded817b6cc | C++ | KPO-2020-2021/zad5_2-AdamDomachowski | /src/goraGran.cpp | UTF-8 | 1,950 | 2.75 | 3 | [
"Unlicense"
] | permissive | #include "goraGran.hh"
/*!
\file
\brief metody klasy goraGran
*/
/*!
konstruktor goraGranu
\param [in] srodek - wspolrzedne srodka goraGranu.
\param [in] a - dlugosc
\... | true |
314302374bbbf0907746e1bec95ca24185374bb8 | C++ | Vinayakk83/Competitive-Programming | /LeetCode/1396_Design_Underground_System.cpp | UTF-8 | 976 | 3.1875 | 3 | [] | no_license | class UndergroundSystem {
public:
unordered_map<int, pair<string, int>> idMap;
unordered_map<string, unordered_map<string, pair<int, int>>> stationMap;
UndergroundSystem() {
}
void checkIn(int id, string stationName, int t) {
idMap[id] = {stationName, t};
}
... | true |
10e4e6e7f663c96a4e45525d565e7f65d5772be6 | C++ | 595624187/c | /算法实验2/main.cpp | WINDOWS-1252 | 787 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
#define N 10
int x[N]={-1};
int abs(int i){
if(i<0) i=-i;
return i;
}
int Place(int k)
{
for(int i=0;i<k;i++)
if(x[i]==x[k]||abs(i-k)==abs(x[i]-x[k]))
return 1;
return 0;
}
void Queen(int n)
{
int k=0;
while(k>=0){
x[k]++;
... | true |
0d91d8ce2483c5ba2ad589cbc83c4ebeff7d5b3b | C++ | Wibben/WCIPEG | /dwitesep09p3.cpp | UTF-8 | 1,123 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
class Point
{
public:
double x,y;
void setVal(double x, double y)
{
this->x = x;
this->y = y;
}
double slope(Point p)
{
return (p.y-y)/(p.x-x);
}
Point midpoint(Point p)
{
... | true |
b1a08a0f7c11f96af508639d487b095f623b594b | C++ | rohitnotani4/CP | /InterviewBit/Bit Manipulation/Divide Integers.cpp | UTF-8 | 701 | 3.21875 | 3 | [] | no_license | /*
https://www.interviewbit.com/problems/divide-integers/
*/
int Solution::divide(int A, int B)
{
int dividend = A, divisor = B;
if(!divisor || (dividend==INT_MIN && divisor==-1))
return INT_MAX;
// Check if both are negative/positive using XOR
int sign = ((dividend < 0) ^ (divisor <... | true |
1ce5ba9808edf05ae74deba9e74b75e7d1fd3b7b | C++ | pabitrapadhy/cpp_11_examples | /cpp_11_examples/auto.h | UTF-8 | 1,461 | 3.625 | 4 | [] | no_license | //
// auto.h
// cpp_11_examples
//
// Created by Padhy, Pabitra on 16/06/18.
// Copyright © 2018 Padhy, Pabitra. All rights reserved.
//
#ifndef auto_h
#define auto_h
#include <iostream>
using namespace std;
/*
Type Inference:
---------------
Use of 'auto' could also be done with return types of a function, w... | true |