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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fcde823bbf8837ca7975341575c25f956aa76fdb | C++ | primayoriko/problem-solving-solution | /Compfest/SEA Selection 2020/Syntax Checker.cpp | UTF-8 | 2,779 | 3.796875 | 4 | [] | no_license | // PROBLEM STATEMENT
// Ryo creates a new language that only consists of ‘(‘, ‘)’, ‘[‘, ‘]’, ‘<‘, ‘>’, or we can say:
// L = { ‘(‘, ‘)’, ‘[‘, ‘]’, ‘<‘, ‘>’ }.
// Because this is the first time Ryo has invented something, he wants to use this invention as his thesis on his Master. But, he is not sure if this in... | true |
7c0fb9c855ab0ba50efeab97285df2c9fd924959 | C++ | SystemKultur/performancehelper | /include/AverageUsage.hpp | UTF-8 | 435 | 2.6875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <cstdint>
#include <iostream>
#include <string>
namespace systemkultur
{
class AverageUsage
{
private:
float _cpu;
float _memory;
public:
AverageUsage( const float cpu, const float memory);
float cpu() const;
float memory() const;
static const Ave... | true |
3c91ee447f05f5fd73ca0c23d714e1ee8b4745bc | C++ | donnice/learnCPP | /ch5/Iterator_traits.cpp | UTF-8 | 1,061 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <iterator>
#include <typeinfo>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <forward_list>
// page 139
using namespace std;
// iterator_trait allow us to check what kind of
// iterator is supported
//void test(vector<string>& v,forward_list<int>& lst)... | true |
6ef29e8571d82fa4fc581a36ead0fa0bc820a40f | C++ | ByteMansion/leetcode | /tree/leetcode572.cpp | UTF-8 | 8,647 | 3.734375 | 4 | [] | no_license | /**
* @brief Leetcode 572: Subtree of Another Tree
* Given two non-empty binary trees s and t, check whether tree t
* has exactly the same structure and node values with a subtree of s.
* A subtree of s is a tree consists of a node in s and all of this node's descendants.
* The tree s could also be considere... | true |
ecb64073e11397b295ec4cdb001158ebb3271e7a | C++ | gohmrmts/cppws-class12 | /main.cc | UTF-8 | 3,620 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <sstream>
#include <time.h>
#include "utf8.h"
using namespace std;
const int loopend = 1000000;
void advanced(utf8 * str)
{
clock_t start = clock();
for (int i = 0; i < loopend; i++)
{
for (int j = 0; j < 4; j++){}
}
clock_t end = clock();
double for_time = (double)(end -... | true |
4f2e5d7090f790f78e2ddcaf479f60ad628a349b | C++ | Meharab/Problem-Solutions | /analog clock.cpp | UTF-8 | 3,821 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<process.h>
#include<iostream.h>
//using namespace std;
int calculatehrs(int h)
{
int x;
switch(h)
{
case 0: x=90;
break;
case 1:
case 13: x=60;
break;
case 2:
case 14: x=30;
break;
case 3:
case 15: x=0;
break;
case 4:
case 16: x=... | true |
637c8d91d0eb12adbc3a97993bf4fa1700123c48 | C++ | ferreirasilvaeduardo/UberHub-Code-Club | /2021-3/Tarde/Exemplos/Exercicio_String.cpp | UTF-8 | 900 | 3.671875 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
/*
xLeitura de duas frases
xImprimir as frases separadamente
xAdicionar um espaco no final da primeira frase
xJuntar as duas frases
xImprimir o resultado final da frase 1
xImprimir o tamanho final da frase
*/
int main(){
char str1[50], str2[50];
... | true |
4880be9be9716b73d655239f50aa5ab33ba70365 | C++ | Juanchiselo/CIS17C_48596 | /Proj/FinalProject_CardFightGameExtended/FinalProject_CFGE/FinalProject_CFGE/Hand.cpp | UTF-8 | 930 | 3.65625 | 4 | [] | no_license | /*
* Jose Sandoval
* CIS-17C: C++ Programming
* November 11, 2014
* Project #1: Card Fight Game
* Description: A fighting game that uses cards.
*/
#include "Hand.h"
#include "GameManager.h"
// Constructor for Hand class.
Hand::Hand()
{
// Create a deck with 200 cards.
deck = new Deck(200);
// Fill the hand... | true |
a3b8f5da8be1bfe913fa2828b1f713d6e787b96b | C++ | Teh-Bobo/ProjectEuler | /46/main.cpp | UTF-8 | 496 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "euler.h"
using namespace std;
int main()
{
const int MAX = 5779;
vector<bool> meh(MAX,false);
primesieve ps(MAX,true);
for(int i=3; i < MAX; ){
for(int j = 1; (i+(2*j*j)) < MAX; ++j){
meh[(i+(2*j*j))] = true;
meh[i] = true... | true |
3c17c553cefae98df320a64565964ccbf8e9b7c7 | C++ | HowCanidothis/DevLib | /SharedModule/External/ticksplitter.cpp | UTF-8 | 1,949 | 2.984375 | 3 | [
"MIT"
] | permissive | #include "ticksplitter.h"
#include <qmath.h>
TickSplitter::TickSplitter(qint32 prefferedTicksCount)
: m_prefferedTicksCount(prefferedTicksCount)
{
}
float TickSplitter::TicksStepForRange(float range) const
{
float exactStep = range/((float)m_prefferedTicksCount + 1e-6f); // mTickCount ticks on average, the ... | true |
083c21c1e63977bce589a0fe5a58ba349d963366 | C++ | blueKeys12/COIN_315 | /DSProject3/Fly.cpp | UTF-8 | 1,061 | 3.0625 | 3 | [] | no_license | #include "Fly.h"
Fly::Fly(CConsole * CCon, Player * player) : Danger(CCon, player){
text = white;
backG = green;
y = 1;
x = 3;
lane = "%";
limit = 10;//limit is 10 because that's how long I want fly to exist.
random = 0;
}
void Fly::move(){
if (random == 5 && limit != 0){
limit--;
display();
if (p... | true |
1d75dca45ad4b1f1fc10832c5a35480d16333e3b | C++ | DChang87/Competitive-Programming-Solutions | /mockccc15j5.cpp | UTF-8 | 1,076 | 3.046875 | 3 | [] | no_license | //upper and lower bounds with vectors
//Royal Guard
//Guard walks around, check how many buildings the guard will walk into
#include<bits/stdc++.h>
using namespace std;
int N,M;
vector<pair<int,int>> Xs,Ys;
int x,y,xf,yf;
int main()
{
cin.sync_with_stdio(0);cin.tie(0);
cin>>N;
for (int i=0;i<N;i++){
... | true |
7549002d16a0854c488cda5026f9fe31a51e6836 | C++ | jyoti-2/Sample_Coding-Question | /Tree/Insertion_BT.cpp | UTF-8 | 1,626 | 4.15625 | 4 | [] | no_license | // Insertion in a Binary Tree in level order
// Given a binary tree and a key, insert the key into the binary tree at the first position available in level order.
// Use iterative level order traversal using queue. if we find a node whose left child or right child is NULL/empty we put the keys at that position
#inclu... | true |
9edd773f7514505ea2f65bd0205869c1df73e1cb | C++ | TraceIvan/backup-copy-of-my-acm-code | /[kuangbin带你飞]专题三 Dancing Links/F poj 3074 Sudoku.cpp | GB18030 | 6,163 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string.h>
//ȷĶ壺һ0-1ɵľǷҵһеļϣʹüÿһжǡðһ1
const int MN = 9*9*9+10;//,9*9ӣÿӿԷ1~9
const int MM = 9*9+9*9+9*9+9*9+100;//
//õ(i - 1) * 9 + jΪ1ʾijеѾһռ81С
//81 + (i - 1) * 9 + vбʾiѾvֵһռ81С
//162 + (j - 1) * 9 + vбʾjѾvֵһռ81С
//243 + (3 * ((i - 1) / 3) + (j + 2) / 3 - 1) + vбʾ3... | true |
cdc777ee9f96f8ed36434631008c64a31688acaf | C++ | RanjithSelvan/Sudoku | /Sudoku/PuzzleMaker.cpp | UTF-8 | 1,943 | 3.1875 | 3 | [] | no_license | #include "PuzzleMaker.h"
#include <string.h>
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <vector>
PuzzleMaker::PuzzleMaker()
{
a = NULL;
for(int i = 0; i < 9; i++)
{
n_arr[i] = i+1;
}
}
PuzzleMaker::PuzzleMaker(Board* nboard)
{
a = nboard;
for(int i = 0; i < 9; i++)
{
n_arr[i] = i+1;
... | true |
b333d0f3b56dccc34064d37ec6e4f0881c15b8d7 | C++ | simonatsn/fil-blst | /src/util.cpp | UTF-8 | 11,884 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright Supranational LLC
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#include <fstream>
#include <iostream>
#include <cstring>
#include "util.hpp"
#include "fil_blst.h"
static void print_value(unsigned int *value, size_t n, const char* name... | true |
43d731abaf00f6618aaab7c792841a5d8029b5b0 | C++ | uvbs/AnpanMMO | /Server/AnpanMMOServer/Master/ItemMaster.cpp | UTF-8 | 2,032 | 3.03125 | 3 | [] | no_license | #include "stdafx.h"
#include "ItemMaster.h"
#include "MySQL/MySqlConnection.h"
bool ItemMaster::Load(const MySqlConnection &Connection)
{
MySqlQuery Query = Connection.CreateQuery("select * from Item;");
ItemItem BindItem;
s32 Sheet = 0;
char NameBind[128];
Query.BindResultInt(&BindItem.ID);
Query.BindResultStr... | true |
25e17d6e54db81a280642a202dfbc2edee0eec6e | C++ | arafuls/CPP-Casino-Card-Game | /CPP_Casino/CPP_Casino/Build.cpp | UTF-8 | 1,249 | 2.984375 | 3 | [] | no_license | #include "Build.h"
Build::Build()
{
trueSum = NULL;
}
// Function: Append
// Purpose: Set a new build with defined parameters
// Parameters: vector<Card> setOfCards, Card buildCard, string playerNameOwningThisSet, int valueYouAreBuildingTo
// Returns:
void Build::Append(std::vector<Card> &set, ... | true |
07e8b5082b3010b0b90d876361adaa5e6fa583b0 | C++ | luigcapo/capochichiboinali | /src/server/server/CommandsService.cpp | UTF-8 | 4,050 | 2.609375 | 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.
*/
#include "CommandsService.h"
#include "ServiceException.h"
#include <locale>
#include <memory>
#include <string>
using namespace st... | true |
e269f2287d5659552702b0000c7c9cf1638555c7 | C++ | alanalvescorrea/c-- | /ex06.cpp | UTF-8 | 1,015 | 2.90625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
float qtLitros, qtLatas, altura, raio, area=0, custoLatas=0;
printf ("\nPROGRAMA QUE CALCULA O CUSTO PARA PINTAR UM CILINDRO");
printf ("\n");
printf ("\nCusto da Lata de Tinta: R$ 20,00");
... | true |
a3c36c2705e76cc4fb84909bff3223ae69c3210d | C++ | xdsarkar/NetworkLab | /3/3.2/serverlib.cpp | UTF-8 | 2,101 | 2.59375 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<stdarg.h>
#include<inttypes.h>
#include<sys/time.h>
#include<fstream>
#include <ctype.h>
#include "packunpack.h"
uint64_t getMicrotime()
{
struct timeval currentTime;
gettimeofday(¤tTime, NULL);
... | true |
d84aefcd458ab46d4660c704eab43bf6dcc53b5c | C++ | drdavella/cmnt | /src/cpp/cmnt.cpp | UTF-8 | 9,826 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <unistd.h>
#include <error.h>
#include <errno.h>
#include <boost/program_options.hpp>
#include <lister.hpp>
#include <comment.hpp>
#include <comment_editor.hpp>
struct command_args
{
std::string filename;
std::ve... | true |
374760eb7ba6350861d1e08ed1011c10d19f0327 | C++ | TangLin12/OJ_task | /LanQiaoCUP/JiShuanKe/Binary.cpp | UTF-8 | 787 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
string rec[202];
string Open = "sin(";
string Opens = "(";
string Close = ")";
string get_n(int n) {
string ch = "";
vector<char> tmp;
while (n) {
char a = '0' + n % 10;
tmp.push_back(a);
n /= 10;
}
for (int i = tmp.... | true |
46cad0bd7287f767ef890b55566f230fa4255b7f | C++ | badbayard/tp_lif1 | /TP1_EXO8.cpp | UTF-8 | 371 | 3.046875 | 3 | [] | no_license | #include <iostream>
using namespace std ;
int main (void)
{
int a, b, i, j;
cout<<"quelles sont les dimensions du rectangle: longeur ?"<<endl;
cin>>a;
cout<<"la largeur"<<endl;
cin>>b;
for(i=0;i<a;i++){
for(j=0;j<b;j++)
{
cout<<"*";
}
... | true |
092217f0e126f96126fc2d65f62b49b737df034a | C++ | Dylrak/CPSE2 | /v2cpse2-examples-master/opgave_2/wall.cpp | UTF-8 | 426 | 2.828125 | 3 | [] | no_license | #include "wall.hpp"
wall::wall(sf::Vector2f position, sf::Vector2f size, sf::Color color) :
position{ position },
size { size },
color { color },
rectangle ( sf::RectangleShape() )
{
rectangle.setSize(size);
rectangle.setPosition(position);
rectangle.setFillColor(color);
}
void wall::draw(sf::RenderWindow & wi... | true |
cd98cf7df17f60b90d2428f10c33fb25781b9628 | C++ | Girl-Code-It/DS-ALGO-in-Cpp-Submissions | /Santushti/String_Milestone/Hackerearth_Questions/Easy/Count_Enemies.cpp | UTF-8 | 793 | 2.875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
string s;
cin>>s;
int ans = 0, count = 0, flag = 1;
for(int i = 0; i < s.length(); ++i) {
if(s[i] == 'X') {
flag = 0;
}
if(s[i... | true |
333bd171a800f34f85e14d6e87191256e03dcdef | C++ | Stage53/Arduino | /libraries/LC_Screen/textView.h | UTF-8 | 6,109 | 3.296875 | 3 | [] | no_license | #ifndef textView_h
#define textView_h
// A rectangle of "flowing" formatted text. You can delete, insert, append,
// and scroll the text and it'll "do the right thing".
//
// We'll see..
//
// For now we'll just do the Adafruit monospaced stuff. If everything works
// out? Maybe this can be upgraded to deal with fanc... | true |
b3cd29b3c70b3c0c5183e651f1f7b7dd84267de3 | C++ | ccs99301/Object_Oriented | /Fibonacci/fib_c.cpp | UTF-8 | 793 | 2.875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void big_add(int num[3][100])
{
int i;
for(i=0;i<100;i++)
num[2][i]=num[0][i]+num[1][i];
for(i=0;i<99;i++)
{
num[2][i+1]+=num[2][i]/10;
num[2][i]%=10;
}
}
void big_print(int *a)
{
int i=99;
while(a[i]==0)
i--;
for(i;i>=0;i--)
cout << a[i];
cout << endl;... | true |
0a8c43e0ddba96095b8cdebc521868be284c0d07 | C++ | truthspy/LeetCode | /Session1/031_Next_Permutation.cpp | UTF-8 | 1,019 | 3.484375 | 3 | [] | no_license | /**
* from Internet
* Condensed mathematical description:
* Find largest index i such that array[i − 1] < array[i].
* Find largest index j such that j ≥ i and array[j] > array[i − 1].
* Swap array[j] and array[i − 1].
* Reverse the suffix starting at array[i].
*/
class Solution {
public:
void nextPermutation... | true |
1207aa939ef7a6e44d411e109936fd97faca47bb | C++ | yongwhan/uva | /12356.cpp | UTF-8 | 572 | 2.609375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
string eval(int x) {
if(!x) return "*";
stringstream ss; ss<<x;
return ss.str();
}
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n,q;
while(cin>>n>>q&&(n||q)) {
map<int,int> left, right;
for (int i=1; i<=n-1; i++) right[i]=i+1;
for (in... | true |
9da97fffba0079a2a83ac80b4832d77b45caf705 | C++ | hunchoB/assembler | /3lab.cpp | UTF-8 | 2,158 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <random>
#include <ctime>
using namespace std;
extern "C"{
int sum = 0;
const int size = 3;
int tempSize = size;
int multiplierMainDiagonal = size * 4 + 4;
int multiplierSaidDiagonal = size * 4 - 4;
int array[size][size];
};
int main()
{
srand(time(0)... | true |
648c8e7899e9cb86babd163104c14989a4c8d494 | C++ | ddcc/llvm-project | /clang/test/SemaCXX/cxx2b-overloaded-operator.cpp | UTF-8 | 2,058 | 3.515625 | 4 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | // RUN: %clang_cc1 -verify -std=c++2b %s
namespace N {
void empty() {
struct S {
int operator[](); // expected-note{{not viable: requires 0 arguments, but 1 was provided}}
};
S{}[];
S{}[1]; // expected-error {{no viable overloaded operator[] for type 'S'}}
}
void default_var() {
struct S {
constex... | true |
9532bbf03361a13d09b076b6823e1d6c1944e90b | C++ | heturing/Cpp_primer_solution | /ch14/ex14_37.cpp | UTF-8 | 403 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class TestEqual{
public:
TestEqual(int i) : old(i) {}
bool operator()(const int j){
return old == j;
}
private:
int old;
};
int main(){
vector<int> v{1,2,3,4,5,6};
int oldV = 1;
int newV = 10;
replace_if(v.begin(), v.end(... | true |
9db317cb03aa8595cda673c7458bba14145f6a59 | C++ | uwcms/ipmimt | /libs/wisc_mmc_functions.cpp | UTF-8 | 10,950 | 2.546875 | 3 | [] | no_license | #include <stdexcept>
#include "wisc_mmc_functions.h"
#include "../Command.h"
using namespace WiscMMC;
#define U16_DECODE(vec, off) (((vec)[(off)+1]<<8) | (vec)[off])
nonvolatile_area::nonvolatile_area(sysmgr::sysmgr &sysmgr, uint8_t crate, uint8_t fru)
: crate(crate), fru(fru), hw_info_area(this), app_device_info_a... | true |
a866563f6758486f59cd6d67a7502d0461374c83 | C++ | PotterSu/LeetCode | /offer/TreeMirror.cpp | UTF-8 | 1,035 | 3.921875 | 4 | [] | no_license | /*
二叉树的镜像定义:源二叉树
8
/ \
6 10
/ \ / \
5 7 9 11
镜像二叉树
8
/ \
10 6
/ \ / \
11 9 7 5
*/
#include "iostream"
using namespace std;
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), le... | true |
c867544b44031aff85f7ffad23c7eecee27e24e3 | C++ | esraatlici/C | /5 Kasım 02.cpp | ISO-8859-9 | 830 | 2.765625 | 3 | [] | no_license | #include<stdio.h>
#include <stdlib.h>
struct DogumGunu
{
int yil;
int ay;
int gun;
}dogum_gunu,bugun,fark; //struct tipinden global degiskenler
// struct DogumGunu dogum_gunu,bugun,fark; yukardaki gibi olur bu sekilde de tanmlanabililr
int main()
{
printf("Dogum gununuzu GG-AA-YYYY giriniz: ");
... | true |
cc36cb8666a620f8020dcf15ddd508308a8f991c | C++ | JackDavid127/CC | /src/components/KeyValueStorage.h | UTF-8 | 2,184 | 2.828125 | 3 | [] | no_license | //
// KeyValueStorage.h
// SimRunner
//
// Created by Scott on 12/10/2014.
//
//
#pragma once
#include <map>
#include <boost/noncopyable.hpp>
#include "SimRunnerAssert.h"
namespace SimRunner
{
namespace Components
{
template <typename TKey, typename TValue>
class KeyValueStorage : private ... | true |
28f7f93ff9dd2b5923c27d84cd6097bea73fddd5 | C++ | iAndu/university | /Anul 1/LFA/Laborator/General DFA Accepter/main.cpp | UTF-8 | 2,650 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
struct expresion {
int state, jump;
char event;
};
int** create_automata(vector<expresion> vec, unordered_map<char, int> my_hash, int nr_states, int nr_events) {
... | true |
df7f066fc0d653a7d6186ad67cbbaa7e009a9298 | C++ | PatelManav/Codeforces_Backup | /BeautifulYear.cpp | UTF-8 | 470 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll long long
using namespace std;
bool CheckYear(ll y){
ll a = y / 1000;
ll b = y / 100 % 10;
ll c = y / 10 % 10;
ll d = y % 10;
if (a != b && a != c && a != d && b != c && b != d && c != d)
{
return true;
}
return false;
}
int main(){
ll y... | true |
f00b2b7540c74c40ef9e35afeac1ffd04626467c | C++ | SleepyAkubi/Propitious | /Propitious/engine/memory/include/Propitious/Containers/Helpers/Queue.hpp | UTF-8 | 6,018 | 2.859375 | 3 | [] | no_license | #ifndef PROPITIOUS_MEMORY_CONTAINERS_HELPERS_QUEUE_HPP
#define PROPITIOUS_MEMORY_CONTAINERS_HELPERS_QUEUE_HPP
#include <Propitious/Memory/Common.hpp>
#include <Propitious/Containers/Queue.hpp>
namespace Propitious
{
namespace
{
using vol = Allocator::vol;
}
template <typename T>
using RingBuffer = Queue<T>;
... | true |
a35280b763c7f0137d4c4fd5303873fecc11910a | C++ | iamraf/A.T.E.I.TH | /4. Programming Methodologies/Lab 4/lab4_1.cpp | UTF-8 | 673 | 3.375 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int syn(char pc[], char ch, int n)
{
int counter = 0;
for(int i = 0; i < n; i++)
{
if(pc[i] == ch)
{
counter++;
}
}
return counter;
}
int syn2(char *pc, char ch, int n)
{
int counter = 0;
... | true |
3175725f9b2a43528c19413b434b6a38ee15bbba | C++ | kevin-keraudren/CETUS-challenge | /forest/src/Tree.h | UTF-8 | 25,347 | 2.609375 | 3 | [] | no_license | #ifndef __TREE_H__
#define __TREE_H__
// Templated code needs to be in header files.
// http://stackoverflow.com/questions/8395653/c-linker-error-undefined-reference-only-to-one-specific-class-member-defined
// Reason for using a pointer for test_class and params:
// error: non-static reference member can’t use defa... | true |
4f1b9af65b8a55f6c176612f52b76457ad551561 | C++ | jonturner53/grafalgo | /cpp/include/match_egc.h | UTF-8 | 2,110 | 2.890625 | 3 | [] | no_license | /** @file match_egc.h
*
* @author Jon Turner
* @date 2011
* This is open source software licensed under the Apache 2.0 license.
* See http://www.apache.org/licenses/LICENSE-2.0 for details.
*/
#ifndef MATCH_EGC_H
#define MATCH_EGC_H
#include "stdinc.h"
#include "Graph.h"
#include "List.h"
#in... | true |
067a9b6bdd7afc5a57105e95ca4de836eb364591 | C++ | wzw123975/MyJniDeme | /app/src/main/cpp/list_dir_all_file.cpp | UTF-8 | 1,888 | 2.671875 | 3 | [] | no_license | #include <jni.h>
#include <android/log.h>
#include <cstring>
#include <dirent.h>
#include <cstdlib>
#define LOGE(FORMAT, ...) __android_log_print(ANDROID_LOG_ERROR,"JniListDirAllFiles",FORMAT,##__VA_ARGS__);
const int PATH_MAX_LENGTH = 256;
extern "C"
JNIEXPORT void JNICALL
Java_com_wzw_jnilibrary_JniListDirAllFiles_l... | true |
22e8019095f1856a691a65e673d656940b75a91b | C++ | KendrickAng/competitive-programming | /kattis/freefood/freefood.cpp | UTF-8 | 409 | 3.28125 | 3 | [] | no_license | #include <iostream>
int main() {
int n, start, end;
bool hasFood[366] = { 0 };
for (int i = 0; i < n; i++) {
std::cin >> start >> end;
for (int j = start; j <= end; j++) {
hasFood[j] = true;
}
}
int total = 0;
for (auto& b: hasFood) {
if ... | true |
733c1cde2813b7cd0993051c2c803d8ee3384909 | C++ | bluebambu/Leetcode_cpp | /523. Continuous Subarray Sum/523. Continuous Subarray Sum/_template.cpp | GB18030 | 3,208 | 3.40625 | 3 | [] | no_license | // _template.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <vector>
#include <algorithm> // std::for_each
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <un... | true |
7c802eed7685445a5ff44a78d0618ec1aef45a2f | C++ | Thugday/BOJ | /1927.cpp | UTF-8 | 577 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <functional>
#include <queue>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
// priority_queue 가 최대힙을 구하는 성질이기 때문에, 안에 vector<int>와 greater<int>를 넣어주어 최소힙을 구해준다.
priority_queue<int, vector<int>, greater<int>> q;
cin ... | true |
5caaf365358e75b4a6f889a0220e1382d102f8c2 | C++ | Simon-Fuhaoyuan/LeetCode-100DAY-Challenge | /flattenNestedListIterator/main.cpp | UTF-8 | 1,599 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
// This is the interface that allows for creating nested lists.
// You should not implement it, or speculate about its implementation
class NestedInteger {
public:
// Return true if this NestedInteger holds a single integer, rather than a nested list.
... | true |
8345f9f1ce94a7e63239eb44452c3369035bdf46 | C++ | emeryberger/Heap-Layers | /heaps/top/staticheap.h | UTF-8 | 1,221 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | // -*- C++ -*-
/*
Heap Layers: An Extensible Memory Allocation Infrastructure
Copyright (C) 2000-2020 by Emery Berger
http://www.emeryberger.com
emery@cs.umass.edu
Heap Layers is distributed under the terms of the Apache 2.0 license.
You may obtain a copy of the License at
http://www.apache.org/l... | true |
624114216dc9e9ce0c928b0d075e2215e8c63900 | C++ | dishadas168/Project-Euler | /008-LargestProduct.cpp | UTF-8 | 663 | 3.140625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
long largestProduct(string N, int k){
long largest = 0;
long curr =1;
for(int i=0; i < N.length() - k; i++){
curr = 1;
for(int j=i; j< i+k; j++){
curr *= (N[j]-'0')... | true |
38e2970a5da4b91504432ef4231444b8884c2267 | C++ | singhashish-26/Leetcode | /Algorithms/Tree/maximum-binary-tree.cpp | UTF-8 | 1,343 | 3.6875 | 4 | [] | no_license | #https://leetcode.com/problems/maximum-binary-tree/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNod... | true |
bd8b479e92e9744ff70e9e01df7658cfe8b87bbe | C++ | cvora23/CodingInterviewQ | /ArraysAndStrings/include/utility.h | UTF-8 | 466 | 2.890625 | 3 | [] | no_license | /*
* utility.h
*
* Created on: Aug 19, 2014
* Author: cvora
*/
#ifndef UTILITY_H_
#define UTILITY_H_
#include <iostream>
using namespace std;
template <size_t size_x, size_t size_y>
void printMatrix(int (&anArray)[size_x][size_y])
{
for (int nRow = 0; nRow < size_x; nRow++){
for (int nCol =... | true |
34942687f01076b42750033a0040b2f5e0349515 | C++ | uuuy/DataStructure | /searchforsecondmin.cpp | GB18030 | 815 | 4.09375 | 4 | [] | no_license | //еڶС
#include <iostream>
#include <string>
#include <limits.h>
using namespace std;
template <class T>
int getArrayLen(T& array){
//ʹģ嶨һ getArrayLen,úarrayij
return (sizeof(array) / sizeof(array[0]));
}
int secondmin(int array[], int len){
int first = INT_MAX;
int second = INT_MAX;
for(int i = 0; i < le... | true |
5bf46ee9b0d732cd55b27358e0788eb67cfdebae | C++ | treelist/prototype_windows_sound | /prototype/MyEndpointManager.h | UHC | 899 | 2.640625 | 3 | [] | no_license |
#ifndef __MYENDPOINTMANAGER_H_
#define __MYENDPOINTMANAGER_H_
class MyEndpointManager
{
private:
HWND hWnd; // Ŭ ϴ ڵ
IAudioEndpointVolume* pEndpointVolume;
IAudioMeterInformation* pMeterInformation;
float val;
public:
MyEndpointManager(HWND hWnd, CoreAudioInterfaceHelper* helper) : hWnd(hWnd)
{
reset(helpe... | true |
019a2fe781483e389cb91e90dc0dd76bd4f4c10d | C++ | mystardust/LeetCodeSolution | /3Sum.cpp | UTF-8 | 1,226 | 3.046875 | 3 | [] | no_license | #include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> result;
int n = nums.size();
if(n < 3) return result;
sort(nums.begin(), nums.end());
for(int i=0; i<n; ++i)
... | true |
f62789988bedf66e6ed6791a8fa18cee4703b003 | C++ | abhijith0505/Algorithms | /subset.cpp | UTF-8 | 824 | 3.5625 | 4 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int M = 7; //Value of the total sum
int val[6] = {1, 2, 4, 5, 6, 999}; //Given values in increasing order and last one set to a high value
int selected[6] = {0, 0, 0, 0, 0, 0};
void display()
{
for(int i=0; i<6; ++i)
if(selecte... | true |
f8b86886d577e49de82c62493a8e41d842164e9d | C++ | samg31/expressiontree | /expr.cpp | UTF-8 | 9,714 | 3.28125 | 3 | [] | no_license | #include "expr.hpp"
#include <iostream>
#include <cassert>
Expr::~Expr()
{
}
BoolExpr::BoolExpr( int val )
:value( val )
{
}
const Type* BoolExpr::Check( ASTContext& context )
{
return &context.boolTy;
}
void BoolExpr::Accept( Visitor& v )
{
v.visit( this );
}
AndExpr::AndExpr( Expr* lhs, Expr* rhs, ASTContext&... | true |
8860f1d78a6972d4b5037cb95ad363c272ffaeac | C++ | wachtlerlab/iris | /lib/rgb.cc | UTF-8 | 2,905 | 3.125 | 3 | [] | no_license | #include "rgb.h"
#include <algorithm>
#include <utility>
#include <iomanip>
#include <cmath>
#include <cfloat>
namespace iris {
std::tuple<int, int, int> rgb::as_int(float base) const {
int a[3];
std::transform(cbegin(), cend(), a, [base](const float v){
return static_cast<int>(v * base);
});
... | true |
2461aa8b928ad540985aab72943cc350e5382b4d | C++ | UsterNes/PowerVoice | /CommonClass/MyCursorManager.cpp | UTF-8 | 1,828 | 2.609375 | 3 | [] | no_license | // MyCursorManager.cpp: implementation of the CMyCursorManager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyCursorManager.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////... | true |
77016a0fbe9399a57d194a613fa64ce79ebb1d0a | C++ | SOWMYA0604/sowmya | /PPS/problem11.cpp | UTF-8 | 230 | 2.703125 | 3 | [] | no_license | #include<math.h>
#include<stdio.h>
int main()
{
int x1,y1,x2,y2,d,D;
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
d=(y2-y1)*(y2-y1)+(x2-x1)*(x2-x1);
D=sqrt(d);
printf("the distance between two points is %d",D);
}
| true |
05fca569699d20ae672ddc4217adbdca650ac7d2 | C++ | mjoshi07/ROS-projects | /src/turtleSim/rotate.cpp | UTF-8 | 1,260 | 3.421875 | 3 | [] | no_license | #include "Motion.h"
int main(int argc, char** argv)
{
// initiate a new ROS node named "turtleBot_rotate"
ros::init(argc, argv, "turtleBot_rotate");
// create a new node handle
ros::NodeHandle n;
// create variables to store the values
double angularSpeedInDegrees;
double relativeAngleInDegrees;
bool isClo... | true |
40129b0dc7aa3e537860c5138cab596bc9fa1e9f | C++ | jjzhang166/WinNT5_src_20201004 | /NT/inetsrv/iis/svcs/cmp/aspcmp/shared/inc/rdwrt.h | UTF-8 | 979 | 2.546875 | 3 | [] | no_license | // RdWrt.h
#pragma once
#ifndef _READWRITE_H_
#define _READWRITE_H_
// this class handles a single-writer, multi-reader threading model
class CReadWrite
{
public:
CReadWrite();
~CReadWrite();
void EnterReader();
void ExitReader();
void EnterWriter();
... | true |
105caefe6e2e285a052cf5eadc8313c8ca66f3aa | C++ | xeon2007/Reliable-UDP | /src/net/connection.cpp | UTF-8 | 4,579 | 2.734375 | 3 | [] | no_license | #include "net/connection.h"
uint8_t Connection::s_buffer_send[MAX_HEADER_SIZE + MAX_DATA_SIZE];
uint8_t Connection::s_buffer_recv[MAX_HEADER_SIZE + MAX_DATA_SIZE];
Connection::Connection()
{
m_running = false;
m_connected = false;
m_socket = Socket();
packet_loss = 0;
}
Connection::~Connection()
{
if(m_running... | true |
594ae4e5534b562a836d2b282c847a26a5c73a9e | C++ | xuancanhit99/vs-big-repo | /Class-Constructor-Destructor/Nhap/PhanSo.cpp | UTF-8 | 980 | 2.5625 | 3 | [] | no_license | #include "PhanSo.h"
void PhanSo::Nhap() {
cout << "\n Nhap tu so: ";
cin >> TuSo;
cout << "\n Nhap mau so: ";
cin >> MauSo;
}
void PhanSo::Xuat() {
cout << TuSo << "/" << MauSo;
}
PhanSo::PhanSo(){}
PhanSo::~PhanSo() {}
PhanSo PhanSo::Cong(PhanSo ps) {
//tra ve phan so
PhanSo KQ;
KQ.TuSo = this->TuSo * ps.Ma... | true |
619cac0e0d51f186e7130e957b67262494ebc1ed | C++ | egg0315/LeetCode | /200-199/286.walls-and-gates.cpp | UTF-8 | 1,984 | 3.171875 | 3 | [] | no_license | /*
* @lc app=leetcode id=286 lang=cpp
*
* [286] Walls and Gates
*
* https://leetcode.com/problems/walls-and-gates/description/
*
* algorithms
* Medium (50.47%)
* Likes: 721
* Dislikes: 10
* Total Accepted: 85.2K
* Total Submissions: 168.5K
* Testcase Example:
* '[[2147483647,-1,0,2147483647],[214748... | true |
84fd109c0dbd253d23e6fbbbee2cc08973afe4ce | C++ | southwestCat/rUNSWift-2019-release | /robot/types/IndexSorter.hpp | UTF-8 | 824 | 3.515625 | 4 | [
"BSD-2-Clause"
] | permissive | #pragma once
/*
Struct to allow creation of a vector of sorted indexes.
Use as std::sort(indexVec.begin(), indexVec.end(), IndexCompare(dataVec)).
indexVec should be sorted vector of the indexes from 0 to dataVec.size()-1.
dataVec is the vector for which you want the sorted indexes.
Credit:
https://stackoverflow.com/q... | true |
641006e09d461927780d4bff56e2d626785968f4 | C++ | DesperateProgrammer/luyten | /source/tlv.cpp | UTF-8 | 3,330 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "tlv.h"
CTLV::CTLV(uint32_t tag)
{
m_tag = tag ;
if (tag & TAG_FLAG_RECURSIVE)
{
m_childs.clear();
} else
{
m_leaf = "";
}
}
CTLV::CTLV(std::string serializedTLV)
{
m_tag = 0 ;
uint32_t length = 0 ;
if (serializedTLV.length() < 4)
{
m_tag = 0 ;
m_leaf = "";
return ;
... | true |
f1d521ca1334e55b0596b045c8c8a66d835090ba | C++ | kevinehling/oos1lab | /Hausaufgaben/Hausaufgabe_3/A5/Fahrzeug.cpp | UTF-8 | 392 | 2.8125 | 3 | [] | no_license | #include <iomanip>
#include "Fahrzeug.hpp"
Fahrzeug::Fahrzeug(const char* kz): kz(kz), vin(++zaehler), km(0.0) {};
void Fahrzeug::fahren(double km) {
this->km += km;
}
std::ostream& operator<<(std::ostream &stream, const Fahrzeug &fahrzeug) {
return stream << "kz = " << fahrzeug.kz
<< " VIN = " << fahrzeug.vin... | true |
0dc73903ac4ce2cf39b49295062150ea61473e3f | C++ | tanmaniac/CTCI-Modern-CPP | /include/arrays-and-strings/OneAway.h | UTF-8 | 1,735 | 3.984375 | 4 | [] | no_license | #pragma once
#include <cmath>
#include <string>
namespace strings {
/**
* \brief There are three types of edits that can be performed on strings: insert a character,
* remove a character, or replace a character. Given two strings, write a function to check if they
* are one edit (or zero edits) away.
*
* \param ... | true |
aedd8c0148e55df2b874b8f2743c2719fc1d9f8f | C++ | maximmenshikov/eq_codegen | /include/ConstructorData.hpp | UTF-8 | 1,370 | 3.15625 | 3 | [
"MIT"
] | permissive | /*
* Code generator for Equid project
* (C) Maxim Menshikov 2019-2020
*/
#pragma once
#include <map>
#include <string>
#include <vector>
class ConstructorData
{
public:
ConstructorData() = default;
virtual ~ConstructorData() = default;
ConstructorData(const ConstructorData &rhs) = default;
Construct... | true |
27190f4144dd984827d78d32d65395500258cd4a | C++ | Babelz/EUS | /EUS/View.cpp | UTF-8 | 478 | 3.140625 | 3 | [] | no_license | #include "View.h"
View::View() : x(0.f), y(0.f) {
}
#pragma region Public members
float View::getX() const {
return x;
}
float View::getY() const{
return y;
}
void View::setX(float x) {
this->x = x;
}
void View::setY(float y) {
this->y = y;
}
float View::getRotX() const {
return rotX;
}
float View::getRotY() c... | true |
f73a1b5a9dc10dccac957df60fae375294a07a9d | C++ | carl2019/OJ | /day01.cpp | GB18030 | 1,815 | 3.703125 | 4 | [] | no_license | //ַӵһַɾڶַеַ
//磬롱They are students.͡aeiouɾ֮ĵһַɡThy r stdnts.
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s1, s2;
getline(cin, s1);
getline(cin, s2);
for (auto i = s1.begin(); i != s1.end(); ++i)
{
auto tmp = find(s2.cbegin(), s2.cend(), *i);
if (tmp != s... | true |
c7364c15138791d04693f1f7658f992a5b7c62b4 | C++ | mrudzik/AbstractVM | /sources/parser/LexerModule.cpp | UTF-8 | 2,304 | 2.984375 | 3 | [] | no_license |
#include "LexerModule.hpp"
LexerModule::LexerModule(/* args */)
{
}
LexerModule::~LexerModule()
{
}
void LexerModule::ShowScannedData(const std::vector<s_LexerLine> &lines)
{
std::cout << "\x1b[32m" << "Lexer Scanned Data\n" << "\x1b[0m" << std::endl;
for (int i = 0; i < (int)lines.size(); i++)
{
// Line
st... | true |
5d028817daa8bef8ab938ad6f7f2e3141e2e3ce9 | C++ | parvez843/Academic-Course | /3rd semester/C++/Assignment/Solution/program_24_jewel.cpp | UTF-8 | 662 | 3.625 | 4 | [] | no_license | //Write a program to pass array of values to a functions.
#include<iostream>
#include<vector>
using namespace std;
void ID()
{
cout<< "Jewel Nath" <<endl;
cout<< "ID - 11909037" <<endl;
cout<< "Program - 24" <<endl<<endl;
}
void Display(vector<int>v)
{
cout<<"This array is -- "<<endl;
... | true |
c3601793684cf704173e6db60927e0fed9f3828b | C++ | bg1bgst333/Sample | /designpattern/mvc/mvc/src/mvc/custom_controller.cpp | UTF-8 | 1,685 | 2.8125 | 3 | [
"MIT"
] | permissive | // 既定のヘッダ
#include <iostream> // C++標準入出力
// 独自のヘッダ
#include "custom_controller.h" // class_custom_controller
// メンバの定義
// メンバ関数changed
void class_custom_controller::changed(){
// changedが呼ばれた.
std::cout << "class_custom_controller::changed()" << std::endl; // "class_custom_controller::changed()"と出力.
// custom... | true |
0ea0b9ce4fe5e56fcd4c2a879340bd706b5dd868 | C++ | dusk0825/DTK | /src/DTK/DTK_String.cpp | UTF-8 | 784 | 3.109375 | 3 | [] | no_license |
#include "DTK_String.h"
#include <ctype.h>
DTK_DECLARE DTK_INT32 CALLBACK DTK_Strcasecmp(const char* s1, const char* s2)
{
while(toupper((unsigned char)*s1) == toupper((unsigned char)*s2))
{
if(*s1 == '\0')
{
return 0;
}
s1++;
s2++;
}
return touppe... | true |
6961974ee905092d98de0c76793dbad66a3b9870 | C++ | emilianbold/netbeans-releases | /cnd.completion/test/unit/data/org/netbeans/modules/cnd/completion/TooltipTestCase/file.cpp | UTF-8 | 167 | 2.5625 | 3 | [] | no_license | int foo(int k) {
return 2;
}
int bar() {
return 1;
}
void zoo(int i, int j) {
}
int main() {
zoo(foo(1), bar());
zoo(foo(1), ((1)));
return 0;
} | true |
bb0afe18029f76dff53a6aeed772e896f8e2efd5 | C++ | ssyze/Codes | /Codeforces/674/E.cpp | UTF-8 | 2,152 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n, mn = 0x3f3f3f3f;
vector<int> a, b;
void dfs(int pos, vector<int> a, vector<int> b)
{
if (pos == 7) {
mn = min(mn, min(a[1], b[2]) + min(a[2], b[3]) + min(a[3], b[1]));
return;
}
if (pos == 1 || pos == 4) {
vector<int> c = a, d = b;... | true |
3af71a4a41e0ac022e4fafc4e10a5b3ba8e35ad0 | C++ | Imran4424/LeetCode-Solutions | /DynamicProgramming/Medium/152.MaximumProductSubarray_BU_3.cpp | UTF-8 | 720 | 3.296875 | 3 | [] | no_license |
class Solution {
public:
int maxProduct(vector<int>& nums) {
if (nums.size() == 0) {
return 0;
}
if (nums.size() == 1) {
return nums[0];
}
int minVal = nums[0];
int maxVal = nums[0];
int maxP = nums[0];
for (int i = 1; i < nums.size(); ++i) {
vector <int> current;
cu... | true |
e82f03a9b0a8447a0caa40705f4f4bca2caa0728 | C++ | guyongpu/SwordOffer | /src/P20_Stack_FuncMin.cpp | UTF-8 | 1,393 | 3.71875 | 4 | [] | no_license | //
// Created by yongpu on 2019/9/13.
//
#include "P20_Stack_FuncMin.h"
/*
* 题目:包含min函数的栈
* 描述:实现一个能够得到栈中所含最小元素的min函数
* 思路:本题目需要使用两个栈,数据栈和辅助栈。
* 数据栈存放正常的数据,辅助栈存放当前情况下最小的元素,
* 辅助栈两种方式,方式1是可以只在压栈元素比栈顶元素小或等于才入栈,出栈则与辅助栈顶元素相等才出栈
* 方式2是可以采用当压栈元素比栈顶元素大,压入相同栈顶元素的方式,出栈则直接出栈;
* 方式1方便,但是空间开销会大一些,而方式2则空间开销小一些。
*/
void P... | true |
76b0f12b4e2e2802cdffe7affcce6c4727fe6320 | C++ | Drakon0168/OpenGL | /LearningOpenGL/LearningOpenGL/Point3D.h | UTF-8 | 3,271 | 3.671875 | 4 | [] | no_license | #pragma once
#include "pch.h"
struct Point3D
{
public:
float x;
float y;
float z;
bool direction;
Point3D();
Point3D(float x, float y, float z);
Point3D(float x, float y, float z, bool direction);
Point3D(const Point3D& other);
~Point3D();
//Assignment operators
void operator=(const Point3D& other);
Poi... | true |
dfa5bc41dd4e4d9560ab828e9132ad4427a3aff8 | C++ | yurychu/cpp_coding | /21/03/experiments.cpp | UTF-8 | 278 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int num_int_float = 4.549;
cout << "cut information " << num_int_float << endl;
unsigned short int uns = 65500;
short int nouns = uns;
cout << "unsigned with sing = " << nouns << endl;
return 0;
}
| true |
cdc5ce533d7021dc609f99497f105d62fb730a1a | C++ | Rishi-T2408/Data-structures-and-Algorithm | /Balancing parenthesis in an equation.cpp | UTF-8 | 2,003 | 4 | 4 | [] | no_license |
#include <iostream>
#include <string.h>
using namespace std;
struct Stack
{
int top;
int size;
int* S; //This will create an array which will work same as stack
}st;
void Create(Stack *st)
{
cout << "Please enter the size of the stack" << endl;
int sz;
cin >> sz;
st->size=sz;
st->top = -1; //Intially stack is... | true |
fd24dcd583302bfc99d4d2c6a4332e18e30be223 | C++ | DaDaMrX/ACM | /Code/Fast Power/HDU 5667 Sequence (矩阵快速幂).cpp | UTF-8 | 1,448 | 3.359375 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
struct Matrix
{
long long m[3][3];
Matrix() {};
Matrix(long long a, long long b, long long c, long long d, long long e, long long f, long long g, long long h, long long i)
{
m[0][0] = a; m[0][1] = b; m[0][2] = c;
m[1][0] = d; m[1][1] = e; m[1][2] = f;
m[2][0] = g; m[2][1]... | true |
57430d1e7c0cf3163208ef8a45c202b847178896 | C++ | Antoniojr144/Exercicios | /Chapter2/Exercicio2.2.cpp | UTF-8 | 946 | 2.96875 | 3 | [] | no_license | /**
** \ingroup Exercicios/Chapter2
**
** \brief Exercicio 2.2
**
** Solução do exercicio 2 do capitulo 2 do livro "Guide
** to Scientific Computing in C++", de J. Pitt-Francios e J. Whiteley,
** segunda edição;
**
** \author Antonio Francisco Jr. (UEL)
**
** \version 0.1
**
** \date 28/02/2020
**
** contact: antoni... | true |
6bf1289a04bf44970d17a2099152bbd25b7b8442 | C++ | sangwonparkk/accounting-system | /fromtoFile.cpp | UTF-8 | 2,865 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include "stdInterface.h"
#include "fromtoFile.h"
using namespace std;
// Function: readFromFile: reads records data from data.txt, and updates dynamic array records
// Inputs: reference to dynamic array records, reference to... | true |
87b7a84af7cbfcf5d564d9253ff09d3f54a672ef | C++ | kang-jisu/algorithm | /baekjoon/9월/삼성/14503_로봇청소기.cpp | UTF-8 | 1,386 | 2.9375 | 3 | [] | no_license | #include <iostream>
using namespace std;
// 입력받는 d와 dx 방향 왼쪽으로 회전하는 순서가 달라서 틀렸음
int A[51][51];
int V[51][51];
int cleannum = 0;
int n, m;
int cnt = 0;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int bx[] = {1, 0, -1, 0};
int by[] = {0, 1, 0, -1};
int dd[] = {0, 3, 2, 1};
void clean(int r, int c, int d)
{
... | true |
c9f8f0032d3c3183605d59372a1301b1eb95479e | C++ | yuki252111/leetcode | /codeforce/Codeforces Round 432/Codeforces Round 432/B. Arpa and an exam about geometry.cpp | UTF-8 | 525 | 2.625 | 3 | [] | no_license | //#include <iostream>
//#include <algorithm>
//using namespace std;
//typedef long long ll;
//ll ax, ay, bx, by, cx, cy;
//
//int main() {
// cin >> ax >> ay >> bx >> by >> cx >> cy;
// ll d1 = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
// ll d2 = (bx - cx) * (bx - cx) + (by - cy) * (by - cy);
// ll n1x = cx - bx, ... | true |
fe825636d3e5c5de7f637a6e867521c20f500c76 | C++ | 498888197/OpenGL | /Chapter3/TriangleCulling/TriangleCulling/main.cpp | UTF-8 | 3,219 | 2.796875 | 3 | [] | no_license | //
// main.cpp
// TriangleCulling
//
// Created by 关峰 on 15/1/18.
//
//
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#include <math.h>
#define GL_PI 3.14
static GLfloat xRot = 0;
static GLfloat yRot = 0;
int iCull = 0;
int iOutline = 0;
int iDepth = 0;
void ProcessMenu(int value)
{
switch (value) {
... | true |
7b4efc810d322f39fa1c51e01b35148305292e7f | C++ | zhengchq3/pat_advanced | /1027/1027.cpp | UTF-8 | 416 | 3.109375 | 3 | [] | no_license | #include <iostream>
using namespace std;
char mars[13] = { '0','1','2','3','4','5','6','7','8','9','A','B','C' };
int main()
{
int red, green, blue;
cin >> red >> green >> blue;
cout << "#";
int n1, n2;
n1 = red / 13;
n2 = red % 13;
cout << mars[n1] << mars[n2];
n1 = green / 13;
n2 = green % 13;
cout << mar... | true |
3905852a797421ee2bda6683152b7204d0d8ce9f | C++ | jcayzac/random-stuff | /__algorithms__/Levenstein-distance.cpp | UTF-8 | 7,018 | 3.546875 | 4 | [] | no_license | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <iterator>
// For any two strings of length n and m, respectively (disregarding any
// common prefix or suffix), the following algorithm:
// - Uses an internal buffer of 2+2*max(n,m) integers
// - Evaluates n*m cos... | true |
7db79af1544d87b4491a57a38e78607bbecb41a7 | C++ | dchansen/gt-tomography | /registration/register_Demons_4d.cpp | UTF-8 | 3,531 | 2.515625 | 3 | [
"MIT"
] | permissive | //
// Created by dch on 06/06/16.
//
#include "cuDemonsSolver.h"
#include <boost/program_options.hpp>
#include <string>
#include <iostream>
#include <hoCuNDArray.h>
#include "hoNDArray_fileio.h"
#include <cuLinearResampleOperator.h>
#include <boost/make_shared.hpp>
namespace po = boost::program_options;
using namespa... | true |
8bfbee742aca94861aaed04aac48a4c337254d59 | C++ | Worstcase256/Alex-Zagoskin | /Exam.cpp | UTF-8 | 10,113 | 3.15625 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include<string>
#include<list>
#include<vector>
using namespace std;
class AdressInfo
{
protected:
string City;
string Street;
int HouseNum;
int OfficeNum;
public:
AdressInfo()
{
this->City = "Kharkov";
this->Street = "Haribaldi";
this->HouseNum = 5... | true |
92b9ec73673f908bff08e518ed1e6b94c116e0c8 | C++ | turanbulutt/SecondClassAssignments | /HospitalManagementSystem/assignment2/Doctor.h | UTF-8 | 365 | 2.53125 | 3 | [] | no_license | #include"Employee.h"
enum DoctorTypes { UnknownDoctor,Intern, Practitioner, Assistant, Specialist, Docent, Professor };
class Doctor : public Employee
{
private:
DoctorTypes Doctortype;
public:
Doctor();
Doctor(int, char*, char*, int, char*, char*, int, DoctorTypes);
void SetDoctorType();
void SetDoctorType2()... | true |
5ab1c024401dd425cb8c903ecdde7ec10b448891 | C++ | bszek213/ZoomClassAttendance | /stringContainer.h | UTF-8 | 5,177 | 3.5 | 4 | [] | no_license | #ifndef STRINGCONAINTER_H
#define STRINGCONAINTER_H
#include <stdexcept>
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
using namespace std;
namespace fs = std::filesystem;
class stringContainer
{
public:
stringContainer(int maxNumber);
~stringContainer();
//void push_back(c... | true |
f54921359efb0473756943a015027e57e77f03c7 | C++ | marselaminov/CPP | /Day05/ex03/main.cpp | UTF-8 | 4,265 | 3.53125 | 4 | [] | no_license | #include "ShrubberyCreationForm.hpp"
#include "RobotomyRequestForm.hpp"
#include "PresidentialPardonForm.hpp"
#include "Intern.hpp"
int main() {
std::cout << MAGENTA"Creating bureaucrat objects..."RESET << std::endl;
Bureaucrat first("Jim", 139);
Bureaucrat second("Jon", 40);
Bureaucrat third("Eminem", 1);
std::c... | true |
1ffdbff8dcc3bc0aa60336088d0d9d889c58f1a4 | C++ | TomSievers/EVD_Proj | /application/Detector/include/IDetector.hpp | UTF-8 | 1,705 | 2.875 | 3 | [] | no_license | #ifndef IDETECTOR_HPP
#define IDETECTOR_HPP
#include <memory>
#include <map>
#include <include/Acquisition.hpp>
namespace Detector
{
struct Line
{
double a, b, c;
Line(){};
Line(double a, double b, double c) :
a(a), b(b), c(c)
{};
~Line(){};
};
struct Obje... | true |
851e664998ce95c04c8b44036dd55c7507da9cfb | C++ | maornelas/coj-problems | /1140/the-next-palindrome.cpp | UTF-8 | 2,770 | 2.90625 | 3 | [] | no_license | #define EPS 1e-11
#define inf ( 1LL << 31 ) - 1
#define LL long long
#define abs(x) (((x)< 0) ? (-(x)) : (x))
#define all(x) (x).begin(), (x).end()
#define ms(x, a) memset((x), (a), sizeof(x))
#define mp make_pair
#define pb push_back
#define sz(k) (int)(k).size()
using namespace std;
typedef vector <int> vi;
bool... | true |
51d736ad6c204029ed2a9d5b85bc8896dc704ff1 | C++ | Cyanide-IT/Solar-Tracker | /finalArduinoCode.cc | UTF-8 | 2,099 | 2.953125 | 3 | [] | no_license | #include<Servo.h>
Servo pan, tilt;
const int ldr1 = 0;
const int ldr2 = 1;
const int ldr3 = 2;
const int ldr4 = 3;
double bright1, bright2, bright3, bright4;
double left, right, top, bottom;
int panDesired, tiltDesired;
int panCur, tiltCur;
int lAdj, rAdj;
void setup()
{
Serial.begin(9600);
... | true |
5947235c2f226f10f0c3483241de15b4b532083e | C++ | denishong/gongbu | /algorithm/baekjoon/greedy/11399-1.cpp | UTF-8 | 345 | 2.640625 | 3 | [] | no_license | /* baekjoon 11399 ATM */
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N;
int A[1001];
int sum=0, ans =0;
cin >> N;
for( int i =0; i < N; i++){
cin >> A[i];
}
sort( A, A+N );
for( int i =0; i< N; i++ ){
sum += A[i];
ans += sum;
}
cout << ans << endl;
return 0;
}
... | true |