uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
7c59d883-a031-478a-8311-b5a5b3a1c1df | Wencelsav/2048 | 001.02.cpp | #include <time.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
typedef unsigned int uint;
using namespace std;
enum movDir { UP, DOWN, LEFT, RIGHT };
class tile
{
public:
tile() : val( 0 ), blocked( false ) {}
uint val;
bool blocked;
};
class g2048
{
public:
g2048() ... | ALGO | 0.948534 | 4.309951 |
90789c89-2f57-4e4c-b654-f1a52e098ebb | Buttiyeeppp/Code | HLOJ/C23017.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ls (id<<1)
#define rs (id<<1|1)
const int N=2e5+10;
typedef pair<int,int> PII;
ll read() {
ll f=1,z=0; char ch=getchar();
while(ch<'0'||ch>'9') {
if(ch=='-') f=-1; ch=getchar();
}
while(ch>='0'&&ch<='9') {
z=z*10+ch-'0'; ch=getchar();
}
... | ALGO | 0.999966 | 3.432523 |
1a9e7320-a710-455e-9f23-d2afc077ceac | mkmarathe/cpp | problems/rateLimiter.cpp |
/* Design a system to limit the rate at which users or clients can perform
* actions (e.g., API requests) to prevent abuse and ensure fair resource usage.
* The rate limiter should enforce rules like "no more than X requests per
* second per user."
*/
#include <cassert>
#include <chrono>
#include <ctime>
#include ... | TOOL | 0.923828 | 6.476576 |
d841d616-5362-45bc-8f73-ee04a0d1613e | sbrus1213/Problem-Solving | BOJ_code/11000/A11093_S.cpp | // BOJ 11093 Secret Message
//
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
cin.tie(NULL); ios_base::sync_with_stdio(false);
int tc; cin >> tc;
while (tc--) {
string str; cin >> str;
int sz = str.size(), l;
for (l = 1; l * l < sz; ++l);
ve... | ALGO | 0.999979 | 4.260133 |
f57a127d-0b18-4dd8-a9b7-6beaa3e041e6 | OrhunInan/BBM203 | Assignment 1/EncodeMessage.cpp | #include "EncodeMessage.h"
#include <bitset>
#include <iostream>
// Default Constructor
EncodeMessage::EncodeMessage() = default;
// Destructors
EncodeMessage::~EncodeMessage() = default;
std::string string_to_binary_string(const std::string &input) {
std::string output;
for (char c : input) {
outp... | ALGO | 0.977708 | 5.678139 |
19c4c00e-da91-45ef-a2a0-7a0f45210732 | raincross7/code-similarity | codes/train_code/problem322/problem322_292.cpp | #include<iostream>
using namespace std;
int main()
{
for(int i=1;i>0;i++)
{
int x;
cin>>x;
if(x==0)
{
break;
}
cout<<"Case"<<" "<<i<<":"<<" "<<x<<endl;
}
return 0;
} | ALGO | 0.994155 | 3.206936 |
95781933-8f6c-44d1-b52d-e5dea8c07575 | CarlosArnulfo/Lab3P3_CarlosBonilla | Lab3P3_CarlosBonilla/Lab3P3_CarlosBonilla.cpp | // Lab3P3_CarlosBonilla.cpp : Este archivo contiene la función "main". La ejecución del programa comienza y termina ahí.
//
using namespace std;
#include <iostream>
#include <array>
#include <vector>
#include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> ... | ALGO | 0.998302 | 3.448191 |
ce582a8c-7d3f-45a1-b37c-815fffd1777c | aszos/SchoolWork | Undergrad/CISC220/Notes/Notes-9-11/stacks.cpp | #include <iostream>
/*
Stacks
- Postfix expression evaluation
--> 3 4 +
Algorithms for Stacks
1. If it is a number, push it onto the stack.
2. If it is an operator, pop last 2 numbers, apply operation, push result.
Visual of a Stack
---
|+|
---
|4| = 7
---
|3|
---
Stack Implementation
...using an array:
| | | |... | ALGO | 0.998474 | 5.719316 |
66114986-2575-4ba0-a560-f66988acf274 | manikanta2901/ubuntu | .history/imp/cpp/DataStructures/priority_queues/functions_20200624181758.cpp | #include<bits/stdc++.h>
using namespace std;
void PrintQue(priority_queue<int> a){
while(!a.empty()){
cout << a.top() << " " ; // top function used to get the top element or the largest element upto know
a.pop(); // removes the first element of the list
}
cout << endl;
}
in... | ALGO | 0.998979 | 4.121095 |
3f36b0ac-91d2-4e6f-97cc-12112b20700e | Akshayp001/LeetSolutions | 2251-number-of-ways-to-divide-a-long-corridor/number-of-ways-to-divide-a-long-corridor.cpp | class Solution {
public:
int numberOfWays(string corridor) {
int mod = 1e9 + 7;
int ct=0;
for(auto i:corridor){
if(i=='S'){
ct++;
}
}
if(ct&1 || ct==0) return 0;
if(ct==2) return 1;
vector<int> pcnts;
int p=0;
... | ALGO | 0.999979 | 5.314416 |
76189e31-debd-4b44-a530-52fedcc4714d | trueos/trueos-ports | comms/qsstv/files/patch-qsstv_drmrx_psdmean.cpp | --- qsstv/drmrx/psdmean.cpp.orig 2019-04-18 21:12:04 UTC
+++ qsstv/drmrx/psdmean.cpp
@@ -36,7 +36,6 @@
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
-#include <malloc.h>
void rfft(float *, int, int);
void psdmean(float *input, float *psd, int lblock, int nblocks)
{
| ALGO | 0.996912 | 3.884736 |
673e6d23-b403-4863-9ae5-d33933078fcf | sipho-mancam/common_module | Dependencies/libs/compute/perf/perf_stl_partial_sum.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
using boost::compute::int_;
perf_parse_args(argc, argv... | ALGO | 0.994572 | 5.875501 |
b7d5cc48-a6c4-4133-ac86-9c1d378e4a5e | insectkorea/my-cp | practice2/d/main.cpp | /**
* author: insectkorea
* create-mm-dd hh:mm:ss
**/
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
// clang-format off
/* accelration */
// 高速バイナリ生成
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// cin cout の結びつけ解除, stdioと同期しない(入出力非同期化)
// cと... | ALGO | 0.999997 | 5.04243 |
ce218677-10a1-4871-bf6c-97d6b4dc2af1 | ashokabairwaideology/Leet-code-problem | lcof2/剑指 Offer II 022. 链表中环的入口节点/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* detectCycle(ListNode* head) {
ListNode* fast = head;
ListNode* slow = head;
while (fast && fast->n... | ALGO | 0.999921 | 5.721942 |
77f0945a-968a-44cd-a626-d551075c72f2 | icoretic44/OLP | hello22_maxval.cpp | #include<bits/stdc++.h>
using namespace std;
#define int int64_t
const int N = 1e7+5;
int a[N];
int ST[4*N][3];
void build(int id,int l,int r)
{
if(l==r)
{
ST[id][1] = a[l];
ST[id][2] = a[l];
return ;
}
int mid = (l+r)/2;
build(id*2,l,mid);
build(id*2+1,mid+1,r);
ST[i... | ALGO | 0.999931 | 4.294587 |
8c2f9932-a05f-46f0-a5d5-b3936f988b4d | zxysnow/leetcode | 20-valid-parentheses.cpp | class Solution {
public:
stack<char> stk;
bool isValid(string s) {
for (int i = 0; i < s.size(); i++) {
if (s[i] == '(' || s[i] == '{' || s[i] == '[') {
stk.push(s[i]);
} else {
if (!stk.empty() && (s[i] == ')' && s[i] - 1 == stk.top() || s[i] - 2 ... | ALGO | 0.999522 | 6.426878 |
672f465b-8aaf-4509-b494-ff74adccbaa8 | kyungwonS928/BaekJoon_practice | BaekJoon_Sliver/21760/21760.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
while (T--)
{
int N, M, k, D;
cin >> N >> M >> k >> D;
int team_in = M * (M - 1) / 2 * N * k;
int team_out = N * (N - 1) / 2 * M * M;
int result = D / (team_in + team_out);
if ... | ALGO | 0.999468 | 4.283192 |
8fd22b4f-ebd9-415d-baee-11b260f66ec9 | phongtapcode/DSA_PTIT-2023 | DSA09025.cpp | #include<bits/stdc++.h>
using namespace std;
int dinh,canh,s,t;
vector<int> adj[1000];
bool visited[1000];
int parent[1000];
void DFS(int u) {
visited[u]=true;
for(auto v: adj[u]) {
if(!visited[v]) {
parent[v]=u;
DFS(v);
}
}
}
void path(int s,int t) {
memset(visited,false,sizeof(visited));
DFS(s);
if(!v... | ALGO | 0.999844 | 3.837993 |
30d766de-cb2e-4469-8c7b-7eeead6927eb | Plain-Andy-legacy/android_frameworks_av | media/libstagefright/codecs/amrnb/dec/src/ex_ctrl.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/ex_ctrl.c
Funtions: ex_ctrl
Date: 02/08/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Replaced "int" and/or "char" with OSCL... | ALGO | 0.991022 | 6.994018 |
e443195c-cbaf-40a1-824c-87e3a2696cfd | OscarEscamilla/flutter_farmcontrol | 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 |
98e4d9d8-899c-4fb9-a294-942457b4b37b | MahletNigusse/write-after-read-protocol | storage/ndb/src/common/util/md5_hash.cpp | #include "md5_hash.hpp"
#ifdef WORDS_BIGENDIAN
#define HIGHFIRST 1
#endif
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);
/*
* Note: this code is harmless on little-endian machines.
*/
void byteReverse(unsigned char *buf, unsigned longs)
{
... | ALGO | 0.99963 | 5.926673 |
b306e27c-19d1-4451-9f9b-2da18019a313 | Meyito/Competitive-programming | URI/1533 Detective Watson.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, i;
cin>>n;
map<int,int> killers;
while(n!=0){
killers.clear();
i=1;
while(i<=n){
cin>>x;
killers[x]=i;
i++;
}
map<int, int>::reverse_iterator it;
it=killers.rbegin();
it++;
cout<<it->second<<"\n";
cin>>n;
}
r... | ALGO | 0.999818 | 3.605538 |
5f6901ce-bd59-4e04-b366-e5e64357b58d | LinXin04/C-Primer | inline.cpp | #include <iostream>
using namespace std;
inline double square(double x) { return x*x; }
int main()
{
double a, b;
double c = 13.0;
a = square(5.0);
b = square(4.5 + 7.5);
cout << "a = " << a << ", b = " << b << endl;
cout << "c = " << c;
cout << ", c squared = " << square(c++) << endl;
cout << "Now c = " << c <... | TOOL | 0.95171 | 3.719282 |
1d252ce0-605f-439e-99cf-432bbf47f4c0 | ishandutta2007/codeforces | bohun/normal/956/C.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define ld long double
#define fi first
#define se second
#define ll long long
#define ss(x) (int) x.size()
#define mp make_pair
#define FOR(i, n) for(int i = 1; i <... | ALGO | 0.999855 | 3.835513 |
8f27fd01-cdd7-41a7-9d0e-5273a0b53d0d | Premkumar981/CPP_Daily_Problems | electricity billing system.cpp | #include <iostream>
using namespace std;
class currentBill{
public:
virtual double amount()=0;
};
class Fan: public currentBill{
public:
int watts,hrs;
double amount(){
double t=watts*hrs;
double a= (t/1000)*1.5;
return a;
}
};
class Light: public currentBill{
... | TOOL | 0.988979 | 3.893115 |
dd08e5ce-1fc8-4857-a753-d64bff28463d | skully-coder/competitiveprogramming | Recursion/0002-add-two-numbers/0002-add-two-numbers.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* addTwoNumbe... | ALGO | 0.999947 | 6.359583 |
9011a956-f4b9-459f-89f0-41248a13e717 | shafayetejaman/CLI-projects | extractText/files/week 10/day 4/A_2023.cpp | // https://codeforces.com/contest/1916/problem/0
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#ifdef LOCAL
#include "D... | ALGO | 0.999868 | 4.176056 |
ce1b467a-c973-4a0b-95be-9042bb004bdc | kayarre/reconbench | ann/ann2fig/ann2fig.cpp | #include <cstdio> // C standard I/O
#include <cstdlib> // standard lib defs
#include <cstring> // C strings
#include <fstream> // file I/O
#include <string> // string manipulation
#include <ANN/ANNx.h> // all ANN includes
using namespace std; // make std:: accessible
//---------------... | DATA | 0.900115 | 4.448532 |
a748318d-4163-411a-8cba-ce30b2ad6b1c | ColorfulsKite/THCS2 | PhepToanCoBan2.cpp | #include<stdio.h>
#include<math.h>
void bailam(){
int a,b;
scanf("%d%d",&a,&b);
if(b==0){
printf("%d",0);
return;
}
printf("%d\n%d\n%lld\n%d\n%d\n%.2f\n", a + b, a - b,(long long) a * b, a/b, a%b, (float) a/b);
}int main(){
// int t;
// scanf("%d",&t);
// while(t--){
... | ALGO | 0.99885 | 3.070908 |
37a0726d-3e9b-4b83-b1a5-bc6d6ba1933e | akashghadge/competitive-programming | CodeForces/769/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define en "\n"
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<ll>
#define ll long long
#define v vector
#define pii pair<int, int>
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
int sol(string s... | ALGO | 0.999849 | 5.377534 |
6ab1ab7d-965c-4661-bb9d-33a159173a8e | ProkingK-University/Matrix-and-Vector-Library | matrix.cpp | #include "matrix.h"
#include <iomanip>
//Matrix constuctor creates 2D array and sets them to 0;
Matrix::Matrix(unsigned r, unsigned c) : rows(r), cols(c)
{
matrix = new double*[rows];
for (int i = 0; i < rows; i++)
{
matrix[i] = new double[cols];
}
for (int i = 0; i < rows; i++)
{
... | TOOL | 0.904473 | 4.049494 |
3d661fe6-7eb6-4d4d-8f67-437427e7b523 | ShrutiRani7029/SHEET_PLACEMENT | FIRST LAST OCC.CPP | #include<bits/stdc++.h>
using namespace std;
int first(int arr[],int n,int k)
{
int s=0,e=n-1;
int res=-1;
while(s<=e)
{
int mid= s + (e-s)/2;
if(arr[mid]<k)s=mid+1;
else if(arr[mid]>k)e=mid-1;
else
{
res=mid;
e=mid-1;
}
}
r... | ALGO | 0.999921 | 5.19491 |
0b9f5a85-baac-440f-a8eb-c71b73d1fb29 | javagovindsharma/leetscode | solution/3000-3099/3028.Ant on the Boundary/Solution.cpp | class Solution {
public:
int returnToBoundaryCount(vector<int>& nums) {
int ans = 0, s = 0;
for (int x : nums) {
s += x;
ans += s == 0;
}
return ans;
}
}; | ALGO | 0.999984 | 5.677852 |
1e9f3989-6707-4225-820a-7c808721df10 | PalomaPe/programacion2-fing | src/binario.cpp | /* 5201305 */
/*
Módulo de implementadcíon de 'TBinario'.
*/
#include "../include/utils.h"
#include "../include/binario.h"
#include "../include/cadena.h"
#include "../include/info.h"
#include "../include/avl.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
struct _rep_binario
{
TBinario left;
... | ALGO | 0.999736 | 4.940019 |
af3e0e93-3256-40be-b883-33ead66e9f6c | raincross7/code-similarity | codes/train_code/problem187/problem187_95.cpp | #include <iostream>
#ifdef MBP
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define REP(i, n) for (long long int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (long long int i = 1, i##_len = (n); i <= i##_len; ... | ALGO | 0.999947 | 3.472546 |
351ef34d-f405-4eb7-a735-b9a6ca46a6fd | ishandutta2007/codeforces | keko37/normal/1416/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef pair <int, int> pi;
const int MAXN = 500005;
int n, m, q, cnt, br, ofs = 1;
int p[MAXN], par[MAXN];
int ea[MAXN], eb[MAXN], tip[MAXN], ind[MAXN], ok[MAXN], bitan[MAXN];
int lo[MAXN], hi[MAXN];
vector <int> v[MAXN], ch[MAXN];
set <int> lef... | ALGO | 0.999912 | 4.222518 |
3d4b4579-6d94-477d-8ebc-570c3998ef1a | raincross7/code-similarity | codes/train_code/problem127/problem127_277.cpp | #include <stdio.h>
#include <string.h>
#define ll long long int
#define fl(i,n) for(int i = 0; i < (n); i++)
#define fls(i,s) for(int i = 0; s[i] != '\0'; i++)
int main() {
int h1,m1,h2,m2,k;
scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
int duration;
if(h1 > h2){
duration = ((h1-h2)*60) + ... | ALGO | 0.999785 | 3.736248 |
bf5abbb5-1c28-4fca-aa39-6e2d857da954 | LUO-MIN/Code | 盛水最多的容器.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int start=0;
int end=height.size()-1;
int sum=0;
int maxsum=0;
while(start<end)
{
int len=min(height[start],height[end]);
sum=len*(end-start);
maxsum=max(maxsum,sum);
... | ALGO | 0.999881 | 6.612725 |
723529ec-4ad8-421b-8fe0-9469cd1b3e1f | Ahiraf/_Competitive_Programming_ | Summer_Camp_Problems/floor_ceil_round.cpp | //Given 2 numbers A and B.Find the floor , ceil and round value of A/B
/*Floor : it means the greatest integer less than A/B ....like, 10/3=3.33333333 =3(floor) ....7.5=7(floor)
Ceil : it means the smallest integer greater than or equals to A/B
Round : it means the closest integer to the number . ... 7.5=8(... | ALGO | 0.99892 | 4.37474 |
2e1a73ba-4f40-46f0-87ca-4c6315f543b6 | congvee/Algorithm-Notes-book | 3 入门模拟/3.1 简单模拟/[PAT A1065] A+BandC(64bit).cpp |
#include <iostream>
using namespace std;
int main(){
int T;
cin >> T;
int k = 1;
while(T--){
long double a, b, c;
cin >> a >> b >> c;
if(a + b > c){
cout << "Case #"<< k <<": true" <<endl;
}else{
cout << "Case #"<< k <<": false"<<endl;
... | ALGO | 0.964803 | 4.51966 |
7085694f-81f5-4c9a-a6e9-88ec1a152fa3 | usgs/pestpp | src/libs/Eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.977681 | 6.666052 |
4e4f9471-7b6c-4ba3-af79-882f14d0e6df | AlexGeControl/Auto-Car-04-Planning-01-Trajectory-Planning-Robotics-Approach | src/Eigen-3.3/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.998531 | 3.818773 |
135c4cf3-7c2e-4b6d-8b16-0cad1040ceae | Rehmankk360/Competitive-Programmer-CPP | 3-longest-substring-without-repeating-characters/3-longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int rs = 0;
vector<int> h(127);
int l = 0;
int r = 0;
while (r < s.length())
{
h[s[r]]++;
while (h[s[r]] > 1)
{
h[s[l]]--;
l++;
}
r++;
rs = max(rs, r - l)... | ALGO | 0.999796 | 5.877769 |
303d3e4e-b793-4f75-b67f-3069830f750e | heejj723/algorithm-cote | 그리디/백준 4796.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int L = 5, P = 4, V = 4;
vector<int> answer;
while(1){
int ans = 0;
cin >> L >> P >> V;
if(L == 0 && P == 0 && V == 0){
break;
}
int circle = V/P;
int left = V%P;
ans+=circle*L;
if(left >= L){
ans+=L;
}els... | ALGO | 0.99975 | 3.976344 |
2ff5f2f8-5dee-4d79-a494-af814a625402 | 5yh/leetcode | 位运算/1356.cpp | // bit[i]=bit[i>>1]+(i&1)
class Solution
{
public:
int numbits(int num)
{
int ans = 0;
while (num)
{
num &= num - 1;
ans++;
}
return ans;
}
vector<int> sortByBits(vector<int> &arr)
{
// 值传递方式lambda=
sort(arr.begin(), arr... | ALGO | 0.999982 | 5.416319 |
f399b084-cbb2-451e-9b48-f012e364146b | avcopan/MPACK | mlapack/testing/common/Rgecon.debug.cpp | #include <mblas.h>
#include <mlapack.h>
#include <mpack_debug.h>
#include <blas.h>
#include <lapack.h>
#if defined VERBOSE_TEST
#include <iostream>
#endif
#define MIN_N 3
#define MAX_N 20
#define MAX_LDA 20
#define MAX_ITER 5
REAL_REF maxdiff = 0.0;
void Rgecon_test2(const char *norm)
{
int errorfla... | TEST | 0.917038 | 6.28952 |
b038c8fe-342a-4082-812a-718936db4671 | Saimirbaci/Udacity | CarND-T2-MPC-Project/src/Eigen-3.3/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.994307 | 4.671507 |
228eb805-7f77-47ee-9826-63ec27179f83 | Foysal-Munsy/Rush-Roadmap | Week-29/Day 05/A_Problemsolving_Log.cpp | //
// Created by Foysal Munsy on 19 / 12 / 2023
// Time: 20 : 38 : 15
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define nl '\n'
#define all(x) x.begin(), x.end()
#ifdef LOKAL
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
const int N = 2... | ALGO | 0.999802 | 5.357136 |
e399b0fa-f782-4238-a9e7-2ef04dd92592 | Raghavgarg12/Leetcode | 3213-count-subarrays-where-max-element-appears-at-least-k-times/count-subarrays-where-max-element-appears-at-least-k-times.cpp | class Solution {
public:
long long countSubarrays(vector<int>& nums, int k) {
long long n=nums.size();
long long start=0,end=0,ans=0,count=0;
long long maxi=*max_element(nums.begin(),nums.end());
for(end=0;end<n;end++){
if(nums[end]==maxi) count++;
while(count... | ALGO | 0.999957 | 5.864182 |
a5098032-1a98-474f-a067-c660f136c54d | AdVander18/FileReader | FileReader.cpp | #include <iostream>
#include <filesystem>
#include <string>
#include <fstream>
#include <locale>
#include <algorithm>
#include <cctype>
#include <cstring> // memcmp
#ifdef _WIN32
#include <Windows.h>
#endif
namespace fs = std::filesystem;
#ifdef _WIN32
std::string ansi_to_utf8(const std::string& ansi) {
int wl... | TOOL | 0.927669 | 5.71829 |
a6c93803-f466-471d-a79c-5e7e6ef2435e | mattkatz/Unlogo | src/Tools/ASIFT/libNumerics/rodrigues.cpp | #ifdef RODRIGUES_H
namespace libNumerics {
template <class T>
matrix<T> skew(const vector<T>& v)
{
assert(v.nrow() == 3);
matrix<T> M(3,3);
M(0,0) = M(1,1) = M(2,2) = 0;
M(1,2) = -(M(2,1)=v(0));
M(2,0) = -(M(0,2)=v(1));
M(0,1) = -(M(1,0)=v(2));
return M;
}
template <class T>
matrix<T> rot... | ALGO | 0.983478 | 5.577325 |
6af07b4d-75a1-410a-9b5a-fb7c05009f5f | itlezy/eMule-mods-archive | eMule-0.50a-MorphXT_v12.3_src_and_libs/cryptopp/base64.cpp | // base64.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "base64.h"
NAMESPACE_BEGIN(CryptoPP)
static const byte s_vec[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const byte s_padding = '=';
void Base64Encoder::IsolatedInitialize(const NameValu... | TOOL | 0.928926 | 6.766881 |
4db1b2f7-96ec-479b-beec-6bd248d90051 | nodchip/icfpc2021 | libs/boost_1_76_0/libs/spirit/example/qi/compiler_tutorial/calc3.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A calculator example demonstrating the grammar and semantic actions
// using phoenix to do the actual expression evaluation. The parser is
// essentially an "interpreter" that evaluates expressions on the fly.
//
// [ JDG June 29,... | ALGO | 0.924306 | 7.516595 |
0954ab50-2d0e-4ee8-b849-40358405fc03 | mostafa-cse/Most-Used-Templates-from-Various-Sources | Basics/Counting Sort.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAX = 100;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<int> cnt(MAX + 1, 0);
for (int i = 1; i <= n; i++) {
int x; cin >> x;
cnt[x]++;
}
for (int i = 0; i <= MAX; i++) {
while (cnt[i] > 0) {
co... | ALGO | 0.999987 | 4.605721 |
f025ea8b-cf9d-4d35-9759-73571ddd7170 | LTVinh-dev/ForHCMUT | NMDT/lab/lab_2/Fnc/bai8.cpp | #include<iostream>
using namespace std;
int reverseNum(int n)
{
int reversedNum = 0;
while (n!=0){
reversedNum = reversedNum * 10 + (n % 10);
n /= 10;
}
return reversedNum;
}
int main()
{
int n;
cin>>n;
cout<<reverseNum(n);
return 0;
} | ALGO | 0.999903 | 4.8584 |
35af96f9-b9a8-4484-8880-c8bdf72b6ccb | Syuq/demo | C++/Fraction.cpp | #include "Fraction.h"
#include <bits/stdc++.h>
int gcd(int numer, int denom) {
int result;
while (denom != 0) {
result = numer % denom;
numer = denom;
denom = result;
}
return numer;
}
int lcm(int a, int b) {
return (a / gcd(a,b)) * b;
}
Fraction simplify (Fraction a) {
int cd;
cd = gcd(a.n... | TOOL | 0.98994 | 4.990191 |
e49b1ac0-4ea4-4139-a7ee-bcfabdd328f3 | fli217/LeetCode | #204.cpp | /*============================================================
Problem: Count Primes
==============================================================
Description:
Count the number of prime numbers less than a non-negative
number, n.
============================================================*/
class Solution {
public:
... | ALGO | 0.999979 | 5.142682 |
81ae3183-6c79-4beb-903a-571507e674ce | ishandutta2007/codeforces | couplefire/normal/1361/D.cpp | #include <bits/stdc++.h>
static struct FASTIO {
char READ_CHARACTER; bool REMAINING_CHARACTER = false;
inline void ignore(); inline void flush();
template <typename T> inline bool READ_INT(T &x); template <typename T> inline bool READ_STRING(T &x);
/* ... | ALGO | 0.999902 | 3.612157 |
0cee5e26-3460-488b-ad12-b3014698509b | Shankarisr/VCare-Exchange | exchange_app/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.99857 | 6.76073 |
6ba1ccc2-9f23-4d23-b6a1-71524d0023f1 | babu12f/uri_problem_solved | The Chosen_1983.cpp | #include<bits/stdc++.h>
#define sf scanf
#define pf printf
using namespace std;
int main()
{
int s, r;
float n, mx, rool;
cin>>s;
cin>>r>>n; s--;
mx = r;
rool = n;
while(s--)
{
cin>>r>>n;
if(n>rool){mx = r; rool = n;}
}
if(rool>=8)
{
cout<<mx<<endl... | ALGO | 0.999947 | 3.494634 |
54dcf5c8-812c-42aa-b1ab-3f5308847071 | Marx-23/Portfolio | tecnicasAlgoritmicas/sudoku.cpp | <<<<<<< HEAD
#include <iostream>
#include <utility>
#include "sudoku_helper.h"
using namespace std;
int nodos_visitados = 0;
int INF = 1e9;
int N; int sqrtN;
Tablero tablero;
pair<int, int> mejor_casillero_para_expandir() {
int mejor_i, mejor_j, mejor_cnt;
mejor_i = mejor_j = -1; mejor_cnt = INF;
for ... | ALGO | 0.997757 | 5.795257 |
d0a4e94b-26f4-483a-b6c6-544db07bc4f5 | AllenWu233/algorithm_study | chapter_6/uva804.cpp | #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <iostream>
#include <vector>
#include <cstring>
#include <map>
using namespace std;
const int maxn = 110;
int NP, NT, NF, kase;
int P[maxn]; // 库所
vector<int> T[maxn]; // 变迁
map<int, int> token; // 记录某一个变迁中库所要减少的token数
void read_input() {
... | ALGO | 0.997949 | 3.525266 |
276d34be-d306-4ed5-bd59-5f71fdca7ff7 | sani38/lab | Без опыта./лаб3/B(Циклы, Задачи, анализ цифр числа).cpp | #include <iostream>
using namespace std;
int NumberOfZeroes(int n) {
int count = 0;
while (n != 0) {
if (n % 10 == 0) {
count++;
}
n /= 10;
}
return count;
}
int main() {
int N;
cout;
cin >> N;
if (N < 0) {
cout << "Wrong" << endl;
... | ALGO | 0.999781 | 4.394081 |
0f375487-6e1a-41f5-89a3-cf7ab47f64ca | rohan2371/InterviewPrep_DSA | maths-leetcode/179. Largest Number.cpp | /*
Leetcode Link : https://leetcode.com/problems/largest-number/description/
*/
class Solution {
public:
string largestNumber(vector<int>& nums) {
sort(nums.begin(),nums.end(),cmp);
if(nums[0]==0)
return "0";
string ans ="";
for(auto it : nums)
ans+=to_strin... | ALGO | 0.999928 | 6.335731 |
0ab601a6-c4e5-4c9c-bbf7-9dac53adfbab | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/schi/treap/train/66285a00-cc1a-4029-95ee-8c30948febc9.cpp | #include <fstream>
#include <stdlib.h>
using namespace std;
ifstream cin ("schi.in");
ofstream cout ("schi.out");
struct treap
{
int value;
int size;
long long priority;
treap* left;
treap* right;
};
treap* emptytreap=new treap
{
0,0,-1,NULL,NULL
};
bool find (treap* root, int v... | ALGO | 0.999991 | 3.742787 |
802d56f6-2514-472e-8f12-b6213df312c7 | harshithareddy603/OS | 13os.cpp | #include <stdio.h>
// Best Fit memory allocation
void bestfit(int mp[], int p[], int m, int n) {
int allocated[n];
for (int i = 0; i < n; i++) {
allocated[i] = -1; // Initialize allocation array
}
for (int i = 0; i < m; i++) {
int best_idx = -1;
for (int j = 0; j < n; j++) {
... | ALGO | 0.999885 | 4.826169 |
7d31c4b0-587c-4664-ba2b-3568430d0234 | notYourUsername/PixRCAN | src/modules/fw_att_control/ecl_pitch_controller.cpp | /**
* @file ecl_pitch_controller.cpp
* Implementation of a simple orthogonal pitch PID controller.
*
* Authors and acknowledgements in header.
*/
#include "ecl_pitch_controller.h"
#include <float.h>
#include <lib/ecl/geo/geo.h>
#include <mathlib/mathlib.h>
float ECL_PitchController::control_attitude(const float ... | ALGO | 0.989459 | 6.693571 |
f76703a5-2a96-4afb-9885-c72bf17fb1b5 | Andwerpz/Competitive-Programming-Practice | - cpp -/prefixpurchase.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
//Codeforces - 1870D
//i solved this using a greedy strategy, i couldn't prove that this is correct.
//the intuition is that we want to first maximize the number of purchases, regardless of what we purchase.
//this means fi... | ALGO | 0.99996 | 3.489102 |
f1a1aa7c-7057-4823-befa-1850f259c383 | ThatSpaceCowboy/ucs301-ds-codes | Sorting/quick.cpp | #include <iostream>
using namespace std;
// swap function
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
// Quicksort is another Divide and Conquer algo
// We choose a pivot element and sort the array about it;
int partition(int arr[], int low, int high)
{
int pivot = arr[high]; // We... | ALGO | 0.999976 | 5.038453 |
f3d3994e-2a6f-4bc4-8c7d-089884db85e7 | show-me-code/DNN_with_Eigen_for_Edu | eigen-3.3.8/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.9979 | 3.396939 |
125f10e9-fbcb-486a-9c40-fd49794061a4 | Skywt2003/codes | XJOI/CONTEST/1039/braid/braid.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#define int long long
using namespace std;
const int N=998244353;
int T;
int n,m,k,x;
const int yinzi[96]={1,2,4,7,8,14,16,17,28,32,34,56,64,68,112,119,128,136,224,238,256,272,448,476,512,544,896,952,1024,1088,179... | ALGO | 0.999867 | 4.31548 |
d51d1896-ad49-4c4f-9536-ae9cd1fcc152 | aryan57/cp-archive | Google_Coding_Competitions/Round D 2021 - Kick Start 2021/Primes and Queries.cpp | /*
group : Google Coding Competitions - Round D 2021 - Kick Start 2021
name : Primes and Queries.cpp
srcPath : /home/aryan/Documents/cp/Primes_and_Queries.cpp
url : https://codingcompetitions.withgoogle.com/kickstart/round/00000000004361e3/000000000082bcf4#analysis
*/
/*
author : aryan57
created : 12-July-2... | ALGO | 0.997994 | 3.894972 |
7343027c-ee4b-42ea-b474-8ff3bef3669c | infinidb/mysql | extra/yassl/taocrypt/src/blowfish.cpp | /* C++ code based on Wei Dai's blowfish.cpp from CryptoPP */
/* x86 asm is original */
#if defined(TAOCRYPT_KERNEL_MODE)
#define DO_TAOCRYPT_KERNEL_MODE
#endif // only some modules now support this
#include "runtime.hpp"
#include "blowfish.hpp"
namespace TaoCrypt {
#if defined(D... | ALGO | 0.998424 | 6.753125 |
131846e9-1b09-467d-b7ee-443951ae50f4 | Melatoo/Lista-Vetor-Ufla | Lista/1.cpp | #include <iostream>
using namespace std;
void escreve (int *vet, int b) {
cout << "[";
for (int i = 0; i < b; i++) {
if (i == (b-1))
cout << vet[i];
else
cout << vet[i] << ", ";
}
cout << "]";
}
int main () {
int n, n1;
cin >> n;
int vet[n];
for (int i = 0; i < n; i++) {
cin >> n1;
vet[i] = n1;
... | ALGO | 0.968188 | 4.160389 |
7c6660ca-8def-449a-a536-34b4172862a7 | llenroc/CP | LeetCode/top-interview-questions-medium/dp/coin-change.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define INF LLONG_MAX/4
#define MOD 1e9+7
#define DEBUG(x) cerr << #x << " is " << (x) << endl;
class Solution {
public:
int coinChange(vector<int>& coins, int N) {
int n = coins.size();
if(n==0||N==0) return 0;
vector<int> dp(N... | ALGO | 0.999964 | 5.609938 |
ae098f75-18b3-46c2-a5f9-5919325f34cd | xfbravo/CPP-Learning | HeapSort/HeapSort.cpp | #include <iostream>
#include "HeapSort.h" // Include the header file for heap sort
using namespace std;
int main()
{
int arr[] = {5, 2, 9, 1, 5, 6, 2, 11, 98, 46}; // Example array to sort
int size = sizeof(arr) / sizeof(arr[0]); // Calculate the size of the array
cout << "Original array: ";
for ... | ALGO | 0.999865 | 5.353749 |
5fb31a00-1b1c-483c-8ef6-4441340554d8 | igorbragaia/algorithms | leetcode/1025.cpp | class Solution {
public:
bool divisorGame(int N) {
return N%2 == 0;
}
}; | ALGO | 0.999885 | 5.615645 |
13516cd1-94ff-4f3d-870f-e51e254a54af | demon221/CarND-Path-Planning-Project-P11 | src/Eigen-3.3/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999665 | 3.720849 |
e31ca0cb-9576-4b7d-ba45-6884bd7695e7 | ranjeetkumarmrj2005/leetcode-solutions | 83-RemoveDuplicatesFromSortedList/83-RemoveDuplicatesFromSortedList.cpp | // Last updated: 7/14/2025, 1:48:52 PM
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(head==NULL || head->next==NULL) return head;
ListNode* a=head;
ListNode* b=head->next;
while(b!=NULL){
while(b!=NULL && b->val==a->val){
b=b->n... | ALGO | 0.999848 | 6.062206 |
4d5eec4c-25f0-4e9d-a045-b13beaa5b519 | mason20240920/BatmanInfer | source/cpu/kernels/softmax/generic/neon/fp32.cpp | //
// Created by Mason on 2025/1/17.
//
#include "cpu/kernels/softmax/generic/neon/fp32.hpp"
#include "cpu/kernels/softmax/generic/neon/impl.hpp"
namespace BatmanInfer {
namespace cpu {
template<bool IS_LOG>
void neon_fp32_softmax(const BIITensor *in,
void *const tm... | TOOL | 0.944284 | 6.434979 |
31362c6b-ca06-4e36-8145-bff1106d2db6 | mukul-oo7/Data-Structures-and-Algorithms | 2677-cousins-in-binary-tree-ii/2677-cousins-in-binary-tree-ii.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.999977 | 6.239006 |
0a3c281d-3164-4a18-8f0f-e1441828c12b | DiegoWu/C-code | atbe242pc(dp).cpp | #include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<sstream>
#define ll long long
#define INF 100000000000
#define mod 998244353
using namespace std;
int main(){
int n;
ll ans= 0;
cin>>n;
ll dp[2][11];
dp[1][10]= 0;
for(int i=0; i<10; i++) dp[1][i]= 1;
for(int i=1; i<n... | ALGO | 0.999918 | 4.872036 |
d2b16d7f-f5fd-49bc-bc47-64dea30e523c | Kaushal-11/LeetCode-Problem-Solutions | 2593.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
long long findScore(vector<int>& nums) {
int n = nums.size();
vector<int> marked(n, 0);
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
for (int i = 0; i < n; i++){
... | ALGO | 0.99997 | 4.480347 |
f6790c4a-8785-428b-b96e-0df4f0103785 | Rolight/ACM_ICPC | CodeForces/R163Div2/A.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <string>
#include <iostream>
#include <map>
#include <cstdlib>
#include <list>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long LL;
const int maxn = 55;
int main() {
int n... | ALGO | 0.999662 | 3.355909 |
d38386a7-8772-4c2d-9106-e860abf8e233 | ishandutta2007/codeforces | lhic/normal/508/E.cpp | #include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
typedef long long ll;
typedef long double ld;
using namespace std;
vector<string> ... | ALGO | 0.999828 | 3.925583 |
7f4e8c26-bbab-4dba-b3e3-6c6a83493ea0 | SH4MDEL/boj-algorithm | Algorithm/Algorithm/13392 - 방법을 출력하지 않는 숫자 맞추기.cpp | #include <iostream>
#include <memory.h>
#define fastip std::cin.tie(nullptr)
#define sws std::ios::sync_with_stdio(false)
#define inf 987654321
#define endl "\n"
#define ll long long
using namespace std;
int n;
string s, e;
int cache[10100][15];
int Up(int from, int to)
{
if (from <= to) return to - from;
return 1... | ALGO | 0.999925 | 4.22283 |
d11e2c8f-99f3-4714-a02a-c380bb1f22a0 | umaidansari12/CP_Backup | 12_string/longest_k_unique_character_substring.cpp | //Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution {
public:
bool isValid(int count[], int k) {
int cnt = 0;
for (int i = 0; i < 26; i++) {
if (count[i] > 0)
cnt++;
}
... | ALGO | 0.999731 | 6.021562 |
d99380ad-aca1-4c93-865d-ab2536d6e9cd | sinedanat/teach_yourself_cpp_in_one_hour_a_day_rao_2017 | ch08/bk/bk12_pointers_arrays_similarities.cpp | #include <iostream>
using namespace std;
int main()
{
const int ARRAY_LEN = 5;
// Static array of 5 integers, initialized
int myNumbers[ARRAY_LEN] = {24, -1, 365, -999, 2011};
// Pointer initialized to first element in array
int* pointToNums = myNumbers;
cout << "Display array using pointer... | TOOL | 0.955955 | 5.443904 |
72552b4e-7c0b-4ccd-a9e6-60ae670b836c | HASH-002/6Companies30days | Generate_Binary_Numbers.cpp | vector<string> generate(int n)
{
vector<string>v;
queue<string>q;
q.push("1");
while(n--){
string s = q.front();
q.pop();
v.push_back(s);
q.push(s+"0");
q.push(s+"1");
}
return v;
} | ALGO | 0.999905 | 4.826118 |
72726592-4872-41ba-8970-fd372db083a0 | AhmadFarazWeb3Developer/First-Semester-Coding- | Shapes from Asteriks/full diamod.cpp |
#include<iostream>
using namespace std;
int main() {
int r;
cout<<"\n\n\tEnter number of rows :: ";
cin>>r; // r is for no of spaces before starik.
for(int i=1; i<=r; i++) { //the main loop for stariks is started from here.
for(int j=1; j<=r-i; j++) { // this loop is for making spaces
cout<<" ";
}
for(i... | ALGO | 0.999213 | 3.582607 |
6eae3144-be46-4694-afd3-135d3567603c | Nanduag0/Leetcode | nandincpp/Interval List Intersections.cpp | class Solution {
public:
vector<vector<int>> intervalIntersection(vector<vector<int>>& a, vector<vector<int>>& b)
{
vector<vector<int>> ans;
int i = 0, j = 0;
while(i<a.size() && j<b.size())
{
int start = max(a[i][0], b[j][0]);
int end = min(a[i]... | ALGO | 0.999961 | 5.750125 |
00c9bcbf-cfb3-459a-9a7b-80eb082b4ffd | yschowdary/CSA5150-Cryptography | EXP 32.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
unsigned long long p;
unsigned long long q;
unsigned long long g;
unsigned long long x;
unsigned long long y;
} DSAKey;
typedef struct {
unsigned long long r;
unsigned long long s;
} DSASignature;
typedef str... | ALGO | 0.997533 | 5.798056 |
1144a2b3-746f-4c95-9272-fec9b5a18397 | amalgopal/e-commerce-admin-app | 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 |
7d216173-8d2d-4da4-8fa2-28a93280443c | zephray/ArithMax | Software/AMEv3/Eigenmath/imag.cpp | /* Returns the coefficient of the imaginary part of complex z
z imag(z)
- -------
a + i b b
exp(i a) sin(a)
*/
#include "stdafx.h"
#include "defs.h"
void
eval_imag(void)
{
push(cadr(p1));
eval();
imag();
}
void
imag(void)
{
save();
rect();
p1 = pop();
push(p1);
push(p1);
conjugate();
subtract();
... | ALGO | 0.940976 | 4.782507 |
a33126f2-3ff1-4ab4-aff6-09e5af41840f | dannygto/a31_422_v33_android | system/core/libpixelflinger/tinyutils/VectorImpl.cpp | #define LOG_TAG "Vector"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <cutils/log.h>
#include "tinyutils/SharedBuffer.h"
#include "tinyutils/VectorImpl.h"
/*****************************************************************************/
namespace android {
enum {
NO_ERR... | TOOL | 0.962775 | 7.172092 |
d2bc9107-1a3a-4df4-a5bb-5a41d4615f0c | klishevich/cpp-algorithms2 | adventofcode/day10/day10.cpp | // Day 10: Syntax Scoring - https://adventofcode.com/2021/day/10
#include <algorithm>
#include <iostream>
#include <ranges>
#include <stack>
#include <sstream>
using namespace std;
string input();
int main() {
string chars = "<{[( )]}>", line;
auto ch2pos = [&](char ch) { return (int)chars.find(ch) - 4; };
... | ALGO | 0.997426 | 6.136943 |
a61aaf68-db27-474a-8f53-19029a5e1f45 | Ruhao-Liu/study-c- | 8.13/twoswap.cpp | #include<iostream>
template <typename T>
void Swap(T& a, T& b);
struct job
{
char name[40];
double salary;
int floor;
};
template <> void Swap(job& j1, job& j2);
void Show(job& j);
int main()
{
using namespace std;
cout.precision(2);
cout.setf(ios::fixed, ios::floatfield);
int i = 10, j = 20;
cout << "i,j = "... | ALGO | 0.940443 | 4.323399 |
a90f6e85-4155-4ebc-a7a6-86201e71f097 | bhaviknetam/dsa_with_cpp | 149-max-points-on-a-line/max-points-on-a-line.cpp | class Solution {
public:
int maxPoints(vector<vector<int>>& p) {
int n = p.size();
if(n==1) return 1;
int iteration = 1200;
int ans = 0;
while (iteration--)
{
int i = rand() % n;
int j = rand() % n;
while (i == j)
j ... | ALGO | 0.999839 | 5.591131 |
422ec880-8cc3-47fb-8101-3ffc8202552c | dasdeepanjan/Strivers-SDE-Sheet | Day 4- Arrays Part-IV/Count_Subarrays_with_Given_XOR.cpp | #include <bits/stdc++.h>
int subarraysXor(vector<int> &arr, int x)
{
int xr=0;
unordered_map<int,int> mp;
mp[xr]++; //{0,1}
int cnt=0;
for(int i=0;i<arr.size();i++){
xr^=arr[i];
int k=xr^x;
cnt+=mp[k];
mp[xr]++;
}
return cnt;
} | ALGO | 0.999964 | 5.19838 |
148b320d-9b29-420d-9c08-7be1cd266216 | yummydum/atcoder | 164/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;
ll modPow(ll a, ll n, ll p)
{
if (n == 1)
return a %... | ALGO | 0.999644 | 4.145163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.