uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c379e362-f934-4081-a4ec-a77aff6e6719 | vcamboji/dsa | 0018-4sum/0018-4sum.cpp | class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
int n = nums.size();
vector<vector<int>> ans;
sort(nums.begin(),nums.end());
for(int i=0; i<n; i++)
{
if(i>0&& nums[i] == nums[i-1] ) continue;
for(int j=i+1; j<n; j+... | ALGO | 0.999945 | 6.06405 |
d61a2396-52ec-4860-9d36-b9db4571da25 | DPS0340/DoItDataRithm | 02/Q6.cpp | #include <iostream>
using namespace std;
int card_conv(unsigned x, int n, char d[]) {
char* dchar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int len = sizeof(d) / sizeof(char);
char* temp = (char*)malloc(sizeof(char) * len);
for(int i=0;i<len;i++) {
temp[len] = NULL;
}
int digits;
for(digits=0;x!=0;digits++) ... | ALGO | 0.994325 | 3.846179 |
8535cebf-a242-4fa5-b93d-734998ae9031 | shauryagupta06/coding | linked-list/sort-0s-1s-2s.cpp | //Given a linked list of N nodes where nodes can
//contain values 0s, 1s and 2s only. The task is to
//segregate 0s, 1s and 2s linked list such that all
//zeros segregate to headside, 2s at the end of the
//linked list and 1s in the mid of 0s and 2s.
//Iterate through the linked list. Maintain 3 pointers
//named ... | ALGO | 0.999919 | 4.174933 |
0affd0cb-0a70-4160-a17a-b599c974d581 | ayushsrivastav0811/Leetcode | 19-remove-nth-node-from-end-of-list/19-remove-nth-node-from-end-of-list.cpp | /**
*Definition for singly-linked list.
*struct ListNode {
* int val;
* ListNode * next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
*};
*/
class Solution
{
public:
ListNode* removeNthF... | ALGO | 0.999961 | 5.930414 |
295795b0-3243-4a87-a265-61c5c8903b12 | JJLi0427/BJTU_CS_Learning | operationsystem/FAT16.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_FILENAME_LENGTH 16
#define MAX_FILE_SIZE 1024
typedef struct {
char filename[MAX_FILENAME_LENGTH];
int start_block;
int size;
char data[MAX_FILE_SIZE];
} DirectoryEntry;
typedef struct {
char volume_name[MAX_FILENAME_LENGTH];
... | TOOL | 0.855354 | 4.886915 |
dd76135e-6962-4904-bcef-1dfb511469dd | jayysuthar/Competitive-Programming-Practice | codechef/Akash and Missing Class.cpp | //---------------------------------------------------------------------------------------
//-------------------Author : itsjaysuthar ----------------------------------------------
//---------------------------------------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
int... | ALGO | 0.999906 | 3.739891 |
7509e3b4-0602-496a-b99c-c6be39caad36 | Ladeklubben/LKAppV1 | QZXing/zxing/zxing/pdf417/detector/PDF417Detector.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <algorithm>
#include <limits>
#include <zxing/pdf417/detector/Detector.h>
#include <zxing/pdf417/detector/LinesSampler.h>
#include <zxing/common/GridSampler.h>
#include <zxing/common/detector/JavaMath.h>
#include <zxing/common/detector/M... | ALGO | 0.997704 | 6.241727 |
95c315a8-5b17-4559-83f3-35c25b0b853a | Keneral/andk | sources/cxx-stl/llvm-libc++/libcxx/test/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, Callable<auto, Iter::difference_type> Rand>
// requires ShuffleIterator<Iter>
// && Convertible<Rand::result_type, Iter::difference_type>
// void
// random_shuffle(Iter first, Iter last, Rand&& rand);
#include <algorithm>
#include <cassert>
struct g... | TEST | 0.953097 | 6.410422 |
9b086c72-1e6e-409c-a4bf-7877c91be5ef | TanishqBhargava/Hackerearth | Algorithms/Graphs/Depth First Search/Minimizing graphs' weights.cpp | /*========================*\
| ID: tanishqbhargava2509 |
| LANG: C++ |
\*========================*/
//Tanishq Bhargava
#include "bits/stdc++.h"
using namespace std;
vector<int> dsu, mi;
int find(int u)
{
if(u == dsu[u])
return u;
return dsu[u] = find(dsu[u]);
}
bool uni(int u, int ... | ALGO | 0.999995 | 5.066291 |
82e094cc-88f3-49ce-b35c-56717cd5939a | alexgbs/easyMath | easy_ocr_library/libs/tess-two/jni/com_googlecode_tesseract_android/src/cube/cube_utils.cpp | #include <math.h>
#include <string>
#include <vector>
#include "cube_utils.h"
#include "char_set.h"
#include "unichar.h"
namespace tesseract {
CubeUtils::CubeUtils() {
}
CubeUtils::~CubeUtils() {
}
/**
* convert a prob to a cost (-ve log prob)
*/
int CubeUtils::Prob2Cost(double prob_val) {
if (prob_val < MIN_PRO... | TOOL | 0.966696 | 6.257849 |
a7d94274-b550-4e3b-9f5c-c44bd50881ac | abhishek201202/competitive-programming | Maths/matrix_exponentiation.cpp | // https://www.spoj.com/problems/SEQ/
#include<bits/stdc++.h>
#define int long long
#define dd long double
#define ff first
#define ss second
#define pb push_back
using namespace std;
const int mod = 1e9 + 7;
int k;
vector<int> a , b , c;
struct M{
dd n, m;
vector<vector<dd>> t;
M(int n, int m){
this -> n = n;
... | ALGO | 0.99995 | 3.622943 |
791b18c1-9461-4c8f-8203-f31adb6fa49e | Piyush-rr/LEARNING-DSA | 2DARRAY/sumOfElement.cpp | #include<iostream>
using namespace std;
int main(){
int m,n;
cout<<"enter the rows and col"<<endl;
cin>>m>>n;
int arr[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>arr[i][j];
}
}
int sum=0;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
... | ALGO | 0.999537 | 3.673343 |
3176d05f-f0a9-4265-9521-3ed371c06b90 | gt-retro-computing/llvm-z80 | llvm/lib/Analysis/CFG.cpp | #include "llvm/Analysis/CFG.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Dominators.h"
using namespace llvm;
/// FindFunctionBackedges - Analyze the specified function to find all of the
/// loop backedges in the function and return them. T... | ALGO | 0.999809 | 7.611872 |
c23d4432-4ead-4a3a-9249-19352d39428d | codehappy-net/libcodehappy | src/python_rpc.cpp | #include <libcodehappy.h>
std::string python_cmd = "python";
/* Make a system command call, but suppress any child window (under Windows.) */
void system_call(const char* cmd) {
#if defined(CODEHAPPY_NATIVE) && defined(CODEHAPPY_WINDOWS)
/* Native Windows build. We can use WinExec(). */
// WinExec() is non-blocking... | TOOL | 0.891379 | 6.097078 |
290cfad6-cf6a-4b85-b036-32c12adf181b | PhQuangMinh/PTIT | Kì 2/Code PTIT C/C04022.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
void solve(){
int n;
scanf("%d", &n);
int a[n+5];
for (int i=0;i<n;i++) scanf("%d", &a[i]);
int max1=-1000000000, max2;
for (int i=0;i<n;i++){
if (max1<a[i]){
max2=max1;
max1=a[i];
}
if (max2<a[i] && a[i]<max1) max2=a[i];
}
printf(... | ALGO | 0.999905 | 3.363844 |
353642a9-318a-42dc-847c-c2b0b59dcb10 | JelyFishhhhhh/leetcode | 1672/1672.cpp | class Solution {
public:
int maximumWealth(vector<vector<int>>& accounts) {
vector<int> wealth;
int m = accounts.size();
int n = accounts[0].size();
wealth.assign(m, 0);
for(int i = 0;i < m;i++){
for(int j = 0;j < n;j++){
wealth[i]+=accounts[i][j];... | ALGO | 0.999677 | 5.844577 |
1c2636aa-3f24-4b83-b079-ff63495c6a53 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00759/sticks/sticks.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 100010;
// 0 1 2 3 4 5 6 7 8 9
int stick[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string pi[7] = {"", "10", "1", "200", "20", "2", "6"};
int ps[7] = {0, 1, 0, 2, 1, 0, 0};
string best[maxn], bestn[maxn];
bool visited[100010];
bool bigger(... | ALGO | 0.999475 | 5.104257 |
aa51ec4a-31ff-4386-88e0-112f9487dd0e | AmaranthYan/WaveFunctionCollapse | Sudoku/Sudoku.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <chrono>
#include <assert.h>
#include <vector>
#include <intrin.h>
#ifdef _DEBUG
#define DEBUG_OUTPUT(w) OutputBoard((w), false)
#else
#define DEBUG_OUTPUT(w) ((void)0)
#endif // DEBUG
// Sudoku solution inspired b... | ALGO | 0.999616 | 5.222816 |
8d5e8688-0548-44e3-bcbb-c566d8792cdc | ishandutta2007/codeforces | alishahali1382/normal/1073/F.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> ... | ALGO | 0.999843 | 4.197491 |
7365ff09-2c22-4fa8-a2d5-9b964756b2b1 | swex/boost_ci | libs/graph/test/bipartite_test.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/lookup_edge.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/graph/bipartite.hpp>
/// Verifies a 2-coloring
template < typename Graph, typename ColorMap >
void check_two_coloring(const Graph& g, const ColorMap color_map)
{
typedef boos... | TEST | 0.870097 | 6.625532 |
c6923498-6cb0-4e4b-a3ec-aa5ccd26cf3b | tiany7/Cloud-Computing | BRPC/src/brpc/policy/baidu_rpc_protocol.cpp | #include <google/protobuf/descriptor.h> // MethodDescriptor
#include <google/protobuf/message.h> // Message
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/io/coded_stream.h>
#include "butil/logging.h" // LOG()
#include "butil/time.h"
#includ... | WEB | 0.8751 | 6.169352 |
17f12070-d97c-4c95-946a-cd4e210c05d4 | Joanna-Szulc/Cloud-detection-ASC | Project II: All-Sky/uioCam/uioCam v2.1/yAstro_actan.cpp | #include "stdafx.h"
#include <math.h>
/* @(#) $Id: actan.c,v 1.3 2001/01/10 16:32:21 ecdowney Exp $ */
/* commonly in math.h, but not in strict ANSI C */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#endif
double
actan(double sinx, double cosx)
{
double... | ALGO | 0.977676 | 5.829962 |
74026bf2-8bdf-4995-84f3-7287d2ef2b86 | scoopr/vectorial | bench/dot_bench.cpp |
#include "bench.h"
#include <stdlib.h>
#include <iostream>
#include "vectorial/vec4f.h"
#define NUM (81920)
#define ITER 100
using namespace vectorial;
namespace {
vec4f* alloc_vec4f(size_t n) {
void *ptr = memalign(n*sizeof(vec4f), 16);
return static_cast<vec4f*>(ptr);
}
}
static vec4f... | TEST | 0.860402 | 4.98753 |
08f0ff05-b5f3-40c8-8e15-3baff95a81db | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_valid_48_3.cpp | #include <bits/stdc++.h>
using namespace std;
int aabs(int x) {
if (x < 0) return -x;
return x;
}
long long n, q;
long long a[100030], b[100030], c[100030], pre[100030], npre[100030];
long long minx[100030 << 2], maxx[100030 << 2];
void build(int o, int l, int r) {
if (l == r) {
maxx[o] = minx[o] = pre[l];
... | ALGO | 0.999968 | 3.722493 |
97030997-cc6e-47b3-9f55-4d43920d6f48 | ysl2/kaoyan-data-structure | 00-Keypoint_in_WangDao/Chapter_02-List/01-LinkList/00-Basic_LinkList/03-DoubleCircleLinkList/00-DCLinkList_typedef.cpp | #include <iostream>
using namespace std;
typedef int ElemType;
typedef struct DCLinkNode { // Double Circle
ElemType data;
struct DCLinkNode *pre, *next;
} DCLinkNode, *DCLinkList;
void outPut(DCLinkList L) {
DCLinkNode *p = L->next;
while (p != L) {
cout << p->data << " ";
p = p->nex... | ALGO | 0.999865 | 5.177567 |
1d957e33-4b88-4dfd-80e5-1462767f5a8a | guiltiest-gear/cisp-301-lab | m12-lap.cpp | // Program : m12-lab.cpp
// Author : Jade Fox
// Due Date : April 23, 2023
// Description: Design a program that asks the user to enter a 10-character
// telephone number in the format XXX-XXX-XXXX. The program should
// display the telephone number with any alphabetic characters
// ... | ALGO | 0.891582 | 5.923744 |
27fd74b4-6ff2-4526-a44a-5f37f21cada1 | morris821028/UVa | volume009/972 - Horizon Line.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
struct LINE {
double st, ed, y;
};
int main() {
int n, m;
while(scanf("%d", &n) == 1) {
double a, b, sum;
double P[500];
LINE F[105], G[105];
int cnt = 0, i;
for(i = 0, sum = 0; i < n; i++) {
sca... | ALGO | 0.999756 | 3.953388 |
026cecc7-17a9-4257-a9f8-dfda1ed520c1 | RGBD/bsu-pdcomp-2016 | 01/main-bp-i.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[]) {
if (argc != 3) {
exit(EXIT_FAILURE);
}
size_t n = stoi(argv[1]);
size_t block_size = stoi(argv[2]);
vector<vector<int>> a(n, vector<int>(n));
vector<vector<int>> b(n, vector<int>(n));
... | ALGO | 0.99909 | 4.040569 |
97895852-7567-4d00-88bd-19be41b508a8 | MinhazulAbdinEmon/Grind | ToughCookies/LT-12. Integer to Roman.cpp | // Probelem link : https://leetcode.com/problems/integer-to-roman/submissions/1611558168/
class Solution {
public:
string intToRoman(int num) {
vector<string>symbols = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
vector<int>val ={1000,900,500,400,100,90,50,40,10,9,5,4,1};
st... | ALGO | 0.999417 | 6.336838 |
55e3f59d-5db4-4c47-aaa2-c2ff91a62dd8 | ishandutta2007/codeforces | t1dus/normal/876/C.cpp | /*input
20
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
#define pb push_back
#define INF 1000000000
#define mp make_pair
#define MOD 1000000007
#define F first
#define S seco... | ALGO | 0.999902 | 4.083614 |
dde82faf-005a-4b08-b366-ae6366f8347b | Tanishq0505/Array | 6E.cpp | // (Easy see code to understand)
// Cyclically rotate an array by one (GFG)
// Example 1:
// Input:
// N = 5
// A[] = {1, 2, 3, 4, 5}
// Output:
// 5 1 2 3 4
#include <iostream>
using namespace std;
// approach used
// Assign every element with its previous element and first element with the last element .
// Ill... | ALGO | 0.999924 | 6.335873 |
a126b68f-7288-4e03-9eb3-6717a6910d89 | OpenDelta-Team/enigma2-PLi | lib/gdi/font_arabic.cpp | /*
* This was taken from pango.
* Modified for enigma by Felix Domke <<EMAIL>>.
* I removed support for vowels and ligatures. Sorry.
*
* Original header:
*
* This is part of Pango - Arabic shaping module
*
* (C) 2000 Karl Koehler <<EMAIL>>
* (C) 2001 Roozbeh Pournader <<EMAIL>>
*
*/
#include <vector>
#incl... | TOOL | 0.873492 | 6.315763 |
6fe72465-264d-4c4c-9c8d-b04231124a2d | Dengqiang1/Quick-Cocos2dx-Community | cocos/3d/CCAABB.cpp | #include "3d/CCAABB.h"
NS_CC_BEGIN
AABB::AABB()
{
reset();
}
AABB::AABB(const Vec3& min, const Vec3& max)
{
set(min, max);
}
AABB::AABB(const AABB& box)
{
set(box._min,box._max);
}
Vec3 AABB::getCenter()
{
Vec3 center;
center.x = 0.5f*(_min.x+_max.x);
center.y = 0.5f*(_min.y+_max.y);
center.z = 0.5... | TOOL | 0.869189 | 7.540463 |
c8590736-9eaf-453b-8784-cbfb17632c57 | WantTo-Sleep/Linux | 每日一练/删除有序数组中的重复项.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums)
{
int pos = 0;
for (size_t i = 0; i < nums.size(); ++i)
{
if (nums[pos] != nums[i])
{
swap(nums[++pos], nums[i]);
}
}
return pos + 1;
}
}; | ALGO | 0.999828 | 6.198521 |
1e474cce-7822-40d5-9759-4cf7d252d49a | Marcythm/Python-Interpreter | test/i99/main.cpp | #include <fstream>
#include <iostream>
#include <string>
#include "../../src/support/i99.hpp"
str a, b;
i32 main() {
std::cin >> a >> b;
printf("%s\n", (i99(a) + i99(b)).as<str>().c_str());
printf("%s\n", (i99(a) - i99(b)).as<str>().c_str());
printf("%s\n", (i99(a) * i99(b)).as<str>().c_str());
printf("%s\n", (i... | ALGO | 0.97897 | 4.766379 |
35410419-8a4c-424e-a8da-9ef87dfbbfb4 | yash291/Eye-Motion-Tracking | opencv-master/samples/tapi/pyrlk_optical_flow.cpp | #include <iostream>
#include <vector>
#include <iomanip>
#include "opencv2/core/utility.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/video/video.hpp"
using namespace std;
using namespace cv;
typedef unsigned char... | ALGO | 0.978405 | 5.754824 |
d272ea8f-aa10-4da0-bc5d-f36cd382c32f | yangxiao-cd/learn2024 | 平闰年.cpp | #include<iostream>
#include<limits>
using namespace std;
/*ʵƽĹ */
int main()
{
//֪ʶʾ
cout<<"֪ʶ㣺"<<endl<<"һ" <<endl<<"겻" <<endl<<"İ" <<endl<<endl;
//ʼѭ
while(true){
//Ƿƽ
bool flag;
//
int year;
//ַͱ
string year_string;
//ӡʾ
cout<<"һ(ע⣬Ϊ4λ)";
//ռ
cin>>year;
//жǷ
if( cin.peek() !=... | ALGO | 0.99956 | 3.659139 |
7e462c4d-cc5f-4dfc-b64d-f0870454f497 | plasmatic1/dmoj-solutions | cpp/dmopc14c3p6.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2001, TMAX = 10001;
int n, t, old = 1,
dp[2][TMAX], profits[MAX][3], costs[MAX][3];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> t;
for(int i = 1; i <= n; i++){
cin >> costs[i][0] >> profits[i][0] >... | ALGO | 0.999744 | 3.798019 |
240e4fd0-cfc0-4589-9153-47d6c1b6efd4 | NDunkelberg/ap-test | libraries/SITL/SIM_Submarine.cpp | /*
Submarine simulator class
*/
#include "SIM_Submarine.h"
#include <AP_Motors/AP_Motors.h>
#include <stdio.h>
using namespace SITL;
static Thruster vectored_thrusters[] =
{ // Motor # Roll Factor Pitch Factor Yaw Factor Throttle Factor Forward Factor Lateral Factor
Thru... | TOOL | 0.907324 | 6.496596 |
8b8bf11d-037e-48af-ac8d-5a8a1c6ff339 | Bewenben/CodeProblems | I_love_%username% 155A - Codeforces/I_love_%username%.cpp | #include <iostream>
using namespace std;
int main()
{
int i, t = 0, n, a;
int min, max;
cin >> n >> a;
min = a;
max = a;
for (i = 1; i < n; i++)
{
cin >> a;
if (a > max)
{
max = a;
t++;
}
else if (a < min)
{
... | ALGO | 0.999883 | 3.500798 |
0ef0a270-9987-4091-a16e-f7eb17042a29 | madhusudan1das/C-_basic | sum_of_factors.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int i, n, sum = 0;
cout << "Enter n number: ";
cin >> n;
for (i = 1; i <= n; i++) {
if (n % i == 0) {
// Print the factor
sum += i; // Add the factor to sum
}
}
cout << "Sum of factors is:... | ALGO | 0.999595 | 5.761895 |
888d032c-ffa5-4177-ae57-54ccc106c8ce | I-Infinatoo/batS | changeLimit.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
#define log std::cout
void printHelp() {
std::cout << "\n'changeLimit' changes the upper and lower limit of the 'batS'";
std::cout << "\nchangeLimit receives two arguments as follows:\t";
std::cout << "changeL... | TOOL | 0.931735 | 3.694781 |
4cf9d99d-bdb0-4502-a138-a2c0495eb6f5 | forked-llvm/Polaris-Obfuscator | lldb/source/Host/common/Editline.cpp | #include <climits>
#include <iomanip>
#include <optional>
#include "lldb/Host/Editline.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBAssert.h"
#i... | TOOL | 0.909386 | 4.273655 |
2ccd9d17-9e7f-46d8-91ef-285911aabc00 | TsarIM/AI-Algorithms | NQs_dfs.cpp | #include <iostream>
#include <unordered_set>
#include <string>
using namespace std;
const int N = 8;
bool is_valid(string& state, int row){
for(int i=0; i<row; i++){
if(state[i]==state[row]||abs(state[i]-state[row])==row-i){
return false;
}
}
return true;
}
bool dfs(string& st... | ALGO | 0.99995 | 5.436979 |
e13368b3-030e-446b-bc08-7bb56632091a | manhnv2110/advanced-programmer | BAI TAP HANG TUAN/BT TUAN 11/bai1_linkedlist.cpp | #include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList {
public:
S... | ALGO | 0.999472 | 5.46396 |
5561e399-98d2-4c5a-86a3-d2208029f8de | akcube/Sewing-machine | src/needle.cpp | #include <bits/stdc++.h>
#include <utils.h>
#include <sys/mman.h>
using namespace std;
#define d(i, j) ((i) * (m + 1) + (j))
int needle(char* seq1, int n, char* seq2, int m, int match, int mismatch, int gap) {
int (*dp)[m+1] = (int (*)[m+1]) page_alloc(sizeof(int) * (m+1) * (n+1));
for (int i = 1; i <= n; i++) {
... | ALGO | 0.99984 | 4.641669 |
7a906aad-bc04-4e90-81f8-0bf76fef4db7 | vaishali614/Coding-Interview-Preparation | Day 1 - Arrays/3. missingNumber.cpp | /** 3. Missing Number **/
/*
1) sort and compare with each index - T : O(nlogn) & S : O(1)
2) use hashset to track occurrence of each element - T : O(n) & S : O(n)
3) (ans) bit manipulation - T : O(n) & S : O(1) =>
ll ans = n;
for(ll i = 0; i < n; i++){
ans ^= (i ^ a[i]);
}
4) (ans) Gauss' Fo... | ALGO | 0.999929 | 4.479814 |
c996dd8c-36d8-4e56-8dbe-b04c90a4c563 | aashnajc1/CCC-Phase-5 | DP B1 More Similarities Between Sequence.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
cin >> m;
vector<int> b(m);
for (int i = 0; i < m; i++) {
cin >> b[i];
}
vector<vector... | ALGO | 0.999964 | 4.543667 |
8aa00dee-2179-4118-9517-3cacc6350a95 | jaejunha/Programmers | 완주하지 못한 선수.cpp | #include <string>
#include <vector>
#include <map>
using namespace std;
string solution(vector<string> participant, vector<string> completion) {
string answer = "";
map <string, int> m;
map<string, int>::iterator iter;
int size = completion.size();
for (int i = 0; i < size; i++){
ite... | ALGO | 0.999685 | 5.502242 |
85114280-264b-4aa5-a4f9-c02c97dd2108 | Pandanila/misis_proga | anikin_d_a/bpm_22_1_1.cpp | #include <iostream>
#include <cmath>
int main() {
float x = 0.1;
float delta_x = 0.05;
float eps = 0.0001;
float s = 0;
float elem = 0;
while (x <= 1.001){
for (int i = 1; i < 100000000; i += 1){
elem = std::pow(-1, i + 1) * (std::pow(x, 2*i+1) / (4 * std::pow(i, 2) - 1));
... | ALGO | 0.999516 | 4.044766 |
71174aa5-cb0e-470f-813e-07157fdc9776 | Sujal3013/CP-practice | Implementation/791A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,i=0;
cin>>a>>b;
while(a<=b){
a=3*a;
b=2*b;
i++;
}
cout<<i;
} | ALGO | 0.999836 | 3.58431 |
d5539a25-6f7c-4edb-b10c-827fbe03efe3 | smhemel/LeetCode | 714. Best Time to Buy and Sell Stock with Transaction Fee.cpp | class Solution {
int free[50000], hold[50000];
public:
int maxProfit(vector<int>& prices, int fee) {
int n = prices.size();
hold[0] = -prices[0];
free[0] = 0;
for (int i=1; i<n; i++) {
hold[i] = max(hold[i-1], free[i-1]-prices[i]);
free[i] = max(free[i-1]... | ALGO | 0.999832 | 5.570193 |
954aa055-7f77-4424-8a2d-b03b90d1cd59 | Fresh-hongsi/BaekjoonCpp | 1075-나누기.cpp | #include <iostream>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int N = 0;
cin >> N; //대상이 되는 수 입력
int F = 0;
cin >> F; //나누는 수 입력
int num_2 = (N % 100) / 10; //10의 자리수 숫자
int num_1 = (N % 10); //1의 자리수 숫자
for (int i = 0; i <= 99; i++)
{
... | ALGO | 0.999029 | 3.694115 |
cd795ab4-10a6-4e52-8004-80c1f9eeadb9 | abhishek18124/PPCPPFeb2025 | Lecture 27/007Stacks_AsteroidCollision.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;
// time : O(n)
// space: O(n) due to stack<>
vector<int> asteroidCollision(vector<int>& asteroids) {
stack<int> s;
for (int ast : asteroids) {
if (ast < 0 and !s.empty() and s.top() > 0) {
// collisions will happe... | ALGO | 0.999966 | 5.460202 |
8d16c62f-784e-4f87-b25c-183967a26bdc | TCGBench/TCGBench | data/human_performance_code/human_performance_code_noip/P1309/ac_4.cpp | #include<bits/stdc++.h>
using namespace std;
struct str{
int id,s,w;
};
int n,r,q;
str a[200010],los[100005],win[100005];
bool cmp(str x,str y){
if(x.s!=y.s)
return x.s>y.s;
return x.id<y.id;
}
int main(){
cin>>n>>r>>q;
for(int i=1;i<=2*n;i++) cin>>a[i].s;
for(int i=1;i<=2*n;i++) cin>>a[i].w;
for(int i=1;i<=2... | ALGO | 0.999972 | 3.414411 |
4dfc58a5-4b94-458b-92c0-52608d747fb9 | aman-kumar162/local_random_repository | dp17_countsequence.cpp | #include<bits/stdc++.h>
using namespace std;
int possible(vector<int> arr,int target){
int n=arr.size();
vector<int> dp(target+1,0);
dp[0]=1;
if(arr[0]<=target) dp[arr[0]]=1;
vector<int> curr(target+1,0);
for(int ind=1;ind<n;ind++){
curr[0]=1;
for(int tar=1;tar<=tar... | ALGO | 0.999955 | 5.073311 |
de8dd4cb-e543-4689-bd7e-98a640583aca | apartisan/Clasa-XI | 02 subprograme/subprograme cu vectori.cpp | #include <iostream>
using namespace std;
int dubleaza(int nr){
nr = nr*2;
return nr;
}
void transforma(int n, int x[]){
for (int i=0; i<n;i++)
x[i] = dubleaza(x[i]);
}
void afiseaza(int n, int x[]){
for(int i=0; i<n; i++)
cout << x[i] << " ";
}
int main(){
int n, a[10];
cin>>n... | ALGO | 0.999591 | 3.610626 |
98b6596a-8563-4516-9a0a-f3c4fbf7093d | asvikr/SPOJ_SOL | LITE/13058456.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int tree[400004];
int lazy[400004];
void update(int tl,int tr,int l,int r,int node)
{
int mid=(tl+tr)/2;
if(lazy[node])
{
tree[node]=(tr-tl+1)-tree[node];
if(tl!=tr)
{
lazy[node*2]^=1;
lazy[node*2+1]^=1;... | ALGO | 0.999859 | 3.928748 |
2ac520b2-1411-4b8c-b785-d64c1007a999 | Zuzla/cppbackend | sprint3/problems/instrumentation/precode/v2/dotgen.cpp | #include <assert.h>
#include "graph.h"
#define BUFSIZE 100
#undef DEBUG
/* a pointer to this struct * is passed on to FindTreshold while walking */
struct findtreshold_arg
{
int n_edges;
int current_treshold;
};
void CountEdges (void * content, void * arg)
{
findtreshold_arg * args = (findtre... | ALGO | 0.977146 | 4.622462 |
38837b34-7043-41f4-a4ea-c8c2be992ff4 | PauOlmos/REGULAR_ENGINE | REGULAR_ENGINE/MathGeoLib/include/Math/MathFunc.cpp | /** @file MathFunc.cpp
@author Jukka Jylnki
@brief Common mathematical functions. */
#include "MathFunc.h"
#include "SSEMath.h"
#ifdef MATH_ENABLE_STL_SUPPORT
#include <utility>
#include <algorithm>
#endif
#include "myassert.h"
#include "float2.h"
#ifdef WIN32
#include <Windows.h>
#endif
MATH_BEGIN_NAMESPACE
bool... | ALGO | 0.968044 | 6.636246 |
938cb9bd-d8ce-4354-88ab-2b72525aec7f | citrux/SemiclassicalMonteCarlo | src/find_probability.cpp | #include <fstream>
#include "find_probability.h"
#include "material_specific.h"
#include "logger.h"
#include "config.h"
#include "text_files.h"
using namespace std;
vector<Point> momentums_with_energy_in_direction(double theta,
double energy_value) {
int n = config... | ALGO | 0.999628 | 4.621052 |
d5ee0853-1ba7-4e7e-a88d-970eddbe3215 | pankajjindal/DailyCoding | c++/datastructures/stl/stl/transform1.cpp | #include <set>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>
#include "print.hpp"
int square (int value)
{
return value*value;
}
int main()
{
std::set<int> coll1;
std::vector<int> coll2;
// insert elements from 1 to 9 into coll1
for (int i=1; i<=9; ++i) {
... | ALGO | 0.965494 | 5.295091 |
1155303e-3660-42e1-aeb6-49de13d7eb34 | urvashidbhavsar/SE | C++ Language/program-13_friendFunction.cpp | /* Write a program to swap the two numbers using friend function */
#include<iostream>
using namespace std;
class swapping{
int temp, a, b;
public:
swapping(int a, int b){
this ->a = a;
this ->b = b;
}
friend void Swap(swapping &s);
};
void Swap(swapping &s){
cout << "\n before swapping : "<<s.a << ... | ALGO | 0.995882 | 5.390449 |
f8739a88-bc9e-45a2-a841-441892188799 | jxzb1988/Parallel_CAVIAR | ecaviar.cpp | #include <iostream>
#include <algorithm>
#include <fstream>
#include <string>
#include <cmath>
#include <math.h>
#include <cctype>
#include <unistd.h>
#include "Util.h"
#include "PostCal.h"
#include "CaviarModel.h"
using namespace std;
bool checkInputFiles(string zFile1, string zFile2, string ldFile1, string ldFile... | DATA | 0.925243 | 3.781873 |
4e2d19e1-9248-49de-9e5f-2caab13f6c38 | poorvikaa08/Cpp | Patterns/triangle_num1.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
for(int i=0; i<n; i++)
{
for(int j=0; j<i+1; j++) // 0 --> i OR 1 --> i+1
{
cout << i+1 << " ";
}
cout << endl;
}
return 0;
} | ALGO | 0.999956 | 3.816247 |
1d35853c-767f-4532-9ab5-dbcb2bfdd691 | petrarce/fluid_simulation_framework | extern/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999703 | 4.076589 |
771e4d65-73c5-4985-9d1c-9b3f86bd3669 | ayan2809/Competitive-Coding | Coding Ninjas/nthFibonacciDP_iterative.cpp | #include<bits/stdc++.h>
using namespace std;
int fibo_3(int n)
{
int *ans= new int(n+1);
ans[0]=0;
ans[1]=1;
for(int i=2;i<=n;i++)
{
ans[i]=ans[i-1]+ans[i-2];
}
return ans[n];
}
int fibo_helper(int n, int *ans)
{
if(n<=1)
return n;
// check if output already exists
if(ans[n]!=-1)
{
return ans[n];
}
i... | ALGO | 0.999964 | 4.796818 |
b096595f-46ba-4d8f-a850-2ae003ceb58f | Bharatbardiya/my-leetcode-solutions | 0155-min-stack/0155-min-stack.cpp | class MinStack {
public:
stack<int>st;
stack<int>monost;
MinStack() {
}
void push(int val) {
st.push(val);
if(monost.size()==0 or monost.top()>=val) monost.push(val);
}
void pop() {
int val = st.top(); st.pop();
if(monost.top()==val) monost.... | ALGO | 0.999882 | 6.564688 |
6526aec4-b4ee-4e94-95c7-30cc43a7a7ae | BobaFettyW4p/HW4 | HW4-3.cpp | #include<algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
/**the main issue with this code relates to the std::for_each() operation within the main() function
* What was happening on the original version of this program given on the homework slide
* is that each item in the names ... | ALGO | 0.997111 | 6.055416 |
01751dcc-6cfa-41d4-875f-3bf033e3976d | akshith-07/Leetcode-Solutions | 2346-largest-3-same-digit-number-in-string/2346-largest-3-same-digit-number-in-string.cpp | class Solution {
public:
string largestGoodInteger(string num) {
vector<string> patterns = {"999","888","777","666","555","444","333","222","111","000"};
for (auto &p : patterns) {
if (num.find(p) != string::npos) return p;
}
return "";
}
};
| ALGO | 0.999883 | 6.192667 |
32c802b0-1944-42b4-872c-d21889ad37ce | yogibala/leetcode | solutions/2055. Plates Between Candles/2055.cpp | class Solution {
public:
vector<int> platesBetweenCandles(string s, vector<vector<int>>& queries) {
vector<int> ans;
vector<int> indices; // indices of '|'
for (int i = 0; i < s.length(); ++i)
if (s[i] == '|')
indices.push_back(i);
for (const vector<int>& query : queries) {
con... | ALGO | 0.999564 | 6.504184 |
cb941986-520e-44de-addd-680ada236d09 | AnriaruDoragon/VKMNAU-CPP-Exercises | Homeworks/23/Homework23_Ex1.cpp | #include <iostream>
using namespace std;
int min(int a[4][3]) {
int minimum = INT_MAX;
for (int i=0; i<4; i++) {
for (int j=0; j<3; j++) {
if (a[i][j] < minimum) minimum = a[i][j];
}
}
return minimum;
}
int main()
{
int array[4][3];
for (int i=0; i<4; i++) {
... | ALGO | 0.999761 | 4.036 |
52efd4ff-a56b-4c0c-bfe5-f5efb3417fbe | Metichrou/AIZOPROJEKT2 | Prim.cpp | #include "Prim.h"
#include <iomanip>
#include <queue>
void Prim::PrimMacierz(int wierzcholki, int krawedzie, int** tab) {
auto begin = std::chrono::high_resolution_clock::now();
std::vector<int> poprzednik(wierzcholki, -1);
std::vector<int> key(wierzcholki, INT_MAX);
std::vector<bool> wMST(wierzcholki... | ALGO | 0.999406 | 4.609671 |
c07ffc2f-2a05-42f5-8cca-677c97267f8a | kyllen1/Arrays | Arrays/Arrays.cpp | // Tinkering with arrays
#include <iostream>
#include "Sorter.h"
using namespace std;
// Forward declaration of functions
double average(double* vector, int size, int avg);
double addUp(double* vector, int size, int sum);
double maximum(double* vector, int size, int max);
double minimum(double* vector, int size, int ... | ALGO | 0.999522 | 5.457603 |
2667e9ce-a907-4c14-a130-b1212aebeeac | CalebMason/FirstGame | Engine/Source/ThirdParty/CryptoPP/5.6.5/include/pssr.cpp | // pssr.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "pssr.h"
#include "misc.h"
#include <functional>
NAMESPACE_BEGIN(CryptoPP)
// more in dll.cpp
template<> const byte EMSA2HashId<RIPEMD160>::id = 0x31;
template<> const byte EMSA2HashId<RIPEMD128>::id = 0x32;
template<> const ... | ALGO | 0.945986 | 7.44879 |
77b31541-d672-4800-ae90-8c957d621741 | seaify/poj-codes | 1603/4911859_TLE.cpp | #include<stdio.h>
int i,j,k,m,t,map[25][25];
int main()
{
int t=0;
while(1)
{
for(i=1;i<=20;++i)
{
for(j=1;j<=20;++j)
map[i][j]=100;
map[i][i]=0;
}
for(i=1;i<=19;++i)
{
scanf("%d",&k);
while(k--)
{
scanf("%d",&j);
map[i][j]=map[j][i]=1;
}
}
for(k=1;k<=20;++k)
... | ALGO | 0.992651 | 3.13339 |
6b53166f-7946-4b84-8f52-9761e8c9b180 | brinottage/project5 | Project05/Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.954734 | 6.933585 |
24cf45f8-ff4a-42db-bce5-c2b2abab5616 | as535364/Leetcode-Solution | 2966-divide-array-into-arrays-with-max-difference/2966-divide-array-into-arrays-with-max-difference.cpp | class Solution {
public:
vector<vector<int>> divideArray(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int n = nums.size(), groupCnt = n / 3, groupSize = 3;
vector<vector<int>> res;
for (int i = 0; i < groupCnt; ++i) {
if (nums[i * groupSize + 2] - ... | ALGO | 0.999933 | 5.765036 |
92fb3553-1360-4fc7-9274-1642ef6fdc44 | rsharifnasab/sbu_basic_programming | tamrin7/visit.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
//int s[n],d[n];
int s,d;
cin >> s >> d;
int today =s;
cerr << "today:" << today << endl;
for(int i=1;i<n;i++) // get number from user
{
cin >> s >> d;
// s[i] = s; d[i] = d;
int k =1;
for(k=0;s+k*d<= today;k++);
... | ALGO | 0.999822 | 3.141874 |
34917e06-00a2-4fc6-8c2d-932d8e65ccc8 | ritikbanger/Hacktoberfest2022-DSA | 04. Arrays/remove_duplicate.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{
public:
int remove_duplicate(int a[],int n){
// code here
int i,j;
for(i=1,j=0;i<n;i++){
if(a[i]!=a[j]){
... | ALGO | 0.999832 | 5.879448 |
6c3ecc6c-61dc-437d-bf99-edc12c562dc5 | Aman-107/CPP | DS problem/Counting_Valleys.cpp | // #include <bits/stdc++.h>
// using namespace std;
// string ltrim(const string &);
// string rtrim(const string &);
// /*
// * Complete the 'countingValleys' function below.
// *
// * The function is expected to return an INTEGER.
// * The function accepts following parameters:
// * 1. INTEGER steps
// * 2... | ALGO | 0.999991 | 6.068552 |
aa4aceed-0964-4a59-8ef2-1772b2a290d1 | flucloxin500/Problem-Solving | Codeforces/Sheet 1/C.cpp | #include <iostream>
using namespace std ;
int main () {
long long X,Y,a,b,c;
cin>>X>>Y;
a = X + Y;
b = X * Y;
c = X - Y;
cout<<X<<" + "<<Y<<" = "<<a<<endl;
cout<<X<<" * "<<Y<<" = "<<b<<endl;
cout<<X<<" - "<<Y<<" = "<<c<<endl;
}
| ALGO | 0.99866 | 3.724268 |
96ddaf73-774f-4ad0-9573-39b4e23f15df | chowon986/Study | 백준 알고리즘/포도주 시식/포도주 시식.cpp | // 이전 풀이
//#include <iostream>
//using namespace std;
//
//int D[10001][4];
//int A[10001];
//
//int main()
//{
// int Cnt;
// cin >> Cnt;
//
// for (int i = 1; i <= Cnt; i++)
// {
// int N;
// cin >> N;
// A[i] = N;
// }
//
// for (int i = 1; i <= Cnt; i++)
// {
// D[i][0] = max(D[i - 1][0], max(D[i - 1][1], D[i ... | ALGO | 0.99998 | 4.298508 |
9fbd33c7-e05a-4ea6-92cf-fe19bc2011c9 | cbajs12/BOJ | primeNumber/1929.cpp | #include <iostream>
#include <memory.h>
using namespace std;
int main(void){
int num1, num2;
cin>>num1;
cin>>num2;
int count = 0;
int temp;
int nums[1000001];
memset(nums, 0, sizeof(nums));
nums[1]=1;
for(int i=2; (i*i)<=1000000; ++i){
if(nums[i] == 0){
for(in... | ALGO | 0.999878 | 3.317158 |
fa91de67-708a-4a83-a21e-6966c39cc901 | ChavaAg/Respaldo-Universidad | Seminario de Estructura de Datos I/SED Akinator/BTNodo.cpp | #include "BTNodo.h"
BTNodo::BTNodo() {
pIzda = nullptr;
pDcha = nullptr;
}
void BTNodo::insertar(string szDato,string szPregunta) {
this->pIzda = new BTNodo;
this->pDcha = new BTNodo;
this->pIzda->szOracion = szDato;
this->pDcha->szOracion = this->szOracion;
this->szOracion = szPregunta;
}
BTNodo* BTNodo::g... | ALGO | 0.979826 | 3.776398 |
51243380-c063-4ea9-ae28-af3c06b11609 | Elaine-DWL/shuati_record | leetcode_206_reverse linked list.cpp | // 3个指针实现
class Solution {
public:
ListNode* reverseList(ListNode* head) {
if(!head || !(head->next)) return head;
ListNode *a, *b, *c;
a = head;
b = head->next;
c = b->next;
a->next = NULL;
while(1){
b->next = a;
a = b;
if(... | ALGO | 0.999991 | 5.39453 |
f2271acd-bb6b-4e1c-b593-d3288512c5be | Erdoog/FreeBus | 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.998762 | 6.786404 |
8e671a1a-1314-4e95-b28f-10e3d794e459 | poojaullegaddi/DSA | maxele.cpp | // finding maximum element and index of array
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int a[20],n;
cout<<"enter the size of the array" <<endl;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
if(n==0)
return 0;
int maxe,maxi;
maxe=a[0];
maxi=0;
for(int i=0;i<n;i++)
{
if(a[... | ALGO | 0.999804 | 3.633829 |
9636f1d4-498e-4257-bd5b-1a85a50d50b4 | azpranto/DSAwithCPP | arraypointers.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int arr[] = { 1, 2, 3, 4, 5};
cout << "address of arr: " << arr << endl; // array itself is a pointer which has a location and it always points 0th index element. the address is basically the address of the 0th value location
cout <<... | ALGO | 0.951383 | 3.727639 |
777001b6-af43-40ca-baaa-04bbc8c6b49c | Dhruv100404/AA-LABS | L11/approx vertex cover.cpp | #include <iostream>
#include <vector>
class VCP {
private:
int V;
public:
VCP(int v) {
V = v;
}
void printVertexCover(std::vector<std::vector<int>> &g) {
std::vector<bool> visited(V, false);
for (int i = 0; i < V; i++) {
if (!visited[i]) {
... | ALGO | 0.99927 | 6.453769 |
a3b10af0-84c2-49a5-9968-bc308b132a9f | sarafanshul/Codes | OJs/257B.cpp | #pragma GCC optimize("Ofast") // remove in mingw32 bit ;
#pragma GCC target("avx,avx2,fma")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define l... | ALGO | 0.999714 | 4.678471 |
3e999a89-dddc-438a-bad4-a968662771bb | ashwi23/cd-lab | EXP5/topdownparser.cpp | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char lookahead;
void match(char expected) {
if (lookahead == expected)
lookahead = getchar();
else {
fprintf(stderr, "Syntax error: Expected '%c' but found '%c'\n", expected, lookahead);
exit(EXIT_FAILURE);
}
}
void express... | ALGO | 0.990234 | 3.88989 |
82b2d144-fb5b-4e66-982a-a3ba2443372a | RohitKumarSinha/coadingNinjas | DS/TimeAndSpaceComplexity/ArrayIntersection.cpp | void helper(int *arr1, int *arr2, int n, int m)
{
if (n == 0 || m == 0)
{
return;
}
else
{
if (arr1[0] == arr2[0])
{
cout << arr1[0] << " ";
helper(arr1 + 1, arr2 + 1, n - 1, m - 1);
}
else if (arr1[0] > arr2[0])
{
helper(arr1, arr2 + 1, n, m - 1);
}
else
... | ALGO | 0.99999 | 4.369669 |
a3c4279f-7eea-4a80-a4f5-7c9e5e10ded6 | ApolloOS/frameworks_base | libs/androidfw/misc.cpp | #define LOG_TAG "misc"
//
// Miscellaneous utility functions.
//
#include <androidfw/misc.h>
#include "android-base/logging.h"
#ifdef __linux__
#include <sys/statvfs.h>
#include <sys/vfs.h>
#endif // __linux__
#include <cstring>
#include <cstdio>
#include <errno.h>
#include <sys/stat.h>
namespace android {
/*
*... | TOOL | 0.879583 | 6.662138 |
f7c4cd38-098b-4b21-8bdd-1ca8ed2ed874 | Masterqsx/ProgrammingPractice | leetcode/88_MergeSortedArray/MergeSortedArray.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
if(n==0) return;
int end1=m-1;
int end2=n-1;
int end_new=m+n-1;
while(end_new>=0){
if((end1>=0)&&(end2>=0)){
nums1[end_new]=nums1[end1]>nums2[end2]?nums1[en... | ALGO | 0.999988 | 5.334122 |
313286ed-5869-4425-b16e-407013004740 | beratkirik/CPP-Programming-for-Financial-Engineering | Practice/Level9/Exercises/Group D/Group D/UtilitiesDJD/VectorsAndMatrices/MatrixMechanisms.cpp | // MatrixMechanisms.cpp
//
// Mechanism functions for matrices.
//
// Modification dates
//
// DD 2004-4-3 Kick off
// DD 2004-4-9 Power method, code review and round-off
// DD 2005-12-1 Extracting a row fom a Matrix (can be optmised)
// DD 2006-8-6 set_diagonal() commented out
//
// (C) Datasim Education BV 2004-20... | TOOL | 0.97068 | 4.056229 |
b17ec8dc-4625-45fe-8e32-689a0246b289 | wangtongxue-369/xcpc_Code_file | file/codeforces/race/987_div2/D2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PII pair<ll, ll>
const ll mod = 1e9 + 7;
const ll MAXN = 500005;
const ll base1 = 131;
const ll base2 = 127;
ll _ = 1, n, m, ans = 0; // a[MAXN], f[MAXN];
vector<vector<ll>> ve(MAXN ... | ALGO | 0.999941 | 3.467083 |
477b8a0d-6640-4f17-9b9b-08f292b610d8 | olafraczek/ProceduralProgramming-AGH_COURSE | 1.calc/calc/DStack.cpp | #include "DStack.h" // "" bo moj plik nagl
#include <iostream>
using namespace std;
#include <stdio.h>
/*
#define MAXDSTACK 20
double DStack[MAXDSTACK] = { 0 }; //stos znakowy
int nDHead = 0; // indeks pierwszego wolnego miesca na stosie
*/
DStackItem* createDStack()
{
/*
memset( DStack, 0, MAXDSTACK * sizeof... | ALGO | 0.997566 | 3.320603 |
79e64358-b613-4c32-ab95-ea7f69b190b2 | astyalova/algorithms_tasks | ya/sprint_3/final/eff_quick_sorting.cpp | /*
https://contest.yandex.ru/contest/23815/run-report/130355857/
-- ПРИНЦИП РАБОТЫ --
Алгоритм реализует in-place быструю сортировку (quick sort). Основной принцип работы:
Выбирается опорный элемент (pivot), середина текущего диапазона. Два указателя, i и j,
перемещаются по массиву: i двигается вправо, пока элементы м... | ALGO | 0.999893 | 5.485439 |
e2f6698f-f754-4089-9185-c60ce6da2ccb | tx19980520/Implement-the-algorithm-with-c-- | RADIXSORT.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int max = 0;
int num = 0;
cout << "for your length" << endl;
cin >> max;
int *b = new int[max + 1];
int f = 1;
for (int i = 1; i <= max; ++i) {
b[i] = f; // the first is 1
f *= 10;
}
cout << "for your num" << endl;
cin >... | ALGO | 0.999759 | 3.268764 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.