uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e4d098d5-1e5a-419d-9005-dec4e460b066 | champmaniac/StriverSDESheetSolvings | MajorityElement.cpp | // // Brute Force TC O(N^2) SC (1)
int findMajorityElement(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
int maxCount = 0;
for (int j = 0; j < n; j++)
{
if (arr[i] == arr[j])
maxCount++;
}
if (maxCount > n / 2)
return arr[i];
}
return -1;
}
// Optimized using Hashmap TC O(N) SC O(N)
int fi... | ALGO | 0.999883 | 5.803217 |
b3e9c800-773e-4a9e-9e9e-208bd14b4bc8 | Ferdeno/DSA-using-C-CPP | Matrix/Lower Triangular matrix/Lower Triangular matrix row major.cpp | #include<iostream>
using namespace std;
struct Matrix
{
int *A;
int n;
}m;
void set(struct Matrix *m,int i,int j,int x)
{
if(i>=j)
{
m->A[i*(i-1)/2+j-1]=x;
}
}
int get(struct Matrix m,int i,int j)
{
if(i>=j)
return m.A[i*(i-1)/2+j-1];
return 0;
}
void display(struct Matrix m)
{
for(int i=1;i<=m.n;i++)
{
... | ALGO | 0.99977 | 3.246011 |
c2c1b427-b67a-4769-a29a-cf3d043dd4a1 | gauravvrajj/leetcode-sol | 0905-sort-array-by-parity/0905-sort-array-by-parity.cpp | class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
vector<int>odd,even;
for(auto i:nums)
if(i%2==0)even.push_back(i);
else odd.push_back(i);
even.insert(even.end(),odd.begin(),odd.end());
return even;
}
}; | ALGO | 0.999969 | 5.69312 |
0d9d7f38-e9e7-4bb0-bb91-b0fac293782a | phiysng/leetcode | pat/basic/1063.cpp | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
double max_mode = 0;
for (int i ... | ALGO | 0.989432 | 3.834489 |
7858c363-e2bb-4c4a-b8d5-ba08a3cabada | mohir64/taxi_internet | 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 |
c9757779-e234-4893-bed2-f2a05a18745c | YashGupta018/LeetCode | Data Structure 21-Day Challenge/Day-3/Spiral Matrix II.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> matrix(n, vector<int>(n));
for (int num = 0, left = 0, right = n - 1, top = 0, bottom = n - 1;
left <= right && top <= bottom;
++left, --right, ++top, --bottom) {
for (int j = l... | ALGO | 0.999612 | 6.296585 |
dfe94318-0194-4bf3-8730-5b0d22d69a83 | PiperBetle/MyCode | SXYZ1494 单调爱篮球.cpp | #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define int long long
using std::cin;using std::cout;
int t[1000007];
signed main(){
// freopen("love.in","r",stdin);
// freopen("love.out","w",stdout);
std::ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int i,n,m1,m2,l,d,p,... | ALGO | 0.999699 | 3.514543 |
577b92ac-7a75-45d6-bf3b-6560fbb2b514 | ps3dev/mesa-7.10.2-PS3 | src/glsl/lower_discard.cpp | /**
* \file lower_discard.cpp
*
* This pass moves discards out of if-statements.
*
* Case 1: The "then" branch contains a conditional discard:
* ---------------------------------------------------------
*
* if (cond1) {
* s1;
* discard cond2;
* s2;
* } else {
* s3;
* }
*
* becomes:
*
* ... | ALGO | 0.879447 | 7.662433 |
e85f77f0-5d00-4097-a922-2dcfb5911224 | IMRAN-5740/Programming-Contest | CodE_CheF/PAIREQ.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t=1;
cin>>t;
while(t--)
{
ll n;cin>>n;
vector<ll>vc;
set<ll>st;
for(ll i=0;i<n;i++)
{
ll x;
cin>>x;
vc.push_back(x);
st.insert(x);
}
// if(st.size()==n)cout<<(n-1)<<endl;
// else if(st.size()==1)cout<... | ALGO | 0.999816 | 3.931211 |
c970e77e-f550-48cc-8b1a-b6b94957c040 | Abhishekkute234/Data-Structure-and-Algorithm-in-CPP | 13_linked_list_CPP/12_merge_2_sorted_ll.cpp | #include <iostream>
using namespace std;
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 *mergeTwoLists(ListNode *list1, ListNode *list2)... | ALGO | 0.999861 | 5.437657 |
b8896aff-14b4-4f06-8fb6-35bd3c404037 | valentin-riviere/QuadMorphing | prog_odroid/camera_basler_examples/ttc_estimation/ttc_estimation.cpp | #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <pylon/PylonIncludes.h>
#include <pylon/usb/BaslerUsbInstantCamera.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <chrono>
#include <ctime>
#include "string_tools.h"
#include <fstream>
#include <iterator>
#includ... | ALGO | 0.997676 | 3.976744 |
6897d1db-eb80-4891-bee1-6c50100e93af | SANDEEP-9657/CPP_Learning | PrintAlphabetZ.cpp | // PrintAlphabetZ
#include <bits/stdc++.h>
using namespace std;
void PrintAlphabetZ(int n){
int i , j;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i==0 || i==n-1|| (i+j == n-1)){
cout << "*";
}
else{
cout << " ";
}
}
... | ALGO | 0.999274 | 3.706091 |
e972d81d-3930-4b9e-a769-50e3538d5813 | igor007-cyber/Execicios_cPlusPlus | EstruturaSequencial/exercicio16.cpp | /*
Faça um programa para uma loja de tintas. O programa deverá pedir o tamanho em metros
quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para
cada 3 metros quadrados e que a tinta é vendida em latas de 18 litros, que custam R$ 80,00.
Informe ao usuário a quantidades d... | TOOL | 0.957545 | 6.037286 |
d6a3b1a6-b23f-4e46-bdd1-5c681e45cb61 | QuackPhuc/DSA | BinaryTree.cpp | #include <iostream>
#include <string>
#include "Tree.hpp"
using namespace std;
struct Tree
{
Node *root;
Tree() : root(nullptr) {};
Tree(Node *root) : root(root) {};
Tree(int array[], int size){
root = new Node();
build(root, array, 0, size - 1);
}
friend std::ostream &operato... | ALGO | 0.996688 | 4.679318 |
1533622f-7a52-46fa-9e70-3befe64f2af4 | vfolunin/archives-solutions | EOlymp/9991.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int sum;
cin >> sum;
int res = 0;
for (int a = 1; a < 10; a++)
for (int b ... | ALGO | 0.99802 | 4.923006 |
2c6a5e2c-9c05-439c-8f67-f333d919f7f3 | azzouzin/Social-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 |
2912bb15-5145-4ebe-b1db-5857fa38bf18 | itcgames/ARGO_2018_19_D | ARGO_Team_D/ARGO_Team_D/Box2D/include/Box2D/Dynamics/Joints/b2DistanceJoint.cpp | #include "Box2D/Dynamics/Joints/b2DistanceJoint.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2TimeStep.h"
// 1-D constrained system
// m (v2 - v1) = lambda
// v2 + (beta/h) * x1 + gamma * lambda = 0, gamma has units of inverse mass.
// x2 = x1 + h * v2
// 1-D mass-damper-spring system
// m (v2 - v1... | ALGO | 0.995889 | 7.264818 |
7007647d-d5ca-44f3-b023-16c2dd6571e9 | crimson000000/OIcode | luogu/3240.cpp | #define LOCAL
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
inline ll read()
{
ll x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9')
{
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9')
{
... | ALGO | 0.999971 | 4.325344 |
1929dedf-3eee-424b-b466-1125e0c2fc44 | Harsh-COE/Data-Structure-Algorithm | Algorithms/Sorting-Searching/LinBinSearch.cpp | #include<iostream>
using namespace std;
//This is binary search
//this is the iterative approach
void binaySearch(int *a,int n,int k){
int s=0,e=n-1;
while(s<=e){
int m=(s+e)/2;
if(a[m]==k){
cout<<"the number is there is the list\n";
return;
}else if(a[m]>k){
s=0;
e=m-1;
}else{
s=m+1;
e=e;
... | ALGO | 0.999708 | 4.215638 |
736bb4c0-ea0e-4f94-b1cd-0d24b7c630e6 | raysjoshua/UnrealEngine | Engine/Source/ThirdParty/Box2D/Box2D_v2.2.1/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.987568 | 7.939983 |
7303db36-c0e9-4fe2-a68b-eafaeb7e2879 | 0sidharth/seasonsOfCode | mco16403.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll subCount[300001];
ll height[300001];
ll cost[300001];
void subTreeCounter(int a, int b, vector<pair<int, int> > adj[]) {
subCount[a] = 1;
for (int i = 0; i < adj[a].size(); i++) {
int v = adj[a][i].first;
int w = adj[a][i]... | ALGO | 0.999991 | 4.42943 |
e9286005-7942-4834-b855-36cbc0b68d05 | raincross7/code-similarity | codes/train_code/problem465/problem465_346.cpp | #include <bits/stdc++.h>
#include <unistd.h>
#include <cctype>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cmath>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF LLONG_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define F... | ALGO | 0.999983 | 3.619459 |
a3b91326-4663-46ad-88f0-60b0ed4019a6 | CodeBySushant/SolvedLeetcode | leetcode-main/leetcode-main/solution/1000-1099/1048.Longest String Chain/Solution.cpp | class Solution {
public:
int longestStrChain(vector<string>& words) {
sort(words.begin(), words.end(), [&](string a, string b) { return a.size() < b.size(); });
int res = 0;
unordered_map<string, int> map;
for (auto word : words) {
int x = 1;
for (int i = 0; i... | ALGO | 0.999996 | 6.189425 |
0ae84123-88bb-47d1-a7b6-b28103b2e071 | 4xx31/algorithms-cpp | other-onlinejudges/uva/cp3-chapter1/3_medium/10324_Zeros and Ones.cpp | // https://onlinejudge.org/external/103/10324.pdf
#include <bits/stdc++.h>
int main()
{
char s[1000005];
int N, a, b, temp, round(1);
bool valid;
while (scanf("%s %d", s, &N) == 2)
{
printf("Case %d:\n", round++);
while (N--)
{
scanf("%d%d", &a, &b);
... | ALGO | 0.999918 | 3.966892 |
c8c67695-ab54-41c6-8862-481fce94f7e3 | UY24/Leetcode-GFG | Arrays/Easy/Single Number.cpp | // ques link : https://leetcode.com/problems/single-number/
// O(NLog N) Time and O(1) Space
#include <bits/stdc++.h>
using namespace std;
int singleNumber(vector<int> &nums)
{
sort(nums.begin(), nums.end());
for (int i = 0; i < nums.size() - 1;)
{
if (nums[i + 1] != nums[i])
return nu... | ALGO | 0.999782 | 5.576302 |
f4c27fda-8be4-4742-bb21-df752fe99855 | vectormars/CPP | Algorithm/Combinations/Comb_02.cpp | // Print all possible combinations of r elements in a given array of size n
// Given an array of size n, generate and print all possible combinations of r elements in array.
// For example, if input array is {1, 2, 3, 4} and r is 2, then output should be {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4} and {3, 4}.
// Program to... | ALGO | 0.999488 | 5.78875 |
7e8b524d-f0c4-437f-bc35-c89cb75082b0 | T110-android/android_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_chroma_inter.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the block used for prediction (int)
ypred = y-axis coordinate of the block used for prediction (int)
pp_dec_u = pointer to the post processing semaphore for ... | ALGO | 0.999391 | 6.569502 |
364fa4b7-dd3b-4596-ac39-323406ad24ac | ShuaiBai623/MFT | external_libs/matconvnet/matlab/src/bits/impl/im2row_cpu.cpp | // @file im2row_cpu.cpp
// @brief Stack image patches as matrix rows (CPU)
// @author Andrea Vedaldi
#include "im2row.hpp"
#include <string.h>
using namespace vl ;
using namespace vl::impl ;
/* ---------------------------------------------------------------- */
/* Hep... | ALGO | 0.881151 | 4.988763 |
4ea57acc-0fe7-4b18-95d3-768f0ba893f3 | hossainruetcse/CodesAlgoritms | Square Root Decomposition/sample_format.cpp | #include <bits/stdc++.h>
using namespace std;
#define Set(N, j) (N|(1<<j))
#define reset(N, j) (N&~(1<<j))
#define Check(N, j) (bool)(N&(1<<j))
#define toggle(N, j) (N^(1<<j))
#define turnOff(N, j) (N & ~(1<<j))
#define CLEAR(A, x) ( memset(A,x,sizeof(A)) )
#define pii pair <int, int>
#define pb push_back
#define inf... | ALGO | 0.999684 | 3.571488 |
ded9cd3b-73e0-4e33-8ae7-c9e9c36d6abb | RowonChung/SSAFY21_Algorithm | 권주안/0329금_15685_드래곤커브.cpp | #include <iostream>
using namespace std;
int N;
int dr[] = { 0,-1,0,1 };
int dc[] = { 1,0,-1,0 };
int totalBoard[101][101];
int tempBoard[101][101];
int temptempBoard[101][101];
void dfs(int axisY, int axisX, int readyY, int readyX, int generation) {
if (generation == 0) {
return;
}
int nextAxisY, nextAxisX;
//... | ALGO | 0.99949 | 4.458181 |
25e78924-8d45-444a-b24a-655fce389633 | Divyanshu-012/LeetcodeCommits | 0890-lemonade-change/0890-lemonade-change.cpp | class Solution {
public:
bool lemonadeChange(vector<int>& bills) {
int fiveD= 0;
int tenD = 0;
for(int i = 0 ; i<bills.size();i++){
int curr = bills[i];
if(curr == 5){
fiveD++;
}
else if(cu... | ALGO | 0.999349 | 6.123786 |
07cacbe6-8797-41ae-8c97-d23eba208a5f | ShahJahanApurbo/cp | B_Prime_Matrix.cpp | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define pb push_back
#define for0(n) for (int i = 0; i < n; i++)
#define for1(n) for (int i = 1; i <= n; i++)
#define all(x) (x).begin(), (x).end()
#define gsize(x) (int)((x).size())
void speed()
{
ios::sync_wit... | ALGO | 0.999985 | 3.984221 |
096c02d6-6680-4daa-ba7b-5c3ccc991983 | JamesQAQ/Coding-Practices | ZeroJudge/Solutions/a176. Battle!/2013-01-28_1386637.cpp | #include <cstdio>
char tetris[5][2][5]={{"* ","*** "},{" ","****"},{" * ","*** "},{"** ","** "},{"*** "," * "}};
int n,cnt[5],ans[10],sum;
void dfs(int x){
if (x==n){
for (int i=0;i<2;i++){
for (int j=0;j<n;j++)
printf("%s|",tetris[ans[j]][i]);
puts("");
}
sum++;
puts("\n");
return;
}
f... | ALGO | 0.99981 | 3.685335 |
9a7054f9-7e73-46b5-844e-dd592260050e | dinmukhammedkbtu/bonus-task-point | chapter3,1e.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
double a,n,k=1,ans=1;
cin>>a>>n;
for(int i=1;i<=n;i++){
k*=a;
ans+=k;
}
cout<<ans;
}
| ALGO | 0.99942 | 3.500628 |
55fd2074-501b-4c50-bc97-72cc67b37b70 | Fahadh4444/Coding_Mafia | Concepts/Maths/Square Root/By Binary Search/Sqrt.cpp | #include <iostream>
using namespace std;
int sqrt(int n){
if(n==0 || n==1){
return n;
}
int f=1;
int l=n;
int mid,ans;
while(l>=f){
mid=(f+l)/2;
if(mid*mid==n){
return mid;
}else if(mid*mid<n){
f=mid+1;
ans=mid;
}else{
... | ALGO | 0.999932 | 4.78076 |
c49f2013-3cc8-4b77-b9de-5266cc1494cd | CodeTest-StudyGroup/Code-Test-Study | dmsgk/week39/1300_k번째수.cpp | //
// 1300_k번째수.cpp
// AlgorithmCpp
//
// Created by Johyeon Yoon on 2021/08/31.
//
// 1300 k번째 수
#include <iostream>
using namespace std;
long long n, k;
long long find_cnt(long long mid){
long long cnt = 0;
for (long long i = 1; i < n+1; i ++) {
cnt += min(n, mid/i);
}
return cnt;
}
in... | ALGO | 0.999948 | 4.715709 |
4bb24883-6a73-4544-a56d-e40d59b9f6d6 | happiie/codeBlock_exercise_example | C5bE02-hashing with quadratic probing/main.cpp | //Hash Tables with Quadratic Probing
#include <iostream>
#include <cstdlib>
#define MIN_TABLE_SIZE 10
using namespace std;
//enumeration declaration (a distinct type whose value is restricted to a range of values)
enum EntryType {Legitimate, Empty, Deleted}; // Legitimate = 0; Empty = 1; Deleted = 2;
struct HashNo... | ALGO | 0.999273 | 5.240381 |
ee53632b-db5d-4063-aa87-8eaa9ccf7318 | kanryu/quickviewer | Qt7z/Qt7z/7zip/CPP/7zip/Compress/Rar2Decoder.cpp | #include "StdAfx.h"
#include "Rar2Decoder.h"
namespace NCompress {
namespace NRar2 {
namespace NMultimedia {
Byte CFilter::Decode(int &channelDelta, Byte deltaByte)
{
D4 = D3;
D3 = D2;
D2 = LastDelta - D1;
D1 = LastDelta;
int predictedValue = ((8 * LastChar + K1 * D1 + K2 * D2 + K3 * D3 + K4 * D4 + K5 * c... | TOOL | 0.954991 | 5.216588 |
545a7187-d287-4b7c-b8bc-619e82d5f383 | raincross7/code-similarity | codes/train_code/problem421/problem421_389.cpp | #include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
template <class T> using V = vector<T>;
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st... | ALGO | 0.999985 | 3.716795 |
e2eab4c1-ad64-49dd-a017-60e29b41986b | shivang-saxena/IB | DataStructure/Bit_Manipulation/Interesting_Array.cpp | /*
Interesting Array
You have an array A[] with N elements. We have 2 types of operation available on this array :
We can split a element B into 2 elements C and D such that B = C + D.
We can merge 2 elements P and Q as one element R such that R = P^Q i.e XOR of P and Q.
You have to determine whether it is possible to ... | ALGO | 0.999982 | 4.663164 |
3e81da44-cfc1-468e-b118-b1ff4252f318 | Jaspreet-10/LeetCode | 0219-contains-duplicate-ii/0219-contains-duplicate-ii.cpp | class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
unordered_map<int, int>m;
for(int i = 0 ; i < nums.size() ; ++i){
if(m[nums[i]]>0 and (i+1-m[nums[i]]<=k)){
return true;
}
else
m[nums[i]] = i+1;
... | ALGO | 0.999891 | 6.002594 |
754df148-dbc0-426d-9abe-0f4d38f0c7e4 | austinmccoy6251/CS-171 | hw0/Part3/main.cpp | #include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <Eigen/Dense>
#include <cmath>
using namespace std;
/* Important structs */
struct Vertex
{
float x, y, z;
};
struct Face
{
int v1, v2, v3;
};
struct Object
{
vecto... | TOOL | 0.8702 | 5.044275 |
7697fae4-d124-462e-a99b-e72dd50fa4b2 | tommy16102/2022-algorithm-study | 2021/6주차/서혜민/9663.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
/*
2021.08.14 서혜민
퀸은 상하좌우 대각선을 길이 제한없이 갈 수 있으므로, 체스판의 세로줄에 하나밖에 올 수 없다.
가장 왼쪽의 세로줄부터 시작하여, for문을 통해서 가로줄에 위치하게 한 뒤, check함수를 통해서
가로줄에 위치하게 했을 때 같은 상하좌우 선에 없거나 이전에 놓았던 퀸과 대각선 자리에 없으면
다음 세로줄에 퀸을 놓는다.
*/
int chess[16];
int count = 0;
int N;
bool check(int ... | ALGO | 0.999888 | 4.694124 |
1c968f13-4f1a-4ec2-bab6-b22d6bc19235 | AbdullahWB/Phitron-practice-file | Data_Structures/MODIULE_14/Middle_of_the_Linked_List_two.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:
// int size(ListNode ... | ALGO | 0.999834 | 5.803574 |
79dd7146-b904-4601-99ed-ab047c29bbe6 | krishakxjoshi/LeetWork | 594.cpp | class Solution {
public:
int findLHS(vector<int>& nums) {
unordered_map<int, int> freq;
int maxLen = 0;
for (int num : nums) {
freq[num]++;
}
for (auto& [num, count] : freq) {
if (freq.count(num + 1)) {
maxLen = max(maxLen, count + fr... | ALGO | 0.99994 | 6.171979 |
8b94598e-20d6-4c7a-94f4-8d71b9a8a667 | jeremyhuang3627/Online-Judge | code_forces/cf_101A.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
#define M 100005
string s;
int k,i,cnt,b[M],ans;
pair<int,int> a[26];
int main()
{
cin >> s >> k;
for(i=0;i<s.length();i++){
if(a[s[i]-'a'].first == 0) cnt++;
a[s[i]-'a'].first++;
a[s[i]-'a']... | ALGO | 0.999996 | 3.6725 |
0f05a92b-98a3-44eb-9438-643235b24764 | takashigoto1207/atcoder | abc1xx/abc163/abc163_b.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using namespace atcoder;
using ll = long long;
int main() {
int N, M;
cin >> N >> M;
int A;
int ans = N;
rep(i, M) {
cin >> A;
ans -= A;
if (ans < 0) {
cout << -1 << endl;
... | ALGO | 0.999987 | 4.223241 |
8ec8722f-8aaa-4852-8e9b-5fa88ffaf81d | AnuragJha003/DynammicProgramming | WildCardMatching.cpp | class Solution {
public:
bool recur(string &pattern,string &text,int i,int j,vector<vector<bool>>& dp)
{
if(i<0 && j<0) return true;//if both exhausted comparison done together
if(i<0 && j>=0) return false;//if s1 exhausted and s2 is there thhen false
if(j<0 && i>=0)//if s2 is exhausted pattern s1 is pr... | ALGO | 0.999956 | 6.76425 |
05e2c424-7446-446b-bafe-6a11cf6d9915 | coeing/cframework | framework/ext/boost/libs/numeric/ublas/doc/samples/vector_binary_outer.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < (std::min) (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << outer_prod (v1, v2) << std::... | ALGO | 0.997865 | 3.95939 |
1614d114-356b-49d6-b909-073fb3a5f4a1 | So-Youn/codetree-TILs | 240726/숫자 2개 출력/print-two-numbers.cpp | #include <iostream>
using namespace std;
int main() {
cout << 3 << " " << 5 ;
return 0;
} | ALGO | 0.969755 | 3.238757 |
72b93e4b-3760-4876-ae15-2f335e09ff00 | ishandutta2007/codeforces | benq/normal/1261/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef ... | ALGO | 0.999609 | 4.137036 |
d9d7c39d-eea6-4b2d-925b-d9ac962a0d6c | paBlo01420/Basic-cplus | Program Operator/Operator reasional.cpp | #include <iostream>
using namespace std;
main()
{
bool nilai;
nilai = 3 > 2; // hasil ungkapan : benar
cout << "Nilai = " <<nilai <<endl;
nilai = 2 > 3; // hasil ungkapan : salah
cout << "Nilai = " <<nilai;
}
| ALGO | 0.993562 | 3.57396 |
e3e168d3-37af-40a4-8f8a-e68444232b9a | Imagaverse/CitraEmu | externals/dynarmic/src/dynarmic/frontend/A64/translate/impl/simd_shift_by_immediate.cpp | #include <mcl/bit/bit_count.hpp>
#include "dynarmic/common/fp/rounding_mode.h"
#include "dynarmic/frontend/A64/translate/impl/impl.h"
namespace Dynarmic::A64 {
namespace {
enum class Rounding {
None,
Round
};
enum class Accumulating {
None,
Accumulate
};
enum class Signedness {
Signed,
Unsig... | ALGO | 0.937368 | 7.69391 |
9cc30d40-6921-450e-91c3-63b3df24c6f6 | devgoel186/Leetcode-Solutions | n-queens/Accepted/8-15-2021, 9_36_26 PM/Solution.cpp | // https://leetcode.com/problems/n-queens
class Solution {
public:
bool isSafe(vector<string> &sol, int r, int c, int n)
{
// if(r < 0 || c < 0 || r >= n || c >= n)
// return false;
for(int i = 0; i < n; i++)
{
if(sol[i][c] == 'Q')
return... | ALGO | 0.99995 | 6.138714 |
f9e38035-be45-4a97-b47d-24899805406c | parthgupta21/Coding-Contests | CP-31/0900 Rated/29 Three Indices.cpp | #pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb ... | ALGO | 0.99989 | 4.212576 |
ad3475d6-6cda-4caa-98b3-21d5a416b762 | jixiangwangzi/sps | src/navi2/navigation2/nav2_regulated_pure_pursuit_controller/src/lattice_planner/lattice_planner.cpp | #include "nav2_regulated_pure_pursuit_controller/lattice_planner/lattice_planner.h"
#include <algorithm>
#include <limits>
#include "nav2_regulated_pure_pursuit_controller/common/curve_point.h"
#include "nav2_regulated_pure_pursuit_controller/lattice_planner/curve_1d_generator.h"
#include "nav2_regulated_pure_pursuit... | ALGO | 0.999825 | 6.475801 |
27606765-107f-4920-82f1-49a70498b4f1 | gyokkoo/Introduction-to-Programming-FMI-2017 | 1.Introduction-to-Programming-Practice/week-13/67-square-elements.cpp | /**
*
* Solution to exercises
* Introduction to programming course
* Faculty of Mathematics and Informatics of Sofia University
* Winter semester 2017/2018
*
* @author Gyokan Syuleymanov
* @idnumber 62117
* @task 67
* @compiler GCC
*
*/
#include <iostream>
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6};
int arrL... | ALGO | 0.979351 | 4.360066 |
2f687038-cab6-45a4-9f5b-b59ef17c1a0c | Chandler9Wilson/programming_fundamentals_2 | labs/L3/TT10_L3_Wilson.cpp | /* Author: Chandler Wilson
Course: COSC 1337 Fall 2018
Instructor: Thayer
Lab 3:
1. Provide menu-driven option loop that:
* Ask a user defined number of questions
* Option to quit at any time via sentinel
* Keep track of question stats*/
#include <iostream>
#include <string>
#include <stdexcept>
#include ... | TOOL | 0.914156 | 5.360871 |
52f45d20-4c4e-4ba0-8c46-321fc275b632 | a5tronomy/ue5-ffcotw | Engine/Source/ThirdParty/CryptoPP/5.6.2/include/rc6.cpp | // rc6.cpp - written and placed in the public domain by Sean Woods
// based on Wei Dai's RC5 code.
#include "pch.h"
#include "rc6.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
void RC6::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keylen);
r = Get... | ALGO | 0.997292 | 7.341525 |
c75610a6-2d49-42de-95af-397e9082704b | koritafei/leetcode | array/410.split-array-largest-sum.cpp | /*
* @lc app=leetcode id=410 lang=cpp
*
* [410] Split Array Largest Sum
*
* https://leetcode.com/problems/split-array-largest-sum/description/
*
* algorithms
* Hard (48.74%)
* Likes: 3736
* Dislikes: 118
* Total Accepted: 150.4K
* Total Submissions: 308.5K
* Testcase Example: '[7,2,5,10,8]\n2'
*
*... | ALGO | 0.999948 | 6.516567 |
2c2410df-1555-4058-ba90-9503bb5ef6b7 | rbu12/Calculator | Dependencies/opencv/sources/modules/core/src/lda.cpp | #include "precomp.hpp"
#include <iostream>
#include <map>
#include <set>
namespace cv
{
// Removes duplicate elements in a given vector.
template<typename _Tp>
inline std::vector<_Tp> remove_dups(const std::vector<_Tp>& src) {
typedef typename std::set<_Tp>::const_iterator constSetIterator;
typedef typename s... | ALGO | 0.99959 | 6.232382 |
e6d532db-f0e8-4a3a-ab4b-02452699b66c | DinhHuyKhanh/Codeforces | 1200A.cpp | #include <bits/stdc++.h>
/**
* @author: huykhanh
* @create:
**/
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ins(x) insert(x);
#define endl cout<<'\n'
#define vi(x) vector<int> x;
#define pi(x) vector<pair<int,int>> x;
#define pb push_back
#define rsz resize
#define all(... | ALGO | 0.999808 | 3.415945 |
a14465a1-512d-44a8-a614-7e952be25e8a | Samyc2002/CP | Codeforces/Problemset/Walking_in_the_Rain.cpp | #include <bits/stdc++.h>
using namespace std;
#define gfoi(i, j, k, in) for (int i = j; i < k; i += in)
#define gfod(i, j, k, in) for (int i = j; i >= k; i -= in)
#define foi(i, j) gfoi(i, 0, j, 1)
#define fod(i, j) gfod(i, 0, j, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin(... | ALGO | 0.999822 | 4.22288 |
b38ee5c8-de7e-41bc-8f63-d328d790d524 | Sagarkr5661/CPP | deleteion in a two way.cpp | #include<iostream>
using namespace std;
struct node {
int info;
struct node *prev;
struct node *next;
};
struct node *first = NULL;
struct node *last = NULL;
int remove(int item) {
struct node *ptr = first;
while ((ptr != NULL) && (item != ptr->info))
ptr = ptr->next;
if (ptr =... | ALGO | 0.999932 | 6.291698 |
532397cb-9eae-4525-a80c-b588de03a914 | PixysOS-Beta/frameworks_av | media/codecs/amrnb/enc/src/inter_36.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/inter_36.c
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
1. Eliminated unused include files.
... | ALGO | 0.999425 | 5.616278 |
6978be78-1562-4e4d-bc81-ae5f6580c13f | luolaihua/point-cloud-library-examples | 点云库PCL从入门到精通/第八章/3/Harrisdetect.cpp | #include <iostream>
#include <pcl\io\pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/io/io.h>
#include <pcl/keypoints/harris_3D.h>//harrisͷļ
#include <cstdlib>
#include <vector>
#include <pcl/console/parse.h>
using namespace std;
int main(int argc,char *argv[])
{
pc... | ALGO | 0.957517 | 4.673849 |
e569f1cb-d2f1-422d-b015-54a63b3841f0 | RumRaisins/ProjectEuler | ProjectEuler/ProjectEuler/49_四位全排列素数的递增数列.cpp | #include"ReadText.h"
using namespace std;
int isPrimer[10000] = { 0 };
int Primer[10000] = { 0 };
int main() {
for (int i = 2; i < 10000; i++)
{
if (!Primer[i]) {
Primer[++Primer[0]] = i;
isPrimer[i] = 1;
}
for (int j = 1; j <= Primer[0] && Primer[j]*i <= 10000; j++)
{
Primer[i*Primer[j]] = 1;
i... | ALGO | 0.999585 | 3.574076 |
055e1683-128c-4b92-8b51-385e5406b2fd | LLNL/raja-suite-tutorial | Intermediate_Tutorial/04-LAUNCH/solution/fractal-ex4-RAJA-launch-solution.cpp | #include <malloc.h>
#include <sys/time.h>
#include "RAJA/RAJA.hpp"
#include "umpire/Umpire.hpp"
#include "umpire/strategy/QuickPool.hpp"
#include "../../tpl/writeBMP.hpp"
#define xMin 0.74395
#define xMax 0.74973
#define yMin 0.11321
#define yMax 0.11899
int main(int argc, char *argv[])
{
double dx, dy;
int widt... | ALGO | 0.989149 | 5.276182 |
7e111aed-d8a4-4b86-930e-8d6c60ffdb8f | scoiatael/ThingsIdidAtII | c++/11/square.cpp |
#include "square.h"
#include <vector>
square::square( unsigned int d )
: dimension( d ),
required_sum( d * ( d * d + 1 ) / 2 ),
data( new unsigned int[ d * d ] )
{ }
square:: ~square( )
{
delete [] data;
}
std::ostream& operator << ( std::ostream& stream, const position& p )
{
stream << "[ " << ... | ALGO | 0.879162 | 4.779974 |
60bff170-2686-48db-b409-cae6607b5fe8 | MyckollWinchester/cp-problems | codeforces/team-training.cpp | /*
* Team Training
* https://codeforces.com/problemset/problem/2091/B
* Mon Apr 21 2025, 22:55:30 (UTC-3)
* Myckoll Winchester
*/
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, x, strength, cnt_members = 0, ans = 0;
cin >> n >> x;
vector<int> members(n);
for (int i = 0; i < n; ++i)... | ALGO | 0.999897 | 5.161195 |
7f784266-8c23-4851-aa4a-84f3210cb663 | Bhabaranjan19966/COMPETITIVE-PROGRAMMING--ACCEPTED-CODE | 337.cpp | #include<cstdio>
using namespace std;
int gcd(int a,int b)
{
return ((b==0)? a : gcd(b,a%b));
}
int main()
{
int a,b,c,d,x,y;
scanf("%d%d%d%d",&a,&b,&c,&d);
if((double)((double)a/b)<=(double)((double)c/d))
{
x=(b*c)-(a*d);
y=b*c;
}
else
{
x=(a*d)-(b*c);
... | ALGO | 0.999795 | 4.904151 |
0ffb0173-3463-468d-bba9-d1d57e79f7eb | kayaru28/programming_contest | old_contest/at_coder_JOI2008_D.cpp |
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000 //1e4
... | ALGO | 0.999953 | 4.28971 |
e697dcd1-9344-472d-9840-2a4ad643f982 | nikunj22-cloud/Leet-Code | 0485-max-consecutive-ones/0485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int maxCount = 0 ;
int count = 0;
for( int i =0 ; i<nums.size() ; i++){
if(nums[i]==1){
count++;
maxCount = max( maxCount , count);
}
else{
count = 0; //for reset ... | ALGO | 0.999952 | 6.175719 |
fd7cd0b5-a4db-463e-88a8-993d05502746 | Xinghui-Wu/LeetCode | problem_977.cpp | /**
* 977. Squares of a Sorted Array
*
* Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
*
* Constraints:
* 1 <= nums.length <= 10^4
* -10^4 <= nums[i] <= 10^4
* nums is sorted in non-decreasing order.
*
* Follo... | ALGO | 0.999978 | 7.082025 |
f6386135-c790-41bf-b394-c0a21c237633 | himanshuyadav492/dsa_cpp | mergesort1.cpp | //{ Driver Code Starts
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
/* Function to print an array */
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("\n");
}
// } Driver Code Ends
class Solution
{
public:
void merge(... | ALGO | 0.999927 | 6.45884 |
a12fa36f-571d-4ddc-9ccf-0aa2f8f740bf | alogeclock/Problem-Solving | BOJ/Gold/[7662] 이중 우선순위 큐.cpp | // idea: two pq, ascending order pq, map
#include <bits/stdc++.h>
#define MAX_OPERATION_NUMBER 1000001
using namespace std;
priority_queue<int> maxQ;
priority_queue<int, vector<int>, greater<int>> minQ;
map<int, int> cnt;
void clean() {
while (!minQ.empty() && !cnt[minQ.top()])
minQ.pop();
while (!maxQ.empty... | ALGO | 0.999876 | 4.577198 |
aed50b42-ffb3-4c62-a4d8-4d401e2155b9 | Kryptic-KRN/6Companies30Days | Walmart/15. Divide Two Integers.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
if(dividend==INT_MIN && divisor==-1)
return INT_MAX;
long a=abs(dividend);
long b=abs(divisor);
long res=0;
while(a-b>=0){
long temp=b;
long cnt=1;
while(a>=(temp<... | ALGO | 0.999956 | 5.937831 |
44902fb5-31a8-4d08-bbb4-61e46f69a2cc | raincross7/code-similarity | codes/train_code/problem318/problem318_260.cpp | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
int main() {
ll P, Q, R;
cin >> P >> Q >> R;
cout <... | ALGO | 0.999415 | 3.988746 |
baba71de-ec72-413f-ab01-c69196f13511 | SwetabjaGit/competitive-programming | PrimeTESTS.cpp | #include<bits/stdc++.h>
#include<algorithm>
typedef long long int ll;
using namespace std;
#ifndef ONLINE_JUDGE
#define gc getchar
#else
#define gc getchar_unlocked
#endif
inline int read(){
int res = 0,sign = 1;
char c = gc();
while(!(c>='0' && c<='9')){
if(c=='-')
sign = -1;
c = gc();
}
while(c>='0' &&... | ALGO | 0.999826 | 3.671781 |
445e96b4-a561-45e5-b83b-1eaa689c2cf8 | bayazidHossain2/Practice-Code | UVA/UVA 793 DSU.cpp | #include<iostream>
#include<sstream>
using namespace std;
int parent[100002];
int find_parent(int ind){
if(parent[ind]==ind){
return ind;
}
parent[ind]=find_parent(parent[ind]);
return parent[ind];
}
void connect(int x,int y){
int parentx = find_parent(x);
int parenty = find_parent(y);
... | ALGO | 0.998694 | 3.62191 |
ed1e7c9b-6582-49cb-896e-b026d2a75669 | proRamLOGO/glbajaj-adv-dsa | Day6/FibDP.cpp | #include<bits/stdc++.h>
#define ull unsigned long long int
using namespace std;
int fib(int n, vector<int>& dp) {
if ( n<2 ){
return n;
}
if ( dp[n]!=-1) {
return dp[n];
}
return dp[n] = fib(n-1,dp) + fib(n-2,dp);
}
int main() {
int n; cin >> n;
vector<int> dp(n+1,-1... | ALGO | 0.999975 | 4.429972 |
45ef03d5-9350-4340-979d-1f137cb0c1fb | Ravindranath-Porandla/LeetCode | 0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp | class Solution {
public:
string reverseWords(string s) {
stringstream ss(s);
string word;
vector<string> words;
while (ss >> word) {
words.push_back(word);
}
string ans = "";
for (int i = words.size() - 1; i >= 0; i--) {
ans += words[... | ALGO | 0.999906 | 6.289208 |
395e6a15-95c8-424a-89e2-e4dfb374b972 | Shree987/Codebuddy-2019 | Compsoc-IEEE-NITK/Week-3/Permutations.cpp | /*
Name : Shreeraksha R Aithal (@Shree987)
Question: Permutations (https://www.interviewbit.com/problems/permutations/)
Following is the required Solution function
*/
void dp(vector<vector<int>> &v1, vector<int> &v, vector<int> &A, int n){
int i;
if(n==A.size()){
v1.push_back(v);
}
else{
... | ALGO | 0.999981 | 6.000803 |
b43b831a-15f0-4e54-9def-e1cef19fb20b | walkccc/LeetCode | solutions/1996. The Number of Weak Characters in the Game/1996-2.cpp | class Solution {
public:
int numberOfWeakCharacters(vector<vector<int>>& properties) {
int ans = 0;
const int maxAttack = (*ranges::max_element(
properties, ranges::less{},
[](const vector<int>& property) { return property[0]; }))[0];
// maxDefenses[i] := the maximum defense for the i-th ... | ALGO | 0.998661 | 5.449161 |
b6ed1985-409a-4dda-ad37-c3e61eb065bd | RanaEssam03/Linear_Structures | stack_problems/problem2.cpp | //@author: Nour El-din
//@date: 28 April 2023
#include "../stack/Stack.cpp"
#include <bits/stdc++.h>
using namespace std;
int longestValidParentheses(string s) {
Stack<int> st;
int sz = s.size();
int ans = 0;
int strt= 1e5, end= 0;
vector<bool> rghtPlcd(sz, true);
for(int i = 0; i < sz; i++){... | ALGO | 0.999617 | 5.533415 |
ce2c7443-2486-4474-84c4-855df44185e9 | saamimahmud/DSA | pattern10.cpp | /*
QUESTION-> create the following pattern :
*
**
***
****
*****
*****
****
***
**
*
*/
#include<iostream>
using namespace std;
void pattern10(int n){
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<"*";
}
cout<<endl;
}
}
void pattern11(int n){
for(int i=1;i<=n;i+... | ALGO | 0.999775 | 3.945767 |
f7bafa04-38dd-43de-8e70-4f24f3f1240c | aadarsh231099/Codeforces | 1234A-Equalize Prices Again.cpp | //https://codeforces.com/problemset/problem/1234/A
//Equalize Prices Again
#include <bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
int sum = accumulate(a, a + n, 0);
int minPrice... | ALGO | 0.999842 | 5.560891 |
b1297280-984c-4c90-8394-03cfd18c1a9c | MaheshSharan/LeetCode_Automation | solutions/3000-3099/3075.Maximize Happiness of Selected Children/Solution.cpp | class Solution {
public:
long long maximumHappinessSum(vector<int>& happiness, int k) {
sort(happiness.rbegin(), happiness.rend());
long long ans = 0;
for (int i = 0, n = happiness.size(); i < k; ++i) {
int x = happiness[i] - i;
ans += max(x, 0);
}
ret... | ALGO | 0.999989 | 5.3945 |
347afb84-71bf-489b-a496-ee91c70d1cb5 | chonai-flora/ABC-cpp | abc265/c.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <bitset>
#include <unordered_map>
using namespace std;
struct pos { int x; int y; };
int main() {
cin.tie(0)->sync_with_stdio(0);
int h, w, i = 0, j = 0;
cin >> h >> w;
vector<string> g(h);
for (auto& s : g) cin >> s;
unordered... | ALGO | 0.999944 | 4.021917 |
3e18ffb8-282f-4c79-99ab-1310fddaa235 | walle45611/coding | 104_A/sol.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
cin.ignore();
for (int i = 0; i < n; ++i) {
vector<int> nums;
int num;
while (cin >> num) {
nums.push_back(num);
}
cin.ignore();
sort(nums.rbegin(), nums.rend());
cout << nums[0] << ... | ALGO | 0.999555 | 4.16739 |
8492bbef-65ea-42f6-907e-4a72b6b235a9 | we11cIJm/misis2023f-22-03-samsonov-n-o | prj.codeforces/1898b.cpp | #include <iostream>
#include <vector>
int main() {
int T;
std::cin >> T;
while (T--) {
int n;
std::cin >> n;
std::vector<int> nums(n);
for (int i = 0; i < n; i++) {
std::cin >> nums[i];
}
long long int ans = 0;
int m = nums[n - 1];
... | ALGO | 0.999887 | 4.964102 |
a74476ce-2aba-4dd9-9079-356eb6c7142c | VishanR-prog/Redone-Projects | Redone C++/HeightOfCylinder.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main () {
// Initializing the Surface Area, radius, height & pi
double s, r, h;
double pi = 3.14159;
// Asks for the values for the Surface Of The Cylinder
cout << "Enter the value for the Surface Of the Cylinder & the radius: " << endl... | ALGO | 0.970919 | 3.925273 |
eca5b151-89c3-4f5b-a693-045522470846 | duc123694/Owner-avatar-letienduc_HN-ENG-KS24A_-l-p-tr-nh-C_-session4 | session4.Ex5.cpp | #include <stdio.h>
int main(){
int a,b,c;
printf("Moi nhap so thu nhat:");
scanf("%d",&a);
printf("Moi nhap so thu hai:");
scanf("%d",&b);
printf("Moi nhap so thu ba:");
scanf("%d",&c);
if(c<a&&c>b||c>a&&c<b){
printf("so %d nam trong khoang so %d va so %d",c,a,b);
}else{
printf("so %d khong nam trong khoan... | ALGO | 0.998772 | 3.214481 |
7f38c9b8-a807-432d-933d-14a4764d2a25 | vairleon/3d-scene-visualization | lib/planefit.cpp | #include "planefit.h"
FitPlane::FitPlane(PointCloudT::Ptr cloud_tgt)
{
this->cloud_tgt = cloud_tgt;
this->cloud_inliers = PointCloudT::Ptr(new PointCloudT);
coeff = Eigen::VectorXf(4);
// calculate centroid of target pointcloud
Eigen::Vector4f centroid4f;
pcl::compute3DCentroid(*cloud_tgt, cen... | ALGO | 0.963144 | 5.050271 |
d808258e-50a6-4b0f-9cdc-f61deb941780 | UM-iRaL/Resource-Aware-Coordination-AirSim | AirSim/ros/src/navigation/global_planner/src/gradient_path.cpp | #include <global_planner/gradient_path.h>
#include <algorithm>
#include <stdio.h>
#include <global_planner/planner_core.h>
namespace global_planner {
GradientPath::GradientPath(PotentialCalculator* p_calc) :
Traceback(p_calc), pathStep_(0.5) {
gradx_ = grady_ = NULL;
}
GradientPath::~GradientPath() {
... | ALGO | 0.999741 | 4.978796 |
c2874baa-9a27-4369-a408-ac55006d92f2 | AChen24562/C-Plus-plus | Intro To C++/PE4B/PE2.23.cpp | // (c) S. Trowbridge & J. Sun
// WK4 - PE
#include <iostream>
using namespace std;
int main() {
cout << "1%3 = " << 1%3 << endl;
cout << "2%3 = " << 2%3 << endl;
cout << "3%3 = " << 3%3 << endl;
cout << "4%3 = " << 4%3 << endl;
cout << "5%3 = " << 5%3 << endl;
cout << "6%3 = " << 6%3 << endl;... | ALGO | 0.991469 | 3.048682 |
853b3583-54af-43dc-b5c8-a7b5dbe26103 | AntonetaSkenderi/WEB-SERVER-TO-CLIENT-COMMUNICATION-FOR-WEB-USAGE-DATA-ANALYSIS | Log File Code.cpp |
// Rule: 1
IF
freemem <= 193.5
freemem > 117.5
THEN
usr = 93
+ 0.0001 * outtime
- 0.0016 * intime
- 0.0019 * bytesize
+ 0.0022 * req
- 1.9716 * exec
// Rule: 2
IF
freemem > 304.5
fork <= 1.095
bytesize > 1626.5
THEN
usr = 88
+ 0.152 * intime
- 0.0009 * outime
- 3.0119 *req
- 0.0011 * exec
+ 0.31 ... | ALGO | 0.993233 | 3.023391 |
32150750-a3c7-4d77-84ec-a929ae7c3832 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p01274/994703518/response_0.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#define ll long long
#define maxn 100009
#define inf 999999999999
using namespace std;
ll dp1[10009];
ll dp2[10006];
char s[25];
int num[105];
int main() {
int n, m, x, y;
while (scanf("%d", &n) != EOF) {
if (n == 0)
break;
for (int i = 0; i < ... | ALGO | 0.999695 | 3.412061 |
407ba019-7bd5-4517-bd66-6e3118148dc5 | mad-anne/SN_lab_1 | src/classifiers/source/Perceptron.cpp | #include "classifiers/header/Perceptron.h"
#include "classifiers/header/Score.h"
Perceptron::Perceptron(
double alpha,
const double* bias,
IDataSetAccessor* dataSetAccessor,
const INeuron* neuron,
const IActivationFunction* activationFunction) :
IClassifier(),
alpha(alpha),
... | ALGO | 0.869945 | 6.45674 |
629c9621-2ba6-43c9-91b2-6e46b403b816 | CarlosEcos/Competitive-Programming-Algorithms | Algorithms/Greedy/huffman_code.cpp | #include <bits/stdc++.h>
#define all(s) s.begin(),s.end()
#define pb push_back
using namespace std;
typedef long long ll;
class Huffman{
int minlength(vector <char> &v){
int n = v.size();
int freq[26];
for(auto c : v){
freq[c-'a']++;
}
multiset <int> s;
int ans = 0, best1 = 0, best2 = 0;
for(int i = ... | ALGO | 0.999799 | 4.145809 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.