uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
91908808-4bd3-4e3a-9798-b712fde4b99e | GoatGirl98/Walkthrough-of-ACCoding-in-BUAA | 2016级-软件学院-C++程序设计/C12-2016级C++期末上机模拟赛/BUAAOJ657 模拟 搜索剪枝.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 15
using namespace std;
int x, y, z;
int m, n;
struct Hero {
int cost;
int atk;
Hero(int _c = 0, int _a = 0) {
cost = _c, atk = _a;
}
};
bool cmpCost(Hero a, Hero b) {
return a.cost < b.cost;
}
bool cmpAtk(Hero a, Hero b) {
return a.atk > b.at... | ALGO | 0.999646 | 3.512691 |
b362c6f1-816c-4845-ac06-07595ebd311c | Deepanshu-Sharma-18/leethub | 441-arranging-coins/441-arranging-coins.cpp | class Solution {
public:
int arrangeCoins(int n) {
int c=0;
for(int i=1;i<=n ; i++){
n-=i;
if(n >= 0){
c++;
}
}
return c;
}
}; | ALGO | 0.999924 | 6.462443 |
becf5f0d-6b34-4566-a26b-35c48145bfac | NovaWilliamClark/InventorySort | InventorySort/Source/Core/InventorySystem.cpp | #include "InventorySystem.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// InventorySystem constructor
InventorySystem::InventorySy... | TOOL | 0.978361 | 6.22415 |
5658a98d-e784-4469-94b1-c3f40ab18030 | superjax/matrix_comparison | lib/Eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.97492 | 6.666052 |
66075c54-866b-4171-882d-6cffc1327613 | Anannaya-Sikder/XPSC-problem-solving | 23 february/legs.cpp | #include <bits/stdc++.h>
using namespace std;
#define long long
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cout << (n + 3) / 4 << endl;
}
return 0;
}
//https://vjudge.net/contest/691642#probl... | ALGO | 0.999852 | 4.055294 |
2b32a62c-c177-413a-9441-a4dc9a8956d1 | Gani-23/Flutter-Dicegame | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.99887 | 6.783439 |
2340a00f-55e7-4c35-8f6e-8fc5f0967c69 | AnusreeK-2000/ADA_1BM18CS017 | linear.cpp | /* Implement Recursive Binary search and Linear search and determine the time required to search an element. Repeat the experiment for different values of N and plot a graph of the time taken versus N. */
#include<iostream>
#include<chrono>
using namespace std::chrono;
using namespace std;
int linear(int a[], int ind... | ALGO | 0.999668 | 5.661276 |
33268443-2779-44d2-adcc-7506b9d375cd | Kaileshwaran13/CodeChef | 500 - 1000 difficulty rating/Id and Ship.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
char ch;
cin >> ch;
switch (ch) {
case 'B':
case 'b':
cout << "BattleShip\n";
break;
case 'C':
case 'c':
... | ALGO | 0.994392 | 3.546744 |
109f29a0-6ee9-4aed-a8a2-1cdce4c28613 | Vivashwan/LeetCodes | 621-task-scheduler/task-scheduler.cpp | class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
unordered_map<int, int>mp;
for(auto it: tasks)
{
mp[it]++;
}
priority_queue<int>pq;
for(auto it:mp)
{
pq.push(it.second);
}
int time=0;... | ALGO | 0.999992 | 6.517176 |
a26fcfa2-402f-4475-8f65-7cfe89df2a00 | analgorithmaday/analgorithmaday.github.io | code/cpp/RemoveUniqueInPlace.cpp | void removeUnique(char*& str)
{
int checker=0;
char* istr = str;
char* ehead = NULL;
while(*str != '\0')
{
int val = *str;
while(*str != '\0' && (checker & 1 << val))
{
if(ehead == NULL)
ehead = str;
// while there are duplicates
*str='\0';
str++;
val = *str;
}
if(*str == '\0') break;
checker |= 1<<val;
if(ehead != NUL... | ALGO | 0.996956 | 4.006245 |
0496063b-2fe1-4a8d-84cf-32a793c2cb94 | Artlesbol/Cpp-practice-on-CGplatform | tasks of the 7th week/7-5.cpp | #include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
int num;
cin>>num;
while(num)
{
cout<<num%10;
num/=10;
}
return 0;
} | ALGO | 0.999793 | 3.67754 |
ac6397d1-7ee1-4e00-bec7-61aad64c4217 | Eaglebrave/the-C-repository | 幂次方表示法.cpp | #include <bits/stdc++.h>
using namespace std;
int x,a[32];
void npow(int n){
for(int i=x;i>=0;--i){
if(a[i]<=n){
n=n-a[i];
if(i>1){
cout<<"2(";
npow(i);
cout<<")";
}
if(i==1)cout<<"2";
if(i==0)cout<<"2(0)";
if(n!=0)cout<<"+";}}
}
int main()
{int n;
cin>>n;
a[0]=1;
while(a[x]<n){
x++;
... | ALGO | 0.999816 | 3.61341 |
e30e16b1-2b1a-4387-a928-f5808f135ad3 | Jae-Hyuk-Jang/baekjoon-source-code | Tree/4256/main.cpp | #include<bits/stdc++.h>
#define MX 1001
using namespace std;
int N;
int preorder[MX], inorder[MX], pos[MX];
void postorder(int pLo, int pHi, int iLo, int iHi) {
if (pLo > pHi) return;
int root = preorder[pLo];
int lSize = pos[root] - iLo;
postorder(pLo + 1, pLo + lSize, iLo, pos[root] - 1);
postorder(pLo + lSi... | ALGO | 0.999948 | 4.79853 |
602b4749-a32b-410f-b6e3-fd250282752c | rootial/acm | codechef/June Challenge 2015/CBARG.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define esp 1e-12
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define sz(x) ((int)((x).size()))
#define pf(x) ((x)*(x))
#define pb push_back
#define pi acos(-1.0)
#define in freopen("F:\\code\\data\\solve_in.txt", "r", stdin);
#define out ... | ALGO | 0.999053 | 3.259249 |
12ba4372-aff1-486f-941a-81a82abf818e | MartinKroe/AliRoot | TEvtGen/EvtGen/EvtGenModels/EvtSVSNONCPEIGEN.cpp | EvtSVSNONCPEIGEN::~EvtSVSNONCPEIGEN() {}
std::string EvtSVSNONCPEIGEN::getName(){
return "SVS_NONCPEIGEN";
}
EvtDecayBase* EvtSVSNONCPEIGEN::clone(){
return new EvtSVSNONCPEIGEN;
}
void EvtSVSNONCPEIGEN::init(){
// check that there are 11 arguments
checkNArg(11,7);
checkNDaug(2);
checkSpinDaug... | TOOL | 0.989838 | 4.605897 |
6a37c35c-d8ab-483d-bd2d-81eaba9f892c | hieupham1103/TINHOC | ONLINE OJ/CODEFORCES/Contest kho dam/CF ROUND/DIV 3/Codeforces Round 579/F2.cpp | #include"bits/stdc++.h"
#define int long long
//#define double long double
#define ii pair <int,int>
#define fi first
#define se second
#define endl '\n'
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
int dp[110][60010];
bool cmp(ii a, ii b){
return a.fi + a.se > b.fi ... | ALGO | 0.999897 | 4.428161 |
434cf789-c637-45a1-83f2-ef1798258452 | deepak-ganwani/CSES-Problem-Set | 6. Tree Algorithms/PathQueries.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int N=2e5;
class SegmentTree{
public:
vector<int> seg;
SegmentTree(int n) {
seg.resize(4*n+1);
}
void build(int ind, int low, int high, vector<int> &arr)
{
if (low==high) {
seg... | ALGO | 0.999917 | 4.8037 |
2f5bd93c-d46e-49fd-acb7-9bac2322e6f9 | EtherTyper/cloth-encounters | deps/libigl/tests/include/igl/AABB.cpp | #include <test_common.h>
#include <igl/AABB.h>
#include <igl/EPS.h>
#include <igl/avg_edge_length.h>
#include <igl/barycenter.h>
#include <igl/colon.h>
#include <igl/get_seconds.h>
#include <igl/point_mesh_squared_distance.h>
#include <igl/point_simplex_squared_distance.h>
#include <igl/randperm.h>
#include <igl/read_t... | TEST | 0.983064 | 7.790315 |
551a6bd9-de50-48d6-8766-727382e78277 | RoboTrainerAID/robotrainer_control | robotrainer_controllers/src/drive_modes/ackermann.cpp | /*
Beware: This implementation only works for virtual axes parallel to the y-axis,
centered on the x-axis.
*/
#include "drive_modes/ackermann.h"
#include <cmath>
void AckermannMode::set_axle(double x, double y, double a) {
// Contrary to DifferentialMode, AckermannMode needs to keep track of the
// axle defi... | ALGO | 0.995109 | 6.296219 |
d9dea9a8-08e7-4637-a9bf-506dfae46b2e | AlexandruTarau/Drone-Minigames | gfx-framework-master/src/lab_m1/Tema2/House.cpp | #include "lab_m1/Tema2/House.h"
#include <iostream>
House::House(
glm::vec3 position,
glm::vec3 scale,
glm::vec3 rotation,
float ownAreaRadius,
float height,
float width,
float depth,
float roofHeight
) {
this->position = position;
this->scale = scale;
this->rotation = rotation;
this->ownAreaRadius = ownAr... | TOOL | 0.966969 | 5.989632 |
67a3f07a-79df-47a3-85c4-61e1621b3f20 | rmccormick314/Projects | Perfect Numbers/3perfectNums.cpp | #include <iostream>
#include <cctype>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <immintrin.h>
#include "omp.h"
using namespace std;
long long int n = 2;//pow(10, 1500);
long long int i = 1;
long long int sum = 0;
bool found = 0;
const int CHUNK = 16;
const int NB_THREADS = 8;
int main()
{
... | ALGO | 0.99896 | 3.943569 |
c414cdcb-cfdd-4823-9a01-bb5420c92db3 | Jaanvi/leetcode | 3455-minimum-length-of-string-after-operations/3455-minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s)
{
int size=s.length();
map<char,int>m;
for(int i=0;i<size;i++)
{
m[s[i]]++;
}
int count=0;
for(auto it=m.begin();it!=m.end();it++)
{
if(it->second<3)
{
... | ALGO | 0.999962 | 5.81693 |
e861bb98-80e3-4add-a11b-8b2ee8d3b364 | ishandutta2007/codeforces | isonan/normal/1588/F.cpp | #include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
int n,p[200001],que[200001][3],q;
int P[200001];
long long a[200001];
int bel[200001],st[200001],end[200001],top;
const int B=450;
int siz[B<<2][B<<2|1];
long long V[B<<2|1];
bool vis[200001],in[200001],qd[200001];
std::pair<i... | ALGO | 0.999817 | 3.104419 |
bd20ad42-936b-4bed-838a-6df2c9d77b5c | Shifa617/C-program- | last digit 30_1_25.cpp | #include <stdio.h>
int main()
{
int n, last_digit;
printf("Enter a number: ");
scanf("%d", &n);
last_digit = n % 10;
printf("Last digit of the number = %d\n", last_digit);
return 0;
}
| TOOL | 0.906003 | 3.986202 |
c3793fe6-8a91-4688-92aa-8d166185092c | Sardhendu/self-driving-vehicle | src/path_planning/src/Eigen-3.3/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.99445 | 3.396939 |
bc9be89f-feea-495a-81bb-3cddac788f28 | Relarium/Relarium | src/swifttx.cpp |
#include "swifttx.h"
#include "activemasternode.h"
#include "base58.h"
#include "key.h"
#include "masternodeman.h"
#include "net.h"
#include "obfuscation.h"
#include "protocol.h"
#include "spork.h"
#include "sync.h"
#include "util.h"
#include <boost/lexical_cast.hpp>
using namespace std;
using namespace boost;
std:... | TOOL | 0.988416 | 6.0315 |
4d3d810f-d605-4cb6-9377-0f3be54b6793 | luis01qs/Repositorio | Entrenamiento/Codeforces/Contest 23-03-2023/a.cpp | # include <bits/stdc++.h>
# define ll long long
using namespace std;
int main()
{
freopen("prueba.txt", "r", stdin);
int tt;
cin>>tt;
while(tt--)
{
string s;
cin>>s;
sort(s.begin(), s.end());
if(s[0] == s[3])
{
cout << -1 << endl;
co... | ALGO | 0.999579 | 3.763765 |
9ee74235-cc29-4968-bd0c-344b1820d900 | dw-dw-dt/Derivatives-Library-Lecture | Class4-SABR/UTEuropeanOptionSABR.cpp | #include "UTMathFunctions.hpp"
#include "UTEuropeanOptionSABR.hpp"
#include "UTEuropeanOptionLogNormal.hpp"
#include "UTEuropeanOptionNormal.hpp"
using namespace std;
///////////////////////////////////////////////////////////////////////////////
// Destructor
UTEuropeanOptionSABR::~UTEuropeanOptionSABR()
{
}
/////... | ALGO | 0.998618 | 7.680398 |
6f0b1970-5e68-4295-ba5b-03731972f58f | PaukIsUha/optimizing_formating_code | predictions/full_output_predicted_submissions/Codenet/p02390/688814348/9.cpp | #include <iostream>
using namespace std;
int main(void) {
int S;
cin >> S;
cout << S / 3600 << ":" << (S % 3600) << ":" << (S % 3600) % 60 << endl;
}
| ALGO | 0.860678 | 3.955363 |
952ebb6e-895a-4906-9146-97ef7787a610 | 2468785842/krkr2 | cpp/core/msg/MsgIntf.cpp | //---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Definition of Messages and Message Related Utilities
//---------------------------------------------------------------------------
#include "tjsCommHead.h"
#in... | TOOL | 0.866492 | 6.695731 |
c31e9ef0-8113-4d23-92eb-667fcb0db887 | fast050/Problem_Solving | #12 Data Structure 1/#12 Double Linked List Data Structure/#12 Double Linked List Data Structure/#12 Double Linked List Data Structure.cpp |
#include <iostream>
using namespace std;
class Node {
public:
int value;
Node* next;
Node* previous;
};
void InsertNodeAtBeginning(Node* &Head, int Value) {
Node* new_node = new Node();
if(Head!=NULL)
Head->previous = new_node;
new_node->previous = NULL;
new_node->next = Hea... | ALGO | 0.999492 | 5.154453 |
152aaa0f-3df5-4843-a1fb-5277963a0b56 | HarryGogonis/YAGE | packages/bulletphysics/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp | #include "btPersistentManifold.h"
#include "LinearMath/btTransform.h"
btScalar gContactBreakingThreshold = btScalar(0.02);
ContactDestroyedCallback gContactDestroyedCallback = 0;
ContactProcessedCallback gContactProcessedCallback = 0;
///gContactCalcArea3Points will approximate the convex hull area using 3 points
... | ALGO | 0.976247 | 6.886747 |
8997ba49-bd76-4510-8818-0f2de46aa424 | abhiram22MH1A4267/Github-Problems | Difficulty: Easy/Height of Binary Tree/height-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str) {
// Corner Case
if (str.length() == 0... | ALGO | 0.998977 | 7.123262 |
77569dfa-912d-421b-b3e7-e5c58a4e6f54 | Aty-0/S2DE | Libs/boost_1_76_0/libs/spirit/example/qi/compiler_tutorial/calc8/vm.cpp | #include "vm.hpp"
#include <boost/assert.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
// (performance warning)
#endif
namespace client
{
int vmachine::execute(
std::vector<int> const& code
, std::vector<int>::co... | TOOL | 0.882335 | 5.675509 |
2dc6aad6-a1ab-4b05-a37a-0f49e3a1cbcb | skzr001/Leetcode | 107. Binary Tree Level Order Traversal II/lc107.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int>> levelOrderBottom(TreeNode* root) {
vector<vector<int>> res;
... | ALGO | 0.999994 | 6.311828 |
4563b2f9-efa9-4306-a5a3-5dc90b0fef53 | Marcel-Rodekamp/NSL | Executables/Examples/example_lattice.cpp | #include <chrono>
#include "NSL.hpp"
#include <yaml-cpp/yaml.h>
int main(int argc, char* argv[]){
NSL::Logger::init_logger(argc, argv);
auto init_time = NSL::Logger::start_profile("Program Initialization");
// Define the parameters of your system (you can also read these in...)
typedef NSL::comp... | ALGO | 0.969467 | 3.903151 |
c49356f7-1cbd-4fa9-a5a3-567fbcad7899 | dkhonker/sysu | 数据结构/数据结构实验课文件/EXP15-graph(BFS,Kruskal)/for_test/source/20354008/spanforest.cpp | #include<stdio.h>
#include<memory.h>
#include<stdlib.h>
const int maxn=5001;
int *A[maxn];
int *B[maxn];
bool visited[maxn];
int d[maxn], n, counter=0;
int f, r;
int list[maxn + 1];
int bfs(int u){
f = 0; r = 0;
visited[u]=true; list[r++] = u;
while (f < r){
u = list[f++];
f++;
for (int i=1; i<=d[u]; i++){... | ALGO | 0.999702 | 3.443633 |
4aa5b865-4010-49ab-bfbc-0436b6c9cfa5 | antonov-andrey144/dzmm | Lab9/Task1/homework/Source.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include "HashTable.h"
int main()
{
HashTable* table = hashTableCreate(256); //
FILE* file = fopen("input.txt", "r");
while (!feof(file))
{
char* str = new char[50];
fscanf(file, "%s", str);
hashTableAdd(table, str);
}
fclose(file);
hashTablePri... | ALGO | 0.924833 | 3.829817 |
248e0edf-2f72-4c81-8454-6aa9cb9b1569 | KraitOPP/Codeforces | D_Exam_in_MAC.cpp | #include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
// pair<int, int>,
// null_type,
// less<pair<int, int>>,
// rb_tree_tag,
// tree_order_statistics_node_update>
// ordered_multiset;
#define fasti... | ALGO | 0.999942 | 4.088896 |
63ce952d-4b86-4ab4-96eb-9a6195c781de | Codave/RedBlackTree | TestRedBlackTree.cpp | #include<iostream>
#include"RedBlackTree.h"
using namespace std;
int main() {
const int NEG_INF = -99999;
RedBlackTree<int> t(NEG_INF);
//t.insert(12);
//t.insert(16);
//t.insert(8);
//t.insert(10);
//t.insert(4);
//t.insert(14);
//t.insert(2);
//t.insert(6);
//t.insert(5);
//cout << t.header->right->le... | ALGO | 0.98708 | 3.96809 |
fab5faac-4705-4dff-8108-074234398340 | blueboy/portalclassic | dep/recastnavigation/Recast/Source/RecastFilter.cpp | #define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAssert.h"
/// @par
///
/// Allows the formation of walkable regions that will flow over low lying
/// objects such as curbs, and up structures such as stairways.
///
/// Two neighboring spans are walkable if: <tt>rcAb... | ALGO | 0.98646 | 6.787532 |
8325942f-1f1d-4302-ae5e-a206e8235418 | Peresmeshnik01/RGR | Atbash_Cipher/atbash_cipher_for_rus.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <locale>
using namespace std;
string atbash(string s) {
string result = "";
string a = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
string b = a;
reverse(b.begin(), b.end());
string A = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
strin... | ALGO | 0.999889 | 4.752733 |
bbdb68eb-925a-4aed-ab70-8ba3f881f06e | Myakita/PNRPU-classes | Сложные сортировки/Многофазная сортировка.cpp | // Многофазная сортировка.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void merge(vector<int>& arr, int left, int mid, int right) {
int n1 = mid - left + 1;
int n2 = right - m... | ALGO | 0.999984 | 4.361654 |
9aabfdf9-c5ec-4089-86cf-827710aa836b | mikaelleRubia/projetos-residencia-tic18 | C/Pratica_7/exercicio01.cpp | #include <string>
#include <iostream>
using namespace std;
int main() {
for(int i = 1; i <= 100; i++) {
if(i%3 == 0 && i%5 == 0){
cout << "FizzBuzz ->" << i << endl;
}
if(i%3 == 0){
cout << "Fizz ->" << i << endl;
}
if(i%5 == 0){
cout <... | ALGO | 0.997869 | 4.557727 |
afe0846c-95c4-428e-b59d-81b4ae651766 | P79N6A/Codes-1 | Trainning/2016多校第05场/标程/ATM Mechine/std.cpp | #include <bits/stdc++.h>
using LL = long long ;
#define ALL(v) (v).begin(),(v).end()
#define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC)
const double Inf = 1e12;
const int N = 2000 + 1;
const int D = 15 + 1;
double dp[N][D];
bool vis[N][D];
double calc(int K,int W) {
if (K == 0) {
... | ALGO | 0.999442 | 3.961036 |
596782c4-475b-4de1-8a4e-f82bb6b7b737 | oss5824/practice | DFS와BFS/4963.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<string>
using namespace std;
int N, M, cnt;
int Map[50][50];
bool visit[50][50];
int dx[8] = { -1,-1,-1,0,0,1,1,1 }, dy[8] = { -1,0,1,1,-1,-1,0,1 };
void bfs(int x, int y)
{
queue<pair<int, int>>q; q.push... | ALGO | 0.999627 | 4.885235 |
5c726aa5-cfc8-4c54-a168-e95717b88fda | open-vela/external_libopencore-amr | opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp | /*
------------------------------------------------------------------------------
Filename: d3_14pf.cpp
Functions: decode_3i40_14bits
------------------------------------------------------------------------------
MODULE DESCRIPTION
FUNCTION: decode_3i40_14bits (decod_ACELP())
PURPOSE: Algebraic codebook dec... | ALGO | 0.999775 | 6.014283 |
57db9a39-3c07-4143-80e5-7bde5c5066e0 | polwro-projects/tsp | src/tsp/algorithm/inaccurate/genetic/algorithm.cpp | #include "tsp/algorithm/inaccurate/genetic/algorithm.hpp"
#include <algorithm>
namespace tsp::algorithm::inaccurate::genetic {
Algorithm::Algorithm(DistanceMatrix distances,
PopulationSizeType population_size,
SelectionPoolSizeType pool_size)
: tsp::algorithm::Algorithm{distances}
, kPopulationSize{popu... | ALGO | 0.999951 | 6.274948 |
7ba417ea-4998-42a3-9215-bc7bc13f0db8 | ivanj26/Algorithm-DataStructures-DesignPattern | Algorithm/String/string-match/kmp.cpp | #include <string>
#include <iostream>
using namespace std;
void computeLPSArray(int *lps, string pat)
{
int m = pat.length();
int i = 1;
int j = 0;
lps[0] = 0;
while (i < m)
{
if (pat[i] == pat[j])
{
j++;
lps[i] = j;
i++;
}
else
{
if (j == 0)
{
lps[i] = 0;
i++;
}
else
... | ALGO | 0.999972 | 6.298537 |
feb82e54-79b4-4d72-ab7e-876813123d5c | ThatSunshine/LearnOpengl | Include/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.999362 | 4.856711 |
6dbcfb84-3439-4a1c-b5c4-450c73dff318 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/maximum-number-of-moves-to-kill-all-pawns-Solution.maxMoves/177816_Bypass.cpp | void get_checksum2(char *buf, int32 len, char *sum)
{
md_context m;
switch (xfersum_type) {
case CSUM_MD5: {
uchar seedbuf[4];
md5_begin(&m);
if (proper_seed_order) {
if (checksum_seed) {
SIVALu(seedbuf, 0, checksum_seed);
md5_update(&m, seedbuf, 4);
}
md5_update(&m, (uchar *)buf, len);
}... | ALGO | 0.999821 | 5.105646 |
365be4a7-1f5f-4f79-bf9f-2fc0d729091b | Mahmoudezzat00/problem-solving-with-c--main | sheets/sheet #5 (functions)/G. Max and MIN.cpp | #include<bits/stdc++.h>
using namespace std;
void sorting(int arr[],int size){
sort(arr,arr+size);
}
int main(){
int size;
cin>>size; // 4
int arr[size]; // [5,6,7,1]
for(int i=0;i<size;i++){
cin>>arr[i];
}
sorting(arr,size);// [1,5,6,7]
cout<<arr[0]<<" "<<arr[size-1];
}
| ALGO | 0.999953 | 3.053151 |
d6741105-c5c1-438d-a763-9312ecdcbf60 | AbdullahAlshuaibi/CS111 | carClass.cpp | #include <iostream>
using namespace std;
enum dirct {NORTH, EAST, SOUTH, WEST};
int total=0;
class Car
{
private:
string make;
string model;
int year;
int mileage;
dirct dirction;
int x;
int y;
public:
Car(string mk, string md, int yr);
string getMake();
void turnRight();
dirct getDirction();
... | TOOL | 0.904862 | 4.174191 |
b6ae652c-44d1-422e-a7b3-4a957ad0665b | kipr/opencv | modules/contrib/src/featuretracker.cpp | /
#include "precomp.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/contrib/hybridtracker.hpp"
using namespace cv;
CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
params(_params)
{
switch (params.feature_type)
{
case CvFeatureTr... | TOOL | 0.953266 | 6.690749 |
da6207fa-7066-4df1-ae8f-27c035f91732 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/game-of-life-Solution.gameOfLife/177860_Exec_Code_Bypass.cpp | zrestore(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
alloc_save_t *asave;
bool last;
vm_save_t *vmsave;
int code = restore_check_operand(op, &asave, idmemory);
if (code < 0)
return code;
if_debug2m('u', imemory, "[u]vmrestore 0x%lx, id = %lu\n",
(ulong) alloc_save_clie... | ALGO | 0.989682 | 3.480092 |
0dc7bd7b-86e6-47f2-8ca4-f8c4e19ca79c | indraprhmbd/PRAKTIKUM | PRAKTIKUM/SEMESTER 1/fungsi-rekursif.cpp | #include <iostream>
using namespace std;
int faktorial(int n){
if(n==1) return 1;
else return (n*faktorial(n-1));
}
int fibonacci(int n){
if(n<=1) return n;
else return fibonacci(n-1) + fibonacci(n-2);
}
int main(){
int angka;
cout<<"Input angka : ";cin>>angka;
cout<<"Faktorialnya adalah ... | ALGO | 0.997026 | 4.581017 |
b8ad9401-2b3f-4251-97a0-3711d02afa1f | fpGHwd/algorithm-cpp | src/leetcode/p557_1.cpp | //
// Created by suzumiya on 4/3/19.
//
#include "p557_1.h"
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
// 完全都是自己做的并没有修改,只是最后一个单词好像有点问题
string Solution::reverseWords(string s) {
string::iterator end = s.begin(), start = s.begin();
for (; end < s.end(); e... | ALGO | 0.999792 | 4.870815 |
306aea13-3bb8-4143-b8d2-353787b18546 | CaviesInPics/Homework_2020 | 第二阶段作业/CF605E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
int x = 0, f = 1; char c = getchar();
while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
while (isdigit(c)) {x = x * 10 + c - '0', c = getchar();}
return x * f;
}
typedef long double db;
const int maxn = 1005;
int n, vi... | ALGO | 0.999715 | 3.281973 |
5c761d2c-4b22-4e39-ad7a-14d623872452 | axelu/leetcode | cpp/03000-03499/maximumcoincollection.cpp |
// 3466. Maximum Coin Collection
// https://leetcode.com/problems/maximum-coin-collection/
class Solution {
private:
const long long INF = 1e14;
long long ans;
long long mem[100001][2];
long long rec_lane1(vector<int>& lane1, int i) {
if( i == lane1.size() )
return 0LL;
... | ALGO | 0.9999 | 5.882018 |
166346db-0d2b-468d-b766-ba60b56b1044 | pseudo-usama/my-undergrad-coding | 1 Semesters/3/Data structures/Programs/Pre semester self learning/8Stack/Uses of Stack/Infix to Postfix (Stack).cpp | // Infix to Postfix (Stack).cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
#include "string"
#include "stack"
using namespace std;
bool Oprator_Prefrance(char First, char Second);
string To_Postfix(string Expression);
void main() {
string Expression;
string P... | ALGO | 0.9908 | 4.862172 |
a0f80604-02a7-4dde-ac4a-0f92d8b51e28 | Dandelionzhao0124/colorcorrection | color_correction_code/Last_general/function.cpp | #include "function.h"
void calMask(const vector<Point2f>& pts, Mat& msk)
{
int width = msk.size().width;
int height = msk.size().height;
for (int j = 0; j < pts.size();++j)
{
if(pts[j].y >= 0 && pts[j].y < height &&
pts[j].x >= 0 && pts[j].x < width)
msk.at<uchar>(pts[j].y, pts[j].x) = 255;
else
conti... | TOOL | 0.95976 | 3.972243 |
16672381-6c88-4911-b210-0365f11bd896 | dhiru7890/cpp-learning | codes/squareroot.cpp | #include<iostream>
using namespace std;
int mySqrt(int x) {
if(x == 0 || x == 1)
return x;
int start = 1, end = x, ans = 0;
while(start <= end) {
int mid = start + (end - start) / 2;
if(mid <= x / mid) {
ans = mid; // Store the result
start = mid ... | ALGO | 0.999768 | 4.567041 |
6a3aab27-33b5-4273-806c-85202a4b1b27 | owais-rashid-mir/c-cpp-programming | ArrangePositiveNegativeNums_Owais_04.cpp | /*
Program : C++ program which will arrange the positive and negative numbers in one dimensional array in
such a way that all positive numbers should come first and then all the negative numbers will come after that,
without changing the original sequence of numbers.
Example: Original array contains: 10,-15,1,3,-2,0,... | ALGO | 0.999934 | 4.874539 |
d5700e36-f08f-4362-9cd1-0aa2038b6eb7 | asayushranjansinha/LeetCode-Submissions | 55-jump-game/55-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int n = nums.size();
int maxIndexReached = 0;
if(n == 1){
return true;
}
for(int i = 0; i < n-1 && maxIndexReached >= i; i++){
maxIndexReached = max(maxIndexReached,
... | ALGO | 0.999981 | 6.237823 |
df36c446-577e-4d3a-be37-ad51ea5564b4 | panzerhong/C-ADD-ADD | General concept/Selection Sort.cpp | #include<iostream>
using namespace std;
int main()
{
int arr[100],n,i,j,position,swap;
cout<<"Enter number of elements in arrray:\n";
cin>>n;
cout<<"Enter the elements in an array : \n";
for(i=0;i<n;i++)
cin>>arr[i];
for(i=0;i<n-1;i++)
{
position = i;
for(j=i+1;j<n;j++)
{
if (arr[position]>arr[j])
... | ALGO | 0.999863 | 4.033762 |
539e4841-acb3-4855-8d93-7741c9585dba | DaaGvda/xray-oxygen | code/engine.vc2008/utils/xrAI/xrCrossTable.cpp | ////////////////////////////////////////////////////////////////////////////
// Module : xrCrossTable.cpp
// Created : 25.01.2003
// Modified : 25.01.2003
// Author : Dmitriy Iassenev
// Description : Building cross table for AI nodes
////////////////////////////////////////////////////////////////////////////
#... | ALGO | 0.995109 | 4.034178 |
31132bf2-3799-4289-aa72-dd5e03e397cf | sssukh/daily-coding | programmers_17684/source.cpp | #include <string>
#include <vector>
#include <unordered_map>
#include <iostream>
using namespace std;
vector<int> solution(string msg) {
vector<int> answer;
vector<string> dictation{ "","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q",
"R","S","T","U","V","W","X","Y","Z" };
unord... | ALGO | 0.999912 | 4.47267 |
aaa40c56-1d18-4b5a-9b05-a52fbc0cb1b7 | Sneh1999/CTCI-solutions | Arrays and Strings/isUnique.cpp |
#include <set>
#include <string>
#include <iostream>
std::set<char> chars(std::string s){
std::set<char> char_set;
for(char &c : s){
char_set.insert(c);
}
return char_set;
}
// to not be able to have a data structure you can sort the string and then check every adjacent string
bool is_unique(s... | ALGO | 0.998331 | 5.276577 |
1c15d59e-570f-44f9-abd3-df719537d457 | Patompongbig/Problem_solving | Week4/twoteams.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <map>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n + 1);
vector<int> group(n + 1, -1);
bool bipartite = true;
int count = 0;
int bipartite_value = 0;
map<int, int> d... | ALGO | 0.999959 | 4.573489 |
5e8c8962-9fe3-4f39-9eb0-d0610496fd27 | Lizonghang/IEEEX | Flower Games/C++-Solution.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// Joseph Ring
// Score: 20.00
// Status: Terminated due to timeout
int main() {
int T;
cin >> T;
for (int t=0; t<T; t++) {
int N, M=2, result=0;
cin >> N;
for (int i=... | ALGO | 0.99995 | 4.132088 |
690bc82c-c51d-4a75-ab0c-9fe05d8a5ce5 | mohit-pareek09/DSA-leetcode | Difficulty: Easy/Insertion at doubly linked list/insertion-at-doubly-linked-list.cpp | class Solution {
public:
Node* addNode(Node* head, int p, int x) {
// Create a new node with value x
Node* newNode = new Node(x);
// Case 1: Empty list
if (head == nullptr) {
if (p == 0) {
return newNode; // Return new node as head if p == 0
... | ALGO | 0.999802 | 6.198336 |
203f3499-df82-4c59-ae32-7e11f9fef8ec | bharatm29/Leetcode-CP | DSPractice/stack.cpp | #include <iostream>
#include <iterator>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
#define max_sz 101
void error(string err){
throw runtime_error(err);
}
class StackArr{
private:
vector<int> v;
int top{-1};
public:
StackArr(){
v.resiz... | ALGO | 0.984761 | 4.796762 |
b67db829-445c-4b30-a2ce-f806cd85fda0 | Arhan13/seanprashad-leetcode-patterns | Sliding Window/1004. Max Consecutive Ones III/Codes/sliding-window.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int longestOnes(vector<int> &nums, int k)
{
int n = nums.size();
int oneCounter = 0;
int zeroCounter = 0;
int left = 0;
int right = 0;
int maxLength = 0;
while (right < n)
{
... | ALGO | 0.999921 | 5.937152 |
df707108-ec20-445a-ac87-1c6427814390 | yang-su2000/CP-Practice | archived/2023-07/07-16-1600.cpp | #include <bits/stdc++.h>
using namespace std;
// ./run sample.cpp
#define ll long long
int main() {
int t, n;
string s;
cin >> t;
while (t--) {
cin >> n >> s;
if (n % 2) {
cout << -1 << endl;
continue;
}
map<pair<char, char>, int> m; // (a, b) c... | ALGO | 0.999907 | 4.33754 |
6271fa7f-475b-4bf1-b5e3-3f4ea6320f1b | dsorvq/cf | div4/1669/b.cpp | #include <bits/stdc++.h>
#include <numeric>
using namespace std;
void solve() {
int n;
cin >> n;
unordered_map<int, int> fmap;
for (int i = 0; i != n; ++i) {
int a;
cin >> a;
++fmap[a];
}
int res = -1;
for (auto [el, freq] : fmap) {
if (freq >= 3) {
res = el;
break;
... | ALGO | 0.999931 | 4.488837 |
ef8f0019-e649-4683-8a91-6a06b72611fb | DIEGOROCU/FAL-Ejericios | EVALUACIONES CONTINUAS/EVCON1.cpp | /**
* Escribid el nombre y usuario del juez los miembros de la pareja:
* Nombre y usuario:
* Nombre y usuario:
*
* Explica brevemente el algoritmo:
* Se recorre el vector contando comprobando si tenemos una cadena de elementos iguales, contando
* la longitud de la misma
* Cuando encontremos un elemento distinto... | ALGO | 0.999984 | 4.756498 |
122dc257-6b06-43b4-a640-5b56c7cee580 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_13305_6.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0) ? a + b : b - a;
}
| ALGO | 0.999871 | 3.761678 |
60e09539-06c7-45d9-80af-2587d3a3b3e5 | HP657/codetree | 240131/특정 문자로 시작하는 문자열/strings-that-start-with-a-specific-character.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
char b;
cin >> b;
int cnt = 0, sum = 0;
for (int i = 0; i < n; i++)
{
if (a[i][0] == b)
{
cnt++;
su... | ALGO | 0.998286 | 4.222409 |
3d1ce52f-77cb-4726-b4d1-40282b5f0f26 | ShobheshMohite/Let-s-Start-From-Scratch | pattern4.cpp | /*
1 * * *
* 2 * *
* * 3 *
* * * 4
*/
#include<iostream>
using namespace std;
void Display(int iValue,int jValue){
for(int iCnt = 1; iCnt <= iValue ; iCnt++){
for(int jCnt = 1; jCnt <= jValue ; jCnt++){
if(iCnt == jCnt)
{
cout... | ALGO | 0.986695 | 3.592197 |
67788a02-316e-4563-90e7-87c707f73296 | yplusplus/aabbyy | 20140422/b.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1 << 7;
const int MOD = 1e4 + 7;
struct Matrix {
int value[N][N], size;
Matrix() { memset(value, 0, sizeof value); }
Matrix(int size, int x = 0) : size(size) {
for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
value[i][j] = 0;
}... | ALGO | 0.999916 | 4.406631 |
d2f72a60-326a-4972-a560-aebfea6e4f83 | Eunno-An/LeetCode | 1770-maximum-score-from-performing-multiplication-operations/1770-maximum-score-from-performing-multiplication-operations.cpp | class Solution {
public:
vector<vector<int>> dp;
int solve(int i, int n, int j, vector<int>& nums, vector<int> &M){
if(j==M.size()) return 0;
if(dp[i][j] != INT_MIN) return dp[i][j];
int left = solve(i+1, n, j+1, nums, M) + (nums[i] * M[j]);
int right =... | ALGO | 0.999992 | 5.686204 |
83feb0e8-f461-4c9c-8a57-10e44c2d859c | yanakievv/DSA-course-student-19-20 | Homework #7/Task #3/Solution.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
#define min(a,b) ((a) < (b) ? (a) : (b))
struct Directory
{
std::string name;
std::string path = "/";
Directory* parent = nullptr;
std::vector<Directory*> subdirs;
Directory() = defa... | TOOL | 0.943169 | 4.810037 |
d2f2832a-dce9-438b-9876-4f8e45ba98f6 | Nayassyl/pp1 | lab3/3.cpp | #include <iostream>
using namespace std;
int main()
{
int n , i ;
cin >> n ;
int arr[n] ;
for (int i = 0; i < n; i++)
{
cin >> arr[i] ;
}
for (int i = 1; i < n; i++)
{
if (arr[0] < arr[i])
arr[0] = arr[i] ;
}
cout << arr[0] ;
return 0 ;
} | ALGO | 0.999527 | 3.459358 |
53e47071-adaa-4244-80d3-87854777074b | escobarflughafen/solveleetcode | src/003.cpp | //
// Created by Yashushi on 2018/09/20.
//
#include "include/common.h"
class Solution{
public:
int lengthOfLongestSubstring(string s){
if(s.length() == 0) return 0;
if(s == " ") return 1;
int startpos = 0;
int alphacounter[256] = {};
for(int t=0; t<256; t++){
... | ALGO | 0.998579 | 4.020815 |
87a3f6d3-458f-4430-8e12-dbcbf9a7d07b | ishandutta2007/codeforces | shayan.p/normal/875/B.cpp | #include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ll long long
using namespace std;
const ll maxn=3e5+10;
ll n,ans[maxn];
bool mark[maxn];
int main()
{
cin>>n;
ll last=n;
for(ll i=1;i<=n;i++)
{
ll x;cin>>x;mark[x]=1;
while(mark[last])last--;//avalini ke n... | ALGO | 0.999982 | 3.564196 |
2409bf78-de6a-453c-b3a9-062e98a53bcf | A-R-M-028/DSA | 3 ARRAY/triplet.cpp | #include <iostream>
#include<stdio.h>
#include<vector>
using namespace std;
//Simple funda jkata term sekota loop required
int main(){
int key=80;
vector<int>arr{10,20,30,40,50};
for(int i=0;i<arr.size();i++){
cout<<"You are at i: "<<arr[i]<<endl;
for(int j=i+1;j<arr.size();j++){
... | ALGO | 0.999314 | 3.490756 |
cd78f6d5-a7e9-4877-bddf-1e3ea08a7868 | gregatjhu/bootcamp24 | gem5-resources/src/parsec/disk-image/parsec/parsec-benchmark/pkgs/kernels/canneal/src/netlist_elem.cpp | #include <assert.h>
#include <math.h>
#include "annealer_types.h"
#include "location_t.h"
#include "netlist_elem.h"
netlist_elem::netlist_elem()
:present_loc(NULL)//start with the present_loc as nothing at all. Filled in later by the netlist
{
}
//********************************************************************... | ALGO | 0.991565 | 5.355078 |
65b74c01-bd8e-4150-9daf-91013fc8cb25 | joelnb/xmlrpc-c | release_number/01.15.00/tools/xmlrpc_pstream/xmlrpc_pstream.cpp | #include <cassert>
#include <cerrno>
#include <string>
#include <vector>
#include <list>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <readline/readline.h>
#include "cmdline_parser.hpp"
#include "xmlrpc-c/girerr.hpp"
using girerr::throwf;
#include <featur... | TOOL | 0.906292 | 5.768243 |
adbb9207-4c77-4f64-9d9f-368cc3dea92a | Michellebuchiokonicha/Flutter-offline-database | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998799 | 6.776823 |
0573a969-1b2f-4505-890c-302a9087dec0 | Phimos/practice-of-programming-iii- | 简单大整数.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
const int MAX = 110;
class CHugeInt {
// ڴ˴Ĵ
char num[210];
int len;
public:
CHugeInt(char *s)
{
int l = strlen(s);
for (int i = 0; i < l; i++)
num[i] = s[l - i - 1];
num[l] = 0;
len = l;
}
CHugeInt()
... | ALGO | 0.999343 | 3.092129 |
039752ad-db72-4fd6-8301-aa35e9563dac | AlexandreDFM/Raytracer | src/Primitives/Cone.cpp | /*
** EPITECH PROJECT, 2023
** raytracer
** File description:
** Cone.cpp
*/
#include "Cone.hpp"
namespace RayTracer {
Cone::Cone(double _radius, double _height, const Vector3D& _position, std::shared_ptr<IMaterial> &_mat)
: position(_position), radius(_radius), height(_height), matPtr(_mat)
{}
... | ALGO | 0.928894 | 6.913894 |
8d0ff3ff-5578-4865-b113-d58e28954195 | ric-gar/CPlusPlus_How_To_Program_Exercises | Chapter_4/Exercise_4.33.cpp | /*
File name: Exercise_4.33.cpp
Author: Ricardo Garcia
Date: 09/01/2024
Book: C++ How to Program 10th edition by Paul Deitel and Harvey Deitel
Exercise: 4.33 Page 155
Description: Determine if three nonzero values can represent the sides of a triangle.
*/
#include <iostream>
int main() {
// Prompt user to enter fir... | ALGO | 0.999542 | 6.328105 |
7b5c0f76-fc31-4b62-a1ee-ab09164bbd50 | rabraghib/solved | leetcode/LeetCode-75/kids-with-the-greatest-number-of-candies.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
int n = candies.size();
vector<bool> result(n, false);
int max = *max_element(candies.begin(), candies.end());
for (int i = 0; i < n;... | ALGO | 0.999938 | 5.411034 |
09186a8e-476b-461f-b060-83fd88bae772 | graphbig/graphBIG | benchmark/bench_gibbsInference/bayes_net.cpp | /**************************************************************
This code shows an example of using Gibbs sampling for
Bayesian network approximate inference. The interfaces
are similar to the Dlib inference tool, but built on
System G native store.
verfied according to CSci 5512 UMN
Gibbs Sampling for Approxim... | ALGO | 0.999565 | 7.098188 |
ec5536fc-3029-4ee3-828f-36c54869683e | sogood99/cpp-comp | furthest-building-you-can-reach/furthest-building-you-can-reach.cpp | #include <bits/extc++.h>
#include <bits/stdc++.h>
#define LSOne(S) ((S) & -(S))
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>,
__gnu_pb... | ALGO | 0.999759 | 5.587388 |
43b9197d-f56f-40f6-b9f6-9d7c77b98818 | momoisgoodforhealth/DSA | bubblesort.cpp | #include <bits/stdc++.h>
using namespace std;
void bubblesort(vector<int>& v) {
int n = v.size();
for (int i = 0 ; i < n; i++) {
for (int j = 0; j<n-i-1; j++) {
if (v[j] > v[j+1]) swap(v[j],v[j+1]);
}
}
}
int main() {
vector<int> v = {5,9,1,3,2};
bubblesort(v);
for (auto i: v... | ALGO | 0.999923 | 4.670518 |
d222a6c9-a695-4e78-bb85-27de8de1fbdf | ishandutta2007/codeforces | alexandra_udristoiu/normal/1491/C.cpp | #include<iostream>
#include<cstring>
using namespace std;
int t, n, i, j;
long long sol;
int s[5005], v[5005];
int main(){
cin>> t;
for(; t; t--){
sol = 0;
memset(v, 0, sizeof(v) );
cin>> n;
for(i = 1; i <= n; i++){
cin>> s[i];
}
for(i = 1; i <= n; i++... | ALGO | 0.999909 | 3.588885 |
67615d9d-3d4c-4281-ba1c-11ee937975b4 | lujiazho/LeetCode-Record | LeetCode/169-majority-element.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////
// easy
////////////////
// Time Complexity: O(n)
// Space Complexity: O(n)
///////////////////////////////////////////////////////////////////////////////////////////////
class Solution {
public:
int majorityElement(vec... | ALGO | 0.999929 | 5.279349 |
a07bdc75-df2b-4e02-85d4-67a24966b453 | kalakris/stomp_motion_planner_icra2011 | stomp_motion_planner/src/stomp_cost.cpp | /** \author Mrinal Kalakrishnan */
#include <stomp_motion_planner/stomp_cost.h>
#include <stomp_motion_planner/stomp_utils.h>
#include <Eigen/LU>
USING_PART_OF_NAMESPACE_EIGEN
using namespace std;
namespace stomp_motion_planner
{
StompCost::StompCost(const StompTrajectory& trajectory, int joint_number, const std::v... | ALGO | 0.998186 | 6.163558 |
ba610483-d5ce-4690-b295-9acb03369b20 | Jatin-Shihora/LeetCode-Solutions | 2255-minimum-swaps-to-group-all-1s-together-ii/2255-minimum-swaps-to-group-all-1s-together-ii.cpp | class Solution {
public int minSwaps(int[] nums) {
// Calculate the minimum swaps needed to group all 1s or all 0s together
int op1 = minSwapsHelper(nums, 0); // Grouping all 0s together
int op2 = minSwapsHelper(nums, 1); // Grouping all 1s together
return Math.min(op1, op2);
}
... | ALGO | 0.999985 | 6.790064 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.