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 |
|---|---|---|---|---|---|---|
d8a29d8a-51f0-408b-aa1e-4f14085c89bc | luischurata20/operadores. | joseluis.cpp/3.1.cpp | #include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
float a, b, h;
cout << "Introduce los lados ";
cin >> a >> b;
h = sqrt( a * a + b * b);
cout << " lado 1 = " << a << endl;
cout << " lado 2 = " << b << endl;
cout << " hipotenusa = " << h << endl;
system("PA... | ALGO | 0.977468 | 3.108196 |
cae7986b-0da1-4d4b-80ad-368ec93ad4f0 | manikanta2901/ubuntu | .history/practice/cpp/Leetcode/Cpp/MedianOfTwoSortedArrays_20210322201651.cpp | #include<bits/stdc++.h>
using namespace std;
void swap(int *a,int *b){
int temp = *b;
*b = *a;
*a = *b;
}
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
double answer;
int gap = ceil((nums1.size() + nums2.size()) / 2),start,end;
while(gap > 0){
start = 0;
... | ALGO | 0.999995 | 4.784516 |
82c06ef4-cbf3-4bf5-a9c9-ffb99c06a622 | HirdyanshuSinghChanaria/DSA | 219-contains-duplicate-ii/contains-duplicate-ii.cpp | class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
int n=nums.size();
unordered_set<int>a;
for(int i=0;i<n;i++){
if(a.count(nums[i])) return true;
else a.insert(nums[i]);
if(a.size()>k){
a.erase(nums[i-k]);
... | ALGO | 0.999917 | 5.946477 |
37baccc8-e048-469e-8a73-bcf4b0b30358 | christofferholmstedt/inkscape | src/2geom/piecewise.cpp | #include <2geom/piecewise.h>
#include <iterator>
#include <map>
namespace Geom {
Piecewise<SBasis> divide(Piecewise<SBasis> const &a, Piecewise<SBasis> const &b, unsigned k) {
Piecewise<SBasis> pa = partition(a, b.cuts), pb = partition(b, a.cuts);
Piecewise<SBasis> ret = Piecewise<SBasis>();
assert(pa.siz... | ALGO | 0.998814 | 4.32251 |
d4d2d672-bfa9-4f3c-8392-9eb68db1bbdd | tonowak/acmlib | code/flow/mcmf-dijkstra/test.cpp | #include "../../utils/testing/test-wrapper.cpp"
#define MCMF MCMF_spfa
#include "../mcmf-spfa/main.cpp"
#undef MCMF
#include "main.cpp"
void test() {
const int max_n = 10;
const int max_m = 20;
const int max_cap = 20;
const int max_cost = 100;
const int n = rd(2, max_n);
const int m = rd(0, max_m);
vector<tuple... | ALGO | 0.994899 | 5.25052 |
fe30311e-220f-40ba-a5ea-d6d6be8275eb | wjyaxxx/Algorithm-exercise-code | acwing/algorithm basic lesson/3 lesson-search and graph theory/traversal and store of graph and tree .cpp | #include <bits/stdc++.h>
using namespace std;
const int N=100010;
//store of graph:
//adjacency list
int h[N],e[N],ne[N],idx;
// initialize(初始化)
idx=0;
memset(h,-1,sizeof h);
void add(int a,int b)
{
e[idx]=b;
ne[idx]=h[a];
h[a]=idx++;
}
//use dfs to traversal of tree or graph
bool st[N];//记录每个点是否被搜索过
//... | ALGO | 0.999841 | 3.738003 |
dd4cfc85-72e2-40d0-a79f-b6c2b33febac | loal123/CP | codeforces/Codeforces_Codeforces_Round_872_Div_2/A_LuoTianyi_and_the_Palindrome_String.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define SZ(x) ((int)... | ALGO | 0.998773 | 4.767031 |
0fe415db-8708-4367-81ea-fec0a114e777 | ishandutta2007/codeforces | wlzhouzhuan/normal/1472/F.cpp | // Author: wlzhouzhuan
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fir first
#define sec second
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s... | ALGO | 0.999942 | 4.313971 |
73b33402-626f-49d6-808c-a863d0eccf9a | hjiang13/LLMs-in-IR | processed_data/Decompiled_Humaneval_x_cpp_164_Result_O3/Codellama31_Decompiled_O3_SEP7/test/CPP_7.cpp |
#undef NDEBUG
#include<assert.h>
bool issame(vector<string> a,vector<string>b){
if (a.size()!=b.size()) return false;
for (int i=0;i<a.size();i++)
{
if (a[i]!=b[i]) return false;
}
return true;
}
int main(){
assert (issame(filter_by_substring({}, "john"),{}));
assert (issame(filter_by_... | TEST | 0.931945 | 5.018115 |
3f38ec36-afc9-4e1d-af4e-b4efd720360b | aokiLourenco/IC | Projeto_2/Part_III/audio.cpp | #include <string>
#include <iostream>
#include <SFML/Audio.hpp>
#include <memory>
#include <chrono>
// Include snd
#include <sndfile.hh>
#include "./Headers/audio.hpp"
/**
* Constructor for the audio_codec class
* Open the file, load the samples and calculate the basic information about the audio file
* Set the M... | TOOL | 0.8718 | 5.510095 |
8339d241-6e46-4f9b-9c2a-ac97ba619ffc | just3obad/Turbo-Final | bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | #if defined (_WIN32) || defined (__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
#include "btConvexPolyhedron.h"
#include "LinearMath/btConvexHullComputer.h"
#include <new>
#include "LinearMath/btGeometryUtil.h"
#include "LinearMath/btGrahamScan2dConvexHu... | ALGO | 0.980879 | 7.026882 |
8d59afc8-2fcc-431e-8534-ec9cefca68dd | timeplus-io/proton | src/Interpreters/ConcurrentHashJoin.cpp | #include <memory>
#include <mutex>
#include <Columns/ColumnSparse.h>
#include <Columns/IColumn.h>
#include <Interpreters/ConcurrentHashJoin.h>
#include <Interpreters/ExpressionActions.h>
#include <Interpreters/PreparedSets.h>
#include <Interpreters/TableJoin.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parse... | ALGO | 0.85198 | 7.333755 |
98284d4e-410d-41d4-8a8f-79abb59ee611 | vasubheda/Movie-Cast-Suggester | myenv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998526 | 7.214447 |
19b108dc-f7de-4c6d-9b0d-a79bb971530c | naimishvarsani/musium | 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.998799 | 6.776823 |
8d22aa12-c93f-439d-97ce-9d1b056b605d | EnsekiTT/atcoder | ABC/abc085/c.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <climits>
using namespace std;
int main() {
// 入力
int N, W;
cin >> N >> W;
int ans[3];
ans[0] = -1;
ans[1] = -1;
ans[2] = -1;
int val = 0;
int k;
bool break_flag = false;
for(int i = 0; i < N+1; ++i){
for(i... | ALGO | 0.999871 | 3.702552 |
dbad6739-8710-4834-9b99-69a5f8bb3491 | raincross7/code-similarity | codes/train_code/problem225/problem225_326.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
#define l_ength size
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
void add_mod(ll& a, ll b){
a = (a<MOD)?a:(a-MOD);
b = (b<MOD)?b:(b-MOD);
a += b;
a = (a<MOD)?a... | ALGO | 0.999977 | 3.153726 |
f6ccec10-226c-4f24-8559-712fdce38aca | wwt17/BZOJ | 3870 Our happy ending(DP).cpp | #include <cstdio>
const int N=21,K=21,mo=(int)1e9+7;
int n,k,L,f[N][1<<K];
inline void inc(int &a,const int b){
if((a+=b)>=mo) a-=mo;
}
int Main(){
scanf("%d%d%d",&n,&k,&L);
long long w=0;
if(L>k) w=L-k,L=k; k++;
f[0][1]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<1<<k;j++) f[i][j]=0;
for(int j=0;j<1<<k;j++) i... | ALGO | 0.999789 | 3.47028 |
cb21d9c6-2de7-4b00-9e12-ee9a3cab7849 | Tphuong612/DSA | DSA anh loc/14. quy hoach dong/bai 26 Maximum path sum 2.cpp | #include <bits/stdc++.h>// duyet ngang
using namespace std;
int main()
{
int n;
cin>>n;
int a[n+5][n+5], f[n+5][n+5];
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)
cin>>a[i][j];
}
memset(f, 0, sizeof(f));
for(int j=1;j<=n;j++) f[1][j]=a[1][j];// hang 1
for(int i=2;i<=n;i++){
for(int j=1;j<=n;j++){
... | ALGO | 0.999985 | 3.508888 |
7c9cebcf-d2e9-47c5-8e55-c61567c11529 | 2856672598/2022 | text_2_14/text_2_14/text.cpp | //#include<iostream>
//#include<vector>
//using namespace std;
//
//class Solution {
//public:
// int singleNonDuplicate(vector<int>& nums) {
// int ret = 0;
// for (auto e : nums)
// {
// ret ^= e;
// }
// return ret;
// }
//};
//
//int main()
//{
// return 0;
//}
//#include<iostream>
//#include<vector>
//#inc... | ALGO | 0.999468 | 4.302261 |
f0d9bfb5-cbc8-4703-84fa-f918260cc69f | GarvitKaushik123/DS_ALGO | graph_level2/min_cost_to_connect_cities.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#inc... | ALGO | 0.999943 | 4.164949 |
5af44bd5-7a71-42c5-8c6f-143e530371cf | Badalsingh07/LeetcodePractice | 0010-regular-expression-matching/0010-regular-expression-matching.cpp | class Solution {
public:
bool isMatch(string s, string p) {
int m = s.size(), n = p.size();
vector<vector<bool>> dp(m + 1, vector<bool>(n + 1, false));
dp[0][0] = true;
for (int i = 0; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (p[j - 1] == '*') {
... | ALGO | 0.99978 | 5.63134 |
4ff5c015-76f4-446a-8013-deaaf28b0d0c | ishandutta2007/codeforces | sidneyearth/normal/787/A.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 10000000;
int s[maxn], t[maxn];
int main(){
int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
for(int i = b; i < maxn; i += a) s[i] = true;
for(int i = d; i < maxn; i += c) t[i] = true;
int ans = -1;
for(int i = 1; i < maxn; i++)
if(s[i] && t[i]){
... | ALGO | 0.999968 | 3.011668 |
3d1c4438-e3f0-4336-9b06-7e386bf1b8f2 | ritvikanandi/CPP | codeforces-codechef/Edu112/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ios ios_base::sync_with_stdio(false), cin.tie(NULL)
#define pb push_back
#define po pop_back()
#define umap unordered_map
#define uset unordered_set
#define mod 1000000007
#define pi 3.141592653589793238
#define maxe *... | ALGO | 0.999956 | 4.413825 |
10b3a43c-9442-4b25-8141-f22c8b7aeed8 | 104478896/leetcode | 221. 最大正方形.cpp | /*在一个由 '0' 和 '1' 组成的二维矩阵内,找到只包含 '1' 的最大正方形,并返回其面积。
*/
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int maxSide=0;
int row=matrix.size();
int col=matrix[0].size();
if(row==0||col==0){
return 0;
}
vector<vector<int>>dp(row,ve... | ALGO | 0.999852 | 5.976654 |
5d23e01b-e77d-42b9-8e42-5684bd869625 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_13304_1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll l,r;
cin >> l >> r;
int m = 2018;
r = min(r, l+4038);
for (ll i=l; i<r; i++){
for (ll j=i+1;j<=r;j++){
int x = i*j%2019;
m = min(m, x);
}
}
cout << m << endl;
}
| ALGO | 0.999918 | 3.753104 |
a813ccb1-27b1-4eda-837b-b7dde78b0aee | asalexanderlee/illuminate2D | illuminate2D/include/opencv-4.5.1/samples/cpp/peopledetect.cpp | #include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>
#include <iomanip>
using namespace cv;
using namespace std;
class Detector
{
enum Mode { Default, Daimler } m;
HOGDescriptor hog, hog_d;
public:
Detector() : m(... | ALGO | 0.986025 | 7.2604 |
c0fc1ab8-a090-473d-bd7d-3a60dbf1a026 | RiccardoRedigolo/GfGSeptember2024 | ricerca.cpp | #include <iostream>
#include <vector>
std::vector<std::string> laurea_mat = {"laurea di primo livello in scienze matematiche", "laurea", "laurea matematica","laurea triennale"};
int main(){
std::string s;
std::string reply="s";
bool found = false;
while (reply == "s"){
std::cout << "Prego inserire ricerca... | ALGO | 0.995044 | 3.69946 |
278fed42-4dd7-4bdd-9b66-0e8211d02fba | Shaon2710/C-CPP-Code | InsertionSort.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
int arr[n+1];
for(int i=0;i<n;i++){
scanf("%d", &arr[i]);
}
for(int i=0; i<n; i++){
int j=i;
while(j>0 && arr[j] > arr[j-1]){
int temp = arr[j];
arr... | ALGO | 0.999995 | 3.821365 |
1fa5204f-e179-47d6-8284-30644ce6feb4 | gitter-badger/freefem | src/fflib/glumesh2D.cpp | // $Id$
#include <iostream>
#include <cfloat>
#include <cmath>
#include <complex>
using namespace std;
#include "error.hpp"
#include "AFunction.hpp"
using namespace std;
#include "rgraph.hpp"
#include "RNM.hpp"
#include "fem.hpp"
#include "FESpacen.hpp"
#include "FESpace.hpp"
#include "MatriceCreuse_tpl.hpp"
#in... | TOOL | 0.908401 | 4.094187 |
2a24bcc4-8d08-426f-b22c-b1de6da26d09 | actium/codeforces | 1000/60/1064a.cpp | #include <algorithm>
#include <array>
#include <iostream>
template <typename T, size_t N>
std::istream& operator >>(std::istream& input, std::array<T, N>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(size_t v)
{
std::cout << v << '\n';
}
void solve(std::array<size_t, 3>& d)
{
... | ALGO | 0.999883 | 4.736095 |
a798e839-d462-4ee6-a9af-ad49c71a6a98 | iam-Arman/Algorithms | Recursion/factorial.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll fact(ll n)
{
if(n==0) return 1;
return n*fact(n-1);
}
int main()
{
int n;
cin>>n;
cout<<fact(n)<<endl;
} | ALGO | 0.99999 | 5.19581 |
e0b42d77-9118-4fd0-857d-51d1b6489060 | HRF05/DMOJSolutions | ccc11j2.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long long unsigned llu;
typedef pair<int,int> pii;
typede... | ALGO | 0.999552 | 3.481798 |
ed240ceb-a993-4d1a-a9f3-3414d489c412 | eantoranz/hiphop | src/runtime/base/server/ip_block_map.cpp | #include <runtime/base/server/ip_block_map.h>
#include <util/logger.h>
using namespace std;
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
IpBlockMap::Acl::Acl() : m_networks(true) {}
IpBlockMap::BinaryPrefixTrie::BinaryPrefixTrie(bool allow) {
m_children[0] = m_c... | TOOL | 0.958318 | 7.531882 |
9b464ed4-7f91-4b77-bacc-fffb4fe6f097 | MegumiSuki0923/Book | usr/book/Chapter_18/lambda0.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
#define SIZE1 39
#define SIZE2 3900
#define SIZE3 390000
bool f3(int x) {return x % 3 == 0;}
bool f13(int x) {return x % 13 == 0;}
class f_mod
{
private:
int dv;
public... | ALGO | 0.998359 | 3.735296 |
94caa829-9985-409b-ac18-fdab502e3f75 | sv022/IndustrialProgramming | ПР1/Triangle/main.cpp | #include <iostream>
#include <math.h>
#include "triangle.h"
int main() {
Triangle tr[3];
int i = 0;
while (i < 3){
double a, b, c;
std::cin >> a >> b >> c;
Triangle temp(a, b, c);
if (!temp.exst_tr()){
std::cout << "Triangle doesn't exist." << '\n';
} else {tr[i] = temp; i++;}
}
for (int i = 0; i < 3... | ALGO | 0.992411 | 4.060634 |
740899bf-2c55-4f1d-9d92-3429e526d8b6 | phamthainb/c-ptit | tailieu/nganhang169/rotation4.cpp | //Code By PMD
#include<iostream>
using namespace std;
const int N = 1e7 + 5;
long long a[N] , n ;
long long findMin(long long arr[], int low, int high){
if (high < low) return arr[0];
if (high == low) return arr[low];
int mid = low + (high - low)/2;
if (mid < high && arr[mid + 1] < arr[mid]){
re... | ALGO | 0.999951 | 4.761886 |
83678b5c-3a6c-42a3-afae-74baa62910dc | AkiTheMemeGod/SRM_Attendance_Tracker | 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.998799 | 6.776823 |
512527e8-896f-4a43-a422-fa37134fe719 | Feroz455/DATA-STRUCTURE-By-Seymour-Lipschutz | Chapter-06/SOLVED PROBLEMS/6-1.cpp | /*
Page 196
6.1 Consider the following stack of characters, where STACK is allocated N = 8 memory cells:
STACK: A, C, D, F, K, ___, ___, ___,
(For notational convenience, we use “___” to denote an empty memory cell.) Describe the stack as the following operations take place:
(a) POP(STACK, ITEM)
(b) POP(STACK, ITEM... | ALGO | 0.998864 | 3.820198 |
45faef90-0dbe-498a-b467-104335dac3fa | prabhxjottsingh/leetcode-practise-problems | Algorithm 1/Day - 4 (Two Pointers)/0344 - Reverse String.cpp | // Problem Link: https://leetcode.com/problems/reverse-string/
// Time Complexity: O(N)
// Space Complexity: O(1)
class Solution
{
public:
void reverseString(vector<char> &s)
{
int start = 0, end = s.size() - 1;
while (start < end)
{
char temp = s[start];
s[star... | ALGO | 0.999278 | 6.546889 |
04dfdde9-2a92-405b-b026-bb82a98c96d7 | Jimut123/code-backup | 4rth_Sem_c++_backup/SHIT/bsearch.cpp | #include <stdio.h>
#include <conio.h>
void bsort(int[] ,int);
void disp(int[],int);
void bsearch(int[],int,int);
main()
{
int a[100],n,i,s;
printf("\nEnter the array limit : \n");
scanf("%d",&n);
printf("\nEnter the array elements : \n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
pri... | ALGO | 0.999811 | 3.50226 |
45066b3c-7241-4273-9878-3544edabaca7 | FraRita/AlgoLab2023 | Previous Years/Fleet Race/code.cpp | #include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/successive_shortest_path_nonnegative_weights.hpp>
#include <boost/graph/find_flow_cost.hpp>
#define C 50
typedef boost::adjacency_list_traits<boost::vecS, boost::vecS, boost::directedS> traits;
typedef boost::adjacency_list<boost::vec... | ALGO | 0.999491 | 3.829256 |
5b5ca60e-0186-4ac6-b526-acb6485898d2 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5762_25.cpp | #include <bits/stdc++.h>
using namespace std;
struct point {
int x, y;
point(int x, int y) : x(x), y(y) {}
point() : x(0), y(0) {}
};
const int maxN = 2050;
int n;
int a[maxN][maxN];
void print() {
for (int y = 0; y < n; y++) {
for (int x = 0; x <= n; x++) printf("%c", a[x][y] ? '#' : '.');
printf("\n")... | ALGO | 0.999666 | 4.302045 |
f7ee3e17-0883-4c9f-9f8c-3b4f16b206a0 | MathProgrammer/CodeChef | C Programs/C Programs - 6/Maximize Disjoint Pair Sum.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
#define MAX_LENGTH 100000 + 1
using namespace std;
void solve()
{
int no_of_elements, i, difference, elements[MAX_LENGTH];
long long max_sum_upto[MAX_LENGTH] = {0};
scanf("%d %d", &no_of_elements, &difference);
for(i = 1; i <= no_of_elements; ... | ALGO | 0.999651 | 3.897931 |
0145f464-3a7e-4324-845f-de3e54c2d020 | achutha02/DSA | Basic_maths/odd_prime_factors.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n=36;
for(int i=1;i<=n;i++){
if(n%i==0 && i%2==1){
bool isPrime=true;
if(i<2){
isPrime=false;
}
for(int j=2;j<i;j++){
if(i%j==0){
isPrime=false;
break;
}
}
if(isPrime){
cout << i << " ";
}
}
}
}
| ALGO | 0.999077 | 4.106627 |
4b211730-0d94-400e-81f4-1ce2039afa31 | IIITManjeet/Leetcode-solutions | 70-climbing-stairs/climbing-stairs.cpp | class Solution {
public:
int climbStairs(int n) {
if(n==1 || n==2)return n;
int prev=1,cur=1;
for(int i=2;i<=n;i++){
int temp=cur;
cur=temp+prev;
prev=temp;
}return cur;
}
}; | ALGO | 0.999971 | 5.716568 |
55855896-c518-40af-bf84-af85e36a72f8 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_56_16.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, r, c;
char ch[410][410], pat[410][410];
bitset<640010> bs[26], ans;
int N, M;
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%s", ch[i]);
scanf("%d%d", &r, &c);
for (int i = 0; i < r; i++) scanf("%s", pat[i]);
ans.set();
N = n +... | ALGO | 0.999951 | 3.514707 |
44967074-1b3f-4b58-9fdd-10adb82c7c9f | Himangi-Malik/Main-Quest | LinkedList/#725 leetcode.cpp | //samjh aagya tha kya karna, doosre type se answer nikaal bhi diya tha
//but it was taking too much time and slowing me down so pokaik puk puk
//i am skipping this but sahi socha tha maine remainder and dividend ke case mein thanks
class Solution {
public:
int length(ListNode* head){
int count = 0;
... | ALGO | 0.998445 | 5.211937 |
82220d62-d4ab-4692-a2d9-828eecbd65b2 | imtiaz1710/competitive-programming | codeforces/codeforces contest/Codeforces Round #632 (Div. 2)/b.cpp | #include <bits/stdc++.h>
#define ll long long
#define us unsigned short int
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);
using names... | ALGO | 0.99999 | 3.329162 |
0fe166dc-904b-404f-a841-eaa8c3e8440b | naxocist/POSN-IPST | sandbox/algorithm/linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
struct node{
int val;
node *next;
};
node *createNode(int v) {
node *N = new node;
N->val = v;
N->next = NULL;
return N;
}
node *pushFront(node *head, int v) {
node *N = createNode(v);
if(head == NULL) return N;
N->next = head;
return N;
}
node *pushBack(node... | ALGO | 0.999891 | 3.467382 |
db5093a4-0bdb-4c77-b138-37fb7af1710d | Rajpreet2206/SuperComputer-Programming | week5_MPI/main2.cpp | //Vector based implementation of Reduction Operation
#include <iostream>
#include <vector>
#include <cmath>
void compute_local_sum(const std::vector<int>& array, int start_idx, int end_idx, int& local_sum) {
local_sum = 0;
for (int i = start_idx; i < end_idx; ++i) {
local_sum += array[i];
}
}
voi... | ALGO | 0.999975 | 5.716987 |
7c358b6b-078e-4f12-8816-ed39ebc07c0d | ravenxrz/MyLeetCode | 4.CodingInterviews/NewVersion/59. 数据流的第 K 大数值.cpp | #include "leetcode_base.h"
class KthLargest {
public:
KthLargest(int k, vector<int>& nums) : k_(k) {
int i = -1;
for (i = 0; i < k && i < nums.size(); i++) {
min_heap_.push(nums[i]);
}
while (i < nums.size()) {
if (nums[i] > min_heap_.top()) {
... | ALGO | 0.999808 | 5.688817 |
8dc32583-fe58-4cc4-b268-aca4cbc360b8 | neverac/2020summer | 个人赛9/A/26791686_3019244081_A.cpp | #include<bits/stdc++.h>
/*
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<ctime>
*/
#define ll long long
using namespace std;
const int N=1e5 + 100;
const double eps=1e-10;
int a[2*N];
int main(){
int n;
scanf("... | ALGO | 0.999815 | 3.206775 |
34380872-fc8b-4d1d-a408-bd5de29204c9 | ishandutta2007/codeforces | n_z__/normal/1450/H1.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int p=998244353;
int qp(int x,int n=p-2)
{
int ret=1;
while(n)
{
if(n&1)ret=ret*x%p;
x=x*x%p,n>>=1;
}
return ret;
}
int fac[200001],ifac[200001];
void init(int n)
{
fac[0]=1;
for(int x=1;x<=n;x++)
fa... | ALGO | 0.999995 | 4.056046 |
789b79d9-376d-4df2-afa2-3c612d704343 | mrsaidkarim/CompetitiveProgramming | Bootcamp/Day00/D.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
bool correct(string str)
{
stack<char> s;
for(char c: str)
{
if(c == '(' || c == '[')
s.push(c);
else if(c == ')' || c == ']')
{
if(s.empty())
return false;
if((c == ')' && s.top() == '(') || (c == ']' && s.top() == '[')... | ALGO | 0.9998 | 5.428141 |
85f22bf0-98e8-473c-b89d-1eb5e5326620 | spook953/rdrhooks | solution/project/src/utils/tier0/mem_utils/mem_utils.cpp | #include "mem_utils.hpp"
MemAddr mem::findBytes(std::string_view dll, std::string_view bytes)
{
auto sigToBytes = [](const char *const sig) -> std::vector<int>
{
std::vector<int> bytes{};
char *const start{ const_cast<char *>(sig) };
char *const end{ const_cast<char *>(sig) + strlen(sig) };
for (char *curr... | TOOL | 0.964818 | 5.63472 |
71bdff1f-49cc-4baf-a9e7-5ae7d583c96f | ishandutta2007/codeforces | tutis/normal/1266/F.cpp | /*input
5
1 2
1 3
1 4
4 5
*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<ll>adj[505050];
ll h[505050];
ll a[505050];
ll d[505050];
void... | ALGO | 0.999813 | 4.139511 |
e9e215e7-a56d-4d76-8c79-94a54ce71209 | kina111/Fundamental_DSA_C_Cpp | Graph/(Graph)_CutVertex.cpp | #include <bits/stdc++.h>
using namespace std;
//Task: Cut Vertex (Articulation points)---def: dinh ma khi loai bo dinh do va cac canh ke thi so tplt tang.
//Idea: 2 approaches: naive: iterate over all the vertice
//Tarjan's:
const int MAX_SIZE = 10001;
int n, m;
vector<int> adj[MAX_SIZE];
bool used[MAX_SIZE];
... | ALGO | 0.999904 | 4.36228 |
c4adbf4a-213e-4a8b-9e09-d2b159a47e79 | sourabh575/DSA-ALL-CODES | lec 44 linked list/q7 doublylinkedlist if head & tail are null.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* prev;
node* next;
//constructor
node(int d){
this->data=d;
this->prev=NULL;
this->next=NULL;
}
};
void print(node* head){
node* temp=head;
while(temp !=NULL){
cout<<temp->data<<" ";
temp=temp->next;
}
cout<<e... | ALGO | 0.998343 | 4.177112 |
54b03f9c-b801-475b-9b5a-7d454472e0e2 | sarvex/leetcode-c-sharp | solution/0500-0599/0591.Tag Validator/Solution.cpp | class Solution {
public:
bool isValid(string code) {
stack<string> stk;
for (int i = 0; i < code.size(); ++i) {
if (i && stk.empty()) return false;
if (code.substr(i, 9) == "<![CDATA[") {
i = code.find("]]>", i + 9);
if (i < 0) return false;
... | ALGO | 0.992653 | 6.103214 |
32ea3d9b-e88c-4140-96c8-5fe4aa006740 | llvm/llvm-project-staging | compiler-rt/test/fuzzer/AbsNegAndConstant64Test.cpp | // abs(x) < 0 and y == Const puzzle, 64-bit variant.
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < 16) return 0;
int64_t x;
uint64_t y;
memcpy(&x, Data, sizeof(x));
memcpy(&y, ... | ALGO | 0.971502 | 5.092611 |
56610136-8bc6-4553-9f9b-bb1c40350406 | hikjik/cses | solutions/download-speed/main.cpp | #include <algorithm>
#include <iostream>
#include <limits>
#include <queue>
#include <vector>
template <class Iterator> class IteratorRange {
public:
IteratorRange(Iterator begin, Iterator end) : begin_(begin), end_(end) {}
Iterator begin() const { return begin_; }
Iterator end() const { return end_; }
privat... | ALGO | 0.999773 | 5.028915 |
16df4a55-62ae-469f-b4e2-14cdf4b9adf6 | ishandutta2007/codeforces | liti/normal/139/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <fstream>
#include <cstring>
#include <iomanip>
#include <deque>
#define SZ(x) (( (int) x.size() ))
using namespace std;
int a[7];
int main()
{
int n;
cin >> n ;
in... | ALGO | 0.999923 | 3.403655 |
0e542eff-ba34-44d0-962d-7124cc258426 | sarvex/leetcode-free-pascal | lcof/面试题43. 1~n整数中1出现的次数/Solution.cpp | class Solution {
public:
int countDigitOne(int n) {
int a[12]{};
int f[12][12];
memset(f, -1, sizeof f);
int i = -1;
for (; n; n /= 10) {
a[++i] = n % 10;
}
function<int(int, int, bool)> dfs = [&](int pos, int cnt, bool limit) -> int {
... | ALGO | 0.999933 | 6.497475 |
76bb84b7-70d0-4a7b-b4e5-e94d715ccedf | elgar328/short-coding | BOJ9012/main.cpp | #include <iostream>
#include <stack>
#include <string>
bool vps_check(std::string & line)
{
std::stack<char> st;
for (int i=0; i<line.size(); i++)
{
if (line[i] == '(')
st.push('(');
else
{
if (st.empty()) return false;
else
{
... | ALGO | 0.999429 | 5.352736 |
41c956cf-256a-4ff2-acde-c17ec09f8004 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9391_4.cpp | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long t;
cin >> t;
while (t--) {
long long a, b, c, r;
cin >> a >> b >> c >> r;
long long x = c - r;
long long y = c + r;
if (a > b) swap(a, b);
long long te = abs(a - b);
long long ans = 0;
if (c >= a && c + b) {
... | ALGO | 0.999738 | 3.912609 |
9ce9f9f0-8787-4566-b86d-da8d1c4e5a55 | DhruvPandey1509/Vscode-Program-Folders | Geeks for Geeks/Medium/Merege_two_Sorted_List.cpp | #include "bits/stdc++.h"
using namespace std;
struct Node
{
int data;
struct Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
Node *sortedMerge(Node *head1, Node *head2)
{
Node *temp = new Node(-1);
Node *l3 = temp;
while (head1 and head2)
{
if (head1... | ALGO | 0.999933 | 4.469646 |
d262d215-8800-4952-abf8-119a0638c43b | rohandarandale1144/GFG_to_GitHub | Medium/Combination Sum/combination-sum.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution {
private:
void find(int idx, vector<int>&candidates, int target, vector<int>&res, vector<vector<int>>&ans)
{
if(target==0)
... | ALGO | 0.999372 | 5.848494 |
b198fdac-947a-4173-8316-aaf287d8540b | AdamHermes/exercises | exercise4.cpp | #include <iostream>
int main(){
using namespace std;
int n;
cin >> n;
for (int i =0; i<n;i++){
for (int j =0; j< n-i-1;j++){
cout << " ";
}
for (int k =0; k <=i; k++){
cout << "#";
}
cout << '\n';
}
} | ALGO | 0.999956 | 3.86472 |
9fb65cbf-d775-4b99-8b43-04845449bc6b | SalahHassan202/assuit_sheet_solved_by_cpp | Sheet 02/R. Sequence of Numbers and Sum.cpp | // R. Sequence of Numbers and Sum
# include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main ()
{
int num1,num2 ,sum=0;
while(cin>>num1>>num2)
{ int min , max;
if(num1<=0 || num2<=0)
{
return 0;
}
if(num1>=num2)
{
max=num1;
min=num2;
}
else
{
... | ALGO | 0.99925 | 3.927527 |
29062325-60a7-4e7a-a2c2-418dd3655034 | Binsal/Leetcode | 1006-clumsy-factorial/1006-clumsy-factorial.cpp | class Solution {
public:
int rec(int n){
n=abs(n);
if(n==0)return 0;
if(n==1)return -1;
if(n==2)return -2;
if(n==3)return -6;
return -n*(n-1)/(n-2)+(n-3)+rec(n-4);
}
int clumsy(int n) {
n=abs(n);
if(n==0)return 0;
if... | ALGO | 0.999991 | 5.092833 |
10dd0446-7619-431a-831f-d17c092a064e | WhiteMordred/llama-tools | examples/perplexity/perplexity.cpp | #include "common.h"
#include "llama.h"
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <sstream>
#include <thread>
#include <mutex>
#include <vector>
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
struct results_perplexity {
std::vector<l... | DATA | 0.995322 | 7.371544 |
c21e1cf2-409c-4470-95fb-7d103c90fd9e | sarvex/leetcode-idris | solution/1600-1699/1662.Check If Two String Arrays are Equivalent/Solution.cpp | class Solution {
public:
bool arrayStringsAreEqual(vector<string>& word1, vector<string>& word2) {
return reduce(word1.cbegin(), word1.cend()) == reduce(word2.cbegin(), word2.cend());
}
}; | ALGO | 0.999647 | 6.458018 |
a6a4cf6b-cdbd-4d27-9956-ecd474e95e7d | prakhar-161/DSA-prep | Dynamic Programming 1/10-triangle_2d.cpp | #include <bits/stdc++.h>
using namespace std;
// Memoization
int f(int i, int j, int n, vector<vector<int>>& triangle, vector<vector<int>> &dp) {
if(i == n-1) return triangle[n-1][j];
if(dp[i][j] != -1) return dp[i][j];
int down = triangle[i][j] + f(i+1, j, n, triangle, dp);
int diag = triangle[i][j] ... | ALGO | 0.999992 | 6.042628 |
75d80dde-4ce0-4492-a831-16d28c340064 | zerolxf/zero | zhuanti/searchlxf/a.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<map>
#include<queue>
#include<vector>
using namespace std;
const int maxn = 1e6+100;
const int INF = 0x3f3f3f3f;
#define pr(x) cout << #x << " = " ... | ALGO | 0.999943 | 3.967487 |
c3447973-41a4-4904-b070-b8770fabad63 | epiglottiss/algorithm_SP | 1W/2DPeakFinder.cpp | #include <iostream>
#include <ctime>
#include <Windows.h>
using namespace std;
#define SIZE 5
int board[SIZE][SIZE];
int direction[2][4] = { {0,0,1,-1},{1,-1,0,0} };
struct PeakInfo {
int value;
int row;
int col;
};
void InitBoard() {
srand((unsigned int)time(NULL));
for (int i = 0; i < SIZE; i++)
{
for (int... | ALGO | 0.996405 | 3.8938 |
db2e1d29-cde8-4910-915d-e306dd05d3d5 | ishandutta2007/codeforces | roundgod/normal/980/E.cpp | #include<bits/stdc++.h>
#define MAXV 1000005
#define MAXLOGV 22
using namespace std;
vector<int> G[MAXV];
int root;
int parent[MAXLOGV][MAXV];
int n,k;
bool used[MAXV];
vector<int> ans;
void dfs(int v,int p)
{
parent[0][v]=p;
for(int i=0;i<G[v].size();i++)
if(G[v][i]!=p) dfs(G[v][i],v);
}
void init(int ... | ALGO | 0.999992 | 3.649833 |
beb68bac-e2a8-4130-8e33-777932bce47e | YimTaeKeun/Baekjoon_CPP | 2153.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool isPrime(int x);
int main(){
string temp;
int sum = 0;
cin >> temp;
for(int i = 0; i < temp.size(); i++){
if(isupper(temp[i])) sum += temp[i] - 'A' + 27;
else sum += temp[i] - 'a' + 1;
}
cout << ((isP... | ALGO | 0.999232 | 4.481297 |
28c53897-5303-4127-a1c6-56697b21993e | NipunRathore/GFGPracticeSolutions | Easy/Binary Tree to BST/binary-tree-to-bst.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
void printInorder (struct Node* node)
{
if (node == NULL)
... | ALGO | 0.999824 | 7.318666 |
be0c6543-d3a7-4a7b-9e12-250b7dbbc9c0 | Tejas2124/Cp-Solutions | GeorgeAndAccomodation.cpp | #include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include ... | ALGO | 0.999227 | 3.580402 |
207a9de0-a383-417a-b3bd-2d4a78569854 | GreatGameDota/leetcode-challenges | medium/longest-nice-subarray/solution.cpp | class Solution
{
public:
int longestNiceSubarray(vector<int> &nums)
{
int ret = 1;
for (int i = 0; i < nums.size(); i++)
{
int sz = 2;
while (i + sz <= nums.size())
{
if (!check(i, i + sz, nums))
break;
... | ALGO | 0.999956 | 5.642755 |
bb397bb6-2a5f-44b6-9b0d-35d33dd0cf55 | zxh4321/webserver | timer/lst_timer.cpp | #include"lst_timer.h"
#include"../http/http_conn.h"
#include "../log/log.h"
sort_timer_lst::sort_timer_lst()
{
head = NULL;
tail = NULL;
}
sort_timer_lst::~sort_timer_lst()
{
util_timer *tmp = head;
while (tmp)
{
head= tmp->next;
delete tmp;
tmp = head;
}
}
void sor... | TOOL | 0.964289 | 4.203537 |
128a4c4d-1f8c-46c7-972d-055c6afbd3f8 | ppinko/Cpp_exercises_with_solutions | math_exercises/radix.cpp | // Non-Repeating Integers
// https://edabit.com/challenge/SJLZ6thTfCsFWgvYv
#include <cassert>
#include <vector>
#include <numeric>
#include <functional>
#include <iostream>
int factorial(int n) {
if (n == 0 || n == 1)
return 1;
std::vector<int> v (n, 0);
std::iota(v.begin(), v.end(), 1);
int ... | ALGO | 0.999286 | 5.932992 |
c7ca1b9d-32fb-4c81-838c-fe36efbb0c05 | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/perfect-rectangle.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
bool isRectangleCover(vector<vector<int>>& rectangles) {
enum Location {L = 0, B = 1, R = 2, T = 3};
int left = numeric_limits<int>::max(), bottom = numeric_limits<int>::max(),
right = numeric_limits<int>::min(), top = numeric_limit... | ALGO | 0.999867 | 6.941773 |
e4df38df-7a2d-40b2-a3e0-e55895b5d169 | sofa-framework/issofa-merge | applications/plugins/SofaOpenCL/OpenCLSpringForceField.cpp | #include "OpenCLTypes.h"
#include "OpenCLSpringForceField.inl"
#include <SofaObjectInteraction/BoxStiffSpringForceField.inl>
#include <SofaDeformable/SpringForceField.inl>
#include <SofaDeformable/StiffSpringForceField.inl>
#include <SofaDeformable/MeshSpringForceField.inl>
#include <SofaDeformable/TriangleBendingSpri... | TOOL | 0.918422 | 6.584404 |
18140463-ea17-40d6-bf47-73d61b56f6e9 | Kamila729/Likhacha4eva_Kamila_11-008 | semestrovaya2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cyclic (int v, int &cycle_st, vector <int> *graph, vector <int> &color ) { //проверка графа на цикличность
color[v] = 1;
for (size_t i = 0; i < graph[v].size(); ++i) {
int to = graph[v][i];
if (color[to] == 0) {... | ALGO | 0.999987 | 4.418933 |
f00c7c1b-81c3-4d1b-a57d-37e76fdbd182 | shyed2001/Webassembly | Projects_WASM/prime_distributed_projectPrlCc1B V6 server (10K)/cpp_src/prime_worker.cpp | // cpp_src/prime_worker.cpp
#include "prime_library.h" // Assuming prime_library.h is in the parent directory
extern "C" {
uint64_t count_primes_in_range(uint64_t start, uint64_t end) {
uint64_t count = 0;
for (uint64_t i = start; i <= end; ++i) {
if (is_prime(i)) {
coun... | TOOL | 0.975268 | 5.786392 |
4c033d94-dfb7-440c-b2f4-4ac0410a5743 | ar0n1n/yandex-algorithms | 5/D/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
int main() {
size_t n, dist, ans = 0;
ifstream in("input.txt");
ofstream out("output.txt");
in >> n >> dist;
int arr[n];
for (int i = 0; i < n; ++i)
in >> arr[i];
for (int l = 0, r = 1; r < n; ) {
if (arr[r] - arr... | ALGO | 0.99961 | 3.745517 |
9d6a1f47-e3cb-4c10-b1bf-b659db039f8e | lakshman2003/coding-questions | temp3.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
#define ll long long
#define ldd long double
#define en '\n'
#de... | ALGO | 0.999938 | 3.814004 |
c07903bc-adeb-4e15-813a-87e59a782eb6 | haiphamcoder/CodeSignal | TheCore/P04.LoopTunnel/problem029_additionWithoutCarrying.cpp | #include <iostream>
using namespace std;
int solution(int param1, int param2)
{
int heso = 1;
int result = 0;
while (param1 > 0 || param2 > 0)
{
result += (param1 % 10 + param2 % 10) % 10 * heso;
heso *= 10;
param1 /= 10;
param2 /= 10;
}
return result;
}
int ma... | ALGO | 0.99969 | 4.991978 |
558c64a8-9c66-411e-bbc1-2bc5264844eb | dzhi1993/Practice-DataStructures | LeetCode/055JumpGame.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// 55. Jump Game
// Given an array of non-negative integers, you are initially positioned at the first index of the array.
// Each element in the array represents your maximum jump length at that position. Determine if you are able to rea... | ALGO | 0.999633 | 5.395988 |
fbe23652-c140-4469-81bd-60c6ca23dc9b | rkwitt/coptex | sm/common.cpp | #define _FILE_OFFSET_BITS 64
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_linalg.h>
#include <sys/time.h>
#include <time.h>
#include "pthread.h"
#include "common.h"
extern char *progname;
extern unsigned int verbose;
int count_listfil... | TOOL | 0.988791 | 5.524968 |
3d81440a-afdb-4544-881d-6b3cc11cd4e0 | SousaEdson/CompetitiveProgramming | UVA/01260.cpp | #include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fori(a, l, f) for(int a = l; a<f; ++a)
#define ford(a, l, f) for(int a=l; a>=f; --a)
#define pq priority_queue
#define checkBit(mask, i) ((mask & ... | ALGO | 0.998614 | 3.710148 |
93245df3-e99b-41f2-97ac-78f52f80a68a | pixeldust-project-caf/android_external_skia | bench/SortBench.cpp | #include "Benchmark.h"
#include "SkRandom.h"
#include "SkString.h"
#include "SkTSort.h"
#include <algorithm>
#include <stdlib.h>
static const int N = 1000;
static void rand_proc(int array[N]) {
SkRandom rand;
for (int i = 0; i < N; ++i) {
array[i] = rand.nextS();
}
}
static void randN_proc(int a... | TEST | 0.966741 | 6.219709 |
6486743f-5cdf-40e4-a742-d66faaf24abd | warrior1601/2019_GROUP_33 | model/source/double_equality_function.cpp | #include <cmath>
#include "double_equality_function.h"
double my_DBL_EPSILON = Calc_DBL_EPSILON_For_Machine();
#include <iostream>
double Max( double aValue , double bValue)
{
return ((aValue) > (bValue) ? (aValue) : (bValue));
}
double Relative_Difference (double aValue, double bValue)
{
double cValue = fab... | TOOL | 0.932731 | 4.833196 |
83515903-fb5a-425c-ae5f-1857f112405e | trinhminhtriet/leetcode | solutions/1400-1499/1465.maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts/Solution.cpp | class Solution {
public:
int maxArea(int h, int w, vector<int>& horizontalCuts, vector<int>& verticalCuts) {
horizontalCuts.push_back(0);
horizontalCuts.push_back(h);
verticalCuts.push_back(0);
verticalCuts.push_back(w);
sort(horizontalCuts.begin(), horizontalCuts.end());
... | ALGO | 0.999976 | 5.880961 |
ac8ac490-7edb-4633-9b77-53f0a7e3ebd5 | daniCh8/eth-algolab-2019 | pows/cantonal_courier/cantonal_courier.cpp | /**
* BGL-Flow problem: the solution is to take all the jobs - and constraint the flow given by this jobs to the cost of the tickets.
* The final result will then be the difference between the sum of the reward of all the jobs and the flow of that graph.
* Indeed that flow will correspond to the money spent on ticke... | ALGO | 0.999914 | 3.475204 |
5a7e853c-6498-4cae-91cb-85883e339e2e | ML4SE2022/group3 | data/walkccc-1666132586/C++/409 Longest Palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
int ans = 0;
vector<int> count(128);
for (const char c : s)
++count[c];
for (const int c : count)
ans += c % 2 == 0 ? c : c - 1;
const bool hasOddCount =
any_of(begin(count), end(count), [](int c) { return c & 1; })... | ALGO | 0.999867 | 6.431368 |
5b162039-55ac-43eb-af57-bbda78f5c577 | imrojhimal/c-and-cpp-practice-codes | r.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
while(1)
{
cin>>n>>m;
long long sum=0;
int ma=max(n,m);
int mi=min(n,m);
if(n>=-100&&n<=100&&m>=-100&&m<=100)
{
if(n<=0||m<=0)
{
return 0;
}
}
for(int i=mi;i<=ma;... | ALGO | 0.999876 | 4.062022 |
b26375e6-de17-4235-8282-e6f51bd9de1f | DG-Dibbo/Phitron_Batch-4 | c++ for Data structure/Module 3.5/G_Palindrome_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
int p[n];
for(int i = 0; i<n; i++)
{
cin >> a[i];
p[i] = a[i];
}
int i = 0,j = n-1;
while (i<j)
{
swap(a[i],a[j]);
i++;
j--;
}
for(int i ... | ALGO | 0.999998 | 3.570634 |
277cbc63-6bc1-40f8-9d51-7acc22acd28c | YanRSAlves/Apostilas_linguagens | APOSTILAS LINGUAGENS/C e C++/FundamentosDeC/E0504.CPP | /* *******************************************************************
Programa: e0504.cpp
Proposito: Uso da estrutura if...
Ultima Revisao: 26/08/97
******************************************************************* */
#include <dos.h> // inclusao de bibliotecas
#include <conio.h>
#include <stdio.h>... | ALGO | 0.967461 | 4.422278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.