uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9c53f408-0309-430a-842e-d7a4f7f609e6 | 52North/IlwisObjects | core/geos/src/index/quadtree/NodeQuadTree.cpp | #include <geos/index/quadtree/Node.h>
#include <geos/index/quadtree/Key.h>
#include <geos/geom/Envelope.h>
#include <string>
#include <sstream>
#include <cassert>
#ifndef GEOS_DEBUG
#define GEOS_DEBUG 0
#endif
#if GEOS_DEBUG
#include <iostream>
#endif
using namespace std;
using namespace geos::geom;
namespace ge... | ALGO | 0.999202 | 6.453052 |
f1a22f3e-ca8a-494e-aff0-1ac4235c7f66 | jevinskie/llvm-project-jev-embedded | libc/src/math/generic/truncf.cpp | #include "src/math/truncf.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return fputil::trunc(x); }
} // namespace __llvm_libc
| ALGO | 0.995203 | 6.396059 |
aab9787c-8c82-4f9e-9208-b54a7d242ff7 | vikashtocode/coding-block-practice-question | circularQueue.cpp | #include <iostream>
using namespace std;
class queue
{
public:
int a[5];
int first;
int last;
int sz,n;
queue()
{
first=0;
last=0;
n=5;
sz=0;
}
int size()
{
return sz;
}
void push(int val)
{
if(isfull())cout<<"queue is full"<<endl;
a[last]=val;
last=(last+1)%n;
... | ALGO | 0.998938 | 3.879216 |
79969ae5-5dfa-403d-9e4c-488caad0ee0a | ghost1412/LeetCode | problems/missing_number/solution.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int x = nums[0]^0, n = nums.size();
for(int i=1; i<n; i++){
x = x^nums[i]^i;
}
return x^n;
}
}; | ALGO | 0.999947 | 5.530973 |
e1c7387e-19fa-46f3-84bd-d58ac3f64d49 | imarquez21/NSD | Practical1/Exercise7.GraphDetails-master/Exercise.7.NodeDegrees.cpp | //First Exercise
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <iterator>
#include "Adjacency_Matrix.h"
using namespace std;
void readMatrixFile(string filename, int lines){
ifstream matrix_file(filename);
int nodeA;
... | ALGO | 0.994099 | 4.50649 |
af28abde-7ee8-4af4-a29c-d0b6330f7863 | sahilkhan03/CF-Solutions | codeforces/1358/D.cpp | /*
Author : DemonStar
*/
#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<... | ALGO | 0.999929 | 4.064331 |
db4734d5-e474-4147-bcda-4c2e881cf890 | nasibova/cpp | perimetr.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,p;
cin>>a>>b;
p=(a+b)*2;
cout<<p;
return 0;
}
| ALGO | 0.993553 | 3.412847 |
747cfbdc-70b0-4f5f-91d0-861e80fa8108 | AdsonFS/beecrowd-codes | codes/1478.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define debug(x) cout<<#x << " = "<<x<<endl;
#define pi 3.14159265358979323846264338
#define all(S) (S).begin(), (S).end()
#define INF 0x3f3f3f3f
#define pb push_back
#define mk make_pair
#define MAX 10010
#define S secon... | ALGO | 0.99987 | 3.220884 |
397b8e4a-42ee-4432-ad67-3a29f4e59594 | dudgh9661/algorithmPractice | 알파벳 /main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
* 제약 조건
* 1. 말은 지금까지 지나온 알파벳과 다른 알파벳으로만 이동할 수 있다.
* 2. 말이 지나는 칸은 좌측 상단의 칸도 포함
* 3. 상하좌우로 인접한 네 칸 중의 한 칸
*
* 방문 표시를 안지워도 되나? 어차피 못가는 곳이니깐..?
*
* 출력 : 말이 최대한 몇 칸을 지날 수 있는지를 구하는 프로그램을 작성
*/
int R, C; //R C열
bool alpha[25] = { fa... | ALGO | 0.998737 | 4.245722 |
69052a0a-8896-4843-a456-d50e94b48ca0 | Programmer-Kenton/DataStruct-Cpp | chapter03-stack-queue/Stack/LeetCode/validBracket.cpp | /**
* @Description 利用栈实现括号匹配
* @Version 1.0.0
* @Date 2024/4/7 16:45
* @Author Kenton
*/
#include "iostream"
#include "stack"
bool isLeft(char c){
return c == '(' || c == '[' || c == '{';
}
bool isMatch(char left,char right){
return left == '(' && right == ')' ||
left == '[' && right == ']' ||
l... | ALGO | 0.990665 | 6.671268 |
ab165bfa-1767-4395-b107-49ba19c2194d | Kaulwarmythri/DSA | 1544-make-the-string-great/1544-make-the-string-great.cpp | class Solution {
public:
string makeGood(string s) {
for(int i=0; i+1<s.size(); i++) {
if(abs(s[i] - s[i+1]) == 32) {
s = s.substr(0, i) + s.substr(i+2);
i = max(-1, i-2); //move it 2 chars behind so that after increment we go to prev element and see if we can... | ALGO | 0.999897 | 5.911279 |
b070c7eb-e3c1-44ca-a581-5f756ad59582 | udaysrinu/leetcode-solutions | leetcode-explore-challenge-card-30-day-leetcoding-challenge-531-week-4-3310.cpp | class Solution {
public:
bool canJump(vector<int>& A){
int end=A.size()-1;;
for(int i=A.size()-2;i>=0;i--){
if(A[i]+i >= end){
end=i;
}
}
if(end==0){
return 1;
}
return 0;
}
}; | ALGO | 0.99988 | 5.775499 |
53911d8d-496c-4feb-ae6f-4cde0b866c0f | beingprogrammed/COSM-sem-5 | median-individual.cpp | #include<iostream>
#include<algorithm> // To use sort function
using namespace std;
int main(){
int n;
float median;
cout<<"Enter the number of elements in the series: ";
cin>>n;
float series[n];
for (int i = 0; i < n; i++) {
cout<<"Enter the "<<i<<"th element of the series: ";
... | ALGO | 0.999989 | 4.914191 |
53f03368-605d-401d-9acd-af115d3a2dd9 | stkumar23/thiru_practice | leetcode/cpp/maxdepthbinarytree104.cpp | // Leetcode - 104 - Maximum Depth of Binary Tree
// Given the root of a binary tree, return its maximum depth.
// A binary tree's maximum depth is the number of nodes along the
// longest path from the root node down to the farthest leaf node.
//
// ex: root = [3,9,20,null,null,15,7] => 3
// ex: root = [1,null,2] => 2... | ALGO | 0.999846 | 6.741491 |
20cf4a1a-a276-40dc-9c5c-bda967d3046a | QuachTinh68/LessonCode | C++/Trash/C++ CopyCode/ThuHangCacPhanTuCuaMang.cpp | #include<bits/stdc++.h>
using namespace std;
bool cmp(int l, int r)
{
return r<l;
}
int main(){
int n;
cin >> n;
int h[n], a[n];
for (int i=0; i<n; i++){
cin >> h[i];
a[i]=h[i];
}
int count=1;
sort(h,h+n,cmp);
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
if(a[i]==h[j]) {
cout << j+1 <<endl;
... | ALGO | 0.999819 | 3.667008 |
6dc8a10b-3119-4a2b-984d-6d30adbaf928 | LuminousXLB/sjtuoj | 1101_ac/main.cpp | // 1101. SuperXOR
// #554592 正确 / 分数:100 / 时间:80ms / 内存:1080kb
#include <iostream>
using namespace std;
int main(int argc, char const* argv[])
{
#ifndef ONLINE_JUDGE
freopen("test.in", "r", stdin);
#endif
int T;
cin >> T;
for (int t = 0; t < T; ++t) {
unsigned long long num;
cin >> nu... | ALGO | 0.999415 | 5.403345 |
105dd5c0-6c5c-45c2-ac2b-d1055a052e84 | popomoo/Practice_LeetCode | 148_Sort_List_Shift_up.cpp | using namespace std;
/*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* sortList(ListNod... | ALGO | 0.999993 | 5.569786 |
02a4fb40-d1e8-41c1-bc66-ceb989267b3b | sifakis/CS639S23_Demos | DenseAlgebra/GEMM_Test_0_7/Utilities.cpp | #include "Utilities.h"
#include <algorithm>
#include <cmath>
#include <memory>
#include <new>
#include <random>
void* AlignedAllocate(const std::size_t size, const std::size_t alignment)
{
std::size_t capacity = size + alignment - 1;
void *ptr = new char[capacity];
auto result = std::align(alignment, size... | TOOL | 0.969394 | 5.636806 |
c76156b2-f73d-4113-9e31-387b1f95f541 | mansinerkar-11/GeeksForGeeks | Program_to_print_reciprocal_of_letters_copy.cpp | //{ Driver Code Starts
// Driver function
#include <iostream>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
string reciprocalString(string S)
{
for(int i=0;i<S.size();i++)
{
if(islower(S[i]))
S[i]=97+122-S[i];
else if(isupper(S[i... | ALGO | 0.999578 | 5.999463 |
8bc472fc-dcef-4ff6-a7b8-26fe438e4fc5 | 920052859/Cod_ProblemasResueltos_Codeforce | C - Chat Server's Outgoing Traffic.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
char palabra[103];
int longi;
int pepe=0,res=0,efe=0;
while(cin>>palabra){
if(palabra[0]=='+'){
pepe++;
} else if(palabra[0]=='-'){
pepe--;
} else {
longi=strlen(palabra);
for(int i=0;i<longi;i++){
if(palabra[i]==':'){
res=(longi-i-1)*pep... | ALGO | 0.997382 | 3.45062 |
8150ff80-5b46-41ec-ba26-d2b850deb1ab | ACELab-SHU/LCTES-25-Artifact | zoozve/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | #include "clang/ARCMigrate/ARCMTActions.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Config/config.h"
#include "clang/Driver/Options.h"
#include "clang/ExtractAPI/FrontendActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/Fronte... | TOOL | 0.926183 | 7.59068 |
8489c7b1-b835-4b56-83b3-f2c5f708b27f | suraj101998/LeetCodeSolutions | 2000-2099/2022.Convert 1D Array Into 2D Array/Solution.cpp | class Solution {
public:
vector<vector<int>> construct2DArray(vector<int>& original, int m, int n) {
if (m * n != original.size()) {
return {};
}
vector<vector<int>> ans(m, vector<int>(n));
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
... | ALGO | 0.999253 | 6.576219 |
932133da-f757-4739-b1e5-2ac571ecd2d6 | NinthBurn/pdp_labs | lab5/lab5_opt.cpp | #include <iostream>
#include <mutex>
#include <thread>
#include <vector>
#include <string>
#include <condition_variable>
#include <list>
#include <functional>
#include <future>
#include <random>
#include <queue>
#include <span>
#include <chrono>
using namespace std;
#define POLY1_SIZE 20000
#define POLY2_SIZE 20000
#... | ALGO | 0.99907 | 5.487039 |
a841caa7-9467-49f8-a793-b78c8362ae10 | joan0802/Leetcode_practice | 198. House Robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
if(nums.size() == 1)
return nums[0];
vector<int> dp(nums.size(), 0);
dp[0] = nums[0];
dp[1] = nums[1];
int len = nums.size();
for(int i = 2; i < len; i++) {
for(int j = i-2; j >= 0; j--) {
... | ALGO | 0.999951 | 5.956786 |
4b0dda8d-76ac-45b4-ba84-af274626473f | spothound/-UGR-Primero-de-inform-tica. | primer cuatrimestre/FP/comp/otros/menu.cpp | #include<iostream>
using namespace std;
int MaximoDe(int a, int b){
int maximo = a;
if ( b > maximo )
maximo = b ;
return maximo ;
}
void Menu(){
cout << "Menu: " << endl
<< endl << " I. Introducir numeros. "
<< endl << " S. Suma "
<< endl << " P. Producto"
<< endl << " M. Maximo"
<< endl <... | ALGO | 0.985707 | 3.602664 |
9ddd8358-4955-4d1c-ad64-c00e81de5094 | Iamutkarshkumar/LEETCODE | 3445-lexicographically-minimum-string-after-removing-stars/3445-lexicographically-minimum-string-after-removing-stars.cpp | class Solution {
public:
string clearStars(string s) {
int n = s.size();
// g[c] will hold a stack of indices of character 'a'+c
vector<stack<int>> g(26);
vector<bool> rem(n, false);
// 1) Mark every ‘*’ for removal, and remove the smallest letter to its left
for (in... | ALGO | 0.999879 | 5.284673 |
075bc373-0a4a-408f-8767-a083b4d51038 | davdleet/algorithms-practice | AA/46/AA.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
//freopen("input.txt", "rt", stdin);
int N, K;
cin >> N;
vector<int> arr;
for (int i = 0; i < N; i++)
{
int num;
cin >> num;
arr.push_back(num);
}
cin >> K;
int count... | ALGO | 0.999992 | 4.49073 |
1fad375a-a901-4891-b8e4-e4cfe5017b2e | ishandutta2007/codeforces | triple__a/normal/1189/E.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=300007;
ll n,p,k;
ll a[maxn],ans[maxn];
bool fg[maxn];
ll mult(ll a,ll b){
return (a*b)%p;
}
int main(){
memset(fg,0,sizeof(fg));
scanf("%lld%lld%lld",&n,&p,&k);
for (int i=1;i<=n;++i){
scanf("%l... | ALGO | 0.999944 | 3.523119 |
756b7d0a-7230-41e9-977d-f1f44d2f0d14 | damianmakurat/pg-third-course-cpp | Roslina.cpp | #include "Roslina.h"
#include "Swiat.h"
#include <cstdlib>
#include <iostream>
Roslina::Roslina(Swiat* swiat, int x, int y, int sila, char symbol)
: Organizm(swiat, x, y, sila, 0, symbol) {}
void Roslina::akcja() {
sprobujRozprzestrzenanie();
}
void Roslina::kolizja(Organizm* atakujacy) {
std::cout << "Organ... | TOOL | 0.945821 | 4.93831 |
bfc9ffb4-8d57-4244-ad24-6233a5bbacc3 | MaheshPrograms/CPP | DSL Exam Practice/stack1.cpp | #include <iostream>
using namespace std ;
class stack
{
private :
int top ;
int arr[50];
int MAX_SIZE= 50;
public :
stack();
void push(int);
void pop();
bool isEmpty();
bool isFull();
int get_top();
void display();
};
void... | ALGO | 0.974725 | 4.049632 |
4b4a56f3-a2ad-4eb0-92fc-91f2758e9666 | AnsonJIang-Pku/Programming-Design-and-Internship-2023-Algorithm | 02 递归/(Semi-WA)A:Boolean Expressions.cpp | //如何区分优先级?将表达式分为不同的层次:&|为外层,!()VF为内层
//为什么没有写出&的优先级高于|的优先级?(因为给出的测试样例里没有考虑这种情况)
// (V | F & F) 与表达式 ((V|F) & F)不等价
//所以这种写法严格上来说是错误的
#include <iostream>
using namespace std;
bool expression_value();
bool factor_value();
bool expression_value()
{
bool res = factor_value();
while(true)
{
char op = c... | ALGO | 0.996976 | 3.617481 |
0a6399e5-18ba-4654-bb43-e2fb370f7a95 | Arif-462/algorithom_cpp | Week 7 Introduction to Dynamic Programming/Module 21 Solving DP/21-3 Tabulation and Memorization in code.cpp | /*
# DP Steps:
+++++++++++
-> Define State
-> Identify the recursive equation from the smaller problems
-> Define base cases
# Memorization - Method (Recursive)
===================================
fun(n, a , c......)
{
// 1. Handle base case
// 2. if current state is already solved, return the re... | ALGO | 0.999993 | 5.815244 |
112b0556-66d3-4b01-a8eb-cc8f19a185e9 | alexandraback/datacollection | solutions_5744014401732608_0/C++/lunawyll/contest.cpp | #include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <cmath>
#include <cassert>
using namespace std;
void task();
int main() ... | ALGO | 0.999156 | 4.144306 |
ae884a2f-4fdd-4fd1-9ad3-130b00fba8b2 | prabhjotschugh/DSA-Solutions | 1160-find-words-that-can-be-formed-by-characters/1160-find-words-that-can-be-formed-by-characters.cpp | class Solution {
private:
int isvalid(string s, unordered_map<char, int>map) {
int n = s.size();
for (auto i : s) {
auto it = map.find(i);
if (it != map.end() && it->second > 0) {
map[i]--;
} else {
return 0;
}
}... | ALGO | 0.999933 | 6.158779 |
01da2bce-b014-4fd7-8b1d-4bc8a9e4e7c1 | osmakins/cpplab | pointers/main.cpp | /*Goal: Examine pointers!*/
#include <iostream>
int main()
{
int a = 54;
int *pointerToA = &a;
std::cout << "pointerToA gets the address of a = " << pointerToA << "\n";
std::cout << "*PointerToA gets the value of a = " << *pointerToA << "\n";
return 0;
} | ALGO | 0.858145 | 3.376153 |
42aa0f55-062e-45f9-83f0-a20e97b57003 | u0empty/algorithm | BOJ/잃어버린괄호.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string str;
cin >> str;
vector<string> v;
int prev = 0;
int curr = str.find('-');
while (curr != string::npos) {
string tmp = str.substr(prev, curr - prev);
v.push_back(tmp);
prev = curr + 1;
curr = str.find('-',... | ALGO | 0.999959 | 4.099576 |
7cc0fb20-3e6f-477c-b2a4-8a96a1409b20 | namespace123/CPlusPlus-programming | chapter10/C++X lambda.cpp | #include<iostream>
#include<boost/lambda/lambda.hpp>
using namespace std;
using namespace boost::lambda;
int main(){
int a[] = {30, 90, 10, 40, 70, 50, 20, 80};
const int N = sizeof(a) / sizeof(int);
vector<int> v(a, a + N);
vector<int>::iterator p = find_if(v.begin(), v.end(), _1 > 40);
if(p == v... | ALGO | 0.999747 | 3.88397 |
e1909ff3-24f5-41d2-a5e5-ed29102ea1c7 | kinaphar/AtCoder | ABC/ABC282/d.cpp | #include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
typedef long long ll;
#define I_MAX 2147483647;
#define LL_MAX 9223372036854775806;
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)
#define repl(i, s, n) for (ll i = s; i < (int)(n); i++)
int main() {
int n, m;
cin >> n >> m;
int a... | ALGO | 0.999919 | 4.359152 |
455a631b-0def-4796-a357-04d743a20bf7 | alexandraback/datacollection | solutions_5731331665297408_0/C++/Orpinexyw/C.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
//#include <map>
using namespace std;
int T, n, m;
string c[108];
vector<int> v[108];
int map[108][108];
bool vis[108], vv[108], inq[108];
void add(int a, int b)
{
v[a].push_back(b);
... | ALGO | 0.999997 | 4.387729 |
096fa933-d053-4c5d-a490-e9a88db6f69d | nova-cz/Practicando-Cpp | 1Bases/13-funciones.cpp | #include <iostream>
using namespace std;
int vec[100], tam;
void pedirDatos(){
cout << "Digite el tam del vector: ";
cin>> tam;
for(int i = 0; i < tam; i++){
cout<<"Digite el valor del elemento ["<<i<<"]: ";
cin>>vec[i];
}
}
void cambiarSigno(int vec[], int tam){
for(int i = 0; i < tam; i++)
... | ALGO | 0.998608 | 3.475893 |
0b4df14e-dc3c-41d6-847f-5be174b651de | nathaliaop/tep | Matemática/Fundamentos/Simulações/coconuts_revisited.cpp | // https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=557
/*
The middle of adventure, such a perfect place to start
⣿⣿⣿⣿⣿⣿⣿⢿⠟⢿⣿⣿⣿⣿⠿⠛⠛⠿⢿⣿⣿⣿⣿⠛⣿⢿⣿⣿⣿⣿
⣿⣿⣿⡿⢿⣿⣿⣄⠄⣼⣿⡿⠋⠄⠄⠄⠄⠄⠄⠄⠛⣿⣿⠄⢀⣤⣿⣿⣿⣿
⣿⣿⣷⣤⣸⣿⠛⡛⢛⣿⠋⠄⠄⢀⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⡿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⡿⠁⠄⠁⠈⠄⠄⠄⠄⣿⡀⠄⠄⠄⠄⠄⠄⠄⠓⠸⠏⠄⢹⣿⣿⣿
⣿⣿⣿⡿⠄⠄⠄⠄⠄⠄⠄⢠⠿⠿⢻⣦⣤⣠⠄⠄⠄⠄⠄⠄⠄⠄⠈⠻⣿⣿
⣿⣿⡿⠁⠄⠄⠄... | ALGO | 0.99982 | 4.816036 |
c21dc6d0-5f1f-499f-984f-ea100f483028 | kazunetakahashi/atcoder | 201510_201609/0621_ARC047/D2.cpp | #include <iostream>
#include <algorithm>
#include <set>
using namespace std;
const int M = 5005;
const int infty = 1e9;
int ary[2][10010];
int sum[2][10010];
void query_1(int A, int B, int C) {
ary[0][A] += C;
ary[0][B+1] -= C;
}
void query_2(int A, int B, int C) {
ary[1][A+M] += C;
ary[1][B+1+M] -= C;
}
v... | ALGO | 0.996399 | 4.289046 |
364fe6e4-8153-40f5-be79-e0cb71811bae | gpzero/android_frameworks_base | media/libstagefright/codecs/amrnb/common/src/pred_lt.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "pred_lt.h"
#include "cnst.h"
/*----------------------------------------------------------------------------
; MACROS
; Define module specifi... | ALGO | 0.999642 | 6.58222 |
661fc87a-5b9c-4952-9f0c-7537e680f9f4 | ishandutta2007/codeforces | mr_spade/normal/799/D.cpp | #include<cstdio>
#include<cmath>
#include<algorithm>
#define int long long
using std::max;
using std::min;
const int N(1e5+5),inf(1e9);
int a,b,h,w,n,ans(inf);
int s[N];
inline int read()
{
int sum(0);
char x;
while((x=getchar())<'0'||x>'9');
for(;x>='0'&&x<='9';x=getchar())
sum=(sum<<3)+(sum<<1)+x-'0';
return s... | ALGO | 0.999947 | 3.54913 |
f2c59f60-542d-4519-856c-a9e9f09efcbb | Ankit-Basu/Leetcode-Solutions | leetcode_solutions/1128-number-of-equivalent-domino-pairs/1128-number-of-equivalent-domino-pairs.cpp | class Solution {
public:
int numEquivDominoPairs(vector<vector<int>>& dominoes) {
int cnt[100]{};
int ans = 0;
for (auto& e : dominoes) {
int x = e[0] < e[1] ? e[0] * 10 + e[1] : e[1] * 10 + e[0];
ans += cnt[x]++;
}
... | ALGO | 0.999712 | 6.682784 |
979f7e21-365d-4791-ba86-1db1c9e95583 | aleksp99/bsl | antlr4/src/dfa/DFASerializer.cpp | #include "dfa/DFA.h"
#include "Vocabulary.h"
#include "dfa/DFASerializer.h"
using namespace antlr4::dfa;
DFASerializer::DFASerializer(const DFA *dfa, const Vocabulary &vocabulary) : _dfa(dfa), _vocabulary(vocabulary) {
}
std::string DFASerializer::toString() const {
if (_dfa->s0 == nullptr) {
return "";
}
... | ALGO | 0.870644 | 6.369841 |
0ac128d3-b135-4574-b177-5c1af4fc2472 | avolkov/3d_firmware | marlin-2.1.2.1/kp3s-marlin-latest-2023-12-23/Marlin/src/libs/heatshrink/heatshrink_decoder.cpp | #include "../../inc/MarlinConfigPre.h"
#if ENABLED(BINARY_FILE_TRANSFER)
/**
* libs/heatshrink/heatshrink_decoder.cpp
*/
#include "heatshrink_decoder.h"
#include <stdlib.h>
#include <string.h>
#pragma GCC optimize ("O3")
/* States for the polling state machine. */
typedef enum {
HSDS_TAG_BIT, /* ... | ALGO | 0.891725 | 4.962111 |
1a8b01fb-27ca-4a6a-bcb1-e69f011547be | siddhanttomar2003/CP | 2033-minimum-operations-to-make-a-uni-value-grid/2033-minimum-operations-to-make-a-uni-value-grid.cpp | class Solution {
public:
int minOperations(vector<vector<int>>& grid, int x) {
vector<int>temp;
int n=grid.size(),m=grid[0].size();
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
temp.push_back(grid[i][j]);
}
}
sort(temp.begin(),temp.end()... | ALGO | 0.999993 | 5.671152 |
533af5ba-b06b-455c-9cfd-ee0d4e57baea | dmehrab06/Time_wasters | hackerrank/101 hack april/ACGT.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string a;
cin>>a;
string preva="";
string ans="";
while(preva!=a){
ans="";
int l=a.size();
for(int i=0;i<l;){
//char nw=a[i];
int coun=0;
... | ALGO | 0.999978 | 4.441831 |
f3543eae-0a2e-4fd2-bcd2-9197b57d1241 | Arthur-Yao/Raida_os | cpp/src/core/radapl4.cpp | #include "radappl.h"
#include "radg3da1.h"
#include "radrec.h"
#include "radplnr.h"
#include "radvlpgn.h"
#include "radcnvrg.h"
#include "radopnam.h"
#include <math.h>
//-------------------------------------------------------------------------
extern radTConvergRepair& radCR;
//-------------------------------------... | TOOL | 0.954578 | 3.003304 |
5132f7cd-49b3-4b04-8b65-6926895abcca | zhuqiweigit/leetcode | code/243.cpp | #include <queue>
#include <string>
using namespace std;
class Solution {
public:
int shortestDistance(vector<string>& words, string word1, string word2) {
int i = -1, j = -1;
int min_len = numeric_limits<int>::max();
for(int idx = 0; idx < words.size(); idx++){
if(words[idx] == w... | ALGO | 0.999971 | 5.688904 |
374a72bc-9bd3-4ad6-9a16-80ce6420be6c | akgarg0472/CPP-Programs | FactorialUsingRecursion.cpp | /*Factorial of a number using recursion*/
#include<iostream>
using namespace std;
int fact(int n)
{
if(n>1)
return n*fact(n-1);
}
int main()
{
int n;
cout<<" Enter number to find factorial : ";
cin>>n;
if(n<0)
{
cout<<" Invalid input!!";
return 1;
}
else
... | ALGO | 0.999894 | 4.70699 |
cea51977-0a6f-40d8-b568-a850983b197b | ishandutta2007/codeforces | danya090699/normal/1355/F.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int inf=1e18, mx=1e9;
main()
{
vector <int> pri, qu;
for(int a=2; a*a*a*4<=mx; a++)
{
bool ok=1;
for(int b=2; b*b<=a; b++) if(a%b==0) ok=0;
if(ok) pri.push_back(a);
}
int yk=0;
while(yk<pri.size())
... | ALGO | 0.999934 | 3.497054 |
180d5d27-b05a-4d43-b48a-6b8bbfa492ab | dpark9941/School-Works | comsc 110/Ch7,8 Programming quiz 2.cpp | //============================================================================
// Name : Ch8 Programming quiz part2.cpp
// Author : Donggyu Park
// IDE Used : Eclipse
// Description : sorts the name of presidents alphabetically
//===========================================================================... | ALGO | 0.99781 | 5.442137 |
2bdb3ef2-3d4b-47e7-b51b-3c6758733e36 | LorenzoMaci/Programmazione-I | esami/Test_Di_Lorenzo/19Luglio2.cpp | /*Scrivere una funziona che prenda in input un Vettore A
di dimensione n di puntatori a caratteri (stringhe di C)
e uno short k e restituisca true se esiste almeno una stringa
in A, che abbiamo almeno k caratteri in comune con una qualsiasi
altra stringa di A. NB si presti attenzione ai puntatori a null!*/
#include <i... | ALGO | 0.995955 | 3.929638 |
419b3f53-73ad-400b-bfee-93b565a1cd53 | ROCm/rocSPARSE | library/src/level2/rocsparse_coomv_impl.cpp | /*! \file */
#include "../conversion/rocsparse_coo2csr.hpp"
#include "internal/level2/rocsparse_coomv.h"
#include "rocsparse_common.h"
#include "rocsparse_control.hpp"
#include "rocsparse_coomv.hpp"
#include "rocsparse_utility.hpp"
#include "coomv_device.h"
template <>
inline bool rocsparse::enum_utils::is_invalid(r... | TOOL | 0.992692 | 6.150644 |
3d68ad3c-4338-4df0-82f6-e708df55eddd | sanzamsyed/Algorithms | Topological Sort/TopologicalSort.cpp | #include <stdio.h>
#include <iostream>
#include <stack>
using namespace std;
struct Node
{
bool visited;
string item;
};
Node Graph[100];
int adjMat[100][100];
stack <int> s;
int ver;
int edg;
void ConnectNodes()
{
cin >> ver >> edg;
for(int i = 0; i < edg; i++)
{
int n1;
in... | ALGO | 0.999974 | 4.113911 |
59895ff6-a3fe-46f4-8a79-cda011c4694d | Arvind826688/courseFiles | AsciiUppercase.cpp | #include <iostream>
using namespace std;
int main(){
cout<< " printing ascii values for all uppercase letters of the english alphabets : \n\n";
for(char c = 'A'; c<= 'Z' ; ++c){
cout<< " the ascii value of " << c << " is " << int(c)<< "\n";
}
} | TOOL | 0.948965 | 3.96339 |
af12b98b-65ee-406f-9a89-d97c0dadc614 | Games28/sdl2physics | sdl2physics/Force.cpp | #include "Force.h"
#include <algorithm>
float Force::clamp(float val, float min, float max)
{
if (val < min) return min;
if (val > max) return max;
return val;
}
Vec2 Force::GenerateDragForce(const Body& body, float k) {
Vec2 dragForce = Vec2(0, 0);
if (body.velocity.MagnitudeSquared() > 0) {
... | ALGO | 0.98933 | 6.132816 |
baec7a11-07bf-4157-b56b-ce27b6665a19 | artemchik9321/dinamicmassivezeronegative22.09.24 | dinamicmassivezeronegative22.09.24.cpp | // dinamicmassivezeronegative22.09.24.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
int main()
{
srand(time(0));
int size;
cout << "input ";
cin >> size;
int* ptr = new int[size];
for (int i = 0; i < size; i+... | ALGO | 0.998669 | 3.778708 |
11920485-cf97-404d-a656-e0e5f4f8bdc3 | JaryoGuzoKiller/DataStructure | Stack/W3_1_ArrayStack.cpp | #include<iostream>
using namespace std;
class ArrayStack {
public:
int c;
int t;
int* S;
ArrayStack(int c) {
this->c = c;
this->S = new int[c];
t = -1;
}
bool isEmpty() {
if (t == -1)return true;
else
return false;
}
void top() {
cout << S[t] << endl;
}
void push(int data) {
t = t + 1;
S... | ALGO | 0.997701 | 4.162207 |
9bcb19d9-6230-4b34-926d-6d877b59d7e0 | kims7186/CPP202309 | project/week8/mud_game.cpp | #include <iostream>
#include <string>
using namespace std;
const int mapX = 5;
const int mapY = 5;
// ü ϴ
int user_hp = 20;//ʱⰪ 20
// Լ
bool checkXY(int user_x, int mapX, int user_y, int mapY);
void displayMap(int map[][mapX], int user_x, int user_y);
bool checkGoal(int map[][mapX], int user_x, int user_y);
voi... | ALGO | 0.972052 | 3.534766 |
baf582ca-622c-4018-9317-00356a5f9a28 | Christof/voly-labeller | src/forces/lines_crossing_force.cpp | #include "./lines_crossing_force.h"
#include <vector>
#include "../math/collision.h"
#include "./label_state.h"
#include "../eigen_qdebug.h"
namespace Forces
{
LinesCrossingForce::LinesCrossingForce() : Force("Lines Crossing", 1)
{
}
Eigen::Vector2f LinesCrossingForce::calculate(LabelState &label,
... | ALGO | 0.997797 | 4.952843 |
a0838d27-3c7f-498b-bae9-8ec5dabba8ad | Yuessiah/Destiny_Record | CODEFORCES/1455D_Sequence_and_Swaps.cpp | #include<bits/stdc++.h>
using namespace std;
int const maxn = 510;
int t, n, x, a[maxn];
int main()
{
cin >> t;
while(t--) {
cin >> n >> x;
for(int i = 0; i < n; i++) cin >> a[i];
int ans = 0;
for(int i = 0; i < n; i++) {
if(is_sorted(a+i, a+n)) break;
if(x < a[i]) swap(x, a[i]), ans... | ALGO | 0.999848 | 3.888572 |
2dffa370-ed44-47f9-8ab8-bac85edc6e40 | alvi-uiu/Codeforces | A_Calculating_Function.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main()
{
ll n;
cin >> n;
if (n % 2 == 0)
cout << n / 2;
else
{
cout << -1 * (n + 1) / 2;
}
return 0;
} | ALGO | 0.999496 | 4.396356 |
f2471e95-850c-4ea0-8964-ef674ac0f126 | FalseG0d/Algorithm-Data-Structure | LeetCode/Medium/FlattenBTree.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.999945 | 5.412772 |
74f9b04f-e282-4bc9-9130-ee0349811c34 | ishandutta2007/codeforces | bhaskartm/normal/316/C1.cpp | #include <bits/stdc++.h>
using namespace std;
const int mxN=6405;
const int inf=2e9;
struct Edgee{
int to, cost, cap, flow, backEdge;
};
struct MCMF{
int s, t, n;
vector<Edgee>g[mxN];
MCMF(int _s, int _t, int _n){
s=_s, t=_t, n=_n;
}
void addEdge(int u, int v, int cost, int cap){
Edgee e1={v, cost, cap, ... | ALGO | 0.99999 | 4.037004 |
b7b1734c-2b76-42bf-b538-279d49109197 | csuraj25/Data-Structure | lab/exp7b.cpp | #include<iostream>
#define SIZE 100
using namespace std;
class node
{
public:
node()
{
next = NULL;
}
int data;
node *next;
}*front=NULL,*rear=NULL,*n,*temp,*temp1;
class cqueue
{
public:
void insertion();
void deletion();
void display();
};
int main()
{
cqueue cqobj;
int ... | ALGO | 0.996777 | 3.833354 |
14c26690-12ca-4475-8882-5563359ad680 | Lee-Jungyu/algorithm | baekjoon/15552.cpp | #include <iostream>
using namespace std;
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(false);
int a, b, T;
cin >> T;
for(int i = 0; i < T; i++) {
cin >> a >> b;
cout << a + b << '\n';
}
return 0;
}
| ALGO | 0.999849 | 5.471059 |
e34aabfb-aca3-4fdf-bd8a-b82fbbbb4123 | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_4.3_pureicf/source/vmpBCS.cpp | #include "../include/vmpBCS.h"
using namespace tensor_hao;
using namespace Eigen;
using namespace LBFGSpp;
using namespace std;
void GpBCS_VM::setModel(Model* model_, string initialSCPhiTFlag_)
{
model=model_;
initialSCPhiTFlag=initialSCPhiTFlag_;
Nsite=model->getL();
Ntot=model->getN();
Nspin=Nto... | ALGO | 0.999326 | 4.121574 |
97b2eb0b-243d-49cf-8379-6b5d9089bc4f | ishandutta2007/codeforces | wild_hamster/normal/1037/B.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 1000000007
typedef long long ll;
using namespace std;
const in... | ALGO | 0.99999 | 3.119238 |
f73a7a1d-cbe2-402a-91ac-8fadb0176a2b | son-of-mountain/problem-solving | codeforces/icpc_mansoura/.history/session3/S - Min Cost String_20240810160334.cpp | #include<bits/stdc++.h>
using namespace std;
#define sonic ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
int main(){
sonic ;
string s ;
cin >> s ;
int cost[26];
for(int i=0; i<26; i++) cin >> cost[i];
// approach
// 1. for each character, if it is '?', calculat... | ALGO | 0.999996 | 3.954324 |
620019c8-978a-4b61-95b1-1509083eff88 | peterljq/Online-Judge-Challenger | Peking Univ. OJ/1068.cpp | //Memory Time
//256K 0MS
#include<iostream>
using namespace std;
int main(void)
{
int p[21]={0}; //使 p[0]=0
int str[40]; //括号串,左0右1
int n;
int cases;
cin>>cases;
while(cases--)
{
memset(str,0,sizeof(str)); //str串初始化为全0
cin>>n;
... | ALGO | 0.999883 | 3.463045 |
deb1c329-f7b4-43f0-ab6d-f0b089d9900d | mvaloriani/InformaticaA | Liste/TDE14092010.cpp | /*
Le telecamere di un parcheggio multilivello riconoscono
le targhe di ogni auto in ingresso. Se la targa contenuta
nel file credito.txt (formattato come nel riquadro)
e il credito di almeno 2,50 , la funzione int checkin(char * targa)
restituisce 1, altrimenti restituisce 0
(e una botola risucchia lauto in un pozzo... | ALGO | 0.96772 | 3.609827 |
5a493ab8-e107-41b4-bc4a-e46c24a91102 | rafiqul713/ACM-Programming | UVA/BafanaBafana.cpp | #include<iostream>
using namespace std;
int main ()
{
int t , N , K , P , pos;
cin>>t;
for(int i = 1 ; i<=t ; i++)
{
cin>>N>>K>>P;
pos = K + P;
while(pos > N)
{
pos= pos- N;
}
cout<<"Case "<<i<<": "<<pos<<endl;
}
return 0;
}
| ALGO | 0.999759 | 3.255701 |
90559242-1df7-46c8-9b72-31fcdc586898 | BigMangoHead/competitive-programming | codeforces-mock/codeforces-r952/H2/h.cpp | #include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
struct Node {
int id = -1;
Node() {
}
};
const static vector<pair<int, int>> dir = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const static vector<pair<int, int>> dir2 = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {-1, -1}, {-1, 1}... | ALGO | 0.999872 | 5.025498 |
ff776cbe-6d5c-42d7-b47e-a146c3470e1a | vanssnn/2023-icpc-inc-submission | Code/B.cpp | #include <stdio.h>
#include <string.h>
int max(int total, int* arr, int* arr2){
int i, temp=-1;
for(i=1; i<=total; i++){
if(!arr2[i] && (temp == -1 || arr[i] > arr[temp])){
temp = i;
}
}
return temp;
}
int main(){
int n, m, k, i, check, sum_milk=0, c... | ALGO | 0.999984 | 3.558485 |
aee2e8e1-9018-4b68-af73-6e7e5069e340 | kelamini/eigen-3.4.0 | doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::Matrix2d A;
A << 2, 1,
2, 0.9999999999;
Eigen::FullPivLU<Eigen::Matrix2d> lu(A);
std::cout << "By default, the rank of A is found to be " << lu.rank() << std::endl;
lu.setThreshold(1e-5);
std::cout << "With threshold 1e-5, the ran... | ALGO | 0.999898 | 4.377453 |
70710969-10e3-42e5-807c-21ab55edd070 | ankit-sr/GfG-Programs-Solutions | X_Total_Shapes.cpp | /*
Given a grid of n*m consisting of O's and X's. The task is to find the number of 'X' total shapes.
Note: 'X' shape consists of one or more adjacent X's (diagonals not included)
Example 1:
Input: grid = {{X,O,X},{O,X,O},{X,X,X}}
Output: 3
Explanation:
The grid is-
X O X
O X O
X X X
So, X with same col... | ALGO | 0.999886 | 6.677149 |
d0408a5e-50c2-4d67-984b-45b47deee4bc | suciluz/competitive-programming | ThanksgivingFeast/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fin '\n'
const int maxn=100001;
int n,m,k,a,b,ans=INT_MAX,dis[maxn],dis2[maxn]; vector<int> adj[maxn],shops; bool vis[maxn];
void bfs (int src, int des, int trig) {
queue <int> q; q.push(src); vis[src] = 1;
while(!q.empty()) {
in... | ALGO | 0.999585 | 3.977955 |
d90d28a2-b1cc-4b6e-a165-f5ab400bac3f | jw0293/Algorithm_Problem_Solving | week3/boj_#14497.cpp | #include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 1e9 + 3
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MX = 300 + 1;
int N, M;
bool isEnd;
int sy, sx, y2, x2;
int board[MX][MX];
bool visited[MX][MX];
co... | ALGO | 0.999795 | 3.960503 |
6c0b9c0b-f39c-41a8-be40-4d2d98addc69 | koosaga/olympiad | ICPC/CERC/cerc2015_l.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
char str[105][105];
int n, m, q, lab[105][105], idx;
bool ok(int x, int y){
return x >= 0 && y >= 0 && x < n && y < m && !lab[x][y] && str[x][y] == '.';
}
void dfs... | ALGO | 0.999932 | 4.258416 |
4baede64-42f7-4b85-be68-5992cd9897ef | shivanibhat24/CPP-Programs | Leetcode Programs/encodeanddecodetinyurl.cpp | class Solution {
public:
string encode(string longUrl) {
return longUrl;
}
string decode(string shortUrl) {
return shortUrl;
}
};
| ALGO | 0.940624 | 5.54368 |
92c7f3c7-1f8b-4a08-93dc-8d7d815a5df7 | SamAbelyan/-Solved | USACO/ModernArtPlatinum.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include "temp.cpp"
#include <cstdio>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x) cerr << #x <<" "; print(x); cerr << endl;
#else
#define dbg(x)
#endif
#define sz(x) (int((x).size()))
#define len(x) (int)x.length()
#define all(x) (x).begin(), (x)... | ALGO | 0.99976 | 4.054801 |
303cdce0-45e8-45ba-b235-ddb3acb57c4c | 43EVER/Algorithm-Learning | Old/洛谷/普及练习场/单词接龙/单词接龙.cpp | // 单词接龙.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <numeric>
#include <string>
using namespace std;
int n, maxLen, used[30 + 5];
string datas[30 + 5];
int minLen[30 + 5][30 + 5];
int getMinLen(int a, int b) {
if (minLen[a][b] != ... | ALGO | 0.999873 | 4.543035 |
1424848d-bad9-4c40-9bfb-045626524e94 | theodorekim/QUIJIBO | projects/marchingCubes3D/marchingCubes3D.cpp | #include <float.h>
// Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <iostream>
#include "QUATERNION.h"
#include "POLYNOMIAL_4D.h"
#include "OPTIMIZE_3D.h"
#include "TRIANGLE_MESH.h"
using namespace std;
////////////////////////////////////////////////////////////////... | ALGO | 0.997071 | 5.4783 |
0fbd886d-d53c-4fc1-b64c-84d893be516c | icoty/LeetCode | Algorithms/959.Regions_Cut_By_Slashes.cpp | #include "AllInclude.h"
class Solution {
public:
int regionsBySlashes(vector<string>& grid) {
int ret = 0;
vector<vector<int> > g(3 * grid.size(), vector<int>(3 * grid.size(), 0));
for(auto i = 0; i < grid.size(); ++i)
for(auto j = 0; j < grid.size(); ++j... | ALGO | 0.999027 | 4.791837 |
6607a22a-c6df-4b57-8450-eab6de18dea8 | ipaoTAT/algorithms | best_time_to_buy_and_sell-II/solution.cpp | #include<iostream>
using namespace std;
int max_benifit_II(int prices[], int n)
{
int front[] = new int[n];
int back[] = new int[n];
int min_price, max_price;
front[0] = back[n - 1] = 0;
min_price = prices[0]; max_price = prices[n-1];
for(int i = 1; i < n; i++)
{
if(prices[i] < min_price)m... | ALGO | 0.999803 | 4.028627 |
7225ae43-6699-4d63-a3ff-6488bc528989 | bxiiiiii/bxx | c++/Majority_elem2.cpp | //229.Majority Element 2
/*Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.*/
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int n = nums.size();
... | ALGO | 0.999959 | 5.481483 |
2228e619-74db-4c7d-a1b2-d3c0a11ebbd2 | Abhishekjha002/cses-problems | graph/shortest_routes_2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
// Simple Floyd Wrashall Algo
/*
Reason because floyd warshal is multi source shortest path also
TC: o(N^3)
*/
void solve() {
ll n,m,q;
cin>>n>>m>>q;
ll INF = 9223372036854775807;
vector<vector<ll>> adjList(n+1, vector<ll>(n+1, IN... | ALGO | 0.999986 | 4.781603 |
4d4bb006-bc75-406d-9cd4-f508c5195a09 | balalakshmin/spoj | chgroom.cpp | #include <iostream>
#include<math.h>
using namespace std;
long long divisors(long long n)
{
long long i;
for(i=n/2;i>=2;i--)
if(n%i==0)
return i;
}
bool isprime(long long n)
{
long i;
for(i=2;i<=sqrt(n);i++)
{
if(n%i==0)
return false;
}
return true;
}
int main() {
// your code goes here
//Anne plays... | ALGO | 0.999992 | 4.459119 |
66aa8332-b620-45a3-955f-96053ba9aafd | AustinBoyuJiang/Happy-Hackers-Programming-Challenge-1 | hhpc1p2 - Yuniformity Challenge/std.cpp | /*
* Author: Austin Jiang
* Date: 11/21/2023 3:09:50 PM
* Problem:
* Source:
* Description:
*/
/* Configuration */
//#define MULTICASES
//#define LOCAL
//#define READLOCAL
//#define FILESCOMP
//#define SETMEM
#define FASTIO
#define OPTIMIZE
//#define INTTOLL
#ifdef OPTIMIZE
#pragma GCC optimize(2)
#pragma GCC op... | ALGO | 0.999911 | 4.312331 |
6ab6bf27-abdc-4064-83c5-769c5f3bdbbd | cout-pranav/mycode | mergesort.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(vector<int> &array,int left,int mid,int right)
{
int n1=mid-left+1; //no of elements in first array
int n2=right-mid; //no of element in second array
int a[n1];
int b[n2];
//store n1 elements in first array
for(int i=0;i<n1;i... | ALGO | 0.999986 | 4.955999 |
5a16a86c-f9d0-473e-a67a-799e84061dd1 | KnightChan/LeetCode-cpp | Source/p102 Binary Tree Level Order Traversal.cpp | #include "leetcode.h"
/**
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its level order traversal as:
[
[3],
[9,20],
[15,7]
]
confused what... | ALGO | 0.999959 | 5.949271 |
93012438-3552-46dc-95a3-ac23c824fddb | Yunuskngl/My_Codes | C++/Zeynoödev/hafta6/soru2.cpp |
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char s[10] = "abcde";
revString(s); // fonksiyonu çağırma
}
void revString(char* s) {
int n = strlen(s); // stringin uzunluğunu al
for (int i = 0; i < n / 2; i++) { // stringin yarısına kadar dön
char temp = s[i]; /... | ALGO | 0.998979 | 5.680065 |
756f3bdd-a558-4722-9f55-d7700ef1b84f | tsurugiugsr/LegacyContents | ImageProcess/untitled folder/Image7/Image7/main.cpp | //
// main.cpp
// Image7
//
// Created by 結城朝日 on 2022/05/09.
//
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef uint8_t CHAR;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int8_t BYTE;
typedef int16_t SHORT;
typedef int32_t LONG;
typedef LONG IN... | DATA | 0.902187 | 3.822153 |
61929d91-4063-4a33-9184-e7c286a83021 | flerdacodeu/CodeU-2018-Group9 | group/assignment5/Solution.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include"TestingMacros.h"
using namespace std;
class AlphabetFinder
{
vector<string> words;
vector<char> alphabet;
bool foundAlphabet = false;
//this set can be thought of as the ... | ALGO | 0.999749 | 6.298285 |
78ee088e-86d1-4dab-bc35-cf1df21af2cd | xu20160924/leetcode | leetcodecpp/leetcode/EightFour.cpp | //
// Created by John on 2020/3/5.
//
#include "vector"
#include "stack"
using namespace std;
class Solution{
public:
int largestRectangleArea(vector<int> & heights) {
//push end prevent cannot find smaller one on the right
heights.push_back(0);
stack<int> stk;
int maxArea = 0;
... | ALGO | 0.999894 | 6.678221 |
ab4d765c-6b43-47b1-8169-e241e623d5c0 | ayushssshhh/dsa-2-lab | ass 13(sorting)/01_linear_search.cpp | #include <stdio.h>
int main(){
int a[] = {31, 52 , 23 , 24 ,135 , 90 , 83 , 712};
int n = sizeof(a)/4;
printf("\narray before linear sorting : ");
for(int i=0 ; i<n ; i++)
printf(" %d",a[i]);
for(int i=0 ; i<n ; i++){
for(int j=i+1 ; j<n ; j++){
if(a[i]>a[j]){
... | ALGO | 0.999913 | 3.343071 |
a7d455ce-86c0-40b4-9200-e58e642dbddd | NazmulHasanMasad/leetcode_problems | 121_best_time_to_buy_and_sell_Stock.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
int maxProfit(vector<int> &prices)
{
int n = prices.size();
int buy = prices[0];
int profit = 0;
for (int i = 1; i < n; i++)
{
if (prices[i] < buy)
... | ALGO | 0.999279 | 4.971227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.