uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a40a5119-0b29-4125-b103-689035c93b7e | infinixaco/WAY-TO-PLACEMENT | binary-search-iterative.cpp | #include <iostream>
using namespace std;
int binarySearch(int num, int startingPoint, int endPoint, int arr[]) {
while (endPoint >= startingPoint) {
int mid = (startingPoint + endPoint) / 2;
if (arr[mid] == num) {
return mid;
}
if (arr[mid] > num) {
endPoint = mid - 1;
}
if (arr[mid] < num) {
star... | ALGO | 0.999743 | 5.428436 |
cb2eea10-6de3-43cb-ac36-88651ada5b06 | khaledsliti/CompetitiveProgramming | LightOJ/LOJ1148.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
int main()
{
int T, tc = 1;
scanf("%d", &T);
while(T--){
int n;
scanf("%d", &n);
... | ALGO | 0.999384 | 3.99155 |
f8beb35d-1623-482c-af94-ab5f44d23e26 | htzs2050/ojplus-frontend | hello-algo/codes/cpp/chapter_sorting/merge_sort.cpp | /**
* File: merge_sort.cpp
* Created Time: 2022-11-25
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 合并左子数组和右子数组 */
void merge(vector<int> &nums, int left, int mid, int right) {
// 左子数组区间为 [left, mid], 右子数组区间为 [mid+1, right]
// 创建一个临时数组 tmp ,用于存放合并后的结果
vector<int> tmp(right - left + ... | ALGO | 0.999984 | 5.868121 |
ed7e95d0-5531-4b74-aeb7-ac90ff6679e8 | C0ldSmi1e/CompetitiveProgramming | Contests/AtCoderAtCoderBeginnerContest338/DIslandTour.cpp | /**
* Author: C0ldSmi1e
* Created Time: 01/30/2024 03:52:31 PM
**/
// time-limit: 2000
// problem-url: https://atcoder.jp/contests/abc338/tasks/abc338_d
#include <bits/stdc++.h>
using namespace std;
#ifdef DANIEL_DEBUG_TEMPLATE
#include "../debug.h"
#else
#define debug(...) 42
#endif
int main() {
cin.tie(nullpt... | ALGO | 0.999993 | 4.452332 |
3a049fb2-6bf1-408f-9ad3-16a9d221836e | ishandutta2007/codeforces | danya090699/normal/983/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int sz=5e3+10;
int va[sz][sz], ma[sz][sz];
int main()
{
//freopen("input.txt", "r", stdin);
int n;
cin>>n;
for(int a=0; a<n; a++)
{
scanf("%d", &va[1][a]);
ma[1][a]=va[1][a];
}
for(int a=2; a<=n; a++)
{
for(int b... | ALGO | 0.999993 | 4.274422 |
b6f45745-41d1-4e6b-9d4e-915788dac402 | Nirmal010101/DSA-Code | Hashing/factorialhas.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5; // 10^5
long long fact[N];
int main(){
fact[0]=fact[1]=1;
for (int i = 2; i < N; i++)
{
fact[i] = fact[i-1]*i;
}
// Above is the hash function to store N number factorial
int t;
cin >> t;
while (t--)
{
... | ALGO | 0.999875 | 5.120956 |
73f6e453-3ffc-487e-8e77-60edea02757b | ashokkaji26/DSA_26 | Basic_Progrmas/1_Print_1_to_N.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
for(int counter = 1; counter <= N; counter++) {
cout << counter << " ";
}
return 0;
} | ALGO | 0.985164 | 4.296062 |
1ca5f0a8-f38b-4cde-9f89-9d99ee3f8dec | kallinosis-dev/srcmodbase-source | ivp/havana/havok/hk_physics/constraint/local_constraint_system/local_constraint_system_hk.cpp | #include <hk_physics/physics.h>
#include <hk_physics/simunit/sim_manager.h>
#include <hk_physics/simunit/psi_info.h>
#include <hk_physics/constraint/constraint.h>
#include <hk_physics/constraint/local_constraint_system/local_constraint_system_hk.h>
hk_Local_Constraint_System::hk_Local_Constraint_System( hk_Environment... | ALGO | 0.859982 | 4.486572 |
19a5d985-7510-48a4-b5be-8eb57c55715b | chestnutme/pat-solution | A1053.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 107;
struct node {
int weight;
vector<int> child;
}tree[maxn];
bool cmp(int a, int b)
{
return tree[a].weight > tree[b].weight;
}
int n, m, s;
int path[maxn];
void DFS(int index, int nodeNum, int sum)
{
i... | ALGO | 0.999984 | 3.815422 |
6ff900fa-957b-4647-ad66-e4a373969780 | AnkitMaskara907/CP_codes | vscode/C_Swap_Columns_and_Find_a_Path.cpp | // #pragma GCC optimize("Ofast")
// #pragma GCC target("avx")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
// #define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less_equal<int>, rb... | ALGO | 0.999915 | 4.489603 |
79dc1755-7267-4bb8-9977-4a7672199ed7 | KornilovIgor/SF | BinaryTree/src/BinaryTree.cpp | #include "BinaryTree.h"
BinaryTree::Node::Node(int d, Node* p):
data(d), parent(p) {
leftChild = nullptr;
rightChild = nullptr;
}
BinaryTree::Node::~Node() {
// чистим за собой память
if(rightChild != nullptr)
delete rightChild;
if(leftChild != nullptr)
delete leftChild;
}
Binar... | ALGO | 0.999806 | 3.726912 |
c4dbeca5-ebb0-4346-b032-d0e87cdee50e | Priybhanu99/My-Codes | dice combinations.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define P pair<int,int>
#define pb push_back
#define F first
#define S second
int mod = 1e9 + 7;
int dp[1000005];
int solve(int n){
if(n==0){
return 1;
}
if(dp[n]!=-1){
return dp[n];
}
int temp = 0;
for(int dice=1;dice<=6;dice++){
... | ALGO | 0.999952 | 5.302111 |
6c07f852-5eb4-4552-8ae2-4806eb30a55e | shoaib30/ComputerNetworking-Lab | PartA/QoS_Priority.cpp | #include<iostream>
using namespace std;
#define MAX_SIZE 3
struct message {
int id =-1;
int priority = 0 ;
}q[MAX_SIZE];
int numMessages=0;
int findHighestPriorityMessage() {
int high = 0;
for(int i=1; i<MAX_SIZE; i++) {
if(q[high].priority<q[i].priority)
high = i;
}
r... | ALGO | 0.992036 | 4.614581 |
e66d28a0-6b5b-4e3c-b78f-64002350156d | Rakibul-CoU/ALGORITHM | Change Making.cpp | #include<bits/stdc++.h>
using namespace std;
int minCoins(int coins[], int m, int V)
{
if (V == 0) return 0;
int res = INT_MAX;
for (int i=0; i<m; i++)
{
if (coins[i] <= V)
{
int sub_res = minCoins(coins, m, V-coins[i]);
if (sub_res != INT_MAX && sub_res + 1 < res)
re... | ALGO | 0.999988 | 4.227423 |
2041936a-0f91-4e67-9717-57e21fd614ab | GhostQ/GitSB | src/qt/qtwebkit/Source/WebKit2/Shared/linux/SandboxProcess/SandboxEnvironmentLinux.cpp | #include "SandboxEnvironmentLinux.h"
#include <dirent.h>
#include <dlfcn.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <limits.h>
#include <link.h>
#include <pwd.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/capa... | TOOL | 0.959154 | 5.308625 |
b945b3b9-b6df-4143-a867-4e75e5079e82 | AndrewSnowdy/RoboticsFinal | mesa_new/mesa_cpp/src/admm_optimizer.cpp |
#include "mesa/admm_optimizer.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <set>
using namespace gtsam;
AdmmOptimizer::AdmmOptimizer(const std::map<RobotId, RobotSubgraph>& subgraphs, const AdmmConfig& config)
: robots_(subgraphs), config_(config), beta_(config.beta) {
for (const au... | ALGO | 0.999177 | 5.729931 |
a70031a5-ad6a-45c1-82c6-b4e97dcd0ee8 | ishandutta2007/codeforces | doped.silicon/normal/1016/B.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef gp_hash_table<long long, long long> umap;
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep... | ALGO | 0.999909 | 3.739865 |
194d759e-9337-451e-a260-dee989b4de00 | ebinantu/DATA-STRUCTURE-USING-CPP | binarytree.cpp | #include<iostream>
using namespace std;
struct node
{
int data;
struct node *left;
struct node *right;
};
typedef struct node node;
class Tree
{
node *root;
public:
Tree()
{
root = nullptr;
}
node* createnode(int val)
{
node* newnode=new node;
newnode->data = val;
newnod... | ALGO | 0.999624 | 4.440726 |
1cf9a7e1-50fe-46e6-a40d-9f5d2c19e9f8 | SuminJN/Algorithm | Backjoon/C++/1991_트리 순회.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define MAX 26
vector<int> v[MAX];
void preorder(int x) {
if(x == -1) return;
cout << (char)(x + 'A');
preorder(v[x][0]);
preorder(v[x][1]);
}
void inorder(int x) {
if(x == -1) return;
inorder(v[x][0]);
cou... | ALGO | 0.999933 | 3.933478 |
0ddd0003-1209-423c-bbe7-607281a397d3 | sanjay882530/hcnet-core19.4 | lib/tracy/client/TracyCallstack.cpp | #include <new>
#include <stdio.h>
#include <string.h>
#include "TracyCallstack.hpp"
#include "TracyFastVector.hpp"
#include "../common/TracyAlloc.hpp"
#include "../common/TracyStackFrames.hpp"
#include "TracyDebug.hpp"
#ifdef TRACY_HAS_CALLSTACK
#if TRACY_HAS_CALLSTACK == 1
# ifndef NOMINMAX
# define NOMINMAX
# ... | TOOL | 0.858591 | 3.481196 |
d0cba18f-2ac0-4e36-b79a-348811d12f79 | ccw2010/lc | 461. Hamming Distance.cpp | /* 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding
bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 ≤ x, y < 231.
Example:
Input: x = 1, y = 4
Output: 2
Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
↑ ... | ALGO | 0.999926 | 5.823932 |
51dbb6bd-92b7-45a1-9908-1fb4e3686d14 | Abrahul-107/Pattern_print_cpp | 07_pattern7.cpp | #include<iostream>
using namespace std;
int main()
{
int row,col;
cout<<"ENTER YOUR ROW SIZE "<<endl;
cin>>row;
for(int i=1;i<=row;i++)
{
int k=1;
for(int j=1;j<=i;j++)
{
printf("%d ",k);
k=k+2;
}
cout<<endl;
}
return 0;
} | ALGO | 0.995937 | 3.64147 |
028a45ed-98c3-4d1e-ae6b-9d4cf56d3c72 | Tarin10/Data-Structure-Lab | QuickSort.cpp | #include <iostream>
#include<stdlib.h>
using namespace std;
void print(int arr[], int l, int s)
{
cout<<"\nArray = [";
for(int i=0; i <s-1; i++)
cout<<arr[i]<<",";
if(s <= 0)
cout<<" ]\n";
else
cout<<arr[s-1]<<"]\n";
}
int partition (int arr[], int low, int high)
{
int piv... | ALGO | 0.999877 | 4.706782 |
7b40efe1-1021-4e2c-a32f-26607ac246fb | Alok-kumar-Maurya/codes | 12april.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
#define debugxy(x,y) cout<<"[ "<<x<<" "<<y<<" ]"<< endl
#define debugx(x) cout <<"[ "<< x <<" ]"<<endl
#define en... | ALGO | 0.999847 | 4.504342 |
d80e71fc-05bc-4bef-8c9e-2750d8d035ec | rahulgarg55/LeetCode-GeeskforGeeks-Hustle | 987-vertical-order-traversal-of-a-binary-tree/987-vertical-order-traversal-of-a-binary-tree.cpp | /**
* 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) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999997 | 5.794699 |
195afc03-8691-45a3-9715-5d8c33961eb7 | turajred/datastructur | midterm/queries.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node *next_node;
Node *prev;
Node(int val){
this->val=val;
this->next_node=NULL;
this->prev=NULL;
}
};
void take_input(Node *&head,Node *&tail,int val){
Node *n... | ALGO | 0.999932 | 4.003695 |
5a9439c0-ea01-4956-8108-2d76a7d6627b | splodster/codeforces-problemsets | 800/158A-Next-Round.cpp | // 158A - Next Round - Difficulty: 800
#include <iostream>
using namespace std;
int main () {
int n, k, a[50], count(0);
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
if (a[i] >= a[k-1] && a[i] > 0) {
count++;
}
}
... | ALGO | 0.999944 | 3.525289 |
55bed1e6-26e3-4f54-86c4-0ba8c4dd35c3 | StolasIn/leetcode_Submissions | content/number-of-enclaves/Accepted/8-25-2021, 10_09_57 AM/Solution.cpp | // https://leetcode.com/problems/number-of-enclaves
class Solution {
public:
bool flag;
int cnt;
vector<vector<bool>> vis;
void dfs(vector<vector<int>>& g,int x,int y){
if(x<0 || x>=g.size() || y<0 || y>=g[0].size()){
flag=true;
return;
}
if(g[x][y]==0 ||... | ALGO | 0.999986 | 6.572166 |
77716830-63b4-4fa3-831e-16a07fe2ee6c | Vivekrathore2002/DSA-Coding | 0664-strange-printer/0664-strange-printer.cpp | class Solution {
public:
int strangePrinter(string s) {
int n = s.size();
vector<vector<int>> dp(n, vector<int>(n, 0));
for (int i = n-1; i >= 0; --i) {
dp[i][i] = 1;
for (int j = i+1; j < n; ++j) {
dp[i][j] = dp[i][j-1] + 1;
f... | ALGO | 0.999981 | 5.504331 |
9ed2945f-ec60-4822-a13a-1f12745d0c16 | aditi-govindu/Unstop-100-days | Day11/MaryAndFlowers.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
/*
Description: One day Mary wanted to give a present to her friend, and she decided to give her a beautiful bouquet of flowers, she started collecting the flowers for the bouquet, she exactly needed 2 ty... | ALGO | 0.999967 | 4.993377 |
9a6f5506-1932-4762-9f4c-cf8f4d1da677 | ParthTripathi450/Cpp-Codes-Leetcode- | 1894-find-the-student-that-will-replace-the-chalk/1894-find-the-student-that-will-replace-the-chalk.cpp | class Solution {
public:
int chalkReplacer(vector<int>& chalk, int k) {
int i=0;
int n = chalk.size();
long long total = 0;
for(int i: chalk){
total+=i;
}
k = k%total;
cout<<k<<endl;
for(int j = 0;j<n;j++){
if(chalk[j]>k){
... | ALGO | 0.999961 | 5.402822 |
dc1d8d60-c512-487c-90d4-800fa0d5b30c | RaulitoGC/competitive-programming | online-training-platform/algoexpert/non-constructible-change/non-constructible-change.cpp | #include <vector>
using namespace std;
// Time : O(nLogn)
// Space : O(1)
int nonConstructibleChange(vector<int> coins) {
sort(coins.begin(), coins.end());
int k = 0;
int size = coins.size();
for(int i = 0 ; i < size; i++){
if( k + 1 < coins[i]){
break;
}
k+=coins[i];
}
return k+1;
}
| ALGO | 0.997497 | 4.73768 |
72b81417-5aa1-4723-9976-4e985556e1e5 | janaa-wael/Data-Structures | Data Structures Implementation/Queues/Queues_usingSinglyLinkedLists.cpp | /*
* main.cpp
*
* Created on: Dec 30, 2024
* Author: Jana Wael
*/
#include <iostream>
using namespace std;
class Node {
public:
Node* next;
int data;
Node(int x)
{
next = NULL;
data = x;
}
};
class Queue {
private:
Node* front;
Node* back;
public:
Queue() {
front = NULL;
back = NULL;
}
... | TOOL | 0.937971 | 4.832065 |
c8803b65-48c5-4946-a303-e60ca7048154 | FilipS14/CFGToPDA | PROIECT3LFC/PROIECT3LFC/Grammar.cpp | #include "Grammar.h"
//READ && PRINT
void Grammar::readGrammar() noexcept {
std::ifstream fin{ "fisier.txt" };
if (!fin.is_open()) {
std::cout << "Nu s-a putut deschide fisierul!\n";
}
{
char word;
uint32_t number;
fin >> number;//citim numarul de elemente pentru multi... | ALGO | 0.951535 | 4.674571 |
edde724f-2cc8-4ded-b201-c1d2b62a046f | pradyumn07/LeetCode | 0952-word-subsets/0952-word-subsets.cpp | class Solution {
public:
bool isSubset(vector<int>& freq2,vector<int>& temp){
for(int i=0;i<26;i++){
if(temp[i]<freq2[i]) return false;
}
return true;
}
vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) {
vector<string> ans;
vecto... | ALGO | 0.9999 | 5.854953 |
44db410a-3875-45d8-89cb-1810acfff490 | mmxsrup/procon | atcoder/abc/004/c.cpp | /*
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int... | ALGO | 0.999476 | 3.068239 |
2c3764c6-15cb-4d8c-ae40-ece86952b5c8 | kaspiotr/WDI-intro-to-CS | Sem7_Ex2_20171124/Sem7_Ex2_20171124.cpp | //author: @kaspiotr (Piotr Kasprzyk)
/*
Napisac funckje rekurencyjna void wypisz(), ktora wypisuje kolejne elementy tablicy.
*/
#include <iostream>
using namespace std;
const int N = 10;
void wypisz(int t[N], int idx){
if(idx < N){
cout<<t[idx]<<"\t";
wypisz(t, idx+1);
}
}
//zamiana miejsc... | ALGO | 0.998174 | 5.143583 |
97b6f43d-3f3c-4102-9cb4-667bde01533f | Fydui/MyCpp_Wheel | error4/main.cpp | #include <iostream>
#include <cmath>
#include <string>
#include "exc_mean.h"
using namespace std;
class demo
{
private:
string word;
public:
demo(const string & str){
word = str;
cout << "demo: " << word << " 创建" << endl;
}
~demo(){
cout << "demo: " << word << " 销毁" << endl;
... | ALGO | 0.97017 | 3.965421 |
c8e1444b-5982-43f9-b9f8-6b16d31a49bc | kunyavskiy/competitive-programming-archive | opencup/19-20/200426/H.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>... | ALGO | 0.999737 | 3.490431 |
036361a7-e352-48c9-92c6-a9a7e1e05d0e | puuksl/tptresized | 900/src/client/MD5.cpp | // based on public-domain code from Colin Plumb (1993)
#include <string.h>
#include "MD5.h"
static unsigned getu32(const unsigned char *addr)
{
return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0];
}
static void putu32(unsigned data, unsigned char *addr)
{
addr[0] = (unsigned char)data... | ALGO | 0.932735 | 6.128105 |
083eb975-5300-4f4e-beba-567c94df3da3 | aUprety23/chess | Test_Project/Test_Project/pollingEvent.cpp | #pragma once
#include "Game.h"
//MOVE THE PIECE IF POSSIBLE
bool Game::MovePiece(sf::Vector2f source_position, sf::Vector2f destination_posititon)
{
//Reset the value of attacker
for (Pieces* select : piecesList)
{
select->isAttacker(false);
}
//movement of bishop
if (bishop_BlackB-... | ALGO | 0.985696 | 3.594297 |
46908899-8815-403b-b4c3-501c8bc6d18d | lchyeon0123/Kairos | libraries/opencv/modules/core/src/matrix_decomp.cpp | #include "precomp.hpp"
namespace cv { namespace hal {
/****************************************************************************************\
* LU & Cholesky implementation for small matrices *
\*********************************************************************************... | ALGO | 0.999871 | 4.277206 |
349df52d-3324-44a2-b062-042157db1480 | Shivkant-Chauhan/LeetCode-problems | 98-validate-binary-search-tree/98-validate-binary-search-tree.cpp | /**
* 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) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999962 | 6.974975 |
31b19fac-8395-46ed-a0d7-fb29bada2697 | arnold518/ps-notes | temp/teamnote/Data Structure/Kinetic Segment Tree/test3.cpp | // https://judge.yosupo.jp/problem/line_add_get_min
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
namespace KST
{
const ll INF = 7e18;
struct Line { ll a, b; };
ll divfloor(ll u, ll d) { return u/d - ((u^d)<0 && u%d); }
// p... | ALGO | 0.999748 | 4.932956 |
20a6be9d-ddd1-4547-90e6-a58a1d0626f3 | MagnusEvenstuen/AISProsjektAstroids | src/CollitionDetection.cpp | #include "CollitionDetection.hpp"
#include <cmath>
bool CollitionDetection::collitionDestroy(std::shared_ptr<Astroid>& astroid, std::vector<Laser>& lasers) {
//All collition Destroy functions are functions to destroy objects.
for (auto is = lasers.begin(); is != lasers.end(); is++) {
auto& laser = *is;... | TOOL | 0.925831 | 5.612369 |
610f3ef7-1393-4d4b-90d9-ec5fa56a66d9 | rajaartimuni1234/Ineourn-stl-assigment-solution | ass8-16.cpp | #include<iostream>
using namespace std;
int main(){
for (int i=0; i<5;i++){
for(int j=0; j<9;j++){
if(i==4||j==4-i||j==4+i){
cout<<"*";
}
else {
cout<<" ";
}
}
cout<<endl;
}
}
| ALGO | 0.997824 | 3.158522 |
364b5110-84d5-4a9e-b1a7-ae26a218fb05 | Zellix22/Grand-Theft-Auto-Vice-City-Scripts | re3-master (ac339f47242ab84689938512947cc259f3e6ae13)/src/math/Quaternion.cpp | #include "common.h"
#include "Quaternion.h"
void
CQuaternion::Normalise(void)
{
float sq = MagnitudeSqr();
if (sq == 0.0f)
w = 1.0f;
else {
float invsqrt = RecipSqrt(sq);
x *= invsqrt;
y *= invsqrt;
z *= invsqrt;
w *= invsqrt;
}
}
void
CQuaternion::Slerp(const CQuaternion &q1, const CQuaternion &q2, f... | ALGO | 0.90663 | 4.615091 |
5d0d54ce-0364-4c8b-b79e-1d4e7cc4257f | stavih19/SeekerMatrixSolustion | BestFirstSearch.cpp | //
// Created by stavih19 on 17/01/2020.
//
#include "BestFirstSearch.h"
vector<double> BestFirstSearch::search(Searchable<double> *searchable) {
vector<double> answer;
list < State < double > * > *successors;
list < State < double > * > openList;
list < State < double > * > closeHeap;
priority_qu... | ALGO | 0.999979 | 4.598857 |
08e0e8af-9be1-470d-8413-5f0b1d7d90ac | Bhagwankumarsingh/LeetCodeQuestions | 328-odd-even-linked-list/odd-even-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* oddEvenList... | ALGO | 0.999963 | 5.801004 |
bdcd9719-0db9-4192-9a6d-46bd7d788e50 | youssef4-75/upygame | .history/board/cp_20250504164312.cpp | #include <iostream>
using namespace std;
int power(int base, int pow){
while(true){
if pow
}
}
int main(){
int n;
cin >> n;
int ver = power(3, n - 2);
cout << 4*ver*(n-1) << endl;
} | ALGO | 0.999881 | 3.958378 |
09526747-a16d-4b46-9cac-fa1fea9169cb | ishandutta2007/codeforces | rfpermen/normal/873/C.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=(n);i<=(N);++i)
#define For(i,n,N) for(int i=(n);i< (N);++i)
#define rap(i,n,N) for(int i=(... | ALGO | 0.999962 | 3.068783 |
cbabd67f-900f-4625-b170-7ab302850174 | Atomic-OS/platform_frameworks_av | media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.cpp | /*___________________________________________________________________________
This file contains mathematic operations in fixed point.
mult_int16_r() : Same as mult_int16 with rounding
shr_rnd() : Same as shr(var1,var2) but with rounding
div_16by16() : fractional integer division
... | ALGO | 0.999839 | 6.508576 |
59b78777-a720-41e8-9794-def7a0ebd245 | MohamdOmar/Embedded_linux | c++/01/VowelLetters.cpp | #include<iostream>
bool vowelLetter(char letter)
{
letter = std::tolower(letter);
// Check if the letter is a vowel
return (letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u');
}
int main()
{
char x ;
std::cout << "Pleaze enter the Letter: ";
std::cin>> x ;
... | TOOL | 0.914249 | 5.209608 |
d3da5535-2bb2-4a31-b342-3c62d5197d8f | Phuong103022/C_Plus_Plus_Solution_By_Ki_Lop | CODE_BUOI_10/5.cpp | #include <bits/stdc++.h>
using namespace std;
int cnt1[10000001], cnt2[1000001];
typedef long long ll;
const int MOD = 1e9 + 7;
int main()
{
int n, m;
cin >> n >> m;
int a[n], b[m], Max = -MOD, Min = MOD;
for (int &x : a)
{
cin >> x;
cnt1[x]++;
Max = max(x, Max);
Min ... | ALGO | 0.999992 | 3.142396 |
c18be334-759f-4933-bad6-cb60f7a2b547 | Heimdall-SBOM/heimdall | src/common/MetadataExtractor.cpp | /**
* @file MetadataExtractor.cpp
* @brief Implementation of the MetadataExtractor using modular components
* @author Trevor Bakker
* @date 2025
*/
#ifdef __APPLE__
#include <libkern/OSByteOrder.h>
#include <mach-o/fat.h>
#include <mach-o/loader.h>
#endif
namespace heimdall
{
// Forward declarations
std::string... | TOOL | 0.922026 | 6.994351 |
8f94d78a-957b-445b-af2d-a59b116b7326 | adrian-crisan/FA2017 | BST/BST/Source.cpp | #include <stdio.h>
#include <stdlib.h>
struct Node {
int key;
int size;
Node* parent;
Node* left;
Node* right;
};
Node* newNode(int key) {
Node* node = (Node*)malloc(sizeof(Node));
node->key = key;
node->left = NULL;
node->right = NULL;
node->size = 0;
return node;
}
Node* buildTree(int arr[], int start, ... | ALGO | 0.999954 | 5.254828 |
43b059c3-2379-4a88-bda7-c2ec4426bee2 | Hasin20108/CP | AtCoder/B Contest 314 (12 July 2023)/B.cpp |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define rep for(int i = 0; i < n; i++)
#define repi for(int i = a; i < n; i++)
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define endl '\n'
#define inar int ... | ALGO | 0.999981 | 3.65414 |
837253f9-0495-4278-ab7b-2e3c05881345 | Shantanu-Kulkarni1229/DSA-QUESTIONS | CODING NINJAS/basics/LEET CODE/Strings/String_Compression.cpp | // https://leetcode.com/problems/string-compression/description/
// 443. String Compression
// Given an array of characters chars, compress it using the following algorithm:
// Begin with an empty string s. For each group of consecutive repeating characters in chars:
// If the group's length is 1, append the charac... | ALGO | 0.999967 | 6.528278 |
b27ca3c5-72cf-4213-b4cd-ebdd1e4a6daa | PiriKIM/kuBig2025 | smartPointer/ex13_thread.cpp | #include <iostream>
#include <thread>
#include <mutex> // mutually exclusive
using namespace std;
int counter = 0;
mutex mtx;
void increment()
{
for (int i = 0; i < 1000; ++i)
{
lock_guard<mutex> lock(mtx);
++counter;
}
}
int main()
{
thread t1(increment);
cout << "최종 카운터 값1 : ... | ALGO | 0.981055 | 4.636315 |
f6b7d530-6598-4213-b1a2-843e005490dc | aerys/minko | plugin/bullet/lib/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.cpp | /*! \file gim_tri_collision.h
\author Francisco Leon Najera
*/
#include "gim_tri_collision.h"
#define TRI_LOCAL_EPSILON 0.000001f
#define MIN_EDGE_EDGE_DIS 0.00001f
class GIM_TRIANGLE_CALCULATION_CACHE
{
public:
GREAL margin;
btVector3 tu_vertices[3];
btVector3 tv_vertices[3];
btVector4 tu_plane;
btVector4 tv_... | ALGO | 0.999663 | 5.737035 |
146553c0-ed49-4935-8416-25322f79c4d8 | hjiang13/LLMs-in-IR | POJ-104/67/1690.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i;
double a,b,x[5000],y[5000],z,w[5000];
cin >> "%d",&n);
for(i=0; i<n; i++){
cin >> "%lf %lf",&x[i],&y[i]);
z=y[0]/x[0];
w[i]=y[i]/x[i];
}
for(i=1; i<n; i++){
if((w[i]-z)>0.05){
cout << "better\n");
}
if((z-w[i])>0.05){
cout << "worse\n");
}
if((z-w[i])<=0.0... | ALGO | 0.999803 | 3.556043 |
4b961ce3-b316-4f65-a478-3e85b12de23f | wenyuema-cs/fairness | .history/read_20220315193740.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <fstream>
#include <numeric>
#include <string>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <vector>
using namespace std;
double randam(){
double r = ((double) rand() / (RAND_MAX)) ... | ALGO | 0.999714 | 4.365343 |
5c58d7ad-cdac-4dd6-b487-dc2bcfcb56f2 | hun0905/mbed13 | 13_8_PID_control/main.cpp | #include "mbed.h"
#include "bbcar.h"
#include <math.h>
#include <stdlib.h>
#include "stm32l475e_iot01_magneto.h"
#define bound 0.9
#define PI 3.14159
BufferedSerial pc(USBTX, USBRX);
Ticker servo_ticker;
PwmOut pin5(D5), pin6(D6);
BBCar car(pin5, pin6, servo_ticker);
float state[3] = {0};
float Kp = 0, Ki = 0, Kd = 0;... | ALGO | 0.960309 | 4.10658 |
65c5a184-7d4a-473b-86c7-a2a5001fbfa0 | LamLay/The-Beetle-Game | Beetle_driver.cpp | /*************************************************************************
* File Name: project1.cpp
* Name: lam Lay
* Course: CPTR 142
* Date: January 10, 2018
*
*/
#include <iostream> // for cin and cout
#include <stdlib.h> // for exit
#include <limits> // for invalid... | ALGO | 0.880459 | 5.415602 |
5eeae816-2e5b-443a-b5c8-c7fff68b974a | jkusal/kody | cpp/fibo_re.cpp | #include <iostream>
using namespace std;
int vibo_re(int n)
{
if (n == 0) return 0;
if (n == 1) return 1;
return vibo_re(n-2) + vibo_re(n-1);
}
int main(int argc, char **argv)
{
int n;
cout << "Podaj numer wyrazu ciągu: ";
cin >> n;
cout << "Ciąg Fibonacciego do wyrazu " << n << ": ";
co... | ALGO | 0.999565 | 4.183968 |
cb2751f6-806f-4ee0-9603-280291db661f | VipulChauhan89/CodeChef-Practice-Problems | Beginner/Turbo Sort-TSORT/sort.cpp | //program to sort n numbers in non decreasing order
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int T,num,n;
vector<int> a;
cin>>T;
n=T;
while(T--)
{
cin>>num;
a.push_back(num);
}
sort(a.begin(),a.end());
for(T=0;T<n;T++)
{
cout<<a[T]<<endl;
}
... | ALGO | 0.999964 | 4.490307 |
f4160638-2902-4a47-8029-6748246960df | Devcode5/CPlusPlusProjects | activity19TwoDimensionalArray.cpp |
// activity19TwoDimensionalArray.cpp
// C++Projects
//
// Created by Aqila Nasiry on 4/1/25.
//activity 19: flip the columns as outer loop and rows as inner loop
#include <iostream>
using namespace std;
const int MAX_ROWS = 6;
const int MAX_COLUMNS = 10;
void arraya(int twod[][MAX_COLUMNS], int rows, int columns)... | ALGO | 0.998161 | 4.881041 |
06f74170-aa8f-40c6-a8d1-175435c3d90d | s410385015/NCTU_HW | 互動式形變/Least Squares Meshes/eigen-eigen-b3f3d4950030/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.992232 | 6.121914 |
3ba4a16c-9d19-4d04-9d6b-a69510b49473 | luhillxs/HuntingSeasonBegins | LeetCode/Legacy/Tree/Maximum Depth of Binary Tree.cpp | /*
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(in... | ALGO | 0.999441 | 6.540135 |
f020744f-c7b6-4475-9f3d-ade4de953802 | wbl1997/vins_rgbd_fast_lc | vins_estimator/src/factor/marginalization_factor.cpp | #include "marginalization_factor.h"
void ResidualBlockInfo::Evaluate()
{
residuals.resize(cost_function->num_residuals());
std::vector<int> block_sizes = cost_function->parameter_block_sizes();
raw_jacobians = new double *[block_sizes.size()];
jacobians.resize(block_sizes.size());
... | ALGO | 0.998524 | 4.150812 |
d70e32a5-cff2-4a83-b52c-ce1804a441dd | linscard/grafos | InsertionSort.cpp | #include "../include/InsertionSort.h"
InsertionSort::InsertionSort(Vertex *vector, int size) {
for (int i = 1; i < size; ++i) {
Vertex aux = vector[i];
int j = i - 1;
while ((j>=0) && ((aux.color == vector[j].color && aux.index < vector[j].index ) || aux.color < vector[j].color) ){
... | ALGO | 0.999703 | 4.653385 |
bc17c691-2edc-44b6-9f28-d5c5d46164eb | ishandutta2007/codeforces | ronnie007/normal/95/E.cpp | #include<bits/stdc++.h>
using namespace std ;
#define MAXN 100007
int n ;
int prv[ MAXN ] ;
int comp_sz[ MAXN ] ;
int rnk[ MAXN ] ;
int num[ MAXN ] ;
int dp[ MAXN ] ;
vector < pair < int , int > > v ;
int find ( int x ) {
if ( prv[ x ] == -1 ) { return x ; }
int y = find ( prv[ x ] ) ;
prv[ x ] = y ;
... | ALGO | 0.999546 | 4.171695 |
38ae1449-b2e4-4f8e-be1d-cdc322c987b0 | hursung1/ProblemSolving | 13549.cpp | # include <iostream>
# include <deque>
using namespace std;
int main(){
int n, k, curloc, cursec;
bool locvisited[100001] = {false};
deque<int> locq, move;
cin >> n >> k;
if(n == k){
cout << 0 << endl;
return 0;
}
locvisited[n] = true;
locq.push_back(n); move.push_back(0);
while(true){
cursec = move.at... | ALGO | 0.99996 | 3.706906 |
4b9e84ce-9781-4e40-9384-86d0b85e14b1 | raincross7/code-similarity | codes/train_code/problem042/problem042_28.cpp | #include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pb push_back
#define log(x,b) (log(b)/log(x))
#define rep(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
vi graph[8];
bool vis[8];
int res,n,m;
void dfs(int u,int cnt){
if(cnt==n){
res++;
return;
}
vis[u]=1;
... | ALGO | 0.999906 | 4.476499 |
0ee24f29-ef1e-4010-917f-537b5bee61ff | davrec72/clang-meta | llvm/tools/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp | #include "clang/Rewrite/Frontend/Rewriters.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Pragma.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
using ... | TOOL | 0.928309 | 7.793611 |
53c0983d-7671-4a64-a5a2-90b086dd4cfb | stevensonmat2/game_of_life | life.cpp | #include "life.h"
GameBoard::GameBoard()
{
board = NULL;
}
GameBoard::GameBoard(int x, int y)
{
board_width = x;
board_height = y;
cell_count = x * y;
srand(time(NULL));
board = new int * [board_width];
for (int i=0; i < board_width; ++i)
{
board[i] = new int [board_height];
for (int j=0; j < board_hei... | ALGO | 0.972086 | 3.828489 |
1e8cde40-6e61-4728-91d9-0823af865a4b | PhilipSLuk/security-projects | hackthebox/scripts/reverse-tools/retdec/src/llvmir2hll/optimizer/optimizers/loop_last_continue_optimizer.cpp | /**
* @file src/llvmir2hll/optimizer/optimizers/loop_last_continue_optimizer.cpp
* @brief Implementation of LoopLastContinueOptimizer.
* @copyright (c) 2017 Avast Software, licensed under the MIT license
*/
#include "retdec/llvmir2hll/ir/continue_stmt.h"
#include "retdec/llvmir2hll/ir/for_loop_stmt.h"
#include "retdec... | TOOL | 0.960387 | 7.69922 |
0a30b526-c518-422c-b91c-9a04ed201f18 | 1bin01/Algorithm-Problems | 32639/files/complete-startree-noshuffle.cpp | #include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 1e5 + 5;
int n, d[NMAX], par[NMAX], L[NMAX];
vector<pair<int, int>> Edge;
vector<int> adj[NMAX];
void dfs(int x, int p) {
for (int& nx : adj[x])
if (nx != p) {
... | ALGO | 0.999288 | 3.708573 |
9c51140b-6969-4c6e-b421-7e7dc8a88071 | graybriggs/pong-clone | ball.cpp |
#include <math.h>
#include <stdio.h>
#include <time.h>
#include "ball.hpp"
#include "config.hpp"
#include "paddle_base.hpp"
Ball::Ball() {
box.x = Config::SCREEN_WIDTH / 2 - 5;
box.y = Config::SCREEN_HEIGHT / 2 - 5;
box.w = 8;
box.h = 8;
angle = initial_firing_angle();
xVel = calculate_x_velocity(angle);
yV... | TOOL | 0.92805 | 5.658616 |
7cab2107-4f59-451c-9b8e-7c38cc43833e | trinhminhtriet/leetcode | solutions/0700-0799/0769.max-chunks-to-make-sorted/Solution.cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
int ans = 0, mx = 0;
for (int i = 0; i < arr.size(); ++i) {
mx = max(mx, arr[i]);
ans += i == mx;
}
return ans;
}
}; | ALGO | 0.999983 | 5.709553 |
883818f1-84d5-44bd-a3cb-31cef2cef1e9 | hunterdboyd/Abstractive-Multiplayer-Snake-Game | src/objPosDoubleHashing.cpp | #include "objPosDoubleHashing.h"
#include "MacUILib.h"
#include <iostream>
using namespace std;
objPosDoubleHashing::objPosDoubleHashing()
{
// Instantiate the objPos Hash Table of the default size TABLE_SIZE defined in the objPosHashTable abstract class
// Should also initialize tableSize field with the defa... | ALGO | 0.971639 | 4.689956 |
9baddc62-f750-4ea2-ac5e-cf39cd58a7db | xdu-zhangfan/drivers | max262/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.902421 | 7.471897 |
d3cc90d8-6b49-41cc-a644-9463d81a9e9d | Abhivic000/CF | A_Yogurt_Sale.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define fr first
#define sc second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define rep(i,a,b) for (int i = a; i <= b; i++)
// for (i... | ALGO | 0.999848 | 4.036914 |
7383f97c-286f-4c1b-9bb5-595345fbc9c2 | HappyGames/cocos3d-x | cocos3d/Engine/cocos2dx/cocos2dx/CCConfiguration.cpp | #include "CCConfiguration.h"
#include "ccMacros.h"
#include "ccConfig.h"
#include <string.h>
#include "cocoa/CCDictionary.h"
#include "cocoa/CCInteger.h"
#include "cocoa/CCBool.h"
#include "cocos2d.h"
#include "platform/CCFileUtils.h"
using namespace std;
NS_CC_BEGIN
CCConfiguration* CCConfiguration::s_gSharedConfig... | CONFIG | 0.932819 | 6.183944 |
4fbfb53a-0b98-4047-a80e-951ec25cacd6 | sua1223/Algorithm | Programmers/Lv.1/stageFailure.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
bool compare(const pair<double, int>& a, const pair<double, int>& b) {
if (a.first == b.first)
return a.second < b.second;
return a.first > b.first;
}
vector<int> solution(int N, vector<int> stages) {
vector<int> a... | ALGO | 0.999809 | 3.976 |
599fa9da-d6a0-4823-b264-c7ac722f6151 | Psyhe/Single_Source_Shortest_Paths | PRUNING_EXP/reading.cpp | #include <mpi.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <tuple>
#include <string>
#include <queue>
#include <set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
using namespace std;
const long long INF = 1e18;
int global_root = 0;
const double tau = 0.4;
int delta = 40; /... | ALGO | 0.999705 | 3.217296 |
50ea1b5e-a930-4c12-8842-5bf3c34b5dda | garvitjava/C-WORKSHOP | templates/templatefunctions/swap.cpp | #include <iostream>
using namespace std;
template <typename T>
void swapValues(T &a, T &b) {
T temp = a;
a = b;
b = temp;
}
int main() {
int x = 10, y = 20;
swapValues(x, y); // Works with int
cout << "x: " << x << " y: " << y << endl;
float m = 1.1, n = 2.2;
swapValues(m, n); // Wo... | ALGO | 0.997392 | 6.208351 |
9f9bf364-2db2-40ec-b507-e66652ff2d3d | OmoH37/Calculator | ConsoleApplication1.cpp | #include <iostream>
#include <string>
using namespace std;
int usl = 1;
int x;
int y;
void func()
{
cout << "First num" << endl;
cin >> x;
cout << "Second num" << endl;
cin >> y;
}
int main()
{
string operation;
cout << "+ - * / %" << endl;
cin >> operation;
if (operation == "+")
{
while (usl == ... | ALGO | 0.990028 | 3.299867 |
859536e6-b876-4f6b-b13d-2570881063e9 | tariqul-dev/DSA | LeetCode/mixed/longest_string_chain.cpp | #include <bits/stdc++.h>
using namespace std;
bool compare(string &s1, string &s2)
{
return s1.size() < s2.size();
}
vector<int> createLps(string pattern)
{
int size = pattern.size();
vector<int> lps(size);
int index = 0;
int i = 1;
lps[0] = 0;
while (i < size)
{
if (pattern[... | ALGO | 0.9999 | 4.783519 |
961100d5-065d-4942-9567-00310576c493 | sutitMUT/MIIA0106B | Code/Cplus/LAB03_02/LAB03_02.cpp | #include <iostream>
using namespace std;
// Function to print even numbers 2 to 20 using for loop
void printFor() {
cout << "Using for loop: ";
for (int i = 2; i <= 20; i += 2) {
cout << i << " ";
}
cout << endl;
}
// Function to print even numbers 2 to 20 using while loop
void printWhile() {
... | ALGO | 0.985145 | 5.624161 |
642646d6-b0a9-4dff-a5dc-cfab8de2bac4 | infotoarchit2012/Archit_Kumar_Singh_PS_2A | Function-recursion11.cpp | #include<iostream>
using namespace std;
int FIBBO(int n)
{
if(n<=1)
{
return n;
}
return FIBBO(n-1)+FIBBO(n-2);
}
int main()
{
int n;
cout<<"Enter the number of terms to generate the series: ";
cin>>n;
cout<<FIBBO(n);
getchar();
return 0;
} | ALGO | 0.999734 | 3.904476 |
381c1768-dfad-49b5-83a6-1ad87913283a | dhieunguyen/learning-programming | b2.cpp | #include<iostream>
#include<fstream>
#include<string>
#include<vector>
using namespace std;
struct Canh
{
int diemDau;
int diemCuoi;
};
void docFile(string tenFile, vector<vector<int>> &maTran){
int size;
int temp;
fstream input;
input.open(tenFile,ios::in);
input >> size;
for(int i=0;... | ALGO | 0.999233 | 3.311646 |
039225e6-a2c7-445e-8e70-199c702328b2 | falcaoanderson/CompetitiveProgramming | codcad/SUBS INGLES/Stair/115589.cpp | #include <iostream>
using namespace std;
int main(){
int n,t,ta=0,total=0,i;
cin>>n;
for(i=0;i<n;i++){
cin>>t;
if (t>=ta+10 or i==0){
total+=10;
}else{
total+= t-ta;
}
ta=t;
}
cout<<total<<endl;
return 0;
}
| ALGO | 0.997948 | 3.37929 |
ac37e2ad-8df7-4edd-93ad-b4c5b557f891 | kyle-lotke/hw5 | wordle.cpp | #ifndef RECCHECK
// For debugging
#include <iostream>
// For std::remove
#include <algorithm>
#include <map>
#include <set>
#endif
#include "wordle.h"
#include "dict-eng.h"
using namespace std;
// Add prototypes of helper functions here
void gen_possibilties(string& partial_word, int indx,
int missing_letters, stri... | ALGO | 0.946587 | 5.647377 |
886eab79-0d22-41b5-9e40-f37a62aa03ae | GonzaloMonteodorisio/practicas-teclab | ejercicios_clase/modulo_3/clase_4/ejemplo_vector.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> miVector;
miVector.push_back(10);
miVector.push_back(4);
miVector.push_back(7);
miVector.push_back(8);
std::cout << "El tamaño de mi vector es: " << miVector.size() << endl;
for (int i = 0; i < miVector.size(); i++) {
... | ALGO | 0.944677 | 3.405418 |
18bcf75d-6903-4276-bbfc-5991bac3c9ba | anon-iiswc24/LLMServingSim | astra-sim/extern/network_backend/garnet/gem5_astra/src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp | /*****************************************************************************
dist.cpp -- Implementation of the odometers.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/************************************************************... | ALGO | 0.990466 | 6.558409 |
2d3ae3f7-df2c-4353-91e7-af58be4674b6 | ayush-kumar774/Competitive-Programming | Codeforces/A. Vitaliy and Pie.cpp | // In the name of Aadi Shakti
// We are nothing and you are everything
// Jai Mata Di
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
#define int long long
#define endl "\n"
void solve()
{
int n ;
string s ;
cin >> n >> s;
map... | ALGO | 0.99976 | 4.336476 |
7f60ca62-91e1-42d1-999d-07526d632486 | Dplex/ACMICPC | Acm/1987.cpp | #include <stdio.h>
int r, c;
char data[21][21];
int visit[256];
int max = 0;
void algo(int _r, int _c, int lev) {
if (visit[data[_r][_c]])
return;
if (_r == -1 || _r == r || _c == -1 || _c == c)
return;
visit[data[_r][_c]] = 1;
if (lev + 1 > max)
max = lev + 1;
algo(_r + 1, _c, lev + 1);
algo(_r - 1, _c, ... | ALGO | 0.999368 | 3.776491 |
cf8fe683-9d7b-4a78-94e9-a5a1a9b4a25c | princee09/365dayschallenge | Day223/90. Subsets ll.cpp | class Solution {
public:
vector<vector<int>> subsetsWithDup(vector<int>& nums) {
vector<vector<int>> result;
vector<int> subset;
sort(nums.begin(), nums.end());
backtrack(nums, 0, subset, result);
return result;
}
void backtrack(vector<int>& nums, int start, ve... | ALGO | 0.999913 | 6.653371 |
002aff96-b4af-4aaa-834b-48b95d016476 | hieupm123/swap | code/C++/CSES-Solutions/Additional Problems/Meet in the Middle (1628)/rainboy.cpp | /*
https://cses.fi/problemset/task/1628
Meet in the Middle
practice with Dukkha
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define N 40
#define N_ (1 << (N / 2))
void init_rand() {
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec);
}
int rand_(i... | ALGO | 0.999964 | 4.243381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.