uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b063ff35-7ef7-436a-9540-bb333d908717 | sandeep62/leetcode-problems | 2144-maximum-difference-between-increasing-elements/maximum-difference-between-increasing-elements.cpp | class Solution {
public:
int maximumDifference(vector<int>& nums) {
int n=nums.size();
int res=nums[1]-nums[0];
int minval=nums[0];
for(int i=1;i<n;i++)
{
res=max(res,nums[i]-minval);
minval=min(minval,nums[i]);
}
if(res>0)
{
... | ALGO | 0.999984 | 5.470532 |
da69bd7f-3432-4a71-aed2-5005957e574d | naveenvashistha/DSA-C- | graphs/disjoint set data structure/main.cpp | #include <bits/stdc++.h>
using namespace std;
class disjoint{
vector<int> rank, size, parent;
public:
disjoint(int n){
//considering 1 based indexing
rank.resize(n + 1, 0);
size.resize(n + 1, 1);
parent.resize(n + 1);
for(int i = 0; i < n + 1; i++) parent[i] = i;
... | ALGO | 0.999691 | 4.258666 |
848e9689-d500-4fcb-8773-3ea73782a77b | Mashfiq137/UVa | SummingDigits.cpp | #include<bits/stdc++.h>
using namespace std;
int fun(int n){
if(n<10) return n;
int sum = 0;
while(n){
sum += n%10;
n = n/10;
}
return fun(sum);
}
int main(){
int n;
while(1){
... | ALGO | 0.999874 | 4.523982 |
03dbdd96-d203-4b73-aca9-04a5afe64877 | onecode369/CompetitiveProgramming | CodeChef/IARCSJUD/LEAFEAT.cpp | #include <bits/stdc++.h>
#define DEBUG(x) cerr << #x << " = " << x << endl
#define MOD 1e9+7
#define INF INT_MAX
#define reset(arr,n,i) fill(arr,arr+n,i)
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
ios::sync_with_st... | ALGO | 0.999948 | 3.666533 |
bc5c404f-f14a-4748-9f0a-8568ce32c232 | chaoer/mvs-texturing | libs/mrf/icm_graph.cpp | #include <limits>
#include "icm_graph.h"
MRF_NAMESPACE_BEGIN
ICMGraph::ICMGraph(int num_sites, int) :
sites(num_sites) {}
ENERGY_TYPE ICMGraph::compute_energy() {
ENERGY_TYPE energy = 0;
for (std::size_t i = 0; i < sites.size(); ++i) {
Site const & site = sites[i];
energy += site.data_co... | ALGO | 0.999223 | 6.483231 |
dc925533-8cf4-4c75-863e-10c1873424cd | harshabangi/leetcode | cpp/recursion_and_dp/lexigographical_numbers.cpp | //
// Created by Harsha Vardhan on 18/07/22.
//
#include <iostream>
#include <vector>
using namespace std;
void lexicalOrderHelper(int t, int n, vector<int> &ans) {
if (t > n) return;
ans.push_back(t);
for (int i = 0; i <= 9; i++) {
lexicalOrderHelper(t * 10 + i, n, ans);
}
}
vector<int> lex... | ALGO | 0.999167 | 6.708859 |
d7b2b81d-47a0-43e6-abbb-7658dbbd33c4 | vvnewyear/opencv455 | samples/dnn/dasiamrpn_tracker.cpp | // DaSiamRPN tracker.
// Original paper: https://arxiv.org/abs/1808.06048
// Link to original repo: https://github.com/foolwood/DaSiamRPN
// Links to onnx models:
// - network: https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
// - kernel_r1: https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_k... | TOOL | 0.979263 | 6.385364 |
f5e49797-1842-4988-9a76-0a9d6994e06f | ahmedhussein622/OJ | UVA/UVA-108 - Maximum Sum.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("input.txt", "r", stdin);
int a[110][110];
memset(a, 0, sizeof(a));
int n;
while(scanf("%d", &n) != EOF) {
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
scanf("%d", &a[i][j]);
a[i][j] += a[i - 1][j];
}
}
... | ALGO | 0.999909 | 3.126881 |
3a83c527-ae81-46ef-95a8-6e5d9ea1e79e | seock1000/BeakJoon | C/SumOfBigInteger/SumOfBigInteger/SumOfBigInteger.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
typedef int Data;
typedef struct _node {
Data data;
struct _node* next;
} Node;
typedef struct _stack {
Node* top;
} Stack;
void StackInit(Stack* pstack) {
pstack->top = NULL;
}
void Push(Stack* pstack, Data ... | ALGO | 0.999847 | 3.44956 |
46dc32b7-5c37-49bf-8484-c2a2548affa0 | Strawberry9583/LeetCode | Challenge/July_LeetCoding_Challenge/Day6_plus_one/Day6_plus_one/Day6_plus_one.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
std::vector<int> result(digits);
result.insert(result.begin(), 0);
++(*result.rbegin());
for (auto ele = result.rbegin(); ele != result.rend(); ++ele) {
if ((*el... | ALGO | 0.99841 | 5.586078 |
abaa5256-a647-4904-a0c4-f69b9ad01ec3 | lakshya-8000cr/DSA | STRINGSCHARACTER/findfunction.cpp | #include<iostream>
#include<string>
using namespace std ;
int main(){
string name;
getline(cin , name); // now we will use most usefull function find function which will help us to ind the substr inside the string
string str2;
getline(cin , str2); // ye hum isliye le rahe hai ki str2 ko search karege ... | ALGO | 0.977813 | 3.240416 |
83855ae3-b5e6-45ae-9cbb-7104cc291ec2 | tle-huu/xbrain-hackathon | faisss/hamming.cpp | // -*- c++ -*-
/*
* Implementation of Hamming related functions (distances, smallest distance
* selection with regular heap|radix and probabilistic heap|radix.
*
* IMPLEMENTATION NOTES
* Bitvectors are generally assumed to be multiples of 64 bits.
*
* hamdis_t is used for distances because at this time
* it is... | ALGO | 0.999316 | 5.529766 |
ecdcff2a-0a8e-4616-8b2c-9c1031181eef | yyytir777/Codes | C++/Baekjoon/1269.cpp | // 1269 cpp
#include <bits/stdc++.h>
using namespace std;
int a, b;
map<int, int> cnt;
void input() {
}
void solve() {
}
int main() {
cin >> a >> b;
int tmp;
for(int i = 0; i < a; i++) {
cin >> tmp;
cnt[tmp] = 1;
}
for(int i = 0; i < b; i++) {
cin >> tmp;
// tmp 값이 존재하면 삭제
if(cnt.... | ALGO | 0.999851 | 3.56204 |
f3110a27-c456-43a6-9b40-3a98cfaf0343 | Nand24/Leetcode-Summary | 908-middle-of-the-linked-list/middle-of-the-linked-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* middleNode(... | ALGO | 0.999901 | 5.748538 |
bde6fee3-3253-4572-b401-dd4c16621a74 | SalvageMod/platform_frameworks_base | media/libstagefright/codecs/amrnb/enc/src/levinson.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/levinson.c
Funtions: Levinson_init
Levinson_reset
Levinson_exit
Levinson
------------------------------------------------------------------------------
MODULE DESCRIPTI... | ALGO | 0.998827 | 6.290952 |
3925fb78-bf4b-4248-bb67-0cc57ba18c45 | hrushikesht/CompetitiveProgramming | March'17/cf406/1.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#include <utility>
#include <tuple>
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int>
#define tiii tuple<int,int,int> >
#define tiiii tuple<int,int,int,int>
#define pl pair<ll> pl
#define vpi vector< pair<int,int> >>
#define pb... | ALGO | 0.999834 | 3.33044 |
2efdb9b9-54a3-450f-8723-3cf3b710d6a0 | pepeneif/digitaldirham | src/scrypt.cpp | #include "scrypt.h"
#include "util.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
#if defined(USE_SSE2) && !defined(USE_SSE2_ALWAYS)
#ifdef _MSC_VER
// MSVC 64bit is unable to use inline asm
#include <intrin.h>
#else
// GCC Linux or i686-w64-mingw32
#include <cpuid.h>
#endif
#e... | ALGO | 0.984991 | 5.033745 |
24467000-7e26-489c-afab-533e3ac80cdb | hmofrad/CodingPractice | skinnyleetcode/RLEIterator.cpp | /*
* https://leetcode.com/problems/rle-iterator/submissions/
* (c) Mohammad Hasanzadeh Mofrad, 2020
* (e) <EMAIL>
*/
class RLEIterator {
public:
std::vector<int> seq;
int size = 0;
int index = 0;
RLEIterator(vector<int>& A) {
seq=A;
size=seq.size();
index = 0;
}
... | ALGO | 0.999341 | 5.777528 |
efb4948a-5d0b-4317-8f01-665f36775967 | ishikabansal04/Hackerrank | C++/STL/VectorErase.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin>>n;
vector<int> input(n);
for(int i=0;i<n;i++){
cin>>input[i];
}
in... | ALGO | 0.999271 | 3.016108 |
d6203d62-5c78-452e-b893-adab5256a014 | Mohammad-Ashikul-Islam/Competitive_Programming | CPS Academy/Addition, Subtraction.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;
... | ALGO | 0.997684 | 4.507707 |
2255028d-4dca-49f8-b768-bfebdd9091e3 | dabralhd/algo_design | cpp/jumping_on_clouds.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the jumpingOnClouds function below.
int jumpingOnClouds(vector<int> c) {
unsigned int jumps = 0;
int i = 0;
while ( i != c.size() - 1) {
if( ( (i+2) <= (c.size() - 1)) && (c[i+2] == 0) ) {
i += 2;
... | ALGO | 0.999979 | 5.165146 |
742ad0eb-d247-40b6-b614-f56f5e62bdbe | raincross7/code-similarity | codes/train_code/problem470/problem470_272.cpp | #include <stdio.h>
#include <string.h>
#define MAX_STR_LEN 102
int CheckBracket(char *bracketStr, int *bracketStrIdx, char inputStr);
int main()
{
char inputStr[MAX_STR_LEN] = {'\0'}; // Array for input string
int inputStrLen = 0; // Length of input string
char bracketStr[MAX_STR_LEN] = {'\0'}; // Array... | ALGO | 0.999852 | 4.173918 |
1af4ddf0-9316-44d0-bd2d-1e60429b8ddd | SignumV/SignumV | src/chainparams.cpp | #include "assert.h"
#include "chainparams.h"
#include "main.h"
#include "util.h"
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
struct SeedSpec6 {
uint8_t addr[16];
uint16_t port;
};
#include "chainparamsseeds.h"
//
// Main network
//
// Convert the pnSeeds6 array into usable address ... | TEST | 0.911588 | 6.82971 |
72c64cff-0bf0-4957-a2d7-96c043878f09 | gustavosm/UVa | UVa10600.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> pset;
void init(int n)
{
pset.assign(n, 0);
for (int i = 0 ; i < n ; ++i) pset[i] = i;
}
int find(int i)
{
return (pset[i] == i? i : pset[i] = find(pset[i]));
}
int same(int i, int j)
{
return find(i) == find(j);
}
void unionset(int i, int j)
{
pset[fi... | ALGO | 0.99997 | 4.085175 |
ec721c83-ee2c-4b1c-b48f-f97ff6ed23d1 | 15969687923/JiangWeiyan2024-1 | Historical Code/UJN OJ Test/1022.cpp | #include<stdio.h>
int main(){
float a,b,c;
scanf("%f%f%f",&a,&b,&c);
if(a==b &&b==c&&a==c && a+b>c && a+c>b && b+c>a){
printf("equilateral triangle");
return 0;}
else if(a+b<c || a+c<b || b+c<a){
printf("not a triangle");
return 0;}
else if(a==b || a=... | ALGO | 0.999291 | 3.900792 |
2b4a4cb2-b701-4aed-9880-7d943420003a | asadgulib/SVAM | tutorial/505_MIQ/main.cpp | #include <igl/avg_edge_length.h>
#include <igl/barycenter.h>
#include <igl/comb_cross_field.h>
#include <igl/comb_frame_field.h>
#include <igl/compute_frame_field_bisectors.h>
#include <igl/cross_field_missmatch.h>
#include <igl/cut_mesh_from_singularities.h>
#include <igl/find_cross_field_singularities.h>
#include <ig... | ALGO | 0.951803 | 5.887609 |
8411b2bd-3a9f-4a71-a2b7-d6189c908d1f | ljk1029/ALL_CTool | algorithm/leetcode/double_pointer/test_11.cpp | /**
给定一个长度为 n 的整数数组 height 。有 n 条垂线,第 i 条线的两个端点是 (i, 0) 和 (i, height[i]) 。
找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。
返回容器可以储存的最大水量。
说明:你不能倾斜容器。
示例 1:
输入:[1,8,6,2,5,4,8,3,7]
输出:49
解释:图中垂直线代表输入数组 [1,8,6,2,5,4,8,3,7]。在此情况下,容器能够容纳水(表示为蓝色部分)的最大值为 49。
示例 2:
输入:height = [1,1]
输出:1
*/
#include <iostream>
#include <vector>
usi... | ALGO | 0.999958 | 6.620285 |
cdcb081e-4ace-4c47-8c4c-ff21e5bca12f | rahultomarr/gfg-potd | 18-07-24.cpp | class Solution {
public:
int alternatingMaxLength(vector<int>& arr) {
// Code here
if (arr.empty()) return 0;
int increase = 1; // Length of alternating sequence ending with an increase
int decrease = 1; // Length of alternating sequence ending with a decrease
... | ALGO | 0.999883 | 5.736935 |
dd52f3fb-2c87-4584-9e92-1a96a3ff49c1 | dltkddbs7979/Algorithm | WEEK1/AP1_6/API1_6.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long LongInt;
LongInt fib(LongInt n, int& count){
count++;
if (n<=1)
return n;
else
return fib(n-1, count) + fib(n-2, count);
}
int main(){
int count = 0;
LongInt n, result;
cin >> n;
result =... | ALGO | 0.999801 | 4.323309 |
8929ece5-4cc1-47a5-8aab-66b59bd76135 | IamAliHossain/Data-Structure-Algorithm | Graph & Tree/Finding cycle in graph.cpp | #include"bits/stdc++.h"
using namespace std;
const int N = 1e5+10;
bool vis[N];
vector<int> graph[N];
bool isCycleExist = false ;
bool dfs(int vertex, int parent){
vis[vertex] = true;
for(auto child : graph[vertex]){
if(vis[child] && child == parent)continue;
if(vis[child]) return true;
... | ALGO | 0.999877 | 3.978309 |
607d2359-f94e-40e7-b6ad-b669fdeff834 | srnit/codeon | cammelcase.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
cin>>str;
int i=0,count=0;
while(str[i])
{
if(i==0 && islower(str[i]))
count++;
else if (isupper(str[i]))
count++;
i++;
}
cout<<count<<"\n";
} | ALGO | 0.999227 | 3.912957 |
5e73e741-ad6f-4351-9bff-a9a817eb3491 | bharabhi01/LeetCode-Questions | 897-increasing-order-search-tree/897-increasing-order-search-tree.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.999984 | 6.267153 |
4a707bd9-ae53-4317-a73c-5f367e862875 | ishandutta2007/codeforces | purplecrayon/normal/1291/D.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void fsc(int &x){
register int c;
x = 0; c=getchar()... | ALGO | 0.999966 | 4.400406 |
899863f9-ddf9-4699-a48b-05588f79647a | bhargavbijjam/DSA-LeetCode | 0389-find-the-difference/0389-find-the-difference.cpp | class Solution {
public:
char findTheDifference(string s, string t) {
map<char,int> store;
for(int i=0;i<s.size();i++) store[s[i]]++;
for(int i=0;i<t.size();i++){
if(store.find(t[i]) != store.end() && store[t[i]]>0)
store[t[i]]--;
else return t[i];
... | ALGO | 0.999845 | 6.074073 |
cad50e8f-449a-43db-ae7a-6523634ca0e4 | ishandutta2007/codeforces | jo_ulej/normal/1065/B.cpp | #include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>
#define le... | ALGO | 0.999973 | 4.420001 |
72ba3447-32e7-4d01-a18f-2d626a76aa4c | atimlaa/Data-Structures-and-Algorithms | Assignment5/OurCSCE310Tree.cpp | /*
* Name: Aryan Timla (atimla)
* Assignment 5
* Implement two given functions
* rotateLeft is a function that will rotate a OurCSCE310Tree to the left.
* rotateRight is a function that will rotate a OurCSCE310Tree to the right.
*/
#include "OurCSCE310Tree.h"
#include <iostream>
#include <cmath>
using namespace std;
... | ALGO | 0.999831 | 5.111272 |
73ecb8ab-1f82-42f4-998b-043dac391885 | LearnerMahi/numericalCode | newtonraphsan.cpp | #include<bits/stdc++.h>
using namespace std;
vector<double> stringToCoefficient(string s){
vector<double>coefficient;
regex r("(-?\\d*)x\\^(\\d+)");
smatch m;
while (regex_search(s,m,r)){
string coeff=m[1];
string exp=m[2];
if(coeff.empty()) coeff="1";
int cop=stoi(coeff)... | ALGO | 0.999852 | 4.004091 |
63b8571a-d930-4e6d-82d7-83869be0755b | ishandutta2007/codeforces | oleh1421/normal/1249/D2.cpp | #include<bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
int l[200001];
int r[200001];
int ind[200001];
int t[800001];
const int N=262144;
void upd(int v,int l,int r,int pos,int x){
if (l>pos || r<pos) return;
if (l==r){
t[v]+=x;
return;
}
int m=(l+r)/2;
upd(v... | ALGO | 0.999986 | 3.318712 |
56b8bbc9-4d6c-4263-82d5-2fd7b9afebb4 | ZPYhiahiahia/ACMgo | 计算几何/判断多边形重心.cpp | #include<bits/stdc++.h>
#include<stack>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define read(n) scanf("%d",&n);
#define readll(n) scanf("%lld",&n);
#define readdb(n) scanf("%lf",&n);
#define readch(n) scanf("%c",&n);
#define readstr(n) scanf("%s",n);
#define test pr... | ALGO | 0.999815 | 4.144316 |
b1d8bdc0-ba38-4681-8213-e1370ac697b9 | dtjonesuk/advent_of_code_2015 | day03/Santa.cpp | //
// Created by David on 03/12/2023.
//
#include "Santa.h"
Santa::Santa(LocationMap &l) : locations(l) {}
void Santa::move(char ch) {
// move current location 1 square (based on ch), then add a present at new location
switch (ch) {
case '^':
currentLocation.second += 1;
locat... | ALGO | 0.998533 | 5.71482 |
e8633660-934f-4417-994f-00cf7a327fd1 | dimchor/kattis | patuljci.cpp | #include <iostream>
#include <unordered_set>
#include <vector>
#include <numeric>
template<typename T>
std::vector<std::vector<T>> find_combinations(
typename std::vector<T>::const_iterator first,
typename std::vector<T>::const_iterator const last,
std::vector<T> const set = std::vector<T>{})
{
if (f... | ALGO | 0.99959 | 4.694675 |
8503f4c9-d0ef-44cd-9e0b-a3fdf9e2201d | umdrawa2/ray_tracer | src/RayTracer (redPC's conflicted copy 2014-02-21).cpp | // The main ray tracer.
#pragma warning (disable: 4786)
#include "RayTracer.h"
#include "scene/light.h"
#include "scene/material.h"
#include "scene/ray.h"
#include "parser/Tokenizer.h"
#include "parser/Parser.h"
#include "ui/TraceUI.h"
#include <cmath>
#include <algorithm>
extern TraceUI* traceUI;
#include <iostr... | TOOL | 0.88167 | 6.747014 |
fcae614f-b5fe-44c2-8bc8-d36bee232ee5 | manish-tech-git/SdeSheetChallenge | Ceil from BST.cpp | /************************************************************
Following is the TreeNode class structure:
class BinaryTreeNode {
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this->data = data;
le... | ALGO | 0.999982 | 4.896667 |
5312881b-181c-48bc-8143-b40f65532716 | slientreed/Point2OfferCode | 66_Construct_Array.cpp | /*
说明:
1. 问题:66. 构建乘积数组。给定一个数组A,返回一个数组B,数组B中的元素B[i]是除了A[i]之外的连乘值
2. 思路:具体参考原书:定义 C[i] = C[i-1] * A[i-1],自上而下计算所有A[i];定义 D[i] = D[i+1] * A[i+1] 自下而上计算 B[i] = C[i] * D[i]
*/
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <assert.h>
#include <cstdi... | ALGO | 0.999959 | 3.934709 |
e7ab620e-88a9-42c4-81bc-583a7a43791c | sabanzolj/Tehnike_programiranja2022 | T10/Z2/main.cpp | //TP 2022/2023: LV 10, Zadatak 2
#include <ios>
#include <iostream>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <iomanip>
const double PI=4*atan(1);
class Krug{
double r;
public:
explicit Krug(double x){
if(x<=0)throw std::domain_error("Neispravan poluprecnik");
r=x;
... | ALGO | 0.913038 | 4.603346 |
06895365-f5c6-4f15-9b4b-0e2806f30077 | demul/hands_on_gtsam | third_party/gtsam/examples/ShonanAveragingCLI.cpp | /**
* @file ShonanAveragingCLI.cpp
* @brief Run Shonan Rotation Averaging Algorithm on a file or example dataset
* @author Frank Dellaert
* @date August, 2020
*
* Example usage:
*
* Running without arguments will run on tiny 3D example pose3example-grid
* ./ShonanAveragingCLI
*
* Read 2D dataset w10... | ALGO | 0.922019 | 6.839447 |
b6700849-8e6a-4ba0-902b-2862cc041196 | Mugdha-Hazra/180-Questions-Striver-SDE-sheet-in-CPP | Unique rows in boolean matrix - GFG/unique-rows-in-boolean-matrix.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
#define MAX 1000
vector<vector<int>> uniqueRow(int M[MAX][MAX],int row,int col);
// } Driver Code Ends
class Solution
{
public:
// #define MAX 1000
vector<vector<int>> uniqueRow(int M[MAX][MAX],int row,int col)
{
//Your code ... | ALGO | 0.999274 | 4.518563 |
281c695d-b791-4eff-8ee5-19126b88bbb8 | atanapi/atanapi-core-departed | src/addrman.cpp | #include <addrman.h>
#include <hash.h>
#include <serialize.h>
#include <streams.h>
int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetCheapHash();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << (has... | TOOL | 0.890284 | 6.643281 |
7446c60a-cd97-4931-a0ec-078137dbaaa1 | JulyMaker/AdventOfCode | 2015/Day04/src/md5Hash.cpp | #include <string>
#include "md5.h"
#define CODE "ckczppom"
unsigned int adventDay4problem12015()
{
long long int x = -1;
bool encontrado = false;
while (!encontrado)
{
x++;
// MD5
std::string AdventCoins = CODE + std::to_string(x);
std::string md5Hash = md5(AdventCoins);
if (md5Hash.subs... | ALGO | 0.998922 | 5.705038 |
2d42ca59-daa5-4818-abc0-5a576db4e5ff | ryncsn/fried-cookies | cpp/midtorp2.cpp | #include<iostream>
#include<string>
using namespace std;
double pow(double base,int exp){
double tmp=base;
while(--exp>0)
tmp*=base;
return tmp;
}
template<class T>
class stack{
private:
T *data;
int size,length;
public:
stack(int size=128){
this->size=size;
length=0;
data=new T[128];
}
bool push(T tar)... | ALGO | 0.999721 | 3.503121 |
25313f19-8355-46b8-943d-a1ea14fa05f7 | tingdpw5314/Leetcode | findPeak.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <math.h>
#include <climits>
#include <queue>
#include <sstream>
#include <unordered_map>
using namespace std;
const int size = 9;
template<typename T>
void PrintItvector(vec... | ALGO | 0.999439 | 4.043791 |
e5a12b5f-dbd8-41f0-a8ad-dfcba56f2bf5 | Harshkaushik04/striverA2Z | 8_array_easy/7_moveZeros.cpp | #include<iostream>
#include<vector>
using namespace std;
void moveZeroes(vector<int>& nums) {
//2 pointer
int index=0,i=0;
int numsSize=nums.size();
while(index<numsSize){
while(nums[index]==0 && index!=numsSize-1){
if(index<numsSize-1){
index++;
}
... | ALGO | 0.999945 | 5.821926 |
11e34fca-eec6-45ef-965c-88c6e532564f | Fearycxy/lintcode | 916_Palindrome_Permutation.cpp | class Solution {
public:
/**
* @param s: the given string
* @return: if a permutation of the string could form a palindrome
*/
bool canPermutePalindrome(string &s) {
// write your code here
map<char ,int>mp;
for(char c:s){
if(mp[c]) mp.erase(mp.find(c));
... | ALGO | 0.999716 | 5.963966 |
25d101e7-7d8e-47a6-8eb1-a9dfbff2889e | jeremyhengjm/agents | src/conditional_bernoulli.cpp | #include <Rcpp.h>
using namespace Rcpp;
using namespace std;
// [[Rcpp::export]]
NumericMatrix compute_qvalues_condber(const int & I, const NumericVector & alpha){
int N = alpha.length();
NumericMatrix log_qvalues(I+1, N);
std::fill(log_qvalues.begin(), log_qvalues.end(), R_NegInf);
// initialize the recurs... | ALGO | 0.999633 | 5.670868 |
f8ad3d6d-da8c-44de-bb0b-151eaecf09bb | ILoveAlgorythms/algo | 2sem1/F.cpp | #include <algorithm>
#include <deque>
#include <iostream>
#include <vector>
struct Graph {
enum Color { White, Grey, Black };
std::vector<Color> vert_colors;
std::vector<std::vector<int>> verticies;
std::vector<std::vector<int>> transposed_verticies;
std::vector<int> components;
std::deque<int> tout;
int... | ALGO | 0.999481 | 4.810988 |
1435ba92-2e52-4b1f-87fb-bc8fbd6bf70f | tuandinh2909/OPC_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 |
f1cd1253-a79f-4d38-a0d2-3faad0b3718d | bisnu16cse039/CP | Graph/BFS e.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>adj[1000];
queue<int>q;
int vis[1000];
void bfs(int s,int v){
for(int i=0;i<v;i++)vis[i]=0;
q.push(s);
vis[s]=1;
while(!q.empty()){
int u=q.front();
q.pop();
for(int i=0;i<adj[u].size();i++){
if(!vis[adj[u][i]]){
... | ALGO | 0.999974 | 4.045464 |
0abf0c12-055b-4e9d-833c-e942493d5d0a | Zapryanovx/FMI-SDA-2024-PREP | Week 08/Additional/Leetcode/0338. Counting Bits/bits.cpp | class Solution {
public:
vector<int> countBits(int n) {
vector<int> dp(n + 1, 0);
for (int i = 1; i <= n; i++)
{
dp[i] = dp[i >> 1] + (i & 1);
}
return dp;
}
}; | ALGO | 0.999989 | 6.223088 |
3f3ad189-4ab5-4735-857f-5f32bcf73b91 | xinfeng1i/AlgorithmSolution | geeksforgeeks/data_structure/graph/traversal/graph_representation.cpp | /*
* 图的表示
*
* 邻接矩阵
* 优点:简单高效,增加、删除一条边需要O(1)的时间
* 缺点:空间占用O(V^2),增加一个顶点需要O(V)的时间
*
* 邻接表:
* 优点:节省空间O(V+E)
* 缺点:查询一条边u-v是否在图中非常低效
*/
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
using namespace std;
struct Node
{
int dest;
Node* next;
Node(int v):dest(v), next(NULL){};
};
... | ALGO | 0.999779 | 5.011067 |
47f0a787-ab37-407a-a1c6-545d3fd1887e | tofuwen/icpc-Rujia-Liu | Training_Guide_Rujia_Liu/TrainingGuide_examples/ch1/uva11549.cpp | // UVa11549 Calculator Conundrum
// Rujia Liu
#include<iostream>
using namespace std;
int buf[100];
int next(int n, int k) {
if(!k) return 0;
long long k2 = (long long)k * k;
int L = 0;
while(k2 > 0) { buf[L++] = k2 % 10; k2 /= 10; } // 벢k2ĸ
if(n > L) n = L;
int ans = 0;
for(int i = 0; i < n; i++) // ǰm... | ALGO | 0.999971 | 4.210057 |
12ca1ddb-77fc-4c06-9e70-f06b033fa67c | yopio/aoj | 0025.cpp | #include <iostream>
using namespace std;
int main(void){
int a[4],b[4];
while( cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3] ){
int hit = 0;
int blow = 0;
for( int i = 0 ; i < 4 ; i++ ){
if( a[i] == b[i] ) hit++;
for( int j = 0 ; j < 4 ; j++ ){
if( i != j && a[i]... | ALGO | 0.998084 | 3.709576 |
2f49a3d7-7c32-43c4-ad5a-49d7dce583eb | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12638_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int sz = 3001;
int n;
int x[sz];
int y[sz];
double D[sz][sz];
inline double dist(int i, int j) {
return sqrt(double(x[i] - x[j]) * (x[i] - x[j]) +
double(y[i] - y[j]) * (y[i] - y[j]));
}
bitset<sz> G[sz];
bool check(double d) {
for (int i = (0); i <=... | ALGO | 0.999852 | 4.252091 |
a08ae5c1-32a6-4ccc-83ae-32a3773f3f16 | Steven-Ou/LeetCode | L3151.cpp | #include <iostream>
using namespace std;
class Solution{
public:
bool isArraySpecial(vector<int>& nums){
if(nums.size()<=1 ){
return true;
}
for(int i =0; i<nums.size()-1; i++){
int temp;
temp = nums[i];
if(... | ALGO | 0.999421 | 4.355645 |
6242fc93-36a2-4312-989b-5a46f127e90d | harshita9104/DSA | 68-text-justification/text-justification.cpp |
class Solution {
public:
vector<string> fullJustify(vector<string>& words, int maxWidth) {
vector<string> ans;
int n = words.size();
int index = 0;
while (index < n) {
int total = words[index].size();
int last = index + 1;
// Find how many word... | ALGO | 0.999981 | 6.78072 |
c2c46485-86e9-4a6e-9ab1-3a26c30aafdd | ishandutta2007/codeforces | anadi/normal/1076/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long long int LL;
#define st first
#define nd second
#define pb push_back
#define PLL pair <LL, LL>
#define PII pair <int, int>
const int N = 1e5 + 7;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 9LL;
LL n;
int main(){
// ios_base::sync_with... | ALGO | 0.999963 | 3.788967 |
8ad5fb2b-7ce6-4613-9cd1-b0ff4ed2ea13 | pratikroy311/DS-and-Algo-codes | Arrays and strings/generateStringOddcharacter.cpp | //problem link : https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string generateTheString(int n) {
string res="";
if(n%2==0)
{
for(int i=0;i<n-1;i++)
res... | ALGO | 0.999298 | 5.065368 |
e7e3059e-388f-463e-878c-338bdc311f7d | Mag-strom/cp- | Anagrams.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int search(string pat, string txt) {
// code here
long long int k=pat.size();
unordered_map<char,int>m;
int b=0;
for(int i=0;i<k;i++)
{
... | ALGO | 0.999834 | 5.824957 |
a0349e42-51b3-44ac-8580-804e8b900eea | jaiminb2512/365-Days-of-Code | day_166/Fourth Largest Element in the Array.cpp | #include <queue>
#include <vector>
#include <climits>
using namespace std;
int getFourthLargest(int arr[], int n) {
if (n < 4) {
return INT_MIN;
}
priority_queue<int, vector<int>, greater<int>> minHeap;
for (int i = 0; i < 4; ++i) {
minHeap.push(arr[i]);
}
for (... | ALGO | 0.999981 | 4.869606 |
cd3979eb-6a55-4395-871d-559c433a7f30 | bugreator/library-of-labs | three/second_semester/Computer_Graphic_and_Vision/code/fanzouyang.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GLUT/GLUT.h>
double xk,yk;
double x_1,y_1;
double x_2,y_2;
double f(double x11,double y11,double x12,double y12,double x,double y){
return y11+((y12-y11)/(x12-x11))*(x-x11)-y;
}
void drawpoint(){
glClear(GL_COLOR_BUFFE... | ALGO | 0.991681 | 3.613962 |
d9f56691-160d-4672-a4a2-c998cd4cf6a4 | avielLV/prueba_tecnica_veflat | 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 |
9ddf33bc-0c04-40e9-aa6b-63aa0e49e363 | MeeLn/C- | lab 6/compare usingconstructor of 2 class.cpp | #include<iostream>
using namespace std;
class bcompare;
class acompare{
int a;
public:
acompare(){
a=0;
}
acompare(int x){
a=x;
}
void display(){
cout<<"The value of a:"<<a<<endl;
}
friend void compare(acompare,bcompare);
};
class bcompare{
int b;
public:
bcompare(){
b=0;
}
bcompare(... | ALGO | 0.998547 | 3.371786 |
81eb5cdb-bd54-41d9-8a45-be640a0e4b4e | haven-protocol-org/haven-main | src/daemon/command_parser_executor.cpp | #include "common/dns_utils.h"
#include "common/command_line.h"
#include "net/parse.h"
#include "daemon/command_parser_executor.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/predicate.hpp>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "daemon"
namespace daemonize {
t_com... | TOOL | 0.954497 | 6.526814 |
e3a31333-10fb-4b64-943a-1b2479897188 | Priyanshu-Sarkar03/DSA | 0485-max-consecutive-ones/0485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans = 0;
int cnt = 0;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] == 1) {
cnt++;
}
if(cnt>ans){
ans=cnt;
}
if(nums[... | ALGO | 0.999964 | 6.136861 |
27407f26-21d5-4869-a1e1-c5e79fa26bd4 | Parth-Sohal/cpp.Parth | varoioussorting/bubble.cpp | #include <iostream>
#include <algorithm>
#include <limits.h>
#include <cmath>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
vector<int> arr = {9};
int n = arr.size();
if(arr[n-1]!=9){
arr[n-1] +=1;
for(auto i : arr){
cout << i << " ";
}
... | ALGO | 0.999681 | 4.602078 |
37d05888-06f2-4e01-ae62-e9374a4961af | sansirowaltz/SWERC2023_Notebook | stress-tests/numerical/SolveLinear.cpp | #include "../utilities/template.h"
const int mod = 3;
const int nmax = 4, mmax = 4, nmmax = 10;
const int lut[9] = {-4,-2,-3,-1,-100,1,3,2,4};
int modinv(int x) {
assert(x);
return x;
// return lut[x+4];
}
typedef vector<int> vd;
int solveLinear(vector<vd>& A, vd& b, vd& x) {
int n = sz(A), m = sz(x), rank... | ALGO | 0.998822 | 3.804204 |
d52a88f3-ea2d-40ae-bcb5-dfcf94c20d18 | HovhannesoPogosyan/repo1 | tnayin.cpp/8.cpp | /*8. Draw triangle
Write a program which will input an integer number - N, and "draw" two types of right-angled triangle of height N.
E.g Input 5
Output
*
**
***
****
*****
*
**
***
****
*****
*/
#include <iostream>
void fnc_triangle_1(int);
int main()
{... | ALGO | 0.999774 | 4.041039 |
332f0c8d-28be-4a4a-8827-3d999334ddd0 | us2ahmad/Algorithms-Problem-Solving-Level-3-using-Cpp | Course7/Problem #07.cpp | //#include <iostream>
//
//using namespace std;
//
//void FillMatrix(int matrix[3][3], int rows, int cols)
//{
// int counter = 0;
//
// for (short i = 0; i < rows; i++)
// {
// for (short j = 0; j < cols; j++)
// {
// matrix[i][j] = ++counter;
// }
// }
//
//}
//
//void PrintMatrix(int matrix[3][3], int rows, in... | TOOL | 0.960444 | 3.543686 |
d94cc299-12ca-44e7-8ccd-527d60007f08 | MariaChrysafis/CompetitiveProgramming | Codeforces EDU/Segment Tree, part 2/Step 2/B.cpp | #include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <map>
#define ll long long
using namespace std;
const int MOD = 1e9 + 7;
struct segmentTree {
vector<ll> vec; // add later
vector<ll> addLater; //multiply later
vector<pair<int,int>> rng;
void push(int v) {
addL... | ALGO | 0.999955 | 5.211843 |
26a5ee6f-9a94-4981-9ea3-a9125b3e810b | KevinTeng0207/No-idea-Codebook | Mathematics/CRT.cpp | // 中國剩餘定理
template <typename T>
tuple<T, T, T> extgcd(T a, T b)
{
if (!b)
return make_tuple(a, 1, 0);
T d, x, y;
tie(d, x, y) = extgcd(b, a % b);
return make_tuple(d, y, x - (a / b) * y);
}
long long crt(vector<int> mod, vector<int> a)
{ // x % mod[i] = a[i]
long long mult = mod[0];
int ... | ALGO | 0.99984 | 4.129236 |
dd8743dc-cbc5-4fe5-906f-2dfc6c6aa8b3 | kunyavskiy/competitive-programming-archive | ProblemArchives/timus/p1086.cpp | #ifndef LOCAL
#pragma comment(linker, "/STACK:33554432")
#endif
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <queue>
#include <memory.h>
#include <stack>
#define mp make_pa... | ALGO | 0.998435 | 3.070256 |
b2cbfed4-4b0c-4c61-97d0-d893fe9548de | darkshuige/codecode | c code/P1379 八数码难题(astar算法).cpp | #include<bits/stdc++.h>
#define jiasu ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
#define endl "\n"
using namespace std;
const int maxn=1005;
int gx[]={-1,0,0,0,1,2,2,2,1};
int gy[]={-1,0,1,2,2,2,1,0,0};
int ex[5]={0,-1,+0,+1,+0};
int ey[5]={0,+0,+1,+0,-1};
int f(string s)
{
int ans=0;
fo... | ALGO | 0.999848 | 4.165255 |
d4f2f837-dff8-4e40-b0e8-2ae4cc2d341b | didrlgus/algorithm-practice | baekjoon/1408.cpp | // 24
#include<bits/stdc++.h>
using namespace std;
int h1,h2,m1,m2,s1,s2;
int main() {
scanf("%d:%d:%d",&h1,&m1,&s1);
scanf("%d:%d:%d",&h2,&m2,&s2);
int t1=h1*3600+m1*60+s1,t2=h2*3600+m2*60+s2;
if(t1>t2) t2+=24*60*60;
int ret=t2-t1;
int h=ret/3600,m=ret%3600/60,s=ret%3600%60;
printf("%02d:%0... | ALGO | 0.999766 | 3.724373 |
446d7421-23ea-409a-8d8d-f7bb2c96d21e | DMoNex/Baekjoon | 1000/1343/main.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string input;
int i = 0;
bool flag = true;
cin >> input;
while (i < input.size()) {
while (input[i] == '.') {
++i;
}
if (i + 3 < input.size()) {
if (input[i] == 'X' && input[i + 1] == 'X' && input[i + 2] == 'X' && input[i + 3]... | ALGO | 0.999613 | 3.799657 |
65bbca4a-0d1c-47a5-8005-7d8850f58829 | privel/weather_cmp | 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 |
d8075dcf-e5ce-408d-b610-bc0e4486d931 | olivierzsk/tak | algorytm wyznaczania liczb pierwszych/algorytm wyznaczania liczb pierwszych.cpp | using namespace std;
#include <iostream>
int main()
{
bool flaga;
int n;
int p;
int lp;
int d;
lp = 0;
cout << "ile liczb pierwszych";
cin >> n;
p = 2;
for (lp = 0; lp < n;) {
flaga = false;
for (d = 2; d < p; d += 1) {
if (p % d == 0) {
... | ALGO | 0.999691 | 4.034514 |
2753a394-08cc-4160-86c6-f2e516916277 | fiahamasyatusss/Pertemuan5_RESTAPI | 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.99887 | 6.783439 |
ff4124d3-56a2-4ff2-ab7f-daa9fc6a753a | nasa/EMTG | depend/boost/libs/filesystem/example/tut4.cpp | // filesystem tut4.cpp ---------------------------------------------------------------//
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, cha... | TOOL | 0.875365 | 6.299984 |
e7eabf9d-d1bb-4da6-983c-6c5f2171bedf | mashfiqur05/Problem-Solving | Codeforces/776B_Sherlock_and_his_girlfriend.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define Bismillah() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); /// Fast IO.
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define mem(a,b) memset(a, b, sizeof(... | ALGO | 0.999495 | 4.30246 |
e0af11fb-9c04-4fe5-9bb7-a693050cfaba | AST-TheCoder/CP-Solutions | CodeForces/GNU C++14/1713A | Traveling Salesman Problem/167232260.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define Max 10000000000000000
template <typename T>
using ordere... | ALGO | 0.999808 | 3.730806 |
c78e252a-9959-4abb-bc47-5a33a79e7876 | varunsharma10/cpp | CodeForces/ER72Div2A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long n, k;
int x, y, z;
cin >> n;
while (n--)
{
k = 0;
cin >> x >> y >> z;
cout << max(0, min(z + 1, (x + z + 1 - y) / 2)) << '\n';
}
} | ALGO | 0.999785 | 4.208095 |
d220d77a-bedb-488f-9dd0-704d6f911a86 | Nezz7/Competitive-programming | Training Marathons/String Marathon/A - Tavas and Malekas.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define endl '\n'
#define LL long long
#define LD long double
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const... | ALGO | 0.999983 | 4.243826 |
28e24cd6-05cf-40a3-bc38-cb8d65818074 | eric15342335/comp2113 | Assignment3/2.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
bool passable(vector<vector<int>> planks, int start_row, int start_column, int row_size, int column_size) {
if (0 <= start_row && start_row <= row_size-1 &&
0 <= start_column && start_column <... | ALGO | 0.999968 | 5.172292 |
5c6fbf6c-485a-4943-945c-acaa2d09f5a6 | 18-RAJAT/ONLINE-JUDGE | A_Mix_Mex_Max.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void sol()
{
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;++i)cin>>a[i];
int f=-2,ok=1;
for(int i=0;i<n;++i)
{
if(a[i]==-1)continue;
if(f==-2)f=a[i];
else if(a[i]!=f)
{
ok=0;
... | ALGO | 0.999744 | 4.201642 |
5fc20a3b-1210-4dc0-87f1-e867cef04f81 | pent0/ka3d | source/ode/ode-0.5/OPCODE/OPC_SweepAndPrune.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.998794 | 6.36726 |
9757dffd-e08f-41f7-b615-c5439231fbaf | Spirit599/algorithm | leetcode/cpp/863.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> distanceK(TreeNode* root, TreeNode* target, int k) {
vector<int> a... | ALGO | 0.999996 | 6.037512 |
f2b65c80-c161-4354-a635-cb3ebff43440 | BaslielMesfin/C-codes | factorial recursion (func).cpp | #include <iostream>
using namespace std;
int fact(int n)
{
if (n>1)
return n * fact(n-1);
else
return 1;
}
int main()
{
int num;
cout<<"Factorial calculator\n\n Enter number: ";
cin>>num;
cout<<" "<<num<<"! = "<<fact(num)<<endl;
return 0;
}
| ALGO | 0.990952 | 4.197846 |
0a189db9-6416-418c-8951-00a147afd7a5 | Adikad16/CDAC | PracticeSet1/Assignment2.cpp | /* Write a program that takes the radius of a circle as input and calculate its circumference */
#include<iostream>
using namespace std;
int main()
{
float radius,circumference;
cout << "Enter the Radius of a circle : ";
cin >> radius;
circumference = 2 * 3.14159265359 * radius;
cout << "Circumferen... | ALGO | 0.977011 | 3.78618 |
a32c5d7f-ddf3-49b0-9fec-27c8e6daf877 | pupajupa/qt_and_cpp_course1 | term1/Lab3/sin/Source.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
long double sinx(long double x);
long double cosx(long double x);
long double lnx(long double x);
int main()
{
setlocale(LC_ALL, "Russian");
long double x;
bool isIncorrect;
do
{
isIncorrect = false;
std::cout << "Enter x:" << '... | ALGO | 0.995406 | 3.523493 |
72230739-0e38-43e0-ac9f-12d735ebe3a4 | Al73r/Leetcode | 93. Restore IP Addresses/restoreIpAddresses.cpp | class Solution {
public:
vector<string> restoreIpAddresses(string s) {
int l=s.size();
string ans;
vector<string> result;
for(int i=1; i<=3; i++){
if(l-i>9 || l-i<3 || stoi(s.substr(0, i))>255 || (i>1 && s[0]=='0'))
continue;
ans+=s.substr(0,i)... | ALGO | 0.999451 | 5.817485 |
42c588f1-a0e2-41c8-ba8d-25e163789395 | gz777/CPP-code | data structures/linkedlist/singlyLinkedListAssignmentSampleSol.cpp | /*
Assignment description:
1. Please use the attached script (https://onlinegdb.com/-z_csdJSs) for your reference to create the node structure and the linked list class. The sample class has implemented the following member methods:
o constructor
o destructor
o print()
o update()
o push()
2. Implement the follow... | ALGO | 0.995993 | 5.421762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.