uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1d92e006-3382-4689-9a7c-2438759ed5f4 | BishalPrasad05/Data-Structure-Algorithms | 04. ascii.cpp | #include<iostream>
using namespace std;
int main(){
int ch;
cout<<"Enter the character :";
ch=cin.get();
cout<<"The value of ch is :"<<ch<<endl;
if(ch>=48 && ch<=57){
cout<<"The character is numeric\n";
}
else if (ch>=65 && ch<=90){
cout<<"The character is uppercase\n"... | TOOL | 0.962834 | 3.070444 |
bd625e3f-f28b-4789-9514-dcf52e87ecc7 | Neuronsmatrix/workspace | cses problems set/4p_Graphs/shortest_routes_II.cpp | #include <iostream>
#include <iomanip>
#include <ostream>
#include <fstream>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <array>
#include <algorithm>
#include <functional... | ALGO | 0.999978 | 4.820791 |
7666d09d-dbe0-4325-ba71-22447099023f | code-walker-23/LeetCode-Prep | 0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int low = 0; int high = nums.size() - 1;
while(low <= high){
int mid = low + (high - low)/2;
if(nums[mid] == target)return mid;
else if(nums[mid] > nums[low]){
if(nums[low] <= t... | ALGO | 0.99996 | 6.180299 |
9c8f2219-a49f-4708-8621-03ce284bf558 | feifeigd/Counter-Strike-Global-Offensive | cstrike15_src/engine/networkstringtable.cpp | // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
ConVar sv_dumpstringtables( "sv_dumpstringtables", "0", FCVAR_CHEAT );
#define BSPPACK_STRINGTABLE_DICTIONARY "stringtable_dictionary.dct"
#define BSPPACK_STRINGTABLE_DICTIONARY_FALLBACK "stringtable_dictionary_fallback.dct"
// Th... | TOOL | 0.851734 | 5.437986 |
20f2cbd8-50e0-42d6-8e12-ef5a835093c2 | samueldecarvalhodeveloper/Graph-Algorithms-With-C-Docker-Compose-Bash-Script-CMake-EditorConfig-Object-Oriented-Programming | src/algorithms/directed_acyclic_graph_shortest_path/directed_acyclic_graph_shortest_path_client.cpp | #include <iostream>
#include <vector>
#include "../../constants/graphs.h"
#include "./directed_acyclic_graph_shortest_path.cpp"
using namespace std;
namespace directed_acyclic_graph_shortest_path_client
{
void execute()
{
directed_acyclic_graph_shortest_path graph(NUMBER_OF_VERTICES);
for (co... | ALGO | 0.999647 | 4.973752 |
0bfc7670-69eb-4e77-acb0-7acc0f0521ee | maheshraut07/DSA-Practise | Matrix_find_all_possible_paths_from_top_to_bottom.cpp | /*
Find all possible paths from top to bottom
Difficulty: EasyAccuracy: 72.55%Submissions: 11K+Points: 2Average Time: 10m
Given a N x M grid. Find All possible paths from top left to bottom right.From each cell you can either move only to right or down.
Example 1:
Input: 1 2 3
4 5 6
Output: 1 4 5 6
1 ... | ALGO | 0.99999 | 6.195953 |
3e67b1a5-dd3a-4eed-8b4a-d6f29d28bf8e | Ahmad-AlDeeb/Problem-Solving | AtCoder/Five, Five Everywhere.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define ld long double
#define F first
#define S second
#define vll vector<long long>
#define pb push_back
#define all(v) v.begin(), v.end()
////////////////////////////////... | ALGO | 0.999445 | 5.359269 |
4f6e31df-5d64-4dc7-9ca2-d2882bb3cea1 | RuiqiW/fluid-simulation | extern/libigl/python/py_igl/py_cotmatrix.cpp | m.def("cotmatrix", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& F,
Eigen::SparseMatrix<double>& L
)
{
return igl::cotmatrix(V,F,L);
}, __doc_igl_cotmatrix,
py::arg("V"), py::arg("F"), py::arg("L"));
| ALGO | 0.994743 | 5.819284 |
06ecbd11-19a6-432a-aee5-1e2d936b0009 | richardgeveritt/ilike | src/custom_distribution_proposal_kernel.cpp | #include "custom_distribution_proposal_kernel.h"
#include "likelihood_estimator_output.h"
#include "likelihood_estimator.h"
namespace ilike
{
CustomDistributionProposalKernel::CustomDistributionProposalKernel()
:IndependentProposalKernel()
{
this->proposal_evaluate = NULL;
this->proposal_simulate = NULL;
//thi... | ALGO | 0.919344 | 6.103927 |
123e9c6a-ada4-4551-bdc3-e28052841061 | robert-clayton/KEEPER | src/collision.cpp | #include "collision.h"
bool Collision::AABB(const SDL_Rect& A, const SDL_Rect& B)
{
if (A.x + A.w >= B.x && B.x + B.w >= A.x &&
A.y + A.h >= B.y && B.y + B.h >= A.y)
{
return true;
}
return false;
}
| ALGO | 0.966516 | 5.4749 |
29ea9555-c849-48e4-b7f0-5953a90dee09 | lexuansanh/Self_Driving_Car_Engineer | Lesson_6_Utilizing_Scan_Matching/Exercise-Mapping/libcarla-install/libcarla-install/include/carla/trafficmanager/TrafficLightStage.cpp |
#include "carla/trafficmanager/Constants.h"
#include "carla/trafficmanager/LocalizationUtils.h"
#include "carla/trafficmanager/TrafficLightStage.h"
namespace carla {
namespace traffic_manager {
using constants::TrafficLight::NO_SIGNAL_PASSTHROUGH_INTERVAL;
using constants::TrafficLight::DOUBLE_NO_SIGNAL_PASSTHROUGH... | TOOL | 0.899425 | 6.133065 |
c3ac5718-a299-467b-ac3c-3d7fb1d1d637 | jeff19sab/Bachelor-Thesis | bullet3-master/bullet3-master/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp | #include "btCollisionDispatcherMt.h"
#include "LinearMath/btQuickprof.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/BroadphaseCollision/bt... | ALGO | 0.965114 | 6.807145 |
4cc9b8c4-08b7-4f2c-ae9c-17feb7f4dd93 | kritigupta45/6Companies30days | Google/distinctechosubstrings.cpp | // class Solution {
// public:
// bool check(string &s){
// int j=s.size()/2;
// for(int i=0;i<(s.size()/2);i++){
// if(s[i]!=s[j])return false;
// j++;
// }
// return true;
// }
// int distinctEchoSubstrings(string text) {
... | ALGO | 0.9992 | 5.456399 |
ad97783d-888b-474a-8c0f-55a4d92234fd | adityadeshmukh10/Leetcode | 0045-jump-game-ii/0045-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int jumps = 0;
int current = 0;
int farthest = 0;
for(int i=0;i<nums.size()-1;i++)
{
farthest = max(farthest,i+nums[i]);
if(i==current)
{
current = farthest;
... | ALGO | 0.999985 | 6.049452 |
87ee19e8-f033-4001-b7cc-bb804ef90f7e | berkeodaci/HackerRank-Solutions | 30 Days Of Code/Day 08/C++Solution.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main() {
int times;
string name;
long long int num;
map<string,long long int> myMap;
cin>>times;
for(int i = 0 ; i<times;i++)
{
cin>>name;
ci... | ALGO | 0.992665 | 3.762192 |
59a6650a-50cc-47c3-8189-691b50ed5b1d | hfukuoka/atcoder | algo-method/graph/7-5.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0; i<n; ++i)
template <typename T>
inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
... | ALGO | 0.999984 | 4.13528 |
5a8398a2-59dc-4e25-b460-f1cb80c29746 | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/cgal/examples/Mesh_3/remesh_polyhedral_surface_sm.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>
// Domain
... | ALGO | 0.851354 | 7.410003 |
c70551b0-5291-4c75-b413-b0c1437bcb46 | niickol4s/LLPR-Recuperacao-N1 | formula de bhaskara.cpp | #include <stdio.h>
#include <locale.h>
#include <math.h>
int main() {
setlocale(LC_ALL, "Portuguese_Brazil");
double A;
double B;
double C;
double DELTA;
double R1;
double R2;
printf("Frmula de Bhaskara\n\nInsira os coeficientes da equao: \n");
printf("\nInsira o primeiro coef... | ALGO | 0.999316 | 3.933044 |
a29cd2c1-6e6c-44d8-805e-a12926cf13bd | ishandutta2007/codeforces | icecuber/normal/1097/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int V = 7001;
bitset<V> s[100002];
bitset<V> getmask[V];
bitset<V> init[V];
int square[100], squares = 0;
int squarefree[V];
int main() {
for (int i = 2; i < 100; i++)
square[squares++] = i*i;
ios::sync_with_stdio(0);
cin.tie(0);
... | ALGO | 0.998374 | 4.607805 |
fc992d9a-5f7c-4d3c-956d-3c91d15a3f99 | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/majority-element.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int majorityElement(vector<int>& nums) {
int ans = nums[0], cnt = 1;
for (const auto& i : nums) {
if (i == ans) {
++cnt;
} else {
--cnt;
if (cnt == 0) {
... | ALGO | 0.999958 | 5.941056 |
da4febc1-6d34-45df-925e-d349e3e6adc1 | rahulnishant13/C-Codes | doublelinkrahul.cpp | #include<stdio.h>
#include<conio.h>
#include<malloc.h>
struct node{
int data;
struct node * l;
struct node * r;
};
typedef struct node block;
void insert(block * temp, int data){
while(temp -> r != NULL)
temp = temp ->r;
temp -> r = (block *)malloc(sizeo... | ALGO | 0.999645 | 3.537832 |
ae2b4302-0491-4fd8-a06e-d7554f67f554 | agarwalkshitij/SPOJ-Solved-Questions | ballsag.cpp | //Bottom Up approach
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<vector>
#include<string>
#include<cstring>
#include<stack>
#include<stdlib.h>
#include<queue>
#include<set>
#include<list>
#define pb(x) push_back(x);
#define gc getchar_unlocked
#define pc(x) putchar_un... | ALGO | 0.999942 | 3.298115 |
a2e24f6a-676a-48f0-8249-024384f43b0e | ckmarkoh/AcrosticPoem-RNNPG | first-sentence-generator/main.cpp | /*
* main.cpp
*
* Created on: 10 Mar 2014
* Author: s1270921
*/
/**
* This will be a single program to produce the first sentence,
* considering that there will be naming conflicts in my generation model
* and this one, so I decide to write this as an individual program
*/
/**
* change log
* version ... | DATA | 0.956124 | 4.695724 |
71b10c14-07ca-420e-95c6-426464386b7e | Saikat-SS24/Problem_Solving | LeetCode/Find_Duplicate_File_in_System.cpp | class Solution {
public:
vector<vector<string>> findDuplicate(vector<string>& paths) {
vector<vector<string>> ans;
unordered_map<string, vector<string>> contentToFilePaths;
for (const string& path : paths) {
istringstream iss(path);
string rootPath;
iss >> rootPath; // "root/d1/d2/...... | ALGO | 0.991725 | 6.547975 |
15bc9f5f-05f8-43d3-ba44-3d3e2cbdfaf9 | reddy-v/mission-cpp | Interview/Array/Array/LongestPalindrome.cpp | #include "stdafx.h"
#include "LongestPalindrome.h"
#include <vector>
#include <algorithm>
int LongestPalindrome::Solution1() const
{
string s(2 * str.size() + 3, '#');
auto j = 0;
for (auto i = 2; i < s.size() - 1; ++i)
{
if (i % 2 == 0) {
s[i] = str[j];
j++;
}
}
s[0] = '$';
s[s.size() - 1] = '@';
st... | ALGO | 0.999163 | 4.937572 |
1d1c2534-d79e-4154-bed5-780818b01369 | Dheerajch9401/c-assignment | program.43c.cpp | // string is palindrome or not
#include <stdio.h>
#include <string.h>
int main()
{
char str[] = { "abbba" };
// Start from leftmost and
// rightmost corners of str
int l = 0;
int h = strlen(str) - 1;
// Keep comparing characters
// while they are same
while (h > l) {
if (st... | ALGO | 0.999832 | 3.868711 |
a3120ffb-bb18-4dea-9e2b-402bc75bbcc0 | NikitaaMeena/code2 | swastik.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i,j,mid;
mid = (n+1)/2;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(i==mid||j==mid||j==1&&i<=mid||j==n&&i>=mid||i==1&&j>=mid||i==n&&j<=mid){
cout<<"*"<<" ";
}
else{
cou... | ALGO | 0.999932 | 3.148806 |
fde91ef0-65ac-4c98-9fde-2dad0091f5bd | hacch141/Coding-Practice | GFG/Palindrome-String.cpp | // Palindrome String
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int isPalindrome(string S)
{
// Your code goes here
int start = 0;
int end = S.length()-1;
while(start<end) {
if(S[... | ALGO | 0.999489 | 5.919486 |
312c6e09-7145-4158-b501-b2d6c9328397 | mkmojo/inbox | leetcode/qqy/DecodeWays/main.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<assert.h>
#include<vector>
#include<memory.h>
using namespace std;
class Solution {
public:
int numDecodings(string s) {
if(s.size() <= 1) return s.size();
vector<int> dp(s.size()+1, 0);
dp[1] = 1;
... | ALGO | 0.999483 | 4.553081 |
847d6e53-2578-4821-b354-a3d3a1dfaba2 | JRgit03/Algorithm | voj/ZZJC 2024 Spring Individual Contest-1/I.cpp | #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
int max(int a,int b) {return (a > b ? a : b);}
int min(int a,int b) {return (b > a ? a : b);}
void solve(){
int n; cin>>n;
cout << (1LL << (n - 1)) << "\n";
}
signed main(){
... | ALGO | 0.999923 | 4.914966 |
aee7c9ed-538d-41f1-add5-0ce1f3fde90d | jpark1607/baekjoon_Cplusplus | 2525.cpp | #include <stdio.h>
int main(void) {
int A, B;
int C;
int tA, tB;
scanf("%d %d", &A, &B);
scanf("%d", &C);
tA = C / 60;
tB = C % 60;
A += tA;
B += tB;
if(B > 59) {
A += 1;
B -= 60;
}
if(A > 23)
A -= 24;
printf("%d %d", A, B);
return 0;
}
| ALGO | 0.999417 | 3.680475 |
1a334641-371f-4d92-a832-a1722c17fd57 | NearlyTRex/Boost | libs/bimap/example/bimap_and_boost/range.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.951107 | 6.152916 |
af1b2fab-468c-4797-a1fb-91adafb511ab | fmi-sdp/fmi-sdp-classroom-group7-09-bst-fmi-sdp-24-25 | 06-exam-prep/Task3.cpp | #include "utilities.h"
void reorder_less_than(node<int>* head, int x) {
node<int> dummy(0, head);
node<int>* curr = &dummy;
node<int> dummy_l;
node<int>* larger = &dummy_l;
while (curr && curr->next) {
if (curr->next->data >= x) {
larger->next = curr->next;
curr->next = curr->next->next;
larger = lar... | ALGO | 0.999976 | 4.336408 |
30b80fc3-5296-4acf-9158-0c17b4c1414b | ishandutta2007/codeforces | rosed/normal/1638/C.cpp | #include<bits/stdc++.h>
using namespace std;
namespace red{
#define int long long
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define lowbit(i) ((i)&(-i))
#define mid ((l+r)>>1)
#define eps (1e-8)
const int N=1e6+10,mod=1e9+7,inf=2e9;
int n;
int a[N];
int st[N],top;
int maxn[N],minn[N],col[N];
i... | ALGO | 0.99996 | 4.249291 |
670a67a4-51b0-42d1-8857-d4b6fc1620f4 | SeongmoAhn/ProblemSolving | 1946.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pii pair<int, int>
int T, N;
int main(void) {
cout.tie(NULL); cin.tie(NULL); ios_base::sync_with_stdio(false);
cin >> T;
while (T--) {
cin >> N;
vector<pii> v;
for (int i = 0; i < N; i++) {
... | ALGO | 0.999806 | 4.857269 |
f3f63146-f219-47f3-a298-fa129a56204d | escastroav/Metodos-de-Simulacion-Fisica-2019-1 | clase_17_jun/SumaDeDosVectoresCUDA.cu.cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include <GL/glew.h>
#include <GL/glut.h>
#include <cuda_runtime_api.h>
#include <cuda_gl_interop.h>
using namespace std;
#define Lx 16
#define Nx 8
const int Mx=(Lx+Nx-1)/Nx; //Define la cantidad de bloques suficientes para cubrir la grilla.
//--------------KE... | ALGO | 0.980525 | 3.786756 |
2d214a1f-a583-40e1-9a23-f51d05389cbc | flynn-28/HashLite | examples/hash_text.cpp | #include "HashLite.h"
#include <iostream>
int main() {
std::string input = "Hello, World!"; // define text to be hashed
HashLite sha256(HashAlgorithm::SHA256); // initialize algorithm (in this case SHA-256)
std::cout << "SHA256 Hash: " << sha256.computeHash(input) << std::endl; // hash the text using spe... | ALGO | 0.994611 | 5.594517 |
f02cb6d2-55e3-4abe-a542-2f0badd8608e | Shahshad75/coin_cheko | 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.9988 | 6.76073 |
21cd69e6-d14c-4234-944b-b84681d0755d | Raju-Lama/cpp | discreet/Discrete structure practical manual 2081/8. gcd/main.cpp | #include <iostream>
//8. WAP to find the GCD of two positive integers using euclidian algorithm
int main()
{
std::cout << "Enter two integers : ";
int a, b;
std::cin >> a >> b;
int r ;// for remainder
while((a%b) > 0)
{
r = a % b;//remainder becomes the quotient
a = b; //divide... | ALGO | 0.999427 | 3.296949 |
94823492-b895-47a4-8a76-25788a0f0e80 | alexandraback/datacollection | solutions_5658282861527040_0/C++/jonis/machine.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin>>T;
for(int t=1;t<=T;t++) {
printf("Case #%d: ", t);
int a, b, k;
cin>>a>>b>>k;
int ans=0;
for(int i=0;i<a;i++) for(int j=0;j<b;j++) if((i&j) < k) ans++;
printf("%d\n", ans);
}
return 0;
}
| ALGO | 0.998035 | 3.632053 |
961f5a6e-1a06-40c2-a8c3-fb0297da8dc1 | Anu0825/DSA | tree/diameterOfTree.cpp | //maximum distance(width) between any two nodes
#include<iostream>
using namespace std;
struct Node{
int data;
struct Node* left;
struct Node* right;
Node(int val){
data=val;
left=right=NULL;
}
};
int heightOfTree(struct Node* node){
if(node==NULL){
return 0;
}
in... | ALGO | 0.999818 | 4.500957 |
d19e43e2-2c0d-41c6-8774-294ba0158b9f | fhvirus/CodeArchive | TIOJ/1913.cpp | #include <iostream>
#include <vector>
#include <cmath>
void solve() {
int n;
std::cin >> n;
std::vector<int> v(n);
for (int &i: v)
std::cin >> i;
int ans = 0;
for (int i = 0; i < n; ++i) {
int mn = v[i];
int mx = v[i];
for (int j = i+1; j < n; ++j) {
if (mn > v[j])
mn = v[j];
if (mx < v[j])
... | ALGO | 0.999658 | 4.863855 |
f6fb2578-5aeb-4f9f-937c-ba71594bfb5c | caiyy17/pba-caiyy17 | task04/main.cpp | /**
* @file task04: Accelerated Nearest Search using Kd-Tree
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <chrono>
#include <climits>
#include <cassert>
#define GL_SILENCE_DEPRECATION
#include <GLFW/glfw3.h>
#include <Eigen/Dense>
#include "../src/pba_util_glfw.h"
#include ... | ALGO | 0.999804 | 3.541695 |
05177ad5-b348-4c2e-9c6f-28e0eb3bf419 | purduedb/DB4GenAI | src/optimizer/join_order/plan_enumerator.cpp | #include "duckdb/optimizer/join_order/plan_enumerator.hpp"
#include "duckdb/main/client_context.hpp"
#include "duckdb/optimizer/join_order/join_node.hpp"
#include "duckdb/optimizer/join_order/query_graph_manager.hpp"
#include <cmath>
namespace duckdb {
bool PlanEnumerator::NodeInFullPlan(JoinNode &node) {
return j... | ALGO | 0.996955 | 3.706754 |
209e4c2f-230f-402d-92be-32d286847bed | vinjn/chihuahua | 3rdparty/LibGizmo/src/ZMathsFunc.cpp | #include "stdafx.h"
#include "ZMathsFunc.h"
// Globals ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////... | ALGO | 0.993649 | 4.273044 |
532a17f1-6eeb-4b30-9ac5-dcdbb19532b5 | sarvex/leetcode-ion | solution/2300-2399/2315.Count Asterisks/Solution.cpp | class Solution {
public:
int countAsterisks(string s) {
int ans = 0, ok = 1;
for (char& c : s) {
if (c == '*') {
ans += ok;
} else if (c == '|') {
ok ^= 1;
}
}
return ans;
}
}; | ALGO | 0.999707 | 5.315439 |
550c6db1-3400-49b6-a1c2-87c7fca13435 | ishandutta2007/codeforces | ztc/normal/1173/D.cpp | #include<stdio.h>
long long ans,n,p,q,r[200002];
long long k[200002];
int main(){
scanf("%lld",&n);ans=n;
k[1]=1;
for(int i=2;i<=n;i++)k[i]=k[i-1]*(long long)i%998244353ll;
for(int i=1;i<n;i++){
scanf("%lld%lld",&p,&q);
r[p]++;r[q]++;
}
for(int i=1;i<=n;i++)ans=ans*k[r[i]]%998244353ll;
printf("%lld",ans);
} | ALGO | 0.999864 | 3.787803 |
13c571a0-cea7-4a60-a044-89b3c8cd817d | davidchai21/leetcode-solutions | 557 Reverse Words in a String/ReverseWordsInAString.cpp | class Solution {
public:
string reverseWords(string& s) {
int i=0; int j=0;
int n=s.size();
while (i<n)
{
while (s[i]==' ' && i<n) i++;
j=i+1;
while (s[j]!=' ' && j<n) j++;
reverse(s.begin()+i,s.begin()+j);
i=j;
}
... | ALGO | 0.999972 | 5.838386 |
247b0236-9745-4f29-9b0c-5561f061eaf6 | thedavidhackett/cplusplus | lec_5_files/Matrix.cpp | #include "Matrix.h"
#include <iostream>
#include <chrono>
using namespace mpcs51044;
using namespace std;
int main()
{
auto start = chrono::system_clock::now();
Matrix<3, 3> m = {
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
};
static double total;
for (int i = 0; i < 100'000'000; i++) {
m(1, 1) = i;
total ... | ALGO | 0.999526 | 3.981838 |
756cb62a-1d1b-4e5c-a30b-8088bbb2d5df | DungNguyenManh/Train | Bai3.cpp | #include <stdio.h>
int main()
{
int n;
float sum = 0;
printf("Nhap n: ");
scanf("%d", &n);
printf("S(n) = ");
for (float i = 1; i <= n; i++)
{
if (i == n)
printf("1/%.0f ", i);
else
printf("1/%.0f + ", i);
sum += 1 / i;
}
printf("= %.2... | ALGO | 0.996381 | 3.322763 |
b4f0a2eb-5841-4bed-bf14-d02192ff336f | skagrawal/Udacity-SDC-ND--term-2 | CarND-MPC-Quizzes/global_kinematic_model/src/Eigen-3.3/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.99892 | 3.930508 |
ee4b196d-be11-4a84-9880-b40fbc8c4b95 | jestercn/ybt | 基础(一)C++语言/第三章 程序的控制结构/第一节 if选择结构/1046:判断一个数能否同时被3和5整除.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%3 == 0 && n%5 == 0)
cout<<"YES";
else
cout<<"NO";
return 0;
}
| ALGO | 0.99993 | 3.322896 |
ca63ece4-a076-4f02-8380-7d6c9577098e | jim2832/Data-structure | practice/Ch10_Queue/STL/Leetcode1700.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
class Solution{
public:
int countStudents(vector<int>& students, vector<int>& sandwiches){
queue<int> Queue;
//存每個學生要吃的口味
for(int n:students){
Queue.push(n);
... | ALGO | 0.999837 | 4.98344 |
0fe1ccaa-6af8-4182-93b4-2f2c1d012475 | DarkOfTheMoon/nektar | solvers/CompressibleFlowSolver/EquationSystems/IsentropicVortex.cpp | #include <CompressibleFlowSolver/EquationSystems/IsentropicVortex.h>
using namespace std;
namespace Nektar
{
string IsentropicVortex::className =
SolverUtils::GetEquationSystemFactory().RegisterCreatorFunction(
"IsentropicVortex", IsentropicVortex::create,
"Euler equations for the isentropic... | ALGO | 0.992672 | 5.57978 |
7629f00c-a091-44af-b5e2-fd8fc12e62c8 | Amirhosein-gh98/Field-Runner-Game | FieldRunners.cpp | #include <iostream>
#include <math.h>
#include <algorithm>
#include "rsdl.h"
#include "FieldRunners.h"
#include "Variables.h"
#include "TowerGatling.h"
#include "ReadTextFile.h"
#include "BulletMissle.h"
#include "BulletLightning.h"
#include "BulletGoo.h"
#include "TowerMissle.h"
#include "TowerTesla.h"
#include "Tower... | TOOL | 0.89158 | 3.147096 |
7825aacf-a027-4462-a1ca-9c7797cdacd0 | jyoti-2/Sample_Coding-Question | StringCompression.cpp | /*
To convert a number to a string, use to_string. To concatenate strings, you can simply use +:
*/
#include<bits/stdc++.h>
using namespace std;
string Compression(string s)
{
map<char, int> m;
string res ="";
for(int i=0; i<s.size(); i++)
{
m[s[i]]++;
}
for(auto x : m)
{
... | ALGO | 0.999989 | 5.274016 |
ce5ee2d8-fe03-4779-98ce-620d5ff3128f | yusifaliyevpro/Competitive-Programming | LeetCode/Medium/2130. Maximum Twin Sum of a Linked List.cpp | // 2130. Maximum Twin Sum of a Linked List
// https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list/
#include <iostream>
using namespace std;
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int... | ALGO | 0.999759 | 5.420309 |
d54f66c1-446d-41fb-aa8a-2c8f3270de52 | 2Math0/E_Commerce_Demo | 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.998859 | 6.785645 |
07994b9b-cd64-477c-bda9-27afb89eedb5 | Andrealavi/Computer-Programming-II | Exercises/exercise3.cpp | #include <iostream>
using namespace std;
struct elem {
int n;
elem* next;
};
typedef elem* list;
elem* newElem(int n) {
elem* el = new elem;
el->n = n;
el->next = NULL;
return el;
}
void printList(list l) {
while (l != NULL) {
cout << l->n << endl;
l = l->next;
}
}
list insertElem(list l, elem* e) {... | ALGO | 0.997559 | 4.366574 |
bd499154-cdca-4d0c-8a9e-db7e31b3f820 | jki14/competitive-programming | 2012/CodeJam/Round2/proC.cpp | #include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<climits>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define N 2100
int n,a[N],b[N];
int ret[N],... | ALGO | 0.9995 | 3.43986 |
751b6329-7b79-4ae6-a9b8-7ef1eddb61f7 | muhamadfarissss/STD_M.Faris_2311104017 | 02_Pengenalan_CPP_Bagian_2/Unguided/unguided_no1.cpp | #include <iostream>
using namespace std;
int main(){
int data[10];
cout << "Masukan angka: " << endl;
for (int i = 0; i < 10; i++) {
cin >> data[i];
}
cout << "angka: ";
for (int i = 0; i < 10; i++){
cout << data[i] << " ";
}
cout << endl;
cout << "genap: ";
... | ALGO | 0.990507 | 3.624906 |
cebea47d-7b6f-44a3-82bb-7bd6336c1a9d | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/1300-1399/1344.Angle Between Hands of a Clock/Solution.cpp | class Solution {
public:
double angleClock(int hour, int minutes) {
double h = 30 * hour + 0.5 * minutes;
double m = 6 * minutes;
double diff = abs(h - m);
return min(diff, 360 - diff);
}
}; | ALGO | 0.9996 | 5.913159 |
5e6c24b0-72c6-46b5-a6c6-1f72cb1123a7 | sarvex/leetcode-c | lcof/面试题21. 调整数组顺序使奇数位于偶数前面/Solution.cpp | class Solution {
public:
vector<int> exchange(vector<int>& nums) {
int j = 0;
for (int i = 0; i < nums.size(); ++i) {
if (nums[i] & 1) {
swap(nums[i], nums[j++]);
}
}
return nums;
}
}; | ALGO | 0.999972 | 5.411509 |
f9b04f8f-11c1-40ed-814e-00fc024fae54 | keshav-tech/C-Plus-Plus-Codes | Pointers/Pointers/Pointers.cpp | //Syntax
//<data_type> *name_of_ptr
//int *myIntPointer;
//char *myCharPointer;
// '&' Operator- It gives the address of the variable
// '*' Operator It gives the value stored at the address
#include<iostream>
using namespace std;
int main(){
// int a=10;
// int* aptr=&a;
// cout<<*aptr<<endl;
// *aptr=20;
// cout... | ALGO | 0.998807 | 3.375174 |
c9e109d9-4abb-4241-98e0-e22bc96e920f | MakenaTrust/Wristbands | desktop_photo_search/material/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.996576 | 6.797273 |
ba4da422-4249-4cc3-9bb2-b5db9d9d1f8d | Kishore121523/STL_KIshore | BinarySearch/BinarySearch 1D Arrays/findMinimumInRotatedSortedArray.cpp | #include<bits/stdc++.h>
using namespace std;
int findMinimumInRotatedSortedArrayElements(vector<int> &arr, int n){
int low = 0;
int high = n-1;
int minElement = INT_MAX;
while(low<=high){
int mid = low + (high-low)/2;
if(arr[low] <= arr[high]){
minElement = min(arr[low], minElement);
bre... | ALGO | 0.999991 | 5.621099 |
78198a66-0877-40c5-ae0e-119c2eedbb58 | SadraMoghadam/VulkanAssignments | A00_SLN/VulkanTutorial/VulkanTutorial/External Libraries/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.973426 | 6.277224 |
6c889a2b-c295-4d31-99a6-28f95842819b | DouglasGPSalgado/Faculdade | algoritimos.cpp | #include <iostream>
using namespace std;
// função para ordenação Bubble Sort
void bubble_sort(int vetor[], int tam, int &num_comp, int &num_trocas) {
int i, j, aux;
for (i = 0; i < tam; i++) {
for (j = 0; j < tam - 1 - i; j++) {
num_comp++;
if (vetor[j] > vetor[j+1]) {
... | ALGO | 0.999681 | 5.292835 |
a0e12a12-89ae-4ded-aa70-577a45029a51 | hzding621/algorithms | leetcode/cpp/056_merge_intervals.cpp | struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
bool compareIntervals(Interval i, Interval j) {
return i.start < j. start;
}
class Solution {
public:
vector<Interval> merge(vector<Interval>& intervals) {
sort(intervals.begin... | ALGO | 0.999997 | 6.126377 |
b22ad7e2-1a3c-481c-83af-be7f5d0b8b06 | shuest/leetcode | 73.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
using namespace std;
class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int m = matrix.size(),n = matrix[0].s... | ALGO | 0.99881 | 4.498423 |
fb87ae71-192e-4adf-b474-f1456b7f7bff | gvrkiran/WhatsAppExplorer | data-visualizer/routine/tmk/cpp/lib/vec.cpp | // ================================================================
// Basic allocation and math routines for operating on vectors. Nothing
// original, but I don't want to introduce additional third-party package
// dependencies. These routines keep things simple and local.
//
// Note that one of the primary reasons w... | ALGO | 0.997776 | 7.298094 |
81dabd04-fbca-494b-b5a2-2a2cfe631dff | Ziaeemehr/cpp_workshop | unittest/gtest/01/b/Multiply.cpp | #include "Multiply.hpp"
int
Multiply::twoValues(const int x, const int y)
{
return x * y;
} | TOOL | 0.927762 | 6.003919 |
f850c3dc-9856-4b33-9e1e-0736ad299a88 | zxyDEDIRE/ACM_CODE | 牛牛/牛客周赛 Round 9/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
using pdd=pair<double,double>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int inf=0x3f3f3f3f;... | ALGO | 0.999944 | 3.417758 |
3e3189e3-0c45-4703-9d4e-b71d7050cba1 | mako-tutor/llvm | libcxx/test/std/containers/sequences/vector.bool/max_size.pass.cpp | // <vector>
// vector<bool>
// size_type max_size() const;
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdint>
#include <limits>
#include <memory>
#include <type_traits>
#include <vector>
#include "min_allocator.h"
#include "sized_allocator.h"
#include "test_allocator.h"
#include "test_macr... | TEST | 0.919014 | 6.807151 |
a71d8472-3399-4918-8349-19393550d0cf | Promethe-us/gtsam | gtsam/3rdparty/Eigen/lapack/eigenvalues.cpp | #include "lapack_common.h"
#include <Eigen/Eigenvalues>
// computes eigen values and vectors of a general N-by-N matrix A
EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info))
{
// TODO exploit the work buffer
bool query_size = *lwork==-1;... | ALGO | 0.998426 | 4.671507 |
a5c598da-e256-4bda-a99b-ef5e2e63916c | undefina/fwgghack | cd/上下界网络流板子.cpp | #include <bits/stdc++.h>
using namespace std;
//
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define qwq ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define QWQ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define jum... | ALGO | 0.999946 | 3.321961 |
dd785c35-df76-46f2-8a6b-2ffc00ed389d | ziglang/zig-bootstrap | llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp | #include "llvm/Analysis/BlockFrequencyInfoImpl.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/BlockFrequency.h"
#include "llvm/Support/BranchProbab... | TOOL | 0.948838 | 7.890439 |
d2ff6e74-cace-4839-8a46-a454984e0636 | GouravPal14/ACC45DAYSOFCODE-2024 | Day16-NOTEBOOK.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t,n;
cin >> t;
while(t) {
cin >>n;
cout << 10*n << endl;
t--;
}
return 0;
} | ALGO | 0.99935 | 4.263597 |
31afda8a-852e-44ee-b72a-eabea3d31a44 | ishandutta2007/codeforces | krijgertje/normal/931/C.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999988 | 3.489861 |
8d3326b9-a8b4-4d2c-8a62-fc8b1a15bbf4 | OpenTenBase/TXSQL | boost/boost_1_77_0/libs/graph/example/graph-property-iter-eg.cpp | #include <boost/config.hpp>
#include <string>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/property_iter_range.hpp>
int main()
{
using namespace boost;
typedef adjacency_list< listS, vecS, directedS,
property< vertex_name_t, std::string > >
graph_t;
gr... | ALGO | 0.964736 | 5.070078 |
bae73f76-8913-40e3-8bd2-3706a8ba30d5 | SINGHVISHVJEETSECTIONV2/assignment | Pattern program-2.cpp | #include <stdio.h>
int main()
{
int i, j, n;
printf("Enter value of n: ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
for(j=1; j<=i; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
| ALGO | 0.999643 | 3.51669 |
3150ec50-fda9-43d4-80b0-1cfb046e2c71 | Pksubudhi25/LeetCode | String/151-reverse-words-in-a-string/reverse-words-in-a-string.cpp | #include <string>
#include <algorithm>
class Solution {
public:
std::string reverseWords(std::string s) {
int i = 0, l = 0, r = 0;
int n = s.size();
reverse(s.begin(), s.end()); // Reverse the entire string first
while (i < n) {
while (i < n && s[i] != ' ') {
... | ALGO | 0.999969 | 6.736279 |
e2982c32-a634-48fe-a32a-24a587746a05 | AndreVsc/Flutter-framework-widgets | flutter_exercicie_3/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.997116 | 6.76775 |
f370ffb1-e5bd-4c69-bcb8-b7b861f071d6 | SteveFauci/Learn_c_again | 202505/leetcode/1-linked_list/2-双指针技巧.cpp | // 注意23行和24行要一步一个脚印,不然会ub
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(nullptr) {
}
};
class Solution {
public:
bool hasCycle(ListNode* head) {
ListNode* ptr1 = head;
ListNode* ptr2 = head;
if (ptr1 == nullptr)
return false;
... | ALGO | 0.999745 | 4.859063 |
7862a9b9-d668-49b6-9a60-7dde585741b0 | liuyunian/Program | Algorithm/Bubble.cpp | #include <iostream>
#include "sortTestHelp.h"
template <typename T>
void bubbleSort(T * arr, T n){
for(int i = 0; i < n-1; ++ i){
for(int j = 0; j < n-i-1; ++ j){
if(arr[j] > arr[j+1]){
std::swap(arr[j], arr[j+1]);
}
}
}
}
int main(){
int n = 100;
... | ALGO | 0.998899 | 5.451517 |
4c5e8852-229c-4be3-a50d-123b741fd6de | sarvex/leetcode-s | solution/2200-2299/2226.Maximum Candies Allocated to K Children/Solution.cpp | class Solution {
public:
int maximumCandies(vector<int>& candies, long long k) {
int left = 0, right = 1e7;
while (left < right) {
int mid = (left + right + 1) >> 1;
long long cnt = 0;
for (int& v : candies) cnt += v / mid;
if (cnt >= k)
... | ALGO | 0.999987 | 5.65281 |
7b08cb99-f114-4d3e-887a-ddd579eb1787 | shafitanvir31/aigame | Heuristics.cpp | #include "Heuristics.hpp"
namespace {
constexpr int DR[4]{-1, 1, 0, 0};
constexpr int DC[4]{ 0, 0,-1, 1};
inline int orb_count(const GameState &s, Player p)
{
int total = 0;
for (auto &row : s.board)
for (auto &c : row)
if (c.owner == p) total += c.count;
... | ALGO | 0.999939 | 5.382965 |
5ce762b5-37f0-4226-8004-68397d94a54e | nirmit06/Competitive-Programming | A_Elections.cpp | #include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
bool isPrime(int n)
{
if (n <= 1)
return false;
for (int i = 2; i < n; i++)
if (n % i == 0)
return false;
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin>... | ALGO | 0.999878 | 4.320755 |
2099760b-7f85-4f94-97a5-0e761c944c4f | darshanp2005/My-DSA-Codes | 15Heap/heapclass4Codes/main (5).cpp | class node {
public:
char data;
int count;
node(char d, int c) {
data = d;
count = c;
}
};
class compare {
public:
bool operator()(node a, node b) {
return a.count < b.count;
}
};
class Solution {
public:
string reorganizeString(string s) {
//creat... | ALGO | 0.999998 | 5.946352 |
bdfcbc61-514a-4399-9632-f2d1785dc816 | baidu/bigflow | flume/planner/spark/merge_task_pass.cpp | // Author: Pan Yuchang <<EMAIL>>
// Zhang Yuncong <<EMAIL>>
// Wang Cong <<EMAIL>>
//
#include "flume/planner/spark/merge_task_pass.h"
#include <set>
#include "boost/foreach.hpp"
#include "boost/lexical_cast.hpp"
#include "glog/logging.h"
#include "toft/base/unordered_set.h"
#include "flume/planner/... | ALGO | 0.98933 | 3.963397 |
385b7705-3eee-44bc-b66a-983fb4cdef9c | One-Fist-Man/UVA-solutions | 353 Pesky Palindromes.cpp | //#include<bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//int main()
//{
// set<string>st;
// string s;
// while(cin>>s)
// {
// int counti=0;
// for(int i=0; i<s.size(); i++)
// {
// for(int j=1; j<=s.size(); j++)
// {
// string s2;... | TEST | 0.922635 | 3.604212 |
f0d954fe-3641-46f6-9e02-0b54f375c5b1 | VA-run23/Data-Structures-And-Algorithms | stacksAndQueue-Done/reverseAStack.cpp | //Done
//TC:
//
#include <bits/stdc++.h>
using namespace std;
// Function to insert an element at the bottom of a stack
void insertAtBottom(stack<int> &st, int ele) {
// Base case: If stack is empty, push the element
if (st.empty()) {
st.push(ele);
return;
}
// Recursive case: Pop the... | ALGO | 0.999904 | 5.612912 |
e7b8e9d1-b35d-4866-ae0c-e88b3b780b33 | ngng628/competitive-programming | atcoder/ABC/ABC096/D/main.cpp | # ifndef ONLINE_JUDGE
# include <nglib/atcoder.hpp>
# endif
# ifdef ngng628_library
class Random {
public:
Random() : x(1859738746), y(9707750167), z(2653432786), w(3463085849) {}
[[nodiscard]] int nextInt(int n) noexcept {
uint64_t t = (x ^ (x << 11));
x = y; y = z; z = w;
w = (w ^ (w >> 19)... | ALGO | 0.999905 | 4.406599 |
bae434b8-4cf6-49f9-b5d0-7d94c3fe4b6d | Yili-code/LeetCode-CPP-Optimal-Solutions | medium/0494-Target-Sum/solution.cpp | class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
int sum = accumulate(nums.begin(), nums.end(), 0);
if ((sum + target) % 2 != 0) return 0;
if (sum < abs(target)) return 0;
int plus = (sum + target) / 2;
// sort vector nums from smaller to great... | ALGO | 0.999995 | 6.259883 |
f4546b6c-8425-4056-8398-16609e7891ae | sophgo-forum-service/opencv | samples/cpp/minarea.cpp | #include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help()
{
cout << "This program demonstrates finding the minimum enclosing box, triangle or circle of a set\n"
<< "of points using functions: minAreaRect() minEnclosingTr... | ALGO | 0.997059 | 5.679333 |
87da4267-54d8-48f5-a8b2-60d37e2b8be6 | Revtm/leetcode | redistribute-characters.cpp | #include<bits/stdc++.h>
using namespace std;
bool makeEqual(vector<string>& words) {
int n = words.size();
if(n == 1){
return true;
}
unordered_map<char, int> charMap;
for(string i : words){
for(char c : i){
charMap[c]++;
}
}
for(auto &j : charMap){
... | ALGO | 0.999546 | 5.006974 |
3a32d8c3-b9c2-4eda-a7f6-449ad559b128 | ducbrick/CP | CSES/Building Teams/main.cpp | // Problem: Building Teams
// Contest: CSES Problem Set
// Judge: CSES
// URL: https://cses.fi/problemset/task/1668
// Memory Limit: 512
// Time Limit: 1000
// By DUCBRICK
#include <bits/stdc++.h>
#include <vector>
using namespace std;
const int N = 1e5;
vector<int> adj[N + 1];
int team[N + 1];
void dfs(int u, int ... | ALGO | 0.999981 | 5.302727 |
c72f42bf-1827-4f30-9fef-871fd2032748 | Rajbirsakib/Codeforces_Solution | 753A - Linear Keyboard.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long t,n;
cin>>t;
while(t--){
string a,s;
cin>>a>>s;
int arr[26];
for(int i=0;i<a.size();i++){
arr[a[i]-'a']=i;
}
int sum=0;
for(int i=1;i<s.size();i++){
sum=sum+abs(... | ALGO | 0.999869 | 4.758151 |
f01e771c-446c-475b-8729-0ae372b55f7b | QuantumSuhani/DSA | 204-count-primes/count-primes.cpp | class Solution {
public:
int countPrimes(int n) {
vector<bool>prime(n+1,true);
int cnt=0;
prime[0]=prime[1]=0;
for(int i=2;i<n;i++){
if(prime[i]){
cnt++;
for(int j=2*i;j<n;j=j+i){
prime[j]=0;
}
... | ALGO | 0.999966 | 5.457982 |
ff8682d1-46f6-4744-806f-814ca2635946 | Johniel/contests | atcoder/abc304/A/main.cpp | // github.com/Johniel/contests
// atcoder/abc304/A/main.cpp
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
// #define endl "\n"
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.s... | ALGO | 0.999941 | 4.370563 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.