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 |
|---|---|---|---|---|---|---|
88d06317-541b-4892-9a19-eec709b953aa | ArjunTa1war/codeforces | 124a.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,a,b;
cin>>n>>a>>b;
n = n-a;
b++;
cout<<min(n,b)<<"\n";
return 0;
}
/*we are to find the number of positions where petr can stand
so atleast a people should be ahead of him it me... | ALGO | 0.999826 | 3.133513 |
191a94e3-77e1-468e-9388-33835363ebb4 | jaskirat-13/C_plus_plus | complement.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter number : ";
cin>>n;
int m = n;
int mask = 0;
while(m != 0){
mask = (mask << 1) | 1;
m = m >> 1;
}
int ans = (~n) & mask;
cout<<"Complement of number : "<<ans;
return 0;
} | ALGO | 0.999914 | 5.083262 |
9e8d2ba2-d399-4237-ba1b-172a2259dce6 | alexandraback/datacollection | solutions_5648941810974720_1/C++/Fakvarl/Source.cpp | #include <string>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
int nums[12] = { 0, 2, 8, 3, 6, 7, 4, 5, 9, 1 };
//int arr[MX] ;
string strNums[13] = { "ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE" };
//zero// two //// eight // three // six// seven... | ALGO | 0.999854 | 4.932068 |
07823f71-9f2d-4a2f-9f4f-e5f49a0ee6d5 | codeAntu/LeetCode-problems | cpp/count-nodes-equal-to-average-of-subtree.cpp | #include "iostream"
#include "math.h"
#include "vector"
#include "map"
using namespace std;
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, Tree... | ALGO | 0.999612 | 5.967293 |
53940cf8-da07-4ae2-8315-b5a3fe4459b5 | sakshamVerma08/DSA | Arrays/findSingleElement.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// uses mapping approach
// time complexity : O(N) + O(N log N)
// space complexity: O(N)
int getSingleElement(vector<int> &arr)
{
map<int, int> m;
for (int i = 0; i < arr.size(); i++)
{
if (m.find(arr[i]) != m.end())
{
... | ALGO | 0.999407 | 5.285276 |
a64ce260-35df-41ab-81b8-c2d5cf3c880a | npnkhoi/Competitive-programming | CodeForces/Old/814A.cpp | #include <stdio.h>
int n,m;
int a[200];
bool inc_seq;
int main()
{
scanf("%d%d",&n,&m);
if (m>1) printf("Yes");
else
{
for (int i=0;i<n;i++) scanf("%d",&a[i]);
int tmp;
scanf("%d",&tmp);
for (int i=0;i<n;i++) if (a[i]==0) a[i]=tmp;
inc_seq=1;
for (int i=1;... | ALGO | 0.999985 | 3.062214 |
1b55056c-0728-4ef5-b8db-8f690d362eb3 | utsavtyagi01/Leetcode | Next_Greater_Element.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
stack<int> st;
vector<int> value(nums2.size(), -1);
// Find the next greater element indices in nums2
for (int i = 0; i < nums2.size(); i++) {
while (!st.empty() && (nums2[i... | ALGO | 0.999938 | 6.49415 |
53abed99-607a-46bf-b638-d7d557ef780e | 1shi-xiao/CV-Infer | third_parties/opencv-4.10.0/samples/dnn/person_reid.cpp | #include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/dnn.hpp>
using namespace cv;
using namespace cv::dnn;
const char* keys =
"{help h | | show help message}"
"{model m | | network model}"
"{query_list q | | list of query images}"
"{galle... | DATA | 0.891416 | 6.499674 |
c94a4259-c9d5-454a-ab99-ec39254d52a2 | aamir-ops/Competitive-Programming | Hackerrank/Practice/Algorithms/Sorting/Sorting-comparator.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct Player {
string name;
int score;
} Player;
bool cmp(Player p1,Player p2) {
if(p1.score > p2.score) {
return true;
} else if(p1.score < p2.score) {
return f... | ALGO | 0.999909 | 5.257913 |
f68ab195-baaf-4e6f-9555-2e3db3891227 | CesarHera/cpp-lessons | many_variables.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
void Sum_mult(int n1, int n2, int&, int&);
int main() {
int n1, n2, sum = 0, product = 0;
cout<<"Enter 2 numbers: "; cin>>n1>>n2;
Sum_mult(n1, n2, sum, product);
cout<<sum<<endl<<product<<endl;
system("pause");
return 0;
}
void ... | ALGO | 0.972383 | 4.246217 |
b026f095-b6bf-4852-b472-153aadd3984a | Bijay-Shre-stha/cpp_oop | math.cpp | #include<iostream>
using namespace std;
#include<cmath>
int main()
{
int a, b, c;
cout<<"Enter the value of a & b:"<<endl;
cin>>a>>b;
c=pow(a,b);
cout<<c;
return 0;
return 0;
} | ALGO | 0.998867 | 4.119832 |
ea897fc0-d7a7-40d7-904d-d63adcc7ba15 | Junhachoi-GameDav/c-programming | project3/Project3/3w_3.cpp |
#include <iostream>
using namespace std;
/*
class circle {
public:
int radius;
circle();
circle(int r);
double get_area();
};
circle::circle() : circle(1) {
radius = 1;
}
circle::circle(int r) {
radius = r;
cout << " " << radius << " " << endl;
}
double circle::get_area() {
return 3.14 * radius * radius... | TOOL | 0.899634 | 4.615124 |
48e11388-89f4-411a-87b0-840c1f28741a | ishandutta2007/codeforces | aidos/normal/216/B.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define pll pair... | ALGO | 0.999948 | 3.96071 |
c7a9a10c-b550-4c14-8baf-96d2371d5a4b | joydip007x/CompetitiveCodeArchive | SPOJ/IOIPALIN/18173243_TLE_0ms_0kB.cpp | #include<bits/stdc++.h>
using namespace std;
#define loop(i,L,U) for(long long int i=(long long int)L;i<U;i++)
#define loopeq(i,L,U) for(long long int i=(long long int)L;i<=U;i++)
#define preflag long long flag=0,i=0,j=0,k=0,l=0
#define preflag2 long double flag=0,i=0,j=0,k=0,l=... | ALGO | 0.999979 | 3.506188 |
85c35e1c-79bc-47b1-aa61-840625eb1eb9 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7463_18.cpp | #include <bits/stdc++.h>
using namespace std;
int a[200001];
int b[600001];
int n, L;
bool chk(int d) {
if (d * 2 >= L) return true;
int l = 0, r = 3 * n - 1;
while (b[l] < a[0] - d) l++;
while (b[r] > a[0] + d) r--;
for (int i = 1; i < n; i++) {
l++;
r++;
if (b[l] < a[i] - d) l++;
if (b[r] > ... | ALGO | 0.999985 | 3.641484 |
9d49dc66-e6c7-4e31-94d5-6a33016920d4 | LIFECorp/external_2 | opencv/cv/src/cvcolor.cpp | /********************************* COPYRIGHT NOTICE *******************************\
Original code for Bayer->BGR/RGB conversion is provided by Dirk Schaefer
from MD-Mathematische Dienste GmbH. Below is the copyright notice:
IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
By downloading, ... | ALGO | 0.918474 | 6.214842 |
9188afa8-fe35-4e16-8248-2ea90f64ed0d | ChiyoYuki/xcpc | train/20250510/c.cpp | /**
* author: ChiyoYuki
**/
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define elif else if
using i1 = signed char;
using i2 = signed short int;
using i4 = signed int;
using i8 = signed long long int;
using u1 = uns... | ALGO | 0.99997 | 3.799104 |
94b07b33-8e61-4a86-89f4-40016fcdf1d7 | Prakashdeveloper03/GeeksforGeeks-Problem-Solutions | Easy/Reach a given score/reachScore.cpp | //{ Driver Code Starts
// Driver Code
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
class Solution {
public:
long long int count(long long int n) {
int ans = 0;
for (int i = 0; i <= n / 3; i++) {
int x = n - i * 3;
if (x % 5 == 0) ans += (1 + x / 10);
}
return ans... | ALGO | 0.99978 | 5.559208 |
b2a70413-ec8a-4f0d-a72e-831b2a84c7d3 | hjiang13/LLMs-in-IR | POJ-104/32/584.cpp | #include <iostream>
using namespace std;
int main()
{
char c[101],d[101],e[101],f[101];
int a,b,h,n,i,j,m,o;
int tmp;
cin >> "%d",&n);
for(i=1; i<=n; i++)
{
cin >> "%s\n%s",&c,&d);
a=strlen(d);
b=strlen(c);
for(o=0; o<a; o++) f[o]=d[a-o-1];
for(j=0; j<b; j++) e[j]=c[b-j-1];
for(m = 0; m < a; m++)
{
if(e[m]<f[m])
{
e[... | ALGO | 0.999979 | 3.256437 |
a5dbe277-085a-4b8b-b362-1640959b8b67 | bdqnghi/bi-tbcnn | code/mergesort/cpp/3221.cpp | #include<stdio.h>
#include<iostream>
using namespace std;
int arr[20];
int merge(int *arr,int l,int m,int h)
{
int arr1[10],arr2[10];
int n1,n2,i,j,k;
n1=m-l+1;
n2=h-m;
for(i=0; i<n1; i++)
arr1[i]=arr[l+i];
for(j=0; j<n2; j++)
arr2[j]=arr[m+j+1];
arr1[i]=9999;
arr2[j]=999... | ALGO | 0.999985 | 4.128974 |
3d2441aa-8138-4b82-ae6c-5fb4d9eebf44 | himanshudubey7/Programming | ques/Chocolate_Distribution.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
vector<int> ar(3,0);
int n;
cin>>n;
int i = 0;
ar[0] = 1;
ar[1] = 1;
ar[2] = n- 2;
for(int i = 0;i<3;i++){
cout<<ar[i]<<" ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.9996 | 3.370599 |
bb6dcb97-e60a-4a89-bd84-ffce42c135ca | AlecVitoCeppetelliSpano/OpenSees | SRC/analysis/algorithm/equiSolnAlgo/PeriodicNewton.cpp | // $Revision: 1.4 $
// $Date: 2007-04-02 23:41:13 $
// $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/equiSolnAlgo/PeriodicNewton.cpp,v $
// Written: MHS
// Created: Oct 2002
//
// Description: This file contains the class definition for
// PeriodicNewton. PeriodicNewton is a class which uses the
// Newton-R... | ALGO | 0.998423 | 5.114716 |
3aad94c4-3f0c-440c-80c0-20ba6d6a9270 | rajeev921/Algorithms | C++/Code/solutions/templateCRTPRelational.cpp | #include <iostream>
#include <string>
#include <utility>
template<class Derived>
class Relational{};
// Relational Operators
template <class Derived>
bool operator > (Relational<Derived> const& op1, Relational<Derived> const & op2){
Derived const& d1 = static_cast<Derived const&>(op1);
Derived const& d2... | TOOL | 0.941079 | 4.293817 |
e9f7d883-f3bb-4c51-b84f-68dd86e0b690 | akash-gupta0/DSA | Stacks & Queues/01Stacks/02_reversestring_throughstack.cpp | #include<iostream>
#include<stack>
using namespace std;
int main()
{
string str ="puspendra";
stack<char> s;
for(int i=0;i<str.size();i++)
{
char ch =str[i];
s.push(ch);
}
string ans ="";
while(!s.empty())
{
ans.push_back(s.top());
s.pop();
}
c... | ALGO | 0.999879 | 4.372652 |
0f7ec700-246e-48be-a4d4-d4cec04af967 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8672_4.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int n, m, c;
int xx[160000];
double p[160000], sum[160000], v[160000];
struct node2 {
double l, r, v;
} num[160000 * 4];
struct node {
int a, b;
} s[300005];
bool cmp(node p1, node p2) { return p1.b < p2.b; }
double max(double a, double b) { return... | ALGO | 0.999984 | 4.079355 |
e94bce7a-1553-4af3-8605-59f0653ebb3f | ChauhanPriyanka/leetCode | 505_MazeII.cpp | #include<string.h>
#include <set>
#include<vector>
#include<iostream>
#include<map>
#include<stack>
#include <unordered_set>
#include <algorithm> // std::min_element, std::max_element
using namespace std;
int count2 = 0;
int maxC = INT_MAX;
bool dfs(vector<vector<int>>& maze, int rStart, int cStart, int rEnd, int cE... | ALGO | 0.999661 | 5.341061 |
f129bd29-dce8-4148-943c-9d1b91d78bba | sumanmalakar/DSA_Material | STL/stl_iterator_sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int>v = {2,3,5,6,7};
for(int i=0; i<v.size(); i++){
cout<<v[i]<<" ";
}
cout<<endl;
for(auto it = v.begin(); it != v.end(); it++){
cout<<(*it)<<" ";
}
cout<<endl;
// pass by reference
for(int &value:v){
value++;
}
// for(int ... | TOOL | 0.875449 | 3.559597 |
4cb0f336-32ed-4401-87e4-3420d2a62d88 | macroCyborg/LeetCode-Solution | solution/435.无重叠区间.cpp | /*
* @lc app=leetcode.cn id=435 lang=cpp
*
* [435] 无重叠区间
*/
// @lc code=start
class Solution {
public:
int eraseOverlapIntervals(vector<vector<int>> &intervals) {
return interValSchedule(intervals);
}
int interValSchedule(vector<vector<int>> &intvs) {
int n = intvs.size();
if (intvs.empty()) re... | ALGO | 0.999863 | 6.221155 |
df14b440-3b64-4abd-9db8-f7a914c748c5 | br-labud/cpp | exercises/day_18/Exercise_1.cpp | // Shortest Word
#include <iostream>
#include <sstream>
using namespace std;
int find_short(string str)
{
stringstream ss(str);
string temp;
ss >> temp;
size_t len = temp.length();
while (ss >> temp)
if (temp.length() < len)
len = temp.length();
return len;
}
int main() {
string text =... | ALGO | 0.998069 | 4.688869 |
0d38b937-f7d7-489f-a9ac-47a9841b61f1 | durgeshshukla18/Competitive-Programming-Prcatice | CodeChef/Motivation.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
//space=x, no.mov.=n, s=spacereq, r=rating.
int t;
cin>>t;
for(int i=0;i<t;i++){
int x,n;
cin>>n>>x;
int max=0;
for(int j=0;j<n;j++){
int s,r;
cin>>s>>r;
// int max=0;
if(x>=s && ... | ALGO | 0.999845 | 3.825245 |
9d7b6d2e-1e69-4a38-bd58-477fc3b44dcd | premkhandelwal/DSA | Problems/(IMP) 0-1Knapsack.cpp | ------------------------------------------------------------------------Memoization using dp array---------------------------------------------------------------------
//{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return max val... | ALGO | 0.999968 | 6.071214 |
8142ac79-3f53-4c71-a694-130e41e8e586 | ishandutta2007/codeforces | andrew/normal/630/J.cpp | #include <bits/stdc++.h>
#define p_b push_back
#define endl "\n"
#define m_p make_pair
#define fi first
#define se second
#define pll pair <ll,ll>
using namespace std;
typedef long long ll;
template <typename T>
T sqr(T x)
{
return x*x;
}
template <typename T>
void vout(T s)
{
cout << s << endl;
exit(0);
}
... | ALGO | 0.999852 | 3.06632 |
6aca2acb-98c8-4750-a035-17db6cc4207e | AyaseCore/Noggit3 | Noggit3libs/Boost/libs/spirit/example/qi/compiler_tutorial/mini_c/vm.cpp | #include "vm.hpp"
#if defined(_MSC_VER)
# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
// (performance warning)
#endif
namespace client
{
int vmachine::execute(
std::vector<int> const& code
, std::vector<int>::const_iterator pc
, std:... | TOOL | 0.935694 | 5.702116 |
a09384f4-cf7c-4cce-9189-dbfc5787dbad | Ausp3x/competitive-programming | [2] Personal Training/Codeforces Rounds/[23] Edu. 169 (Div. 2)/D. Colored Portals.cpp | // 人外有人,天外有天
// author: Ausp3x
#pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define pb push_back
// #define DEBUG
typedef long long lng;
template<class T>... | ALGO | 0.999896 | 4.655154 |
b5579320-d7f4-4fce-93d1-03b54c69d696 | voidAnik/C-CPP-Projects | Visual Studio 2013/Projects/Data structure mid/Data structure mid/Bubble sort.cpp | //#include<stdio.h>
//void bubbleSort(int array[], int size);
//void main()
//{
// int array[100];
// int size;
// printf("How many numbers: ");
// scanf_s("%d", &size);
// puts("Input unsorted array:");
// for (int i = 0; i < size; i++)
// {
// scanf_s("%d", &array[i]);
// }
// bubbleSort(array, size);
// for (int i ... | ALGO | 0.999577 | 3.620554 |
8278bc9c-764b-452a-b45e-7716c3a8e7c4 | ecell3-models/CardiacMyocytes-Nygren_1998 | old/Nygren_1998tau_d_LAssignmentProcess.cpp |
#include "libecs.hpp"
#include "Process.hpp"
USE_LIBECS;
LIBECS_DM_CLASS( Nygren_1998tau_d_LAssignmentProcess, Process )
{
public:
LIBECS_DM_OBJECT( Nygren_1998tau_d_LAssignmentProcess, Process )
{
INHERIT_PROPERTIES( Process );
}
Nygren_1998tau_d_LAssignmentProcess()
{
// do nothing
}
vi... | ALGO | 0.93574 | 7.109445 |
631c4c24-b6fa-4a76-970b-287104c7c27e | ishandutta2007/codeforces | golovanov399/normal/1146/E.cpp | #include <bits/stdc++.h>
#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()
using namespace std;
inline int nxt() {
int x;
cin >> x;
return x;
}
struct ... | ALGO | 0.999974 | 4.017482 |
907518ef-b9f8-4b9e-a8f8-96cd5cf08374 | sumoprojects/sumokoin | src/utilities/debug_utilities/dns_checks.cpp | #include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/program_options.hpp>
#include "misc_log_ex.h"
#include "common/util.h"
#include "common/command_line.h"
#include "common/dns_utils.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "debu... | TOOL | 0.971567 | 5.508373 |
8e6c222d-9f49-4b4a-bc19-1fbda881ae68 | m3hr-cryptic/cpp-basic-arithmetic | prime.cpp | #include <bits/stdc++.h>
using namespace std;
//Goldbach's conjecture.
//Calculate an even number as sum of two prime numbers
bool prime(int x)
{
bool primme=true;
for (int i=2;i<=x/2;i++)
{
if (x%i==0)
{
primme=false;
break;
}
}
return primme;
}
void goldbach(int n)
{
for (int i=2;i... | ALGO | 0.999378 | 4.853126 |
53baa2d2-d933-4947-b392-81bd30d8d19f | SOFTK2765/PS | BOJ/9494.cpp | #include <bits/stdc++.h>
using namespace std;
char a[101];
int main()
{
while(1)
{
int n;
scanf("%d ", &n);
if(n==0) break;
int nh = 0;
memset(a, 0, sizeof(a));
gets(a);
int l = strlen(a);
for(int i=0;i<l;i++)
{
if(a[i]==' ')... | ALGO | 0.998447 | 3.046653 |
83fc9b56-c677-42e5-a2e1-3ef172056f1f | externalxdpro/LeetcodeSolutions | CPP/FindPolygonWithTheLargestPerimeter_2971.cpp | // Difficulty: Medium
// You are given an array of positive integers nums of length n.
// A polygon is a closed plane figure that has at least 3 sides. The longest
// side of a polygon is smaller than the sum of its other sides.
// Conversely, if you have k (k >= 3) positive real numbers a1, a2, a3, ..., ak
// where a1... | ALGO | 0.999167 | 6.402773 |
bf991991-30de-4080-9ca0-7a809d7500e9 | Mahmoud-s-Khedr/neetCode150 | twoSumII.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target)
{
int s=0,e=numbers.size()-1;
while(s<e)
{
int sum=numbers[s]+numbers[e];
if(sum==target)
{
return {s+1,e+1};
}
else if(sum>target)
... | ALGO | 0.999838 | 6.384676 |
4d54dbe4-a48d-4dee-9ef3-e294e5135cdd | cihanyyt/elements-of-programming-interviews | 2-exists.cpp | #include <cassert>
#include <deque>
#include <iostream>
#include <random>
#include <vector>
using std::boolalpha;
using std::cout;
using std::default_random_engine;
using std::deque;
using std::endl;
using std::random_device;
using std::uniform_int_distribution;
using std::vector;
struct GraphVertex;
bool DFS(GraphVe... | ALGO | 0.996855 | 5.712219 |
a8fb2c3a-b643-4190-b616-fafd6a397170 | Not-Mostafa/CP | A_And_Then_There_Were_K.cpp | #include <bits/stdc++.h>
using namespace std;
#define FIO ios ::sync_with_stdio(false), cin.tie(nullptr), cout.tie(NULL)
#define ll long long
#define ld long double
#define all(container) (container).begin(), (container).end()
#define cl(x,y) (x + y - 1) / y
#define lp(size) for (int i = 0; i < size; i++)
#define rlp(... | ALGO | 0.999976 | 4.941362 |
3584be5a-cfa9-47af-81ad-61fe17f2e5d4 | viiku/competitive-programming-problems | hackerearth/MaximumSubarraySum.cpp | // C++ program to print largest contiguous array sum
#include<iostream>
#include<climits>
using namespace std;
using ll=long long int;
ll maxSubArraySum(ll a[], ll size)
{
ll max_so_far = INT_MIN, max_ending_here = 0;
for (int i = 0; i < size; i++)
{
max_ending_here = max_ending_here + a[i];
if (max_s... | ALGO | 0.999924 | 5.485803 |
06ff7ada-717b-4f96-a6de-690c5eedb120 | Tastypotato245/boj | 1/12865/main.cpp | // https://www.acmicpc.net/problem/12865
// github/Tastypotato245
#include <iostream>
#include <algorithm>
using namespace std;
int N, K;
int dp[101][100001];
int W[101];
int V[101];
void Solve()
{
cin >> N >> K;
for (int i = 1 ; i <= N ; ++i)
cin >> W[i] >> V[i];
for (int i = 1 ; i <= N ; ++i)
{
for (int j... | ALGO | 0.999983 | 4.537241 |
ba3f3dfb-e9a9-4826-a0c3-3f1877c07103 | luqmanarifin/cp | 0-unclassified/anagrammm.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char s[N], t[N];
int cnt[26];
int must[26];
int main() {
scanf("%s %s", s, t);
int len = strlen(s);
int tlen = strlen(t);
for(int i = 0; i < tlen; i++) {
must[t[i] - 'a']++;
if(s[i] != '?' && i < len) cnt[s[i] - 'a']++;
}
int a... | ALGO | 0.999968 | 3.921351 |
ee1a2945-6602-4229-99c0-91877db6f7ff | yujiaoki/competitive-programming | Atcoder/abc213/c.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i <= end; i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())... | ALGO | 0.999989 | 3.971567 |
4f3378c5-101d-4653-99ad-1ed5fddc3da9 | hyeonseong0917/BOJ | gold/15661.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
using namespace std;
int N;
const int MAX=20+1;
int S[MAX][MAX];
void Input(){
cin>>N;
for(int i=0;i<N;++i){
for(int j=0;j<N;++j){
cin>>S[i][j];
}
}
}
vector<int> cur_picked;
vector<int> next_picked;
b... | ALGO | 0.999961 | 3.784467 |
0e251e1e-4b99-408b-a7d9-6c88ddcf498a | mugifusen/atcoder | ABC352/c.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, max=0, max_idx;
cin >> n;
vector<int> a(n),b(n);
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
if (max < b[i]-a[i]) {
max = b[i]-a[i];
max_idx = i;
}
}
long long sum=0;
... | ALGO | 0.999882 | 3.486972 |
56f68067-c355-49a9-919a-3af3f5a20b53 | retro-games-ltd/redquark-amiberry-rb | src/archivers/lzx/unlzx.cpp | /* $VER: unlzx.c 1.0 (22.2.98) */
/* Created: 11.2.98 */
/* Added Pipe support to read from stdin (03.4.01, Erik Meusel) */
/* LZX Extract in (supposedly) portable C. */
/* ********************* WINDOWS PORTING NOTES STARTS *********************/
/* Ported to Windows Platform... | ALGO | 0.986785 | 5.100767 |
f7c499cc-7a27-4024-b367-ed5127332b2c | hoanxuanbach/Competitive-Programming | ICPC/Regional + Team Contest/COMPFEST 15/I.cpp | // Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_sup... | ALGO | 0.999956 | 5.289912 |
18664cc1-64d0-4630-8e0b-f5425ba47511 | cruro/cruro | src/coins.cpp | #include <coins.h>
#include <consensus/consensus.h>
#include <random.h>
#include <version.h>
bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; }
uint256 CCoinsView::GetBestBlock() const { return uint256(); }
std::vector<uint256> CCoinsView::GetHeadBlocks() const { return std::vecto... | TOOL | 0.854473 | 7.647466 |
e8e68702-0cfa-4972-8a64-f412d93988d6 | sundarlsr/sundarlsr.github.io | CommonAlgorithms/CommonAlgorithms/FibonacciSeries.cpp | #include<iostream>
using namespace std;
/*int fibonacci(int i)
{
if (i == 0)
return i;
else if (i == 1)
return i;
else
return fibonacci(i - 1) + fibonacci(i - 2);
}
int main()
{
int n = 5, i = 0;
printf("Fibonacci Series \n");
for(int c = 1; c <= n; c++, i++)
{
printf("%d \n", fibonacci(i));
}
r... | ALGO | 0.999951 | 3.852304 |
e4043aea-b87e-4b2b-8a2d-c18a3d2f9649 | buraksaribas/c-plus-plus_primer | ch09/e9-34.cpp | #include <vector>
#include <iterator>
using std::vector;
int main() {
vector<int> v{1, 2, 3, 4, 5};
auto iter = v.begin();
while (iter != v.end()) {
if(*iter % 2)
iter = v.insert(iter, *iter);
++iter;
}
// If the container contains any odd values, the loop will continu... | ALGO | 0.998594 | 4.369962 |
8ae78a87-ace1-490b-adcc-c1811c02159b | arshbhatia8/Leetcode-Problems | 1232-check-if-it-is-a-straight-line/1232-check-if-it-is-a-straight-line.cpp | class Solution {
public:
bool checkStraightLine(vector<vector<int>>& coordinates) {
int x1 = coordinates[0][0], y1 = coordinates[0][1];
int x2 = coordinates[1][0], y2 = coordinates[1][1];
for (int i = 2; i < coordinates.size(); ++i) {
int x = coordinates[i][0], y = coordinates[i]... | ALGO | 0.999919 | 5.68738 |
a1e492a6-4d43-4c76-a3a5-554ddb80d53c | ishandutta2007/codeforces | zhangzy/normal/535/A.cpp | %:pragma GCC optimize(3)
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int n;
string s1[10],s2[10];
int main()
{
scanf("%d",&n);
if (n<20)
{
if (n==0) printf("zero");
if (n==1) printf("one");
if (n==2) printf("two");
if (n==3) printf("three");
... | ALGO | 0.998513 | 3.873262 |
196969d4-8823-4b4f-baf6-8df29688744a | AliAshkaniNia/AST-Playground | cmake/thirdparty/benchmark/cmake/std_regex.cpp | #include <regex>
#include <string>
int main() {
const std::string str = "test0159";
std::regex re;
re = std::regex("^[a-z]+[0-9]+$",
std::regex_constants::extended | std::regex_constants::nosubs);
return std::regex_search(str, re) ? 0 : -1;
}
| ALGO | 0.860451 | 5.855292 |
49f1c863-d7e9-4110-b3c3-3013d58f392b | yuichiro-kurose/kyopro | atcoder/abc412/c/main.cpp | // author: Yuichiro Kurose
#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX / 2;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> s(n);
set<int> st;
map<int, int> cnt;
for (int i = 0; i < n; ... | ALGO | 0.998995 | 4.436267 |
2a92f45f-b798-4fca-a824-796c4373fcb1 | raincross7/code-similarity | codes/train_code/problem210/problem210_95.cpp | #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iom... | ALGO | 0.999627 | 3.807067 |
58990e5f-2c1f-41c8-ac97-dbe113ca86c5 | Jinsong-UCL/MSc_ComputationalFinance_thesis | marketDataCalibration/VIXOption.cpp | //
// Created by Marco Paggiaro on 19/01/2021.
//
#include "VIXOption.h"
#include "Faddeeva.hh"
#include <boost/math/quadrature/gauss.hpp>
#define xGauss boost::math::quadrature::gauss<double,64>::abscissa()
#define wGauss boost::math::quadrature::gauss<double,64>::weights()
#define I std::complex<double>(0.0,1.0)
VI... | ALGO | 0.99975 | 6.660903 |
8065d795-711a-4c4e-b1c9-fcf7e4832bd9 | L-U-P-I-N/viola_v4 | 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 |
187da387-40cb-4129-a980-bb7c68c82a01 | andresWeitzel/Ejercicios_Resueltos_Cpp | Bloque 2 - Expresiones y Operadores/Ejercicio 7 - porcentajes de notas.cpp | /*7.La calificacin final de un estudiante es el promedio de tres notas:
la nota de prcticas que cuenta un 30% del total, la nota terica que cuenta un
60% y la nota de participacin que cuenta el 10% restante. Escriba un programa
que lea las tres notas del alumno y escriba su nota final.*/
#include<iostream>
using name... | ALGO | 0.981599 | 3.470857 |
51d62403-d4d6-40c1-8d90-6d2ea3b2ac4e | Ishan-77/DSA | 0169-majority-element/0169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int candidate = nums[0];
int life =1;
for(int i=1;i<nums.size();i++) {
if(nums[i]==candidate) life++;
else if(life==0) {
candidate = nums[i];
... | ALGO | 0.999892 | 5.606724 |
8c43a91a-b3e5-40f9-9882-ec09da4fc6c3 | surjendu104/Leetcode-Solutions | 2233-maximum-product-after-k-increments/2233-maximum-product-after-k-increments.cpp | class Solution {
public:
int mod = 1000000007;
int maximumProduct(vector<int>& nums, int k) {
int n = nums.size();
priority_queue<int, vector<int>, greater<int>> pq;
for(int i : nums) pq.push(i);
while(k--) {
int x = pq.top()+1;
// cout<<"dbg : "<... | ALGO | 0.999987 | 5.547739 |
7e310584-7500-43aa-9ee9-33e0994411a5 | wol101/GaitSym5 | threepp/src/threepp/extras/curves/CatmullRomCurve3.cpp |
#include "threepp/extras/curves/CatmullRomCurve3.hpp"
#include <cmath>
#include <utility>
using namespace threepp;
struct CatmullRomCurve3::Impl {
struct CubicPoly {
float c0{}, c1{}, c2{}, c3{};
void init(float x0, float x1, float t0, float t1) {
c0 = x0;
c1 = t0;
... | ALGO | 0.991064 | 7.124332 |
33dd6201-4629-4fef-b559-23376c791c6f | vucongtuanduong/cpp-codeptit | advanced/cpp0727/cpp0727.cpp | #include <iostream>
using namespace std;
void testCase();
int main () {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--) {
testCase();
cout << endl;
}
}
void testCase (){
int n;
cin >> n... | ALGO | 0.999951 | 4.407901 |
c5e96c03-252d-411f-bca1-a61824c49a17 | sagnikman/LeetCode-Solutions | Longest Palindromic Substring.cpp | //Problem Link: https://leetcode.com/problems/longest-palindromic-substring/
class Solution {
public:
string longestPalindrome(string s) {
vector<vector<bool>> dp(s.size(),vector<bool>(s.size()));
int len=-1;
pair<int,int> ans;
for(int g=0;g<s.size();g++) {
for(int i=0,j... | ALGO | 0.999995 | 6.236514 |
db4631c0-ed0f-4d9d-b9cd-e38faebb5871 | sarvex/leetcode-cpp | solution/1400-1499/1433.Check If a String Can Break Another String/Solution.cpp | class Solution {
public:
bool checkIfCanBreak(string s1, string s2) {
sort(s1.begin(), s1.end());
sort(s2.begin(), s2.end());
return check(s1, s2) || check(s2, s1);
}
bool check(string& s1, string& s2) {
for (int i = 0; i < s1.size(); ++i) {
if (s1[i] < s2[i]) {
... | ALGO | 0.999976 | 5.645968 |
8bc18cd8-b2c7-4914-8118-5d9e4d1decdb | AdityaShekharTiwary/geeks_for_geeks | gfg_reverse_linked_list_in_group_of_given_size.cpp | class Solution
{
public:
struct node *reverse (struct node *head, int k)
{
node* curr = head;
node* prev = NULL;
node* next = NULL;
int cnt = 0;
while (curr && cnt < k) {
next = curr->next;
curr->next = prev;
prev = curr;
... | ALGO | 0.999982 | 4.941571 |
f337d599-70c4-4e6a-aefa-f8b01362da46 | Hiyabye/Baekjoon | 02xxx/02290.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<vector<char>> v;
inline void a(int s, int x) {
for (int i=0; i<s; i++) v[0][x+i+1] = '-';
}
inline void b(int s, int x) {
for (int i=0; i<s; i++) v[i+1][x] = '|';
}
inline void c(int s, int x) {
for (int i=0; i<s; i++) v[i+1][... | ALGO | 0.999541 | 3.628717 |
3149771f-e311-4b58-a0e0-739de50e8914 | Harsh23Kashyap/LeetCode | 135-candy/candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
int n=ratings.size();
vector<int> left(n,1);
vector<int> right(n,1);
for(int i=1;i<n;i++){
if(ratings[i]>ratings[i-1]){
left[i]=left[i-1]+1;
}
}
for(int i=n-2;i>=0;i-... | ALGO | 0.999994 | 6.301312 |
d039f3dd-13f1-4460-a7c0-c2721027359e | sayandip18/CP | GFG-LC/Cycle-detection-undirected.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to detect cycle in an undirected graph.
bool solve(int i, int par, vector<int> &vis, vector<int> adj[]){
vis[i] = 1;
for(auto x: adj[i]){
if(!vis[x])... | ALGO | 0.999968 | 5.926121 |
fa3d61b0-99a6-486c-bdd6-9e96b57be7a5 | alaminmiah4274/Data_Structure | assignment_2/Queries.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int value;
Node *next;
Node(int value)
{
this->value = value;
this->next = NULL;
}
};
void insert_at_tail(Node *&head, int val)
{
Node *newNode = new Node(val);
if (head == NULL)
{
head = newNo... | ALGO | 0.999878 | 5.019916 |
61a310bf-f0c8-4b1e-9b07-7dadac8d1afa | akazad13/competitive-programming | Online Judges/Toph/Arya and OR.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,p,n) for( i = p; i<n;i++)
#define ll long long int
#define pb push_back
#define VI vector<int>
#define VL vector<long long int>
#define VD vector<double>
#define pi pair<int,int>
#define mp(a,b) make_pair(a,b)
#define eps 1e-9
#define PI ... | ALGO | 0.999562 | 4.195677 |
94426ac9-e823-4ba5-bb0b-ee0adc64c655 | sarvex/leetcode-nim | solution/1400-1499/1430.Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/Solution.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.999992 | 6.573897 |
0e971462-04bf-4da5-8555-5f6c86c1caec | Musinghead/olat-gs | SIBR_viewers/src/core/raycaster/Intersector2D.cpp | #include "Intersector2D.h"
#include <core/graphics/Shader.hpp>
#include <core/graphics/RenderTarget.hpp>
#include <core/graphics/Mesh.hpp>
namespace sibr {
float Intersector2D::sign(sibr::Vector2f p1, sibr::Vector2f p2, sibr::Vector2f p3)
{
return (p1.x() - p3.x()) * (p2.y() - p3.y()) - (p2.x() - p3.x()) * (p1.y(... | ALGO | 0.998324 | 6.560498 |
72a31536-8d1e-4e97-b177-2917799f1be7 | sinian666/codes_102_2 | cpp_副本59/chapter_searching/hashing_search.cpp | /**
* File: hashing_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 哈希查找(数组) */
int hashingSearchArray(unordered_map<int, int> map, int target) {
// 哈希表的 key: 目标元素,value: 索引
// 若哈希表中无此 key ,返回 -1
if (map.find(target) == map.end())
return -... | ALGO | 0.999747 | 5.437144 |
a4a62b44-80e1-40c0-a3c4-633b93aa5ab2 | Amit89480/Binary-Tree-FAANG | FAANGQS/NormaltoBalanceBST.cpp | /*************************************************************
Following is the Binary Serach Tree node structure
template <typename T>
class TreeNode
{
public :
T data;
TreeNode<T> *left;
TreeNode<T> *right;
TreeNode(T data) {
this -> data = data;
... | ALGO | 0.999983 | 5.755899 |
6e32be1f-d4bf-4a0f-b19d-eabb1f0c625c | 108k-rahul/Cpp-Apna_College- | 30_LinkedList/STL.cpp | #include<bits/stdc++.h>
using namespace std;
void printlist(list<int> ll){
list<int>::iterator itr;
for(itr=ll.begin(); itr!=ll.end(); itr++){
cout<< *(itr)<<" -> ";
}
cout<<"NULL"<<endl;
}
int main(){
list<int> ll;
ll.push_front(2);
ll.push_front(1);
ll.push_back(3);
ll.... | ALGO | 0.909208 | 3.979292 |
937da1ea-6f9a-4216-87a7-aaf468bf9358 | jtcriswell/PrivAnalysis | lib/CodeGen/AggressiveAntiDepBreaker.cpp | #include "AggressiveAntiDepBreaker.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#i... | ALGO | 0.97614 | 5.225954 |
7e56a51c-0144-48a0-932a-4c8546aff4a3 | QianQNanami/JSOI-WC25 | PJ/judger/source/WC25-300/ccski.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int height,d=INT_MAX;
bool flag;
};
int n,m,xa,ya,k,ans=INT_MAX;
node ma[501][501];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
void dfs(int x,int y,int spot){
if(spot==n){
ans=min(ans,spot);
return;
}
for(int i=1;i<4;i++){
int nx=x+dx[i],ny=y+dy[i... | ALGO | 0.999915 | 3.138831 |
7f057e95-62f9-4659-a76a-83c4cebc5129 | Michaelmilk/leetcode | lt/Combination Sum.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> num;
vector<vector<int> > ret;
void solve(int dep, int maxDep, int target, vector<int> &can)
{
if (target < 0)
{
return;
}
if (dep == maxDep)
{
if (target == 0)
{
vector<int> res;
for (int i = 0; i < maxDep;... | ALGO | 0.999978 | 4.32247 |
5ff7c8c1-21ac-4027-a3f3-5cc068e814a0 | sleevs/jsn-dsa | DSA/CPP/max_flow.cpp |
#include <iostream>
#include <vector>
#include <queue>
#include <limits>
constexpr int INF = std::numeric_limits<int>::max();
class Graph{
private:
int numVertices ;
std::vector<std::vector<int>> adjMatrix ;
public:
Graph (int numVertices ) : numVertices(numVertices)
,... | ALGO | 0.999762 | 6.21271 |
1238fc8b-f2b3-4667-8e90-68efb7f3a136 | Shourya742/CP | Standard template Library/Tell_the_Psoition.cpp | /*In a class there are n number of students. They have three different subjects: Data Structures, Algorithm Design & Analysis and Operating Systems. Marks for each subject of all the students are provided to you. You have to tell the position of each student in the class. Print the names of each student according to th... | ALGO | 0.999777 | 4.368498 |
1bc7255f-639e-4f33-9125-d988b5efca5d | raihansikdar/Competitive_Programming | CodeForces/Contests Code/Educational Codeforces Round 143 (Rated for Div. 2)/B. Ideal Point.cpp | #include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<map>
#include<iterator>
#include<cmath>
#include<cstring>
#include<limits>
using namespace std;
typedef long long ll;
#define S(a) scanf("%lld",&a);
#define SS(a,b) scanf("%lld %... | ALGO | 0.999867 | 3.547966 |
12f5d05d-8971-4ded-88c1-2902f8c55fb8 | Zhenghao-Liu/LeetCode_problem-and-solution | 1799.N次操作后的最大分数和/solution_bitmask_dp.cpp | // __builtin_popcount
const int INF=0xc0c0c0c0;
const int MAXN=1<<(7*2);
int dp[MAXN];
const int MAXI=14;
int g[MAXI][MAXI];
class Solution {
public:
int maxScore(vector<int>& nums) {
int sz=nums.size();
for (int i=0;i<sz;i++) {
for (int j=i+1;j<sz;j++) {
int t=__gcd(nums... | ALGO | 0.999984 | 4.596043 |
23ec9327-e754-42fd-8a9e-ed6579fbbe90 | DanielATV/EVOCA-NBC | Memoria/NBC/src/TuningVersionOL-AK/Ant.cpp | /*
* Ant.cpp
*
* Created on: 22-12-2014
* Author: nicolas
*/
#include "Ant.h"
#include "Initialize.h"
using namespace std;
Ant::Ant():id(0){}
Ant::~Ant(){}
int Ant::getId(){
return id;
}
void Ant::setId(int id_ext){
id = id_ext;
}
void Ant::insertInMem(int object){
Memoria.push_back(object);
evalua... | ALGO | 0.975247 | 3.567992 |
1b722108-8678-48e9-ad57-c186b8bd0f17 | PhQuangMinh/PTIT | Kì 4/TRR 2/Chương 5/floyd.cpp | #include<iostream>
#include <vector>
#include <queue>
#include<algorithm>
using namespace std;
const int mod = 1e9+7;
int a[30][30];
int n;
int d[30][30];
int t[30][30];
void duyet(int u, int v){
vector<int> ans;
ans.push_back(u);
while (u!=v)
{
u = t[u][v];
ans.push_back(u);
}
f... | ALGO | 0.999938 | 3.583221 |
cc3332ac-e38f-41c4-b7d3-4f7b1a407e8a | BK1031/cs190a | hw3/naturereserve.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
struct Edge {
ll weight, destination;
Edge(ll w, ll d) : weight(w), destination(d) {}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll test_cases;
cin >> test_cases;
while (t... | ALGO | 0.999742 | 4.089599 |
866a7224-9214-4652-ab77-80b4187b8bb4 | kartikeypathak/quiz-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.998859 | 6.785645 |
a11f221b-5425-414e-bdd5-4e1c4b16fe67 | ishandutta2007/codeforces | jjleo/normal/1704/D.cpp | #include <bits/stdc++.h>
#define maxn 100086
using namespace std;
typedef long long ll;
int t, n, m;
int main(){
scanf("%d", &t);
while(t--){
scanf("%d%d", &n, &m);
__int128 mx = -1e30, mn = 1e30;
int id;
for(int i = 1;i <= n;i++){
ll sum = 0;
__int128 val = 0;
for(int j = 1;j <= m;j++){
ll x... | ALGO | 0.999705 | 3.468918 |
e84a3646-6277-42c9-8af4-1f6d1b51d524 | miracle-wm-org/miracle-wm | src/tilling_algorithms.cpp | #include "tiling_algorithms.h"
#include <cmath>
miracle::TileInsert miracle::insert_node(
std::vector<TilePosition> const& existing_positions,
double const total_container_size,
double const container_start,
size_t const insertion_index)
{
std::vector<TilePosition> new_positions;
if (existing_p... | ALGO | 0.997295 | 4.851118 |
46a9c954-265c-4391-b3a3-b935ad041574 | alexandraback/datacollection | solutions_5669245564223488_1/C++/justever86/main.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <cst... | ALGO | 0.999921 | 4.05412 |
50cff100-0edf-43f4-83f0-3d4fc80bba27 | izuxhd/DSA-Notes | LeetCode/0015-3sum/0015-3sum.cpp |
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
int n=nums.size();
vector<vector<int>> result;
sort(nums.begin(),nums.end());
int left , right;
for(int i=0;i<n-2;i++){
if ( i > 0 and nums[i]==nums[i-1]){
co... | ALGO | 0.99993 | 5.771959 |
6ce18cb7-21ba-4409-8091-0c485ce16625 | chekhairul/WEEK-10---CODING | function_module.1/exercise_2.cpp | #include <iostream>
#include <math.h>
using namespace std;
#define PI 3.142
float sphere_vol(float radius)
{
float v = 4 / 3 * PI * pow(radius, 3);
return v;
}
int main()
{
float r;
cout << "Enter the radius of the sphere: ";
cin >> r;
cout << "Volume = " << sphere_vol(r) << endl;
retu... | ALGO | 0.97627 | 4.748726 |
a750be43-c04e-4da2-8a3c-d6485731b975 | PedroDariva36/Desktop | Contests/921-Div2/a/a.cpp | #include <bits/stdc++.h>
#include <ios>
#define ll long long
#define pii pair<int, int>
using namespace std;
int t;
int main (int argc, char *argv[]){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> t;
while (t--) {
char aux;
int k,n;
cin >> n >> k;
... | ALGO | 0.999632 | 3.295428 |
ab31876e-c5af-4e17-b253-b7477f22f0be | RepusNamuh/Competitive-Programming | CodeForce/Practice/1076A_minstring.cpp | #include <stdio.h>
#include <iostream>
#include <bits/stdc++.h>
int main() {
int N;
std::string original, firstPart, secondPart, smallestString;;
std::cin >> N;
std::cin >> original;
for (int i = 0; i < N; i++) {
if (original[i] > original[i + 1]) {
firstPart = original.substr(... | ALGO | 0.999948 | 4.322621 |
1777f968-b68c-46da-8bc8-9c999e8f9357 | Ashutosh-777/DSA | Graph/Untitled-1.cpp | #include<bits/stdc++.h>
using namespace std;
bool isSubsetSum(vector<int>arr, int sum){
int n = arr.size();
bool ans[n+1][sum+1];
for(int i=0;i<n;i++){
for(int j=0;j<=sum;j++){
if(i==0){
ans[i][j]=false;
}
if(j... | ALGO | 0.999774 | 4.785684 |
026c1317-d224-4568-80cc-aa458a9519a5 | Bavish7/DSA | Bit Manipulation/bitwise_and_of_numbers_range.cpp | #include<iostream>
using namespace std;
// BITWISE AND OF NUMBERS RANGE (LEETCODE 201)
// USING BIT MANIPULATION - TC=O(LOG(RIGHT)), SC=O(1)
// Steps:
// 1. While `right > left`:
// - Remove the lowest set bit from `right` using `right & (right - 1)`.
// - This ensures we keep only the common prefix bits that m... | ALGO | 0.999818 | 6.434278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.