uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6a7d855e-0715-4623-bdee-5a173f7ae759 | skinzor/android_device_huawei_hwcan | data-ipa-cfg-mgr/hal/src/PrefixParser.cpp | /* External Includes */
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <vector>
/* Internal Includes */
#include "IOffloadManager.h"
#include "PrefixParser.h"
/* Avoiding namespace pollution */
using IP_FAM = ::IOffloa... | TOOL | 0.856401 | 6.408634 |
d82519cf-af37-4759-ab7e-02799aad408c | angel2230/TLBB | Game/boost/libs/graph/example/subgraph.cpp | /*
Sample output:
G0:
0 --> 1
1 --> 2 3
2 --> 5
3 -->
4 --> 1 5
5 --> 3
0(0,1) 1(1,2) 2(1,3) 6(2,5) 3(4,1) 4(4,5) 5(5,3)
G1:
2 --> 5
4 --> 5
5 -->
6(2,5) 4(4,5)
G2:
0 --> 1
1 -->
0(0,1)
*/
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/subgr... | ALGO | 0.999552 | 5.620304 |
67915be4-b14b-4f9d-bbf0-294f1aa9c729 | pranavamrutkar9/CPP-DSA | 01 Fundamentals/08 Arrays/03ReverseArray.cpp | #include <iostream>
using namespace std;
int reverseArray(int arr[], int size){
for (int i = 0; i < size/2; i++)
{
int temp = arr[i];
arr[i]=arr[size-1-i];
arr[size-1-i]=temp;
}
for (int i = 0; i < size; i++)
{
cout<<arr[i];
}
}
int main(){
int a[]=... | ALGO | 0.997433 | 4.655019 |
25c38545-02cc-4b31-99a7-91254a7d98de | AnirudhDaya/DSA-in-Cplusplus | DSA_in_c++/panagram.cpp | #include <bits/stdc++.h>
using namespace std;
string panagram(string s)
{
transform(s.begin(),s.end(),s.begin(),::tolower);
int i;
int count[26]={0};
for(i=0;i<s.size();i++)
{
if(s[i]>='a' && s[i]<='z')
{
count[s[i]-'a']++;
}
}
... | ALGO | 0.999424 | 4.954968 |
c3dbe28d-78c6-4a42-b89c-286e96c2fe0b | yuktaX/DSA | algo_structs/maxheap.cpp | #include<bits/stdc++.h>
using namespace std;
void
MaxTopdownheapify (int H[], int i, int n)
{
int c, t,temp;
while (2 * i + 2 < n)
{
if (H[2 * i + 1] > H[2 * i + 2])
c = 2 * i + 1;
else
c = 2 * i + 2;
if (H[i] < H[c])
{
temp = H[i];
H[i] = H[c];
H[c] = temp;
i = c;
}
... | ALGO | 0.999968 | 3.783455 |
9e0ecefe-c4ad-42fe-a836-b0e0a5ebab75 | hjiang13/LLMs-in-IR | POJ-104/61/72.cpp | #include <iostream>
using namespace std;
int f(int n)
{
if(n==1) return 1;
else if(n==2) return 1;
else return f(n-1)+f(n-2);
}
main()
{
int n,a[10000];
cin >> "%d",&n);
int i;
for(i=0; i<n; i++)
{
cin >> "%d",&a[i]);
printf ("%d\n",f(a[i]));
}
getchar();
} | ALGO | 0.999824 | 3.428677 |
959f8fb0-1977-45ad-b8e7-0a58d3f7bc65 | snehagupta20/design-and-analysis-of-algorithm | DAA project/ques 13/ques_13n14.cpp | //THIS CODE IS WRITEN BY SNEHA GUPTA
//2021UCA1859
//DAA PROJECT
#include <bits/stdc++.h>
using namespace std;
int dp[100][100];
int matrix_chain_multi(int* p, int i, int j)
{
if(i==j)
{
return 0;
}
if(dp[i][j] != -1)
{
return dp[i][j];
}
dp[i][j]=INT_MAX;
for(int k=i; k < j; k++)
{
dp[i][j]=min( dp[i... | ALGO | 0.999952 | 4.062796 |
9533056f-5fde-4168-8c0c-bdf07950e55a | lberserq/shor_cpp | main.cpp | #include "config.h"
#include "common.h"
#include "qregister.h"
#include "qft.h"
#include "measure.h"
#include "multiplier.h"
#include "adder.h"
#include <cstdio>
#include <cstdlib>
state igcd(state a, state b) {
while (a && b) {
if (a > b) {
a %= b;
} else {
b %= a;
... | ALGO | 0.999859 | 3.418398 |
11b27103-4b39-465e-8669-2ac5c69a1947 | anicanor/Project05 | sim.cpp | //sim.cpp
//Aaron Nicanor
//anicanor
//Included libraries used
#include<iostream>
#include<string>
#include<fstream>
#include<assert.h>
#include<stdlib.h>
//Header files
#include"cust.h"
#include"pqueue.h"
using namespace std;
struct Checker{
Cust *ptrCust;
double checker_money;
int finishedTime;
int breakTime... | TOOL | 0.887886 | 4.025064 |
820348cd-9d17-49e8-b1ec-c024f54224b9 | Sourav61/DSA-Practice | GFG/Easy/PrintMatrixInDiagonalPattern.cpp | // https://practice.geeksforgeeks.org/problems/print-matrix-in-diagonal-pattern/1
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*You are required to complete this method */
class Solution
{
public:
vector<int> matrixDiagonally(vector<vector<int>> &mat)
{
... | ALGO | 0.99981 | 5.614326 |
5024a62e-3934-4ebf-9de2-9af46995e1e3 | Maneesha-Rupasinghe/Student-Management | study_manager/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.998866 | 6.76775 |
936664d0-1d09-4c38-9df8-98f422b9cde7 | kapoorp99/c-programs | ch3.cpp | #include<iostream>
using namespace std;
typedef long long int lli;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
lli q,i,s=0;
cin>>q;
int a[q];
for(i=0;i<q;i++)
{
cin>>a[i];
}
for(i=0;i<q;i++)
{
a[i]=a[i]/10;
s=s+a[i];
}
cou... | ALGO | 0.99989 | 3.076436 |
fe287e89-fe4b-4430-bbd0-3420022630eb | thefacetakt/TreapTask | Treap.cpp | #include "Treap.hpp"
#include <algorithm>
#include <utility>
#include <cstdlib>
#include <climits>
namespace NTreap
{
//static variables
size_t Treap::zero = 0U;
//private methods
Treap::Node::Node(int value) :
value(value),
leftest(value),
rightest(value),
priority(... | ALGO | 0.999725 | 4.571231 |
ced5aa38-6d86-4ddf-ab72-247339f70ca2 | eyangch/competitive-programming | Codeforces/1323/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <typename T1, typename T2>
ostream &operator <<(ostream &os, pair<T1, T2> p){os << p.first << " " << p.second; return os;}
template <typename T>
ostream &operator <<(ostream &os, vector<T> ... | ALGO | 0.999413 | 3.836396 |
4063f98f-5d60-4b23-8726-070efccb6753 | yingling-group/lammps-mspin | src/INTEL/angle_harmonic_intel.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: W. Michael Brown (Intel)
------------------------------------------------------------------------- */
#include "angle_harmonic_intel.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include... | ALGO | 0.863216 | 6.853348 |
b67af26e-9f3c-4f89-8a9b-eee5c85ce404 | alavessi/Technosphere-Algorithms-and-Data-Structures | hw7/just_compare_files.cpp | #include <iostream>
#include <fstream>
bool equal()
{
std::ifstream f1("out1.txt"), f2("out2.txt");
while (f1 || f2)
{
int x, y;
f1 >> x;
f2 >> y;
std::cout << x << " " << y << std::endl;
if (x != y) return false;
}
return true;
}
int main()
{
if (equal(... | ALGO | 0.998719 | 4.457766 |
7b5a4c2f-9200-4895-a950-2237716948e1 | HexWhiz36/Codechef | Interior_Design.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,x,y,a,b;
cin>>t;
while(t--)
{
cin>>x>>y>>a>>b;
if((x+y)<(a+b)) cout<<x+y<<endl;
else cout<<a+b<<endl;
}
return 0;
} | ALGO | 0.999631 | 3.350192 |
7dc3b3f3-b59c-4359-8de6-526ca00fb1ea | GambitBSM/gambit_1.0 | contrib/MassSpectra/flexiblesusy/models/HSSUSY/HSSUSY_effective_couplings.cpp | // File generated at Sat 27 Aug 2016 12:40:55
#include "HSSUSY_effective_couplings.hpp"
#include "effective_couplings.hpp"
#include "standard_model.hpp"
#include "wrappers.hpp"
namespace flexiblesusy {
using namespace effective_couplings;
#define INPUTPARAMETER(parameter) model.get_input().parameter
#define MODELP... | TOOL | 0.896669 | 4.297587 |
c5705e85-fafd-43ef-bf57-b43d64ea7787 | OlgaPetrova3103/mod-task01-fa-cpp | src/fun.cpp | unsigned int faStr1(const char *str)
{
int i = 0,
count = 0,
in = 0,//0-вне слова
F = 0; //0-обнаружилась цифра
while (str[i] != '\0')
{
if (in == 0 && str[i] != ' ')
{
if (str[i] > 57 || str[i] < 48) F = 1;
in = 1;
}
else if (in == 1 && str[i] != ' ' && F == 1)
{
if (str[i] >= 48 && str[... | ALGO | 0.996272 | 3.558331 |
44dca2a3-4c29-463c-bb30-b5e3eea07fd5 | stretchxray/Model_Predictive_Control | src/Eigen-3.3/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.989561 | 6.337957 |
d8e6045d-513e-45bb-8f84-d5f6a881c115 | Akashkumar888/OOPS_CPP | assignment-5/dec_to_binary2.cpp | #include<iostream>
using namespace std;
int main(){
// int m;
// cout<<"Enter array size: ";
// cin>>m;
int a[10],n,i;
cout<<"Enter decimal: ";
cin>>n;
for(i=0;n>0;i++){
a[i]=n%2;
n=n/2;
}
cout<<"Binary of the given decimal: ";
for(i=i-1;i>=0;i--){
cout<<a[i];
}
retur... | ALGO | 0.999463 | 4.156703 |
a67e90bf-b3db-4768-ae30-ab51fb08ffec | prince-mali2/LeetCode-Solutions | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> ans;
vector<int> prefix(n);
vector<int> suffix(n);
int p =1;
int s=1;
for(int i=0;i<n;i++){
p*=nums[i];
prefix[i]=p;
}... | ALGO | 0.999982 | 6.091244 |
76204837-c902-4b41-881e-5ec40015939a | xiaozhisky1/Raft-KVServer | src/raftClerk/clerk.cpp | //
// Created by swx on 23-6-4.
//
#include "clerk.h"
#include "raftServerRpcUtil.h"
#include "util.h"
#include <string>
#include <vector>
std::string Clerk::Get(std::string key, std::string &value) {
m_requestId++;
auto requestId = m_requestId;
int server = m_recentLeaderId;
raftKVRpcProctoc::GetArg... | TOOL | 0.955375 | 4.136682 |
13d2c4a0-d778-42e9-a194-91eae9eb27c8 | gittushR/DSA | 0309-best-time-to-buy-and-sell-stock-with-cooldown/0309-best-time-to-buy-and-sell-stock-with-cooldown.cpp | class Solution {
public:
int f(int ind, int buy, vector<int> prices, int n,vector<vector<int>>&dp){
if(ind>=n)return 0;
if(dp[ind][buy]!=-1)return dp[ind][buy];
int profit=0;
if(buy){
profit=max(-prices[ind]+f(ind+1,0,prices,n,dp),f(ind+1,1,prices,n,dp));
}else{
... | ALGO | 0.999974 | 5.973682 |
122d6288-8b1f-4204-b08f-45a24f5d2e9b | ishandutta2007/codeforces | mhq/normal/NA/173.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int maxN = 2 * (int)1e5 + 100;
const int INF = 2 * (int)1e9;
set < pair < int, int > > fr;
int a[maxN], t[maxN];
int n;
int main() {
ios_base::syn... | ALGO | 0.999979 | 3.482211 |
507f71e0-5e21-4615-80d4-9b92a116a6c7 | SlopePlotnick/DataStructure_Experiments_and_Design | 课设/代码/选做题/词梯/词梯/main.cpp | #include<iostream>
#include<vector>
#include<string>
#include<map>
#include<fstream>
#include<algorithm>
using namespace std;
vector<string> words; //存储所有单词的字符串数组
map<string, int> wordToNum; //建立从单词到其编号的映射
const int N = 466550; //事先统计出的总单词个数 用于初始化
int q[N]; //bfs队列 存储编号
int pre[N]; //存储前一个单词的编号
void bfs(int u, int n)... | ALGO | 0.999957 | 4.144104 |
c58be131-c59e-4379-94fc-e727ab2bb22f | Valeomega/AzgathCoreSLF | src/server/game/Combat/ThreatManager.cpp | #include "ThreatManager.h"
#include "Creature.h"
#include "CombatPackets.h"
#include "CreatureAI.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "Hacks/boost_1_74_fibonacci_heap.h"
BOOST_1_74_FIBONACCI_HEAP_MSVC_COMPILE_FIX(Threa... | TOOL | 0.921939 | 5.852825 |
4e65cbf3-eb58-4607-b6a2-4cb381b22bd7 | valber-8/geosci | lmp/alt/ASPHERE/compute_erotate_asphere.cpp | #include "mpi.h"
#include "compute_erotate_asphere.h"
#include "math_extra.h"
#include "atom.h"
#include "atom_vec_ellipsoid.h"
#include "atom_vec_line.h"
#include "atom_vec_tri.h"
#include "update.h"
#include "force.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
/* -----------------------------... | ALGO | 0.99914 | 6.682236 |
e97cc436-38d6-4fc7-bc95-14f63345f37c | GuessEver/ACMICPCSolutions | Gym/100703/F/F.cpp | #include <cstdio>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <climits>
#define INF 1000000007
#define MP make_pair
const i... | ALGO | 0.999984 | 3.108904 |
d737868b-2850-4a4c-a0e6-68a3f82caa75 | Sujal1234/Advent_Of_Code_2024 | day1.cpp | #include <bits/stdc++.h>
void local(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
long long numOccur(std::vector<int> & list, int num){
long long ans = 0;
for (int i = 0; i < list.size(); ++i)
{
if(list[i] == num) ans++;
}
return ans;
}
int main(){
... | ALGO | 0.9999 | 4.238729 |
22b30f47-6848-43da-9111-d8f34ee68da9 | artium59/algo_study | BOJ/10000~/14954.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> store;
void function(int num) {
int sum = 0;
if (num == 1) {
cout << "HAPPY";
return;
}
for(int i = 0; i < store.size(); ++i) {
if (num == store[i]) {
cout << "UNHAPPY";
re... | ALGO | 0.999803 | 3.795403 |
5320ecbf-2056-41aa-b079-7dfc6e635acc | ishandutta2007/codeforces | shadowatyy/normal/1060/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c)... | ALGO | 0.99966 | 4.168134 |
009c56f2-7517-4fc1-b847-dc5ba71517d1 | Aman5012/100DaysOfCode | Day46/Rotate Image.cpp | 48. Rotate Image(matrix)
//QUESTION LNK: https://leetcode.com/problems/rotate-image/description/
TOPIC: array, matrix
CODE:
/////////////////////////////// brute force apppraoch
class Solution {
// TC: O(n.n)
// SC: O(1)
public:
void rotate(vector<vector<int>>& matrix) {
int n = matrix.size();
ve... | ALGO | 0.999761 | 7.157156 |
4531128d-d2b7-460d-866f-b76610772a28 | beingamanforever/cses-erdos-project_euler | CSES/Tree_Matching.cpp | /**
* author: compounding
* created: 2024-09-18 14:58:47
**/
#include <bits/stdc++.h>
using namespace std;
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define NeedForSpeed \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.ti... | ALGO | 0.999207 | 4.374705 |
163c0998-2f44-4613-b3ae-d0a5471791ed | raincross7/code-similarity | codes/train_code/problem421/problem421_232.cpp | #include <bits/stdc++.h>
#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size()) //size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main() {
int load[5][5]={0}... | ALGO | 0.99993 | 3.523438 |
0728d171-a67a-47c7-9f50-e2ee4ec468ef | sourav9582/codingsolcpp | 1379-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree/1379-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* ans;
TreeNode* getTargetCopy(TreeNode* original, TreeNode* cloned, TreeNode* tar... | ALGO | 0.999929 | 5.51377 |
3ab58350-0cbc-49d6-a4c9-92f7624763a9 | enjalot/BGERTPS | blender/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp | #include "btConvexHullShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btSerializer.h"
btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int stride) : btPolyhedralConvexAabbCachingShape ()
{
m_shapeType = CONVE... | ALGO | 0.99298 | 7.224477 |
0b6d954a-631e-41c3-b1f8-2cbe48c82c4d | har200105/LoveBabbar450DSASheet | Greedy/RearrangeCharactersinAStringSuchThatNoTwoCharactersAreSame.cpp | string rearrangeString(string str){
priority_queue<pair<int ,char>>maxH;
unordered_map<char,int>mp;
string ans;
for(int i=0;i<str.size();i++){
mp[str[i]]++;
}
for(auto it:mp){
maxH.push({it.second,it.fi... | ALGO | 0.999993 | 4.727456 |
c4ac7337-2657-48f2-ac88-b210e24dd22d | bsm8734/algorithm-PS | Baekjoon/7576_토마토.cpp | #include <iostream>
#include <string.h>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
int M, N;
int arr[1001][1001] = { 0 };
bool visit[1001][1001] = { false };
int depth = 0;
queue<pair<int, int>> q, mat_tom;
int xy[4][2] = { {0, 1}, {1, 0}, {0, -1}, {-1, 0} };
void BFS() {
while (!q.e... | ALGO | 0.999868 | 4.547271 |
bc78bfa7-ee02-4b1a-af4e-316121768278 | ramanuj-rs/DSA | DSA/stack1.cpp | //Reverse of sentense using stack
#include<iostream>
#include<stack>
using namespace std;
void reverseSentence(string s){
stack<string> st;
for(int i=0;i<s.length();i++){
string words="";
while(s[i]!=' ' && i<s.length()){
words+=s[i];
i++;
}
st.push(words... | ALGO | 0.998931 | 4.58159 |
e494d6b8-7f2c-4a31-a314-c0288e295bc6 | abhishekpd/DSandAlgorithms | CodingPractice/DSProblems/src/StringProblems.cpp | #include "../header/StringProblems.h"
void MaxRepetatingCharacter(std::string inp_string)
{
/*int count[26] = {0};
for (int i = 0; i < inp_string.length(); i++)
count[inp_string.at(i)]++;
*/
} | ALGO | 0.999434 | 4.567667 |
d9ccd1fc-cb43-42f2-bb0b-1d4937648cc0 | HarshCasper/NeoAlgo | C-Plus-Plus/graphs/is_it_a_tree.cpp | /*Given the number of nodes and edges of graph check if it's a tree topology*/
#include <iostream>
#include <vector>
using namespace std;
int nodes, edges, u, v;
vector<int> arr[100001]; //Adjacency List storing the graph
vector<int> vis(100001, 0); //Visited array, it stores wheather the node is visited or not
v... | ALGO | 0.99992 | 5.445167 |
1811acbf-ebaf-4831-8ef2-681a1f5d33d8 | youngkylejan/leetcode | 3Sum/solution.cpp | class Solution {
public:
vector<vector<int> > threeSum(vector<int> &num) {
if (num.size() < 3)
return vector<vector<int>>();
sort(num.begin(), num.end());
vector<vector<int>> results;
vector<int> solution;
for (int i = 0; i < num.size() - 1; i++) {
if (i > ... | ALGO | 0.999836 | 5.491251 |
4a0c3ce7-331f-4c17-90e3-35ab87b60747 | caiweiwenjs/cpp_demo | variadic_template/main.cpp | #include <iostream>
// c++14
auto sumCpp14() {
return 0;
}
template <typename T1, typename... T2>
T1 sumCpp14(T1 a1, T2... args) {
return a1 + sumCpp14(args...);
}
// c++17
template<typename ...Args> auto sumCpp17(Args ...args)
{
return (args + ...);
}
int main() {
std::cout << sumCpp14(1, 2, 3) << std:... | ALGO | 0.938752 | 5.34168 |
3bac6bd8-0a24-4789-a111-bb36ab3de4b8 | tariq005/Infinity-Days-of-Coding | weirdsort.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int i=0; i<n; i++)
{
cin >> a[i];
}
vector<int> p(n);
for (int i=0; i<m; i++)
{
... | ALGO | 0.999985 | 3.473993 |
0940521a-5c31-49d0-83ef-5dc012d49b92 | Kennyarlexy/Competitive-Programming | CONTEST/CODEFORCES/Round_935/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
ll f(ll x, ll y, ll m) {
ll k = y-x+1;
ll N = (m+1 + x-1)/x + (m+1-k + y-1) / y;
return N;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int T; cin >> T;
for (int t = 1; t <= ... | ALGO | 0.999862 | 4.466117 |
0f14ecd6-5fe4-48a3-9cdf-d99d22e3ff4b | kkomy/CSED233 | CSED233_Data_Structure/ASSN4/hash_table.cpp | #include "hash_table.h"
#include "hash_function.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
BucketHashTable::BucketHashTable(int table_size, int bucket_size,
BinaryMidSquareHash *hf)
: table_size(table_size), bucket_size(bucket_size) {
this->... | ALGO | 0.992488 | 4.31439 |
23af5125-ef31-43c3-a4b6-553e8c18e270 | joel-ho/BES | include/eigen__3_3_4/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.989684 | 6.337957 |
43580696-5e1b-496a-9174-d420bfe6be9b | acgtun/leetcode | algorithms/cpp/Integer to English Words.cpp | class Solution {
public:
unordered_map<int, string> digit2char;
string readIt(int num) {
string res;
if(num / 100 > 0) {
res += digit2char[num / 100];
res += " Hundred";
}
num %= 100;
if(num == 0) return res;
if(num < 20)... | ALGO | 0.996749 | 6.12273 |
23f46e4d-7691-407b-b58f-b9933ab6ff89 | E88898/Deitel-exercises | chapter05/exercise_05_08/exercise_05_08.cpp | #include <iostream>
#include <unistd.h>
int
main()
{
int number;
if (::isatty(STDIN_FILENO)) {
std::cout << "Enter the number of integers to be processed: ";
}
std::cin >> number;
if (number <= 0) {
std::cerr << "Error 1: number is invalid." << std::endl;
return 1;
... | ALGO | 0.991335 | 4.719299 |
9cdfe20a-fcfb-428b-a6f4-fa3306f314c0 | LarsBoertjes/DSAIT4120 | assignment0/framework/third_party/oneTBB/examples/parallel_for/seismic/universe.cpp | #include <cmath>
#include <cstring>
#include "oneapi/tbb/blocked_range.h"
#include "oneapi/tbb/parallel_for.h"
#include "common/gui/video.hpp"
#ifdef _MSC_VER
// warning C4068: unknown pragma
#pragma warning(disable : 4068)
// warning C4351: new behavior: elements of array 'array' will be default initialized
#pragma... | ALGO | 0.963388 | 4.56754 |
c6f7a9ff-3d0c-4540-9881-7c95027dffed | mduffor/crow | base/Util/CalcHash.cpp | /* -----------------------------------------------------------------
Calc Hash
This module implements a string hashing function.
----------------------------------------------------------------- */
// contact: <EMAIL>
#include "Debug.hpp"
ASSERTFILE (__FILE__);
#include "Util/C... | ALGO | 0.999618 | 6.104593 |
087c6ceb-2d98-4452-90f0-bc53e49f9d58 | zzfbwoals/Study | BOJ/Step/Deepening1/2/킹퀸룩비숍나이트폰.cpp | #include <iostream>
using namespace std;
int main()
{
int chess[6] = {1, 1, 2, 2, 2, 8};
int input[6];
cin >> input[0] >> input[1] >> input[2] >> input[3] >> input[4] >> input[5];
for (int i=0; i<6; i++)
{
cout << chess[i] - input[i] << " ";
}
return 0;
} | ALGO | 0.998818 | 3.272992 |
06a816ec-58ce-4a73-9cb8-f27fa29e4254 | P-Rajyasri2005/CSA0357-Data-structures | DS Breadth for search.cpp | #include <stdio.h>
int n, i, j, visited[10], queue[10], front = -1, rear = -1;
int adj[10][10];
void bfs(int v)
{
for (i = 1; i <= n; i++)
if (adj[v][i] && !visited[i])
queue[++rear] = i;
if (front <= rear)
{
visited[queue[front]] = 1;
bfs(queue[front++]);
}
}
in... | ALGO | 0.999955 | 4.519617 |
a9721312-825e-4bb4-adeb-5b3f375f92d1 | dilsekhpatnaik7/Leet-Sync | 23-merge-k-sorted-lists/merge-k-sorted-lists.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* merge2Lists... | ALGO | 0.999927 | 6.03899 |
613c8cfa-3d20-4128-93b2-9c15244dc541 | Shreyaspatil2310/GFG | Difficulty: Easy/Queue Reversal/queue-reversal.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//function Template for C++
//Function to reverse the queue.
class Solution
{
public:
queue<int> rev(queue<int> q)
{
stack<int> s;
while(! q.empty()){
int ele... | ALGO | 0.999732 | 5.702058 |
c402b62c-87db-40fb-b36d-301d7cd015e8 | Laanith/DSA | BinarySearch/Medium/FindFirstAndLastPositionOfElementInSortedArray_LC.cpp | #include<bits/stdc++.h>
#include<algorithm>
#define ll long long
#define PYES cout<<"YES"<<endl
#define PNO cout<<"NO"<<endl
#define PMINUS cout<<-1<<endl
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pair<int,int>>
#define vs vector<string>
#define qi queue<int>
#define si stack<int>
#define ... | ALGO | 0.999991 | 6.120946 |
45773bfe-740b-43dd-90fb-f56cf6c9e183 | MAIGOMAIGO/AtCoder | AtCoder Beginner Contest 292/C-cpp/Main.cpp | #include <iostream>
int cou_n(int n){
int c = 0,i = 1;
while(i*i <= n){
if(n%i == 0){
c++;
if(i != n/i)c++;
}
i++;
}
return c;
}
int main(void){
int N;
std::cin >> N;
long long c = 0;
for(int i=1;i<N;i++){
int d1 = cou_n(N-i);
if(i == N-i) c += d1*d1;
else if(i > N-i... | ALGO | 0.999822 | 3.962024 |
91201b71-d9ae-4f7e-8fb4-acf96607e91b | Fardheen-N/Tech_Dose | Tree/1138-grumpy-bookstore-owner/grumpy-bookstore-owner.cpp | class Solution {
public:
int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int minutes) {
int l = 0,r=0;
int n = grumpy.size();
int pro = 0;
for(int i=0;i<n;i++) if(grumpy[i]==0)pro+=customers[i];
while(r-l<minutes){
if(grumpy[r]==1){
g... | ALGO | 0.999894 | 6.487077 |
047b1c05-0b6a-41b1-8c86-27c3ad73ede2 | vedantd25/Leetcode | 368-largest-divisible-subset/largest-divisible-subset.cpp | //reference:https://leetcode.com/problems/largest-divisible-subset/solutions/684677/3-steps-c-python-java-dp-pen-paper-diagram
class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& nums) {
if(nums.size()==0){
return nums;
}
sort(nums.begin(),nums.end());
... | ALGO | 0.999991 | 5.735805 |
17cc8e4b-c222-464e-89aa-a8ce70b7f6f1 | Zahid-Hasan-Mozumder/CF-1600---1800 | (024) Color with Occurrences.cpp | // Problem link: https://codeforces.com/problemset/problem/1714/D
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------... | ALGO | 0.999509 | 4.486609 |
d70ea12b-2632-4e75-9443-2f96f8015ac0 | Huuuuub/digitaltv | tsduck/src/src/tsplugins/tsplugin_merge.cpp | #include "tsPlugin.h"
#include "tsPluginRepository.h"
#include "tsForkPipe.h"
#include "tsTSPacketQueue.h"
#include "tsSectionDemux.h"
#include "tsCyclingPacketizer.h"
#include "tsThread.h"
#include "tsPAT.h"
#include "tsCAT.h"
#include "tsSDT.h"
#include "tsCADescriptor.h"
TSDUCK_SOURCE;
#define DEFAULT_MAX_QUEUED_PA... | TOOL | 0.857519 | 4.412342 |
aaaabd49-a1b4-478e-bd48-225a6c251dc8 | Githubiswhat/LeetCode | C++/src/Solution2101_2200/Solution2111.cpp | //
// Created by windows on 2023/3/2.
//
#include "Solution2111.h"
#include <functional>
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
| ALGO | 0.975681 | 3.008826 |
b3a90004-d45c-44f0-9dbd-f119a060e2f0 | MdAbuNafeeIbnaZahid/Competitive-Programming | Light OJ/1009 - Back to Underworld .cpp | #include <bits/stdc++.h>
using namespace std;
int t, n, u, v, i, j, k, ans[10];
vector<int> vertices[20009];
int visited[20009];
void dfs(int v, int type)
{
if (visited[v] != 0) return;
visited[v] = 1;
if (vertices[v].empty())
{
return;
}
ans[type%2]++;
vector<int>::iterator it;... | ALGO | 0.99978 | 4.461963 |
f87db08f-28c4-4eeb-a798-e98ed792ce93 | shakkhordas/leetcode | Add_Digits.cpp | class Solution {
public:
int addDigits(int num) {
// trivial approach
// while (num%10 != num) {
// int res = 0;
// while (num) {
// res += (num%10);
// num /= 10;
// }
// num = res;
// }
// return num;
... | ALGO | 0.999833 | 6.668029 |
483b626f-8c08-49d0-94e3-aed0f0168560 | Ahmeddraaza/flutter1_Assignment | 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.998733 | 6.76775 |
bf1690df-3c48-429c-ba57-c7cf55ae36fc | gaeun6883/2021.mentoring | 0292.백준2042.구간 합 구하기.cpp | //mentoring 292. 2022.8.9
//세그먼트 트리
#include <iostream>
using namespace std;
long long arr[1000006];
long long tree[4000006];
long long init(long long node, long long start, long long end) {
if (start == end) return tree[node] = arr[start];
long long mid = (start + end) / 2;
long long left = init(node * ... | ALGO | 0.999991 | 4.692395 |
f2cd1168-1e57-4b73-a432-b47180e87d1f | Bootleggers-BrokenLab/frameworks_opt_net_wifi | libwifi_system/supplicant_manager.cpp | #include "wifi_system/supplicant_manager.h"
#include <android-base/logging.h>
#include <cutils/properties.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
// This ugliness is necessary to access internal implementation details
// of the property subsystem.
#define _REALLY_INCLUDE_SY... | TOOL | 0.878513 | 7.317074 |
6d2db41c-8407-4c95-92d1-3c078e30711f | Sahil-Shimpi/CodeStudio | 064. Anagram Difference.cpp | // Problem: https://www.codingninjas.com/codestudio/guided-paths/data-structures-algorithms/content/118626/offering/1377986
/*
Time Complexity : O(N)
Space Complexity : O(1)
Where 'N' is the length of the given string.
*/
#include <vector>
int getMinimumAnagramDifference(string &str1, string &str2) {
... | ALGO | 0.99999 | 6.248577 |
7cc966f8-2563-4802-94d2-aaa3386d785d | Hs21111/oldPc | C++/F_to_C.cpp | #include <iostream>
int main(){
std::cout << "Temperature in Fahrenheit: ";
long double fahrenheit;
std::cin >> fahrenheit;
long double celsius = (fahrenheit - 32) / (9 /5);
std::cout << "Temperature in Celsius: " << celsius;
} | TOOL | 0.936252 | 4.427139 |
40a68f51-b5fb-4f4f-9f4e-46c3fcab0ebe | akamazing/codeChef | codeChef/EASYPROB.cpp | #include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
int main(){
int input[] = {137, 1315, 73, 136, 255, 1384, 16385};
for ( int i=0; i<7; i++ ){
string answer = "0";
int temp = input[i];
while (temp!=0){
string strTmp = "";
if (temp%2==... | ALGO | 0.999847 | 3.415112 |
450440c8-817b-4852-96a8-c50c783d02a2 | gorbit99/AoC2021 | day07/day7-2.cpp | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
int main() {
std::unordered_map<uint64_t, uint64_t> positions;
uint64_t pos;
uint64_t inputNum = 0;
while (std::cin >> pos) {
inputNum++;
positions[pos]++;
s... | ALGO | 0.999275 | 4.09821 |
78620fa7-013b-4e84-af80-750ac40fb2bd | jmvalois/Sherlock_Compilation | SRC_DI2/element/frictionBearing/SingleFPSimple3d.cpp | // $Revision$
// $Date$
// $URL$
// Written: Andreas Schellenberg (<EMAIL>)
// Created: 02/06
// Revision: A
//
// Description: This file contains the implementation of the
// SingleFPSimple3d class.
#include "SingleFPSimple3d.h"
#include <Domain.h>
#include <Node.h>
#include <Channel.h>
#include <FEM_ObjectBroker.h... | TOOL | 0.89319 | 5.698652 |
b2e22f8f-d86c-4b57-9350-bcbbac039f8f | ys7yoo/caffe-examples | examples/cpp_classification/classification.cpp | #include <caffe/caffe.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <algorithm>
#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
#include <vector>
using namespace caffe; // NOLINT(build/namespaces)
using std::string... | DATA | 0.984441 | 7.617253 |
6b54099b-fe35-4892-8291-0b94d2e1b80f | raghavgupta12/crosspoint | crosspoint.cpp |
#include "helper.h"
/*Initialising stats */
void stats::init_values(){
total_energy = 0;
average_energy = 0;
average_power = 0;
total_latency = 0;
average_latency = 0;
count = 0;
}
/* Updates energy, power and latency for stats object */
void stats::update_stats (float energy, float ... | TOOL | 0.923008 | 3.209963 |
0a6ed98a-cb54-4b66-8bd6-a1bd05b9c7cb | kahfiaulia/cpp | titiktengahfungsi.cpp | #include <iostream>
using namespace std;
typedef struct{
float x;
float y;
} titik;
titik titikTengah(titik p1, titik p2);
int main(){
titik p1, p2;
titik pt;
cout << "Titik P1 : " << endl;
cout << "x = ";
cin >> p1.x;
cout << "y = ";
cin >> p1.y;
cout << "Titik P2 : " << endl;
cout << "x = ";
cin >> p... | ALGO | 0.997562 | 5.490279 |
08f9fe1c-a366-4885-b6df-c696e5e6f1ce | i-ramoss/Introducao-a-Logica-de-Programacao---MATA37 | Lista 3/validacaodenota.cpp | #include <iostream>
using namespace std;
int main () {
double nota,media=0;
int cont=0;
while (cont<=1){
cin >> nota;
if (nota>=0 && nota<=10){
media+=nota;
cont++;
}
else
cout << "nota invalida\n";
}
cout << "media = " << media/2 << endl;
return 0;
}
| ALGO | 0.991556 | 3.854912 |
f8b9a0c5-1abc-439e-be82-76d8b82fa128 | jspw/Algorithms-with-c-and-cpp | Dynamic Programming/Matrix Chain Multiplication.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAX 100
int row[MAX], col[MAX];
int dp[MAX][MAX];
bool visited[MAX][MAX];
int f(int beg,int end)
{
if(beg>=end)return 0;
if(visited[beg][end])return dp[beg][end];
int ans=1<<30; //২^৩০ কে ইনফিনিটি ধরছি
for(int mid=beg; mid<end;mid++) //দুইভাগে ভাগ করছি
{
int ... | ALGO | 0.999972 | 3.764832 |
e8ef6492-ffb1-4d90-9ead-9792069c6269 | otavioon/COLA-2022-Tools | datasets/src/algo/codenet/2/s435657215.cpp | #include<iostream>
#include<set>
using namespace std;
multiset<int> Set;
int res,a,n;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
Set.insert(a);
}
while(!Set.empty())
{
auto it=Set.end();
int x=*it;
it--;
Set.erase(it);
for(int i=1;i<=x;i*=2)
{
if(Set.find(i-x)!=Set.end())
{
Set.... | ALGO | 0.999638 | 3.677804 |
4b23b38a-cca9-413c-90bf-5e4af04c9d6b | InTheBloodHorse/ACM | POJ/2456二分.cpp | #include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,m;
int a[100005];
int bin(int dis){
int number=1;
int cnt=a[0];
for(int i=1;i<n;i++){
if(a[i]-cnt >= dis){
number++;
cnt = a[i];
}
if(number>=m) return 1;
}
return 0;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<... | ALGO | 0.999999 | 3.936099 |
a70d3b61-ebdf-47f3-829e-03e9730b8f15 | CHENG-Yunfeng/Leetcode | week1/88. Merge Sorted Array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int p1 = m -1 , p2 = n - 1;
int p = m + n - 1;
while (p1 >= 0 && p2 >= 0) {
if (nums1[p1] > nums2[p2]) {
nums1[p] = nums1[p1];
p1--;
}
... | ALGO | 0.99998 | 5.272513 |
2b53a6a1-162a-4303-ac48-fd127bed9779 | gy910210/LeetCode | H-Index II.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
int len = citations.size();
if (len == 0) {
return 0;
}
int left = 0, right = len - 1;
while (left <= right) {
int mid = (left + right) >> 1;
if (citations[mid] == len - mid) {
... | ALGO | 0.999963 | 6.472364 |
89271c4a-cefe-408c-bc52-301c17241546 | kinghim17/dsa-complete-review | STL/count frequencies.cpp | #include<bits/stdc++.h>
using namespace std;
void countFreq(vector<int>&v, int n){
unordered_map<int,int>h;
for(int i=0;i<n;i++){
h[v[i]]++;
}
for(auto i:h){
cout<<i.first<<" "<<i.second;
}
}
int main(){
int a,b,c,m,n;
cin>>n;
int temp;
vector<int>v;
for(int i=0;i<n;i++){
cin>>temp;
v.push_back(temp);
}
... | ALGO | 0.999657 | 3.975427 |
da4e76bc-37d6-4bf4-afea-ffc95c778dd0 | ananas94/leetcode | merge-k-sorted-lists.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 {
private:
ListNode* merge(List... | ALGO | 0.999939 | 5.842914 |
27fa9b51-33f8-418a-a943-c2a11cc75c92 | marcosotomac/ADS_CS | grafos/main.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
class Graph
{
public:
map<int, vector<pair<int, int>>> V;
vector<vector<int>> dist;
void shortPath()
{
int s = V.size();
initDist(s);
for (int i = 0; i < s; i++)
{
... | ALGO | 0.99996 | 4.024942 |
c698b3f2-74fd-4051-8bd5-b1a83b849497 | stratwine/epi | Closest_stars.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iostream>
#include <queue>
#include <random>
#include <string>
#include <sstream>
#include <vector>
using std::array;
using std::cout;
using std::default_random_engine;
using std::endl;
using std::istringstream;
using std::max;
using s... | ALGO | 0.999745 | 4.71186 |
48436aa7-c5e2-4524-bfdd-57c33bc20fb8 | krishna-raj007/BodhiTree-Annotation | CS101_Spring2020-21 /LAB4_L1/categorized/mod/one_passed/30_mod.cpp | #include<simplecpp>
main_program{
//Write your code here
long int n,m,i=1,f=1;
cin >> n >> m;
repeat(n){
f = (f*i)%m;
i++;
}
cout << f<< endl;
}
| ALGO | 0.999993 | 4.201891 |
660052da-3736-498d-ba1a-5ad2acc14e87 | pablocrossa/trinitycore-portable | src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp | /*
* Comment: MAYBE need more improve the "Raptor Call".
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
{
SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled
SPELL_GRIEVOUS_BITE = 48... | TOOL | 0.85758 | 6.279477 |
31bef53f-f63d-4e4b-831b-7cd485b72092 | dylan007/Coding | codechef/chserve.cpp | /*=======================
Author : Shounak Dey
Filename : chserve.cpp
======================= */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define PB push_back
#define MK make_pair
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#... | ALGO | 0.999821 | 3.692089 |
821a9e4c-7d93-49dd-8b18-73959fa52f87 | aenoskov/RankLib | indri/tags/release-5.11/src/ReformulateQuery.cpp | #include <iostream>
#include <sstream>
#include "indri/Parameters.hpp"
#include "indri/ReformulateQuery.hpp"
std::string indri::query::ReformulateQuery::downcase_string( const std::string& str ) {
std::string result;
result.resize( str.size() );
for( size_t i=0; i<str.size(); i++ ) {
result[i] = tolower(str[... | TOOL | 0.923449 | 3.085396 |
d471c789-f5c3-4e04-863e-b512e89c4169 | matthew-lim-matthew-lim/my-leetcode | 1046-LastStoneWeight/1046-LastStoneWeight.cpp | class Solution {
public:
int lastStoneWeight(vector<int>& stones) {
priority_queue<int> pq;
for (int stone : stones) {
pq.push(stone);
}
while (pq.size() > 1) {
int top1 = pq.top();
pq.pop();
int top2 = pq.top();
pq.pop();
... | ALGO | 0.999894 | 5.851833 |
39b67300-6308-4217-86fc-adb2463c6569 | ishandutta2007/codeforces | heart_blue/normal/390/C.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999859 | 3.572963 |
3c7f9131-5b50-46a5-9a23-09077c9febc4 | AlijonTursunboyev/lab9-FSE1 | problem2.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
vector<vector<int>> graph(a);
for (int i = 0; i < b; i++) {
int u, v;
cin >> u >> v;
graph[u].push_back(v);
graph[v].push_back(u); }
int queue;
cin >> queue;
for... | ALGO | 0.999981 | 4.260453 |
1e0f4abe-d29b-4e00-87a1-2e25ce895351 | wallerm/UE4 | Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformMisc.cpp | /*=============================================================================
GenericPlatformMisc.cpp: Generic implementations of misc platform functions
=============================================================================*/
#include "Linux/LinuxPlatformMisc.h"
#include "Misc/AssertionMacros.h"
#include "G... | TOOL | 0.956548 | 4.03529 |
969b69f4-732e-4f44-b53b-21e46a938c8f | MYTE21/Competitive-Programming-Problems | Codeforces_A, B/Codeforces - 378(A. Playing with Dice).cpp | /*input
2 5
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std ;
int main()
{
int a, b ;
int aWin = 0, bWin = 0, draw = 0 ;
cin>> a >> b ;
for(int i=1;i<=6;i++)
{
if(abs(a-i) < abs(b-i)) aWin++ ;
else if(abs(a-i) > abs(b-i)) bWin++ ;
else draw++ ;
}
cout<<aWin<<" "<<draw<<" "<... | ALGO | 0.999754 | 3.817547 |
eca96ec7-b8a7-4cca-b80c-834bcb5309b8 | JBlakd/self-study | string-longest-common-prefix/longest_common_prefix.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
int i = 0;
string ret = "";
while (true) {
char cur_char = '$';
// check char at current index
fo... | ALGO | 0.996981 | 5.356822 |
7b988e99-1a24-46dd-abd0-5c0a4bb2fff0 | jiang-taibai/LeetCode | src/main/java/com/coderjiang/DailyPractice/Monthly_2025_03/DailyPractice_20250314.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
static bool isBalanced(const string &num) {
int sum = 0;
for (int i = 0; i < num.size(); ++i) {
if (i & 1) sum += num[i] - '0';
else sum -= num[i] - '0';
}
return sum == 0;
}
};
int m... | ALGO | 0.99867 | 5.869202 |
8f348570-441b-4136-be7d-2903a34670ed | goelayush7/LEETCODE | 1138-grumpy-bookstore-owner/grumpy-bookstore-owner.cpp | class Solution {
public:
int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int k) {
int n = grumpy.size();
int wpo = 0;
for(int i =0;i<n;i++){
if(grumpy[i]==0){
wpo += customers[i];
}
}
int i =0;
int j =0;
in... | ALGO | 0.999871 | 5.675123 |
3a78d290-ec88-4d95-9ced-39510b995d47 | fudank2/Everyday_code_Practice | DEC2/binarystringadd.cpp |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll_ll pair<long long,long long>
#define vi vector<int>
#define vll vector<long long>
#defin... | ALGO | 0.999996 | 4.10127 |
29a915bd-d3e9-4157-98b1-96dd7a4ed140 | kmac3063/Cpp_hm | Cats_1_tour/F_BufferedReader/main.cpp | #include <iostream>
#include <string>
#include <cstdint>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <memory>
using namespace std;
class PackageStream {
public:
PackageStream(std::string data, int32_t package_len) : data_(data), package_len_(package_len) {}
int32_t PackageLen() const ... | ALGO | 0.925221 | 4.207405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.