uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
afe3ded5-dc35-4c32-825c-3867e6ec2b4f | uxth/leetcode | cpp/933.number-of-recent-calls.cpp | /*
* @lc app=leetcode id=933 lang=cpp
*
* [933] Number of Recent Calls
*
* https://leetcode.com/problems/number-of-recent-calls/description/
*
* algorithms
* Easy (71.87%)
* Likes: 307
* Dislikes: 1728
* Total Accepted: 47.5K
* Total Submissions: 66.1K
* Testcase Example: '["RecentCounter","ping","p... | ALGO | 0.997111 | 6.914927 |
7e4b1287-b224-427a-8c30-f8da258c10b5 | himanshushukla12/gfg_solutions | Medium/0 - 1 Knapsack Problem/0-1-knapsack-problem.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return max value that can be put in knapsack of capacity W.
int knapSack(int W, int wt[], int val[], int n)
{
// Your code here
if(W==0 || n==0) return 0;
... | ALGO | 0.999997 | 5.808868 |
d05f8570-677f-4e8f-854d-5b4593366dec | Keshu9053/Data-Structure-and-Algorithm | reverse-pairs/reverse-pairs.cpp | class Solution {
public:
void merge(int low, int mid, int high, int& reverse_pairs, vector<int>& nums) {
int j = mid+1;
for(int i = low ; i<mid+1 ; i++) {
while( j<=high && nums[i] > 2*(long long)nums[j] )
j++;
reverse_pairs += j-(mid+1);
}
... | ALGO | 0.99996 | 5.422899 |
ede7f4b2-56d7-4299-94e8-c6751f9c969f | obsolescenceL/obsolescenceL | Graph/ShortestPaths/HRBUST1339SPFA.cpp | /*************************************************************************
File Name: 4_1d.cpp
ID: obsoles1
PROG:
LANG: C++
Mail: <EMAIL>
Created Time: 2015年04月02日 星期四 22时24分28秒
************************************************************************/
#include<cstdio>
#include<cstring>... | ALGO | 0.999965 | 3.918843 |
53612587-b8ff-498c-a22b-149e5deb5d97 | colin-arnet/DSL-crypto-bench-tls | Vitis_Libraries/security/L1/tests/des/desEnc/main.cpp | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "test.hpp"
#include "xf_security/des.hpp"
typedef unsigned char DES_cblock[8];
void cBlock2AP(DES_cblock block, ap_uint<64>& ap) {
for (int i = 0; i < 8; ++i) {
ap(i * 8 + 7, i * 8) = block[i];
}... | TEST | 0.885751 | 3.032922 |
42e40a58-8eff-4078-9ddb-cb92de1285bd | ndina/acm | acm/codef/1108b.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int>v,vv,vvv;
#define pb push_back
int is[5010];
int main(){
int n;
cin >> n;
int a[n];
int maxi = -19;
for(int i = 0; i < n; i++){
cin >> a[i];
vv.pb(a[i]);
vvv.pb(a[i]);
maxi = max(maxi, a[i]);
}
for(int i = 1; i <= maxi; i++){
if(maxi % i ... | ALGO | 0.999973 | 3.391105 |
9c9e4456-5350-45e9-93f8-721bafd1b64a | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/0700-0799/0721.Accounts Merge/Solution.cpp | class UnionFind {
public:
UnionFind(int n) {
p = vector<int>(n);
size = vector<int>(n, 1);
iota(p.begin(), p.end(), 0);
}
bool unite(int a, int b) {
int pa = find(a), pb = find(b);
if (pa == pb) {
return false;
}
if (size[pa] > size[pb]) {... | ALGO | 0.999981 | 6.439083 |
1467f402-c0a4-4c27-bd98-646d2f4c7a2d | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt35/Codenet/p00571/365590977/response_3.cpp | #include <algorithm>
#include <cstdio>
using namespace std;
typedef long long llong;
struct Data {
llong size;
llong value;
} art[500005];
inline bool cmp(const Data &a, const Data &b) {
return a.size < b.size || (a.size == b.size && a.value < b.value);
}
inline llong Max(llong a, llong b) { return a > b ? a : b;... | ALGO | 0.999905 | 3.94654 |
686afc62-360f-45fe-934b-0cbd4e3ac82f | Zeroo-01/Solutions | 115-distinct-subsequences/distinct-subsequences.cpp | class Solution {
public:
// int helper(int i,int j,string &s,string &t,vector<vector<int>>&dp)
// {
// if(j==t.size()) return 1;
// if(i==s.size()) return 0;
// if(dp[i][j]!=-1) return dp[i][j];
// int pick=0;
// if(s[i]==t[j])
// {
// pick=helper(i+1,... | ALGO | 0.999991 | 6.271848 |
12221b8d-8e28-4e48-94fd-1bfe82f5fa56 | omarElsherief/DataStructures | 03_Stack/LL-based/stack.cpp | #include <bits/stdc++.h>
#include "stack.h"
using namespace std;
Node::Node(int data_)
{
data = data_;
next = NULL;
}
Stack::Stack()
{
top = NULL;
}
bool Stack::isEmpty()
{
return top == NULL;
}
void Stack::push(int val)
{
Node *newnode = new Node(val);
if (isEmpty())
{
newnode->... | ALGO | 0.996997 | 4.158461 |
1c6834bb-0e59-4eb2-a187-ac2a327a7088 | raincross7/code-similarity | codes/train_code/problem162/problem162_238.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;
int main()
{
int a,b;
cin >> a >> b;
if(a < b){
cout << "a < b" << e... | ALGO | 0.99968 | 3.433885 |
100e91e0-f635-4031-97f9-5816221039f4 | GaziNazim/CPP | LAB for 22/New folder/MST by kruskal.cpp | #include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
#include<fstream>
using namespace std;
struct edge
{
int u,v,w;
bool operator <(const edge& b)const
{
return w<b.w;
}
};
vector<edge>e;
int par[100];
int find_p(int u)
{
if(par[u]==u)
return u;
else
r... | ALGO | 0.999928 | 4.260799 |
38c2276d-989c-46b7-8b31-d2d70e444423 | nayalchitra/P3_Program | 1-D Array/problem23.cpp | /* program to shift the 0's at even position and 1's at odd position in a binary array.
If there are more 0's than 1's or vice-versa put them at the end of array
Input : 5
1 0 0 0 1
Output:0 1 0 1 0
*/
#include<iostream>
using namespace std;
int main()
{
int n,i;
cin>>n;
int a[n];
int zero=0;
for(i=0;i<n;i... | ALGO | 0.999996 | 3.649081 |
abc18216-90ad-4c58-a85a-7e71ed67c77d | uWaterloo-IEEE-StudentBranch/IEEE-SB-SETUP | WarBots/Box2D_v2.2.1/Box2D/Dynamics/Joints/b2PulleyJoint.cpp | #include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Pulley:
// length1 = norm(p1 - s1)
// length2 = norm(p2 - s2)
// C0 = (length1 + ratio * length2)_initial
// C = C0 - (length1 + ratio * length2)
// u1 = (p1 - s1) / norm(p1 - s1)
// u2 = (p2 -... | ALGO | 0.995293 | 6.996031 |
10eeb061-3931-4c1e-95c4-62b3040cb72b | iamrahul25/LeetCode | Maths/largest-triangle-area.cpp | class Solution {
public:
double largestTriangleArea(vector<vector<int>>& points){
int n = points.size();
double maxarea = 0;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
for(int k=j+1; k<n; k++){
int x1 = points[i][0], y1... | ALGO | 0.999819 | 5.748178 |
6d9c689b-420c-44e6-b9a4-13b8273f1832 | aarthirs/DSA | c++/bitManipulation/reverseBits.cpp | class ReverseBits {
public:
uint32_t solve(string n) {
bitset<32> num(n);
uint32_t ans = 0;
for (int i = 0; i < 32; i++) {
int curr_pos = 31 - i; // Target bit position
int bit = num[i] ; // Extract i-th bit
... | ALGO | 0.999971 | 5.957777 |
a909a13b-914f-43c8-b5a7-680d150c04ce | pahuldeep/CxxPractice | STLbasics/lambda/lambda_capture_with.cpp | #include <iostream>
#include <vector>
#include <functional>
using namespace std;
int main(){
vector<function<void(int)>> object;
int multi = 5;
/* capture variable */
object.push_back( [multi](int x){ cout << "capture lambda: " << x * multi; } );
/* without capture */
object.push_back( [](in... | TOOL | 0.902473 | 5.579233 |
5ae32c25-a99b-4612-b3b6-035878511e14 | uday2005/cs101 | week4/case_toggling.cpp | #include <simplecpp>
main_program {
cin >> noskipws; //do not skip white spaces
char c;
for (cin >> c; c != '\n' ; cin >> c) {
if (c >= 'a' && c <= 'z') c = c - 'a' + 'A';
else if (c >= 'A' && c <= 'Z') c = c - 'A' + 'a';
cout << c;
}
}
//so inside the for loop first condition is initiati... | ALGO | 0.985674 | 5.220482 |
a055a6b2-424f-4d14-88ce-657d96c1d024 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6616_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 3020;
long long a[maxn], b[maxn];
long long dp1[maxn][maxn];
int n;
bool cmp(int x, int y) { return x > y; }
int main() {
while (cin >> n) {
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) {
a[i] -= i;
b[i] = a[i];... | ALGO | 0.999889 | 3.636803 |
fc7c8c76-7b61-459c-b561-c7b5041d1fdf | seopmin/Algorithm | BaekJoon/Graph/4963.cpp | #include<iostream>
#include<string.h>
#include<queue>
#include<tuple>
#include<vector>
using namespace std;
int w, h, sum;
int map[51][51];
int visited[51][51];
int dx[] = {0,0,1,-1, 1, 1, -1, -1};
int dy[] = {1,-1,0,0, 1, -1, -1, 1};
void init() {
memset(visited, 0, sizeof(visited));
sum=0;
}
int bfs(int x, int ... | ALGO | 0.999776 | 4.218449 |
c8f03590-0df8-4672-8099-4170888aac3f | suixibing/MyWay | OJ/Nowcoder/剑指offer/把数组排成最小的数.cpp | class Solution {
public:
string PrintMinNumber(vector<int> numbers)
{
string res("");
sort(numbers.begin(), numbers.end(), [](int a, int b)
{
return to_string(a) + to_string(b) < to_string(b) + to_string(a);
});
for (auto &t : numbers)
res += to_st... | ALGO | 0.999941 | 6.277186 |
8b785224-7bcc-4f47-bde4-ab097545a3ca | iamsile/ACM | 献给杭电五十周年校庆的礼物.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
while (scanf("%d",&n)!=EOF) {
cout << (n*n*n+5*n+6)/6 << '\n';
}
return 0;
}
/*
考虑:n个平面最多可以把空间分成几个部分
使第n个平面与前面n-1个平面都相交,且交线都不重合,那么n-1条直线最多可以把平面划分成为
n(n-1)/2+1个部分,所以f(n)=f(n-1)+n(n-1)/2
最后可以推出公式:f(n)=(n^3+5n+6)/6
Problem Des... | ALGO | 0.999884 | 4.011186 |
39f7d75d-b2f5-40d7-8b84-235bd5bb531d | vaibhav19mark1/DSA | Recursion Questions/series3.cpp | // Print the series: 1 + 3 + 9 + 27 + 81 + ...
#include<iostream>
#include<math.h>
using namespace std;
void series(int n){
if(n==0){
cout<<"1";
return;
}
int t=pow(3,n);
series(n-1);
cout<<" + "<<t;
}
int main(){
int n;
cout<<"Enter no. of terms: ";
cin>>n;
series... | ALGO | 0.999483 | 3.635305 |
5ec1f43f-8c16-40bf-8894-0e909bfd926d | LeonLH/leetcode | cpp/oddEvenLinkedList.cpp | #include<iostream>
using namespace std;
struct ListNode{
int val;
ListNode* next;
ListNode(int x): val(x), next(NULL) {}
};
// every iterator have to steps. 12ms
class Solution{
public:
ListNode* oddEvenList(ListNode* head){
if(!head)
return NULL;
if(!head->next)
return head;
ListNode* p = head;
... | ALGO | 0.999973 | 4.926836 |
d67c48f9-2380-4f01-a93e-516599e27384 | ishandutta2007/codeforces | leapfrog/normal/1244/D.cpp | //{{{
#include<bits/stdc++.h>
using namespace std;typedef long long ll;
template<typename T>inline void read(T &x)
{
x=0;char c=getchar(),f=0;
for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=1;
for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
if(f) x=-x;
}/*}}}*/
const int N=100005;int n,c[N][4],cl[N],et,head[N... | ALGO | 0.999971 | 3.58355 |
184425f2-cf16-4367-b9fa-6a554ddb36e6 | hjiang13/LLMs-in-IR | POJ-104/22/1036.cpp | #include <iostream>
using namespace std;
int main()
{
int a[300],n,i,j,max,sec;
char c;
i=0;
do
{
cin >> "%d%c",&a[i],&c);
i++;
}
while(c!='\n');
n=i;
max=a[0];
sec=-1; ;
for(i=1; i<n; i++)
{
if(a[i]>max){
sec=max; max=a[i]; }
else if(a[i]<max&&a[i]>sec)sec=a[i];
else ;
}
if(sec!=-1) cout << "%d",sec);
else cout << "No... | ALGO | 0.999827 | 3.130913 |
a138480e-d226-42d9-a113-499073721a73 | saurabhh-svg/Contests | CodeForces/D_Divisibility_by_2_n.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long int
#define pb push_back
#define fl(i,n) for(int i=0;i<n;i++)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespac... | ALGO | 0.998028 | 4.301787 |
ce7169df-901a-4412-8e43-129b93c49cde | ZIFANS/Algorithm_Code | PAT/Basic/1013.cpp | #include <iostream>
#include <cmath>
#include <vector>
using namespace std;
bool IsPrime(int n)
{
if(n<2)
return false;
for(int i=2;i<=sqrt(n);++i)
{
if(n%i==0)
{
return false;
}
}
return true;
}
int main ()
{
int m,n,num=2,count1=0;
scanf("%d %d",... | ALGO | 0.999794 | 3.416161 |
538108f9-0c8c-46eb-a191-1698dd70d1fb | pippi0057/Competitive-Programming | AtCoder/ABC-like/aising2020/D.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll int64_t
#define u32 uint32_t
#define u64 uint64_t
constexpr ll inf = 1e17;
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
#define pii pair<int,int>
#define pll pa... | ALGO | 0.999978 | 4.23493 |
76b20174-b2ff-4718-97fa-a4f280635701 | simplybest12/MyCodesCpp | StriverA2ZSheet/Bit_manipulation/set_get_clear_bit.cpp | #include <iostream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <climits>
#include <cmath>
using namespace std;
#define ASCII_SIZE 256
#define MAX_INT 2000000
#define ll long long
#define MOD 1000000007
#define vi vector<int>
#define vd vector<do... | ALGO | 0.999231 | 3.140065 |
cef2dc1e-1950-4590-b6f7-e66d4f7319ee | srilaksha-v/2023-24 | cs lab2/factorial.cpp | #include<stdio.h>
int main()
{
int N;
int s=1;
scanf("%d",&N);
for(int i=1;i<=N;i++)
s*=i;
printf("%d",s);
return 0;
}
| ALGO | 0.999981 | 3.881845 |
2497f74c-06ec-497a-bcec-f699483b1a3a | aditya762/Leetcode-Coding-Practice | 0014-longest-common-prefix/0014-longest-common-prefix - Copy (4) - Copy.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if (strs.empty()) return ""; // Return empty string if input is empty
// Use the first string as a base for comparison
string prefix = strs[0];
// Iterate through the rest of the strings
... | ALGO | 0.999631 | 6.857794 |
91d21bf4-f7f2-42fe-9259-e18e5a081d58 | ishandutta2007/codeforces | froggyzhang/normal/1485/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define N 200020
typedef long long ll;
inline ll read(){
ll x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return x*f;
}
int n,Q,k,a[N];
int main(){
n=read(),Q=read()... | ALGO | 0.999894 | 3.859926 |
a4e1a057-1cba-4465-b123-c6f0d935ed02 | Shivam2501/MSI-GEM5 | src/systemc/tests/systemc/misc/user_guide/chpt11.6/mean.cpp | /*****************************************************************************
mean.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.999418 | 4.632813 |
aa6700fc-9c3a-4459-9f4f-c90cd9ad4301 | pdslab/POR | ControlledConvolution/ControlledConvolution/ImageMeasure.cpp | #include "stdafx.h"
#include "ImageMeasure.h"
ImageMeasure::ImageMeasure(const cv::Mat mat)
{
_image = mat;
}
ImageMeasure::~ImageMeasure()
{
}
void ImageMeasure::CalculateEntropy()
{
//const auto image = p.GetMat();
std::vector<cv::Mat> channels;
cv::split(_image, channels);
auto histSize = 255;
float ra... | TOOL | 0.969161 | 4.913724 |
046dc4ac-9924-4089-8a40-71dba5615234 | ABHISHEK-AMRUTE/CP_Algorithms_hacktoberfest | C++/LinkedList/Reverse_LL.cpp |
// Name : Rithik Dutt
// College : Dayanandan Sagar College of Engineering
#include<bits/stdc++.h>
using namespace std;
class Node{
public: int data;
Node* next;
};
int main(){
Node* Head = NULL;
Node* Tail = NULL;
Head = new Node();
Tail = new Node();
int n;
cout<<"Enter t... | ALGO | 0.99982 | 3.731031 |
f363f70a-5325-4db2-b55c-383fd3e39ae2 | ruby-kim/Algorithm | [N현직자 특강] All-in-One 직무역량 「알고리즘 교육프로그램」/3주차(190425)/vector(insert, remove).cpp | #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
vector<string> v;
v.push_back("Show Me"); // ڿ
v.push_back("Tiger JK");
v.push_back("Dok2");
v.push_back("GAEKO");
v.push_back("ZICO");
//ex4) v.front(), v.back()
cout << "ex4) v.front(), v.back()" << endl;
cout << "v.... | TOOL | 0.921023 | 3.696788 |
b1d0d8e0-0cb9-4b41-b446-38f4e597dd4d | val-fcn/mealsApp | 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 |
4029ece2-e695-4a55-ab0a-67564faf4397 | TheAlokkushwaha/Arsh-goyal-DSA-sheet | Array/Find-the-duplicate-number.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int findDuplicate(vector<int>& nums) {
int ans = 0;
for(int i=0; i<nums.size(); i++){
ans= ans^nums[i];
}
for(int i=1; i<nums.size(); i++){
ans= ans^i;
}
return a... | ALGO | 0.999853 | 5.333496 |
59e3b8e0-00e1-4d90-9733-06eb8b459241 | Bungmint/competitiveprogramming | contest/USACO/248.cpp | #pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
using vpi = vector<pair<int, int>>;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pl>;
using ld = long double;
#define all(v... | ALGO | 0.999814 | 4.483209 |
40e66004-8678-46ab-8ed8-1ba54e975d38 | Pussycat-Doll/My_leetcode. | 奇数位于偶数前面.cpp | vector<int> exchange(vector<int>& nums)
{
int left = 0;
int right = nums.size()-1;
while(left < right)
{
while(left< right && (nums[left]&1) != 0)//ż
++left;
while(left< right && (nums[right]&1) == 0)//
--right;
... | ALGO | 0.999976 | 4.607463 |
792c3403-04b6-4751-bcbc-6eceeecf657d | hoangvantuan123/LTHDT_OOP | OOP/lthdt37.cpp | /*
Bài 37(lthdtbai37.cpp): Tạo lớp đối tượng xâu ký tự có các đặc điểm giống như xâu ký tự
trong Pascal: Có thể khởi tạo đối tượng xâu bằng một hằng xâu; có thể gán hằng xâu hoặc
đối tượng xâu cho đối tượng xâu; có thể dùng phép toán + để nối xâu; có thể dùng các
phép toán so sánh để so sánh xâu; có thể dùng cin và cou... | TOOL | 0.945547 | 3.709652 |
267379af-c4c7-4edd-a063-f2ac5f428179 | Ragab2010/problem_solving_vscode | count_long_number_of_words_in_string.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<sstream>
using namespace std;
/****************************************************************/
//prefer
int count_long_number_of_words_in_string_c(char * cstring){
if(cstring == NULL)
return -1;
int len = strlen(cstring);
if(len <=... | ALGO | 0.999789 | 4.319923 |
568fe710-48d5-4500-817e-48bb6ee87ed3 | Auliorp/Pokemon-flutter-http | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
610d9cff-3bad-4d93-8d32-c9cea87226db | SourVoice/c-leetcode-Experiment | leetcode/931. Minimum Falling Path Sum.cpp | // 931. ½·С
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
//̬滮,
class Solution
{
public:
int minFallingPathSum(vector<vector<int>> &matrix)
{
int n = matrix.size();
int m = matrix[0].size();
vector<vector<int>> dp(n, ve... | ALGO | 0.99999 | 5.055927 |
41e69575-156f-402a-a63a-04a37878c48e | SsalHub/baekjoon | solved/2581/main.cpp | #include <iostream>
#define _MAX_ 10001
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
bool prime[_MAX_] = {
false,
};
prime[1] = true;
for (int i = 2; i < _MAX_; i++)
{
if (prime[i])
continue;
for (int j = i + i; j < _MA... | ALGO | 0.99998 | 4.594355 |
bd368706-9e5b-4cf2-8900-3e6665ba214f | Learning-and-Intelligent-Systems/mit-ros-pkg | branches/unreleased/sandbox/lis/objrec/src/simulation.cpp | /*
* simulation.cpp
*
* Created on: Aug 28, 2012
* Largely based on glxgears.c
*/
#include "simulation.h"
#include "io.h"
#include <stdexcept>
#include <fstream>
#include <opencv2/highgui/highgui.hpp>
namespace objrec {
/*
* Create an RGB, double-buffered window.
* Return the window and context handles.
*/... | TOOL | 0.919658 | 3.712435 |
6778281e-9927-4e34-9e06-10d35886bf6f | ArpitPatni/DSA | 32_Tree_1/2_LevelOrderTraversal.cpp | class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
vector<vector<int>>ans;
if(root==NULL) return ans;
queue<TreeNode*>q;
q.push(root);
while(!q.empty()){
int size=q.size();
vector<int>level;
for(int i=0;i<size;i++){
... | ALGO | 0.999991 | 5.945717 |
641c000b-4321-44eb-a843-0d198c567162 | LeeYunSung/Algorithm | 프로그래머스/프로그래머스_네트워크.cpp | #include <string>
#include <vector>
using namespace std;
bool isNetwork(vector<vector<int>>& computers, int n) {
if (!computers[n][n]) return false;
computers[n][n] = 0;
for (int i = 0; i < computers[i].size(); i++) {
if (computers[n][i] == 1) isNetwork(computers, i);
}
return true;
}
int solution(int n, vect... | ALGO | 0.999872 | 6.054328 |
89585314-a7f4-45b2-852e-c0602d4ebb94 | Harshad-Gore/main.cpp | Threaded_Binary_Tree.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *left, *right;
bool lthread, rthread;
node(int val)
{
data = val;
left = right = NULL;
lthread = rthread = false;
}
};
class threadedBinaryTree
{
node *root;
public:
threadedBinaryTree... | ALGO | 0.999968 | 5.627493 |
e3a7539e-3611-4375-8ed9-b674c84a6ad9 | kwang-12/ros_basalt | thirdparty/eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.978961 | 4.120226 |
4ce62e5c-4116-4f67-bb1d-c48f4e792c21 | jncronin/gk-userland | boost-1.85.0/libs/bimap/example/tagged_simple_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.957225 | 6.020885 |
97d77ee5-d1b4-49cd-a946-ea16e269977e | ishandutta2007/codeforces | 353cerega/normal/1626/C.cpp | //#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define X first
#define Y second
const ll mod = 1000000007;
//const ll mod = 998244353;
ll gcd(ll a, ll b)
{
a = abs(a);
b = abs(b);
if (a==0 or b==0) return a+b;
return gcd(b... | ALGO | 0.999982 | 3.833992 |
958b9b6b-caf0-4ffd-abc0-f1ac04e75f43 | yangxu1003/leetcode | Number of factors/test.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n,k,i;
while(cin >> n){
k=0;
for(i = 2; i <= sqrt(n); i++){
if(n % i == 0){
while(n % i == 0){
n = n / i;
}
++k;
}
}
... | ALGO | 0.999878 | 3.755589 |
4bfc5fdc-2a5a-4f32-837c-158c11d26512 | sumonmd/CodeForce-Problem-Solving | J - IBM Minus One.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int test, i, c=1, t=0;
cin >> test;
while(t<test){
string s;
cin >> s;
cout << "String #" << c++ << endl;
for(int i=0; i<s.size(); i++){
if(s[i]=='Z'){
s[i]='A';
}
... | ALGO | 0.99911 | 4.109747 |
252d4281-3224-419e-bd9e-315a7c4ef747 | minuet-red/cpp | leetcode_another/binary_tree/LeetCode 34.Search for a Range.cpp | #include <stdio.h>
#include <vector>
int left_bound(std::vector<int>& nums, int target){
int begin = 0;
int end = nums.size() - 1;
while(begin <= end){
int mid = (begin + end) / 2;
if (target == nums[mid]){
if (mid == 0 || nums[mid -1] < target){
return mid;
}
end = mid - 1;
}
else if (target ... | ALGO | 0.999962 | 5.533409 |
11dcbd7f-5ffc-4541-89e0-a92a01acaddc | AFpine/Problem-Solving | BOJ/15000-19999/16124.cpp | #include <bits/stdc++.h>
// 16124 나는 행복합니다
// update 220621
using namespace std;
const int INF = 1e9+5;
const long long llINF = 1e18;
const int minINF = -2e9-1;
const int MAX = 1000005;
const long long MOD = 998244353;
int N,Q;
string S;
//pw[i] : 10^i
int pw[MAX];
int tree[4*MAX][10];
int lazy[4*MAX][10];
int tem... | ALGO | 0.999659 | 5.214851 |
6f25f7cf-6566-4e0f-9fef-e68add3edb7d | sidjha57/Competitive | ICPC/thanos.cpp | //template
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<strin... | ALGO | 0.999108 | 4.950794 |
e7a3e2cb-c0bf-4b40-b14c-e3040175aaa4 | fepaf/Competitive-Programming | Resoluções OJ/Neps Academy/615.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define INF 0x3f3f3f3f
#define MAX (1<<20)
#define MOD 1000000007
#define i64 long long
#define all(x) (x).begin() , (x).end()
#define sz(x) (int)(x).size()
#define ii pair<int, int>
#define fs first
#define sc second
#define ... | ALGO | 0.99982 | 3.746192 |
5c3c95cd-2fb5-4fa7-95ca-8b38fd874a97 | Dhiru12321/DSA-GFG | DSA (deepanshu)/ARRAYS/Problems/13_Stock_Buy_and_Sell.cpp | #include <iostream>
using namespace std;
int maxProfit(int arr[], int n)
{
int profit = 0;
for (int i = 0; i < n; i++)
{
if (arr[i] > arr[i - 1])
profit += (arr[i] - arr[i - 1]);
}
return profit;
}
int main()
{
int arr[5] = {1, 5, 3, 5, 9};
int j = maxProfit(arr, 5);
... | ALGO | 0.999218 | 5.206141 |
9f2db416-c024-4814-ab52-458f766ac189 | raghavpatidar/Leetcode | Streak/july2023/2-maximum-number-of-achievable-transfer-requests.cpp | /*
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ *-----------Raghav Patidar----------* |
| Fuck Ratings,Just Enjoy the Contest/Questions |
| I'm in Love with Expe... | ALGO | 0.999899 | 5.512835 |
4d7bb79a-1bb3-4302-ba1c-f49583b9eebe | MelihEkinci/Optical-Flow-Horn-Schunck | eigen-3.4.0/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.997748 | 4.015535 |
b5446231-735a-4113-b1e9-81753d0ccf3d | raincross7/code-similarity | codes/train_code/problem363/problem363_214.cpp | #include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>
//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int... | ALGO | 0.998978 | 3.674138 |
ad26128e-07dc-4483-9011-ca462b230218 | ishandutta2007/codeforces | zoli9/normal/1205/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
int n;
int dax[59][59];
int day[59][59];
int dap[59][59];
int ans[59][59];
vector<pii> ngh[59][59];
vector<int> np[... | ALGO | 0.999994 | 3.433842 |
35ae2dcb-e51c-4bed-9a96-8522b4d14f64 | gidelfino/maratona | codeforces/496/496B.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int n, l[1005], aux[1005], resp[1005];
int main(){
scanf("%d", &n);
for(int i = 0; i < n; i++){
char c;
scanf(" %c", &c);
l[i] = c - '0';
resp[i] = 11;
}
for(int i = 0; i < n; i++){
int t = 10 - l[i];
for(int j = 0; j < n; j++)
aux[j] = (... | ALGO | 0.999958 | 3.133343 |
6f473bf5-1714-4f62-a272-8ddb46b6eabe | nitinnsharma234/leet_code | 62-unique-paths/unique-paths.cpp | class Solution {
public:
int ways (int i, int j , int m ,int n ,vector<vector<int>>& dp){
if(i==m-1 and j==n-1){
return 1 ;
}
int a =0,b=0;
if (i<m and j< n and dp[i][j]!=-1){
return dp[i][j];
}
if(i<m)
{
a=ways(i+1,j,m,n,dp);
}
if (j<n){
b=ways(i,j+1,m... | ALGO | 0.999964 | 6.338699 |
9adbdd68-890f-4a77-ad6e-2572a926c92e | VineetRajput87/GFG-POTD | Game with String.cpp | class Solution{
public:
int minValue(string s, int k){
// code here
unordered_map<char,int> mm;
for(auto x:s)mm[x]++;
priority_queue<int> pq;
for(auto x:mm)pq.push(x.second);
int ans = 0;
while(k--){
int temp = pq.top();
pq.pop(); ... | ALGO | 0.999948 | 4.845086 |
4d74790f-3e5c-4597-9c96-deb5240df4d7 | vishal01072002/Complete-DSA | 06. String/problem06.cpp | #include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
// 443. String Compression
int intToString(vector<char> &s, int ansIndx, int count)
{
if (count < 10 && count > 1){
s[ansIndx] = (count) + '0';
ansIndx++;
}
if (count > 9){
string temp = to_string(c... | ALGO | 0.999979 | 4.879918 |
791f0881-d0c2-4b58-9e86-849053779769 | alishan427/pf-lab-06 | enterpenur.cpp | #include <iostream>
using namespace std;
float price1(string city, string product, int quantity);
main()
{
string product;
string city;
int quantity;
float price, result;
cout << "Enter City: ";
cin >> city;
cout << "Enter Product: ";
cin >> product;
cout << "Enter Quantity: ";
... | TOOL | 0.928947 | 4.208024 |
e392fd4d-6826-4dd2-8d6d-577e2dbc0775 | Kush-Singh-26/AdventOfCode | day6/1.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
vector<string> grid;
ifstream file("indata.txt");
string line;
int xcor, ycor;
int row = 0;
if (!file.is_open()) {
cerr << "Error opening file" << endl;
return 1;
}
while (getline(file, line)) {
int col... | ALGO | 0.999879 | 4.97873 |
a444bca0-51ca-41d3-b555-2ad33b60f9fa | cglwn/ppp3e | 02/08_detect_and_count.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int number_of_words = 0;
string previous;
string current;
while (cin >> current) {
++number_of_words;
if (previous == current)
cout << "word number " << number_of_words << " repeated: " << current << '\n';
previous = cur... | ALGO | 0.998016 | 4.594754 |
9f016401-990c-4074-bfa3-23ac194bfa7c | notJAYanand/Leetcode | 2540-minimum-common-value/2540-minimum-common-value.cpp | class Solution {
public:
int getCommon(vector<int>& nums1, vector<int>& nums2) {
int n1=nums1.size();
int n2=nums2.size();
int i=0,j=0;
while(i<n1 && j<n2) {
// if(nums1[i]==nums2[j]) return nums1[i];
if(nums1[i]<nums2[j]) i++;
else if(num... | ALGO | 0.999979 | 5.660146 |
839e4df5-c207-4b9a-b164-42169538a80c | mukeshlraj/GCL-42 | Class-17/job_sequencing.cpp | #include <iostream>
#include <vector>
using namespace std;
class Job {
public:
int id;
int deadline;
int profit;
Job(int id, int deadline, int profit) {
this->id = id;
this->deadline = deadline;
this->profit = profit;
}
};
bool comp(Job &a, Job &b) {
return a.profit >... | ALGO | 0.999916 | 5.730505 |
2f047748-fb92-457e-904a-f62429c20cfe | ishandutta2007/codeforces | egor.lifar/normal/767/D.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#... | ALGO | 0.99999 | 3.297399 |
266be3d5-0f93-4915-aca2-dde8b802537d | gargparth2003/LeetcodeChallenges | Day1/1530.NumberofGoodLeafNodesPairs.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.999974 | 6.562674 |
87bd5a47-9bba-43f5-85d5-64a37851aeba | ishandutta2007/codeforces | hollwoq_pelw/normal/1202/E.cpp | /*
// is short or still long ???
hollwo_pelw's template(short)
// Note : -Dhollwo_pelw_local
*/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
void FA... | ALGO | 0.999967 | 4.385435 |
96ddf1d9-2039-456c-ad7c-4d4ad0c91d44 | ishandutta2007/codeforces | stgatilov/normal/207/C1.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <c... | ALGO | 0.999785 | 3.832936 |
2d142155-d9e9-4bea-b86d-a39a1b426b7e | Dynesshely/Competition | source/website/ybt.ssoier.cn/1296.cpp | // #include <bits/stdc++.h>
// using namespace std;
// int f[1000050],w[120],v[120];
// int main()
// {
// int T,n,k,i,j;
// scanf("%d",&T);
// while (T--)
// {
// memset(f,0,sizeof(f));
// scanf("%d%d",&n,&k);
// for (i=1;i<=n;i++)
// scanf("%d",&w[i]);
// for (i=1;i<=n;i++)
// {
//... | ALGO | 0.999971 | 3.552453 |
4c6a7c64-1269-4ea1-895b-e35e826aab60 | oroszgy/sefh | indri/src/ShrinkageBeliefNode.cpp | //
// ShrinkageBeliefNode
//
// 29 July 2005 -- pto
//
#include "indri/ShrinkageBeliefNode.hpp"
#include "lemur/lemur-compat.hpp"
#include "indri/Annotator.hpp"
#include "indri/Parameters.hpp"
#include <cmath>
#ifdef ISNAN_IN_NAMESPACE_STD
using std::isnan;
#else
#ifdef ISNAN_IN_NAMESPACE_GNU_CXX
using __gnu_cxx::isna... | TOOL | 0.970644 | 6.086457 |
32ca813a-2a0b-4c98-9436-fd22766aaad8 | CESNET/Nemea-Modules | aggregator/aggregator.cpp | /**
* \file aggregator.cpp
* \brief Aggregation NEMEA module based on UniRec.
* \author Michal Slabihoudek <<EMAIL>>
* \date 2018
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <cstdio>
#include <csignal>
#include <unistd.h>
#include <getopt.h>
#include <libtrap/trap.h>
#include <unirec/unirec.h>
#... | TOOL | 0.925006 | 6.726497 |
6a458dcf-22c3-42ed-a777-bbe1d693b0f7 | ualbertagreen/competitive-coding | LeetCode/sortColors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int zeros = 0;
int ones = 0;
int twos = 0;
for (int n : nums) {
if (n == 0) zeros++;
if (n == 1) ones++;
if (n == 2) twos++;
}
for (int i = 0; i < nums.... | ALGO | 0.9999 | 6.158956 |
1521b1cf-84bd-444e-ab6c-fd499792f0c7 | davidteacmc/conveyor-belt | conveyor_belt/belt_main.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "parameters.h"
#include "cameraCalibrator.h"
#include "fgObject.h"
#include "fgExtraction.h"
#include "tra... | TOOL | 0.873628 | 4.737725 |
8ca52ade-350e-4fb5-b3a3-85c127f47cc3 | priyanka8625/DSA-Daily-Problems-2024 | 09_September_Daily_Problems/11_LC_2220. Minimum Bit Flips to Convert Number_MySoln.cpp | class Solution {
public:
int minBitFlips(int start, int goal) {
int count=0, diff=0;
diff = start ^ goal;
while(diff){
count += diff&1;
diff>>=1;
}
return count;
}
}; | ALGO | 0.999986 | 5.817114 |
26399616-f975-4290-beff-bf4f6b6859e5 | quanganh208/DSA-CodePTIT | DSA09001 - CHUYỂN DANH SÁCH CẠNH SANG DANH SÁCH KỀ.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int v, e;
cin >> v >> e;
vector<vector<int>> adj(v + 1, vector<int>(v + 1));
for (int i = 0; i < e; i++)
{
int a, b;
cin >> a >> b;
adj[a][b] = 1;
adj[b][a] = 1;
}
for (int i = 1; i <= v; i++)
{
... | ALGO | 0.999863 | 4.850585 |
4dd3dbd1-ee9a-4430-9513-fe218586fbe3 | kressjh/openravefork | old/rmanipulation/taskcaging.cpp | // Functions to plan with caging grasps. See
// Rosen Diankov, Siddhartha Srinivasa, Dave Ferguson, James Kuffner.
// Manipulation Planning with Caging Grasps. IEEE-RAS Intl. Conf. on Humanoid Robots, December 2008.
#include "commonmanipulation.h"
class TaskCaging : public ModuleBase
{
public:
struct BODYTRAJ
... | ALGO | 0.998992 | 6.418607 |
1edcd33c-15dd-4f8b-a725-ebce9c67b933 | ViacheslavN/GIS | src/ThirdParty/cryptopp/zinflate.cpp | // zinflate.cpp - written and placed in the public domain by Wei Dai
// This is a complete reimplementation of the DEFLATE decompression algorithm.
// It should not be affected by any security vulnerabilities in the zlib
// compression library. In particular it is not affected by the double free bug
// (http://www.kb... | ALGO | 0.994809 | 5.325518 |
4f3bc7f7-36ac-4571-a04d-37da84823671 | brianchiang-tw/Algorithmic_Toolbox | Assignment_bootstrap/week2_algorithmic_warmup/2_last_digit_of_fibonacci_number/fibonacci_last_digit.cpp | #include <iostream>
int get_fibonacci_last_digit_naive(int n) {
if (n <= 1)
return n;
int previous = 0;
int current = 1;
for (int i = 0; i < n - 1; ++i) {
int tmp_previous = previous;
previous = current;
current = tmp_previous + current;
}
return current % 10... | ALGO | 0.999947 | 5.611818 |
60cb44e6-78bd-4e3e-96db-3235c0fa926d | godely/Problems | UVa/11759.cpp | #include <bits/stdc++.h>
using namespace std;
#define fr(a,b,c) for(int a = b; a < c; a++)
#define rp(a,b) fr(a,0,b)
#define EPS (1e-8)
const double pi = acos(-1);
inline int cmp(double a, double b = 0){
if(fabs(a-b)<=EPS) return 0;
if(a<b) return -1;
return 1;
}
struct point {
double x,y;
point(double x = 0, d... | ALGO | 0.998997 | 3.93161 |
7e8937ca-211c-49c2-9d78-c7f6e1e936f0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5586_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
puts("Odd");
return 0;
}
| ALGO | 0.999201 | 3.510719 |
379cf3f6-c58c-4b1a-a6fb-9dae62acef07 | minseo08/problem_solving | math(implementation)/2003.cpp | #include <iostream>
using namespace std;
int arr[10001];
int main(){
int n, m;
int sum = 0;
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> arr[i];
}
int start = -1;
int end = -1;
int res = 0;
while(end < n){
if(sum < m){
end++;
sum += arr[... | ALGO | 0.999976 | 4.219395 |
4fdc889d-7df3-4401-8cd5-d96613300f67 | bokyoungson/HMD-LSJ-_algorithm | L/kickstart_2019_A_#1.cpp | // passed visible test set
//passed hidden test set : Time Limit Exceeded
#include<iostream>
#include<algorithm>
using namespace std;
int *value;
int *subarr;
int check(int val[], int N, int P) {
int i, j;
int cp = 987654321;
int sum = 0;
int count = 0;
subarr = new int[N - P + 1];
sort(val, val + N);
fo... | ALGO | 0.999765 | 3.671263 |
578bb980-0292-4e73-8d09-dae011f5e2b4 | haomingchan0811/Leetcode | 6. ZigZag Conversion.cpp | class Solution {
public:
// O(N) time and space: 64.24%, ok
string convert(string s, int numRows) {
int i = 0, size = s.size();
string ans = "";
string level[numRows] = {""};
while(i < size){
// bug: inner boundry check "i < size" or invalid char like "\x00" will show... | ALGO | 0.999979 | 6.510673 |
c280a509-72ec-41a8-9ebf-c9d43b0127f0 | fyrsta7/LLM_on_ASAC | result_api_backup/en_without_annotation_mzn/deepseek-coder_loop10/Hopscotch-3.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
int main() {
int n, d, k;
cin >> n >> d >> k;
vector<int> X(n), S(n);
for (int i = 0; i < n; ++i) cin >> X[i];
for (int i = 0; i < n; ++i) cin >> S[i];
int left = 0, right = 2 * 1000000000;
w... | ALGO | 0.999945 | 4.149563 |
3989b2f4-bb5b-4f46-a0ed-2ee53d09a5bc | Astroxphiliauxx/QuadB-Tech | 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 |
30473ee8-07ba-4c0b-a478-62dd18b86593 | sangram2002/Numerical-Methods-codes | Assignment_09/q3_iii.cpp | #include <bits/stdc++.h>
using namespace std;
long double f(long double x)
{
return pow(x,6) - 36*pow(x,5) +450*pow(x,4)-2400* pow(x,3)+5400* pow(x,2) -4320*x +720.0;
}
long double golden_section_search(long double a, long double b, long double eps)
{
long double gr = (sqrt(5.0) + 1.0) / 2.0;
long double... | ALGO | 0.999946 | 4.076122 |
5acf8ca6-0bfb-4e36-81ef-fb4da9e08c26 | ishandutta2007/codeforces | smallling/normal/915/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, x, l, r;
scanf("%d%d%d%d", &n, &x, &l, &r);
if(l == 1 && r == n)
{
puts("0");
return 0;
}
if(l == 1)
{
printf("%d\n", abs(x - r) + 1);
return 0;
}
if(r == n)
{
printf("%d\n", abs(x - l) + 1);
return 0;
}
printf("%d\n", min(abs(x... | ALGO | 0.999949 | 3.49387 |
752b5900-b5a2-4b95-a8a4-a569ed6704e5 | Chayan199916/go-data-go | datastructure/array problems (c++ implementation)/leaders_in_array.cpp | #include<iostream>
using namespace std;
void find_leaders(int *arr, int n){
cout << "Leaders are : " << endl;
int max_till = arr[n - 1];
cout << max_till << "\t";
for(int i = n - 2; i >= 0; i--){
if(arr[i] > max_till){
max_till = arr[i];
cout << max_till << "\t";
... | ALGO | 0.99994 | 3.316836 |
3c481040-c1cf-488e-a74a-9d9c7d188cd3 | tzsombi01/sze_programozas | gyakorlatok/01_het/01_5_bekeres_unsigned.cpp | // 1/5 => Bekérés (2, 3, 16)
#include <iostream>
#define KT 10
using namespace std;
int main()
{
unsigned int f_k = 0, k_e = 1, alap;
cout << "Kérem az alapot: ";
cin >> alap;
cout << endl;
while (f_k <= KT)
{
if (f_k != 0)
k_e *= alap;
cout << alap << "^" << f_k << ". hatványa: " << k_e << endl;
f_k... | ALGO | 0.998077 | 3.547696 |
4bf4266a-d3e1-4405-b8c6-5cfd987cf89d | Somya-Singhal/Leetcode-Daily-Practise | 344-reverse-string/344-reverse-string.cpp | class Solution {
public:
void reverseString(vector<char>& s) {
int n=s.size();
int l=0,h=n-1;
while(l<=h)
{
swap(s[l],s[h]);
l++;
h--;
}
}
}; | ALGO | 0.999553 | 6.143956 |
534f64fa-45a8-4d1f-bdb1-8aefa9301e7a | fang0jun/Data_Structure | 栈与队列/数组模拟队列.cpp | /*
实现一个队列,队列初始为空,支持四种操作:
push x – 向队尾插入一个数 x;
pop – 从队头弹出一个数;
empty – 判断队列是否为空;
query – 查询队头元素。
现在要对队列进行 M 个操作,其中的每个操作 3 和操作 4 都要输出相应的结果。
输入格式
第一行包含整数 M,表示操作次数。
接下来 M 行,每行包含一个操作命令,操作命令为 push x,pop,empty,query 中的一种。
输出格式
对于每个 empty 和 query 操作都要输出一个查询结果,每个结果占一行。
其中,empty 操作的查询结果为 YES 或 NO,query 操作的查询结果为一个整数,表示队头元素的值... | ALGO | 0.999674 | 4.14612 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.