uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7be4c536-323b-4548-a700-01f21827fe68 | mohitvdx/Programs | codeforces/Contests/995div3/a.cpp | // submitted by Mohit Verma "mohitvdx"
// problem:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX >> 1;
signed main(){
ios::sync_with_stdio(false); cin.tie(NULL); // fast IO
int t;
cin>>t;
while(t--){
int n;
ci... | ALGO | 0.999984 | 4.292985 |
361c52b2-324d-4579-9a5f-b082568ec85e | oxygen-hunter/Flashboom | data/leetcode_cpp/rectangle-area.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
return (D - B) * (C - A) +
(G - E) * (H - F) -
max(0, (min(C, G) - max(A, E))) *
max(0, (min(D, H) - max(B, F)));
}
};
| ALGO | 0.984098 | 4.905646 |
f49c28ea-c7c3-47c3-98c8-d355addfafff | Kaulwarmythri/DSA | problems/add_two_numbers/solution.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* addTwoNumbe... | ALGO | 0.999903 | 6.295542 |
5c8d1470-90b6-4c16-a921-4454f8a532a3 | Sagarbha1991/com.example.trilinos | packages/stk/stk_classic/stk_usecases/linsys/LinsysUseCase_5.cpp | /*------------------------------------------------------------------------*/
/* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
/* United States Government. */
/*------------------------------------------------------------------------*/
#include ... | ALGO | 0.964891 | 5.505581 |
ae0df07a-5b5a-470e-a3da-e05960faf789 | pipiTan/QRcode | qzxing/zxing/zxing/common/reedsolomon/ReedSolomonDecoder.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <iostream>
#include <memory>
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
#include <zxing/common/reedsolomon/ReedSolomonException.h>
#include <zxing/common/IllegalArgumentException.h>
#include <zxing/IllegalStateException.h>... | ALGO | 0.999496 | 6.359705 |
4ca27c9f-8fa3-4db5-a9a3-676581a71d7e | FirstKhoi/DSA | Leetcode/TwoPointersPattern/Medium/1963.MinimumNumberofSwapstoMaketheStringBalanced.cpp | #include<bits/stdc++.h>
#include<vector>
using namespace std;
using ll = long long;
//https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/description/?envType=problem-list-v2&envId=2fh4qdsc
class Solution {
public:
int minSwaps(string s) {
int imbalance = 0;
int swaps ... | ALGO | 0.998752 | 5.661231 |
75b52da3-8e3e-49ce-ae4f-6bf9ebcbbaf4 | PrasadThorve/DSA | Backtracking and Recursion/phoneKeypad.cpp | #include<iostream>
#include<vector>
using namespace std;
void keypad(vector<string> superSet, string output, string digits, int index, vector<string> &ans){
//base condition
if(index>=digits.size()){
ans.push_back(output);
return;
}
//processing
int sup... | ALGO | 0.999408 | 4.828982 |
85a1ee4e-5db1-483d-9816-499621d0089c | ishandutta2007/codeforces | wsyhb/normal/705/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cin>>n;
for(i=1;i<=n;i++)
{
if(i%2==1) cout<<"I hate ";
else cout<<"I love ";
if(i<n) cout<<"that ";
else cout<<"it";
}
return 0;
} | ALGO | 0.999895 | 3.272136 |
5dafc1ca-9413-4546-9559-fcfae781323b | jeongminccc/algo | source/KAKAO/카카오 블라인드 채용 2019 D.cpp | #include <string>
#include <vector>
using namespace std;
long long solution(vector<int> food_times, long long k) {
long long answer = 0;
long long i=0;
long long temp =0;
long long temp_k = k;
long long temp_size=food_times.size();
while(temp_size>0){
temp += food_times[i];
... | ALGO | 0.999911 | 4.885175 |
f78d9196-5658-42fd-aa82-d367dd10ea7c | StijnOnline/Learning_Cpp_with_AoC | AdventOfCode2022_Cpp/Day18/Day18.cpp | #include <fstream>
#include <string>
#include <iostream>
#include <sstream>
#include <array>
#include <vector>
#include "Day18.h"
#include <boost/algorithm/string.hpp>
#include <boost/functional/hash.hpp>
#include <unordered_set>
#include <unordered_map>
namespace Day_18 {
struct Position {
int x;
int y;
int ... | ALGO | 0.986615 | 4.210155 |
aef2d8d1-58da-4667-8181-5b8535272590 | ishandutta2007/codeforces | ivl/normal/141/A.cpp | #include <cstdio>
using namespace std;
char host[105], guest[105], next[105];
int pon1[27], pon2[27];
int main(){
scanf("%s%s%s", host, guest, next);
for (int i = 0; host[i]; ++i){
++pon1[host[i] - 'A'];
}
for (int i = 0; guest[i]; ++i){
++pon1[guest[i] - 'A'];
}
for (int i = ... | ALGO | 0.999974 | 3.481433 |
db09a3d4-6422-4b6f-9c59-f0ca328985c3 | itlezy/eMule-mods-archive | eMule-0.50a-neomuleneomule_reloaded-fa3debb/crypto51/blumshub.cpp | // blumshub.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "blumshub.h"
NAMESPACE_BEGIN(CryptoPP)
PublicBlumBlumShub::PublicBlumBlumShub(const Integer &n, const Integer &seed)
: modn(n),
maxBits(BitPrecision(n.BitCount())-1)
{
current = modn.Square(modn.Square(seed));
bitsLe... | ALGO | 0.999157 | 6.763701 |
67feba6d-3d66-492c-a5d9-0415abd95dae | fstudio/Phoenix | test/Experimental/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
// void
// make_heap(Iter first, Iter last);
#include <algorithm>
#include <cassert>
void test(unsigned N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
ia[i] =... | TEST | 0.987377 | 5.567993 |
2684478c-3170-447d-95a1-123a852d7136 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8300_5.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long frac[1000100], rfrac[1000100];
long long pw(long long x, long long y) {
x = (x % mod + mod) % mod;
y = (y % (mod - 1) + mod - 1) % (mod - 1);
long long res = 1;
while (y > 0) {
if (y & 1) res = res * x % mod;
x = x ... | ALGO | 0.999946 | 4.412735 |
cbc2e1ae-653a-4ea1-a27d-99b7ddfdd0c4 | filipdanieloan/pregatire | p4761_40p/bambusi.cpp | #include <bits/stdc++.h>
using namespace std;
ifstream fin("bambusi.in");
ofstream fout("bambusi.out");
long long M, suma;
int n, h[100001], H, st, dr, mij, nrmax;
bool gasit;
int main(){
fin>>n>>M;
for(int i = 1; i<=n; ++i){
fin>>h[i];
nrmax = max(nrmax, h[i]);
}
for(H = nrmax; H>=1; --H){
suma ... | ALGO | 0.999993 | 4.477818 |
c964f206-d592-4962-8fa8-f08d403a838a | wayandway/algorithms-cpp | BOJ/Graph/16234.cpp | // https://www.acmicpc.net/problem/16234
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#include <tuple>
#include <stack>
#define ll long long
#define INF 1e9
using namespace std;
int n,L,R;
int map[52][52];
int open[52][52];
int dr[]... | ALGO | 0.999786 | 3.489161 |
bba28a0f-7191-4c97-95bd-6d48c0859728 | fahreziahmad/039_ConditionalStatement | Con4/Con4.cpp | // Con4.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <iostream>
using namespace std;
int main() {
int bilangan1, bilangan2;
string status;
srand(time(0));
bilangan1 = rand() % 10;
bilangan2 = rand() % 10;
if (bilangan1 == bilangan2)
{... | ALGO | 0.996326 | 4.326303 |
7f20b933-83fb-4243-958f-166745bb5b33 | hi-anusha/-CrackYourPlacement- | 113-path-sum-ii/113-path-sum-ii.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.999941 | 5.909133 |
aa741d83-7571-4f4a-8a96-01c7a98c9e69 | iamsile/ACM | Avoiding a disaster-模拟.cpp | #include <iostream>
using namespace std;
struct Time {
int h,m;
}a,b,c,l;
int cal(Time d,Time e)
{
int k=0;
while (d.h!=e.h||d.m!=e.m) {
d.m++;
if (d.m==60) {
d.m=0;
d.h++;
if (d.h==13)
d.h=1;
}
k++;
}
return k;
}
... | ALGO | 0.99969 | 3.286977 |
2b7b5dbf-9dbb-443a-99a0-43c799bdbe9d | ShivamBhasin2002/competitiveCoding | yetAnotherSODProblem.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
long long l, r;
cin >> l >> r;
l = (l - 1) / 3;
r /= 3;
long long ans = r - l;
cout << ans << "\n";
}
} | ALGO | 0.999765 | 3.884579 |
4fddf876-d8b7-4ac5-9c26-d0a44ee89388 | guziqiu/cppstudy | 03.code/02.c++/04.c++多线程/03.thead_pool.cpp | #include <iostream>
#include <functional>
#include <thread>
#include <vector>
#include <unordered_map>
#include <queue>
#include <mutex>
#include <condition_variable>
using namespace std;
class Task{
private:
function<void()> func;
public:
template <typename FUNC_T, typename ...ARGS>
Task(FUNC_T f, ARGS ...args) {
... | ALGO | 0.999705 | 4.619014 |
ae19872b-d8c4-47c6-be87-388b243157ce | raincross7/code-similarity | codes/train_code/problem318/problem318_438.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;
int main(){
int a,b,c,t=0;cin>>a>>b>>c;
t=a+b+c;
cout<<t-max({a,b,c});
} | ALGO | 0.999675 | 3.818657 |
c9648366-b45f-4895-be8b-876f1308d508 | hicugi/acmp.ru | 11-20/0715 Миша и негатив.cpp | /*
(Время: 1 сек. Память: 16 Мб Сложность: 17%)
Миша уже научился хорошо фотографировать и недавно увлекся программированием. Первая программа, которую он написал, позволяет формировать негатив бинарного черно-белого изображения.
Бинарное черно-белое изображение – это прямоугольник, состоящий из пикселей, кажды... | ALGO | 0.999594 | 4.373935 |
f4bc37af-db79-48ac-a8cb-e320e62ed409 | SenseLogic/MYST | BOOST/boost_1_76_0/libs/date_time/example/posix_time/time_periods.cpp | /* Some simple examples of constructing and calculating with times
* Returns:
* [2002-Feb-01 00:00:00/2002-Feb-01 23:59:59.999999999] contains 2002-Feb-01 03:00:05
* [2002-Feb-01 00:00:00/2002-Feb-01 23:59:59.999999999] intersected with
* [2002-Feb-01 00:00:00/2002-Feb-01 03:00:04.999999999] is
* [2002-Feb-01 00:... | TOOL | 0.909391 | 5.631301 |
e701169c-2c20-48c8-a159-ac38d42c72ec | chaitusvk/astra_sim_complete | extern/network_backend/garnet/gem5_astra/src/systemc/tests/systemc/misc/user_guide/chpt5.1/accumulator.cpp | /*****************************************************************************
accumulator.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/************************************************************************... | ALGO | 0.992821 | 5.740953 |
58ed982b-fcc7-449d-887b-5c2a80308ab6 | vincentlaucsb/Graph-Drawing | lib/snap-exp/signnet.cpp | #include "stdafx.h"
#include "signnet.h"
/////////////////////////////////////////////////
// Signed network
PSignNet TSignNet::GetEdgeSubNet(const int& EDat1, const int& EDat2, const int& EDat3) const {
TIntSet EDatSet;
EDatSet.AddKey(EDat1);
if (EDat2!=TInt::Mn) { EDatSet.AddKey(EDat2); }
if (EDat3!=TInt::Mn... | ALGO | 0.993831 | 5.482807 |
2dc8ed74-967b-4ead-ace7-d832d52f0b7b | HEltim7/cpcode | Archive/HNISTOJ/51cpc/4066.cpp | #include <iostream>
#include <string>
using namespace std;
string a, b;
bool flag;
int main()
{
cin >> a >> b;
for (int i = 0;; i++)
{
flag = true;
for (int j = 0; j < b.length(); j++)
{
if (a[i + j] != b[j])
{
flag = false;
br... | ALGO | 0.9999 | 3.363658 |
dad5c08b-ecd4-467a-95e4-f085d3dd3922 | ishandutta2007/codeforces | kevin114514/normal/703/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
int Ans=0;
while(T--)
{
int b,p;
cin>>b>>p;
if(b>p)
Ans++;
if(p>b)
Ans--;
}
if(Ans==0)
puts("Friendship is magic!^^");
else if(Ans>0)
puts("Mis... | ALGO | 0.999701 | 3.62981 |
1a111631-a4ad-4d6e-aa1c-5de27d852b41 | sinian666/codes_82_1 | cpp_副本16/chapter_stack_and_queue/deque.cpp | /**
* File: deque.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化双向队列 */
deque<int> deque;
/* 元素入队 */
deque.push_back(2);
deque.push_back(5);
deque.push_back(4);
deque.push_front(3);
deque.push_fron... | TEST | 0.916747 | 5.774346 |
d7e42ff8-ce0b-43ba-9792-222fb59d984d | funktionpi/pilar | src/fx/pacifica.cpp | #include "led.h"
#include <fx/pacifica.h>
#include <fx/registry.h>
#include "display.h"
Pacifica::Pacifica() { FxRegistry.registerFX(this); }
//
// "Pacifica"
// Gentle, blue-green ocean waves.
// December 2019, Mark Kriegsman and Mary Corey March.
// For Dan.
//
// Add one layer of waves into the led array
voi... | TOOL | 0.898536 | 3.919755 |
a40fb113-6500-47bd-acc6-9674852d2997 | Santosh-Pathak/DSA_Busted_Sheet | k-Diff_Pair.cpp | #include <bits/stdc++.h>
using namespace std;
void printArray(vector<int> arr, int n)
{
int i = 0;
cout << endl
<< "ARRAY THUS FORMED IS : ";
while (i < n)
{
cout << arr[i++] << " ";
}
}
// BTUTE FORCE METHOD 0(N2) *returning duplicate answer / repeating answer
// int findPairs(vect... | ALGO | 0.999749 | 5.183403 |
2f9a59a4-d7d1-4f74-a8e3-179e29249fbc | SerbIMolot/SdlwBox2d | Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | #include "Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h"
#include "Box2D/Common/b2BlockAllocator.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include <new>
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->All... | ALGO | 0.961258 | 7.221778 |
c3b767f2-b59e-4ae9-bc0b-41ef715a102f | compix/Monte-Carlo-Raytracer | third_party/assimp/code/FixNormalsStep.cpp | /** @file Implementation of the post processing step to invert
* all normals in meshes with infacing normals.
*/
// internal headers
#include "FixNormalsStep.h"
#include <assimp/StringUtils.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <stdio.h>
using name... | TOOL | 0.87835 | 6.749271 |
a328ccff-979a-40a0-a54c-3f8884f1c79a | bagusmaulanahasan/UTS_06TPLM004_221011400240 | 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 |
0eb1eed4-1ff8-419f-ba09-96137802759b | sujeong000/PS-Study | BOJ/14000-14999/14791.cpp | #include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll N;
vector<ll> tidy;
void calc_tidy(ll x) {
tidy.push_back(x);
if (x > 100000000000000000) return;
for (int i=x%10; i<=9; i++) {
calc_tidy(x*10+i);
}
}
int u... | ALGO | 0.999507 | 5.768728 |
14632aa4-2e95-403b-87a2-e01500a9c1d3 | Huzaifa-Khan444/Data-Structure | Returns Max Value/Returns Max Value.cpp | #include<stdio.h>
int MaxValue(int *array) {
int c = array[0];
for (int i = 1; i < 10; i++) {
if (c < *(array + i)) {
c = *(array + i);
}
printf("Maximum Value is %i\n",c);
}
return 0;
}
int main() {
int array[10];
int i;
for (i = 0; i < 10;... | ALGO | 0.999201 | 4.257136 |
283088d3-d45a-4095-9a06-7d1be1c4831e | BangKartavya/GFG | Grinding Geek/main.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int helper(int curr, int totalrem, vector<int> &cost, vector<vector<int>> &dp)
{
if (curr == cost.size())
return 0;
if (totalrem < 0)
return 0;
i... | ALGO | 0.998139 | 4.985988 |
6f644042-1302-42c9-b85b-f8ab7f7622e0 | islomhon/test | git_test1/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.997643 | 6.76775 |
15d69b64-ffe8-4a1f-a904-be2896be5256 | PublicKSH/PS | CODE_NOTE_CPP/2. Shortest Path/Bellman Ford.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define FUP(i, a, b) for(int i = a; i <= b; i++)
#define FDOWN(i, a, b) for(int i = a; i >= b; i--)
#define MS(a, b) memset(a, b, sizeof(a))
#define ALL(v) v.begin(), v.end()
#define CIN(a) cin >> a;
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, ... | ALGO | 0.999279 | 4.050101 |
e11c7631-7e26-49ce-bbbc-548ea47c4872 | Aporna-264/Task_1 | C++/Monkey.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string line;
while (getline(cin, line))
{
string filtered_line = "";
for (int i = 0; i < line.length(); i++)
{
if (line[i] != ' ')
{
filtered_line += line[i];
}
... | ALGO | 0.999965 | 4.200278 |
3125a8a8-41f9-46b6-8550-0865e9ad726a | JaswanthDBMS/OBJECT-ORIENTED-C-PROGRAMMING-LANGUAGE | palindrome or not C++ - Copy (2).cpp | #include <iostream>
bool isPalindrome(int number) {
int originalNumber = number;
int reversedNumber = 0;
while (number > 0) {
int digit = number % 10;
reversedNumber = reversedNumber * 10 + digit;
number /= 10;
}
return originalNumber == reversedNumber;
}
int main() {
... | ALGO | 0.999384 | 5.355613 |
a21e7fed-2cbe-49a7-9964-22b64114f145 | MarvinMachry/insertionQuicksort | insertion/Untitled1.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
void mostrar(int **p, int **o);
main()
{
int x[5]= {7,11,23,43,56};
int *px;
int *i = new int(0);
px = x;
while(*i<5)
{
cout<<"Endereco de memoria: "<<endl;
cout<<p... | ALGO | 0.980181 | 3.412871 |
d18be2b6-9acc-4ff0-861d-11c0fd0557c2 | dangarmol/algorithms-and-data-structures | UVa Online Judge/the3n+1problem.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
void cycles(const int &n, int &contador, unordered_map<int, int> &resultados) {
if (resultados.find(n) != resultados.end()) {
contador = resultados[n];
}
else {
if (n % 2 == 0) cycles(n / 2, contador, resultados);
else cycles(3 * n + 1, contad... | ALGO | 0.999859 | 4.211571 |
d0dbcc3c-c079-4431-86ed-50c2668d8faa | ritwikkhurana/Leet-Code-Submissions | 2503-longest-subarray-with-maximum-bitwise-and/longest-subarray-with-maximum-bitwise-and.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums) {
int maxLen=1,currLen=1,maxNum=nums[0],prev=0;
for (int i = 1 ; i < nums.size() ; i++) {
if (nums[i] > maxNum) {
maxLen = 1;
currLen = 1;
maxNum = nums[i];
} else ... | ALGO | 0.999889 | 5.892277 |
8991ab7d-72c1-4b8e-b666-001b34f7aee6 | nqanh123/Cpp-PTIT | 51.cpp | #include<iostream>
#include<string.h>
using namespace std;
void max(int t, int cs){
while (cs > 0){
if(t > 9){
cout << 9;
t-=9;
cs--;
}
else{
cout << t;
t = 0;
cs--;
}
}
cout << endl;
}
void min(int cs, int t){
string s = "";
while (cs--){
if(t > 9){
s += "9";
t-=9;
}
... | ALGO | 0.99977 | 3.946627 |
d2eb6186-33f9-4151-90e1-ac7abe48b4b6 | goldi1027/GT-EHL | boost_1_64_0/libs/thread/example/perf_condition_variable.cpp | #define BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/chrono/stopwatches/simple_stopwatch.hpp>
#include <condition_variable>
#include <future>
#include <limits>
#include <cstdio>
#include <thread>
#include <mutex>
#include <vec... | TEST | 0.977966 | 7.201347 |
b8aae28c-1a0b-4e46-a996-1413941b75f4 | wyrover/book-code | Exploring C++ 11/chapter46/list4607.cpp | // Listing 46-7. Other Arithmetic Assignment Operators
rational& rational::operator+=(rational const& rhs)
{
numerator_ = numerator() * rhs.denominator() + rhs.numerator() * denominator();
denominator_ *= rhs.denominator();
reduce();
return *this;
}
rational& rational::operator-=(rational const& rhs)
{
numer... | TOOL | 0.868796 | 6.941622 |
e7b117e9-8931-44e3-8c36-aa86a4e8b5ec | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9112_2.cpp | #include <bits/stdc++.h>
using namespace std;
double a[10100], k, l, r, d, s;
int i, n;
int main() {
cin >> n >> k;
for (i = 0; i < n; i++) cin >> a[i];
l = 0;
r = 1000;
while (l < r - 1e-8) {
d = (l + r) * 0.5;
s = 0;
for (i = 0; i < n; i++)
if (a[i] > d)
s -= (a[i] - d) * (100 - k)... | ALGO | 0.999959 | 3.535067 |
d876b9fc-66ab-477c-aac2-bf0b664d36c0 | ngng628/competitive-programming | codeforces/div3/1702/G1/main.cpp | # pragma region library
# include <bits/extc++.h>
# define int Int
# define float Float
# define overload3(_1,_2,_3,name,...) name
# define _step(n) _rep(_,n)
# define _rep(i,n) _repr(i,0,n)
# define _repr(i,b,e) for(int i=(b), i##_len=(e); i<i##_len; ++i)
# define rep(...) overload3(__VA_ARGS__, _repr, _rep, _step)(__... | ALGO | 0.99998 | 4.396424 |
bc66e00f-37e5-4bbd-ac44-b8d5cc5a8987 | linuxdeepin/opencv-mobile | opencv-4.5.4/modules/features2d/src/feature2d.cpp | #include "precomp.hpp"
namespace cv
{
using std::vector;
Feature2D::~Feature2D() {}
/*
* Detect keypoints in an image.
* image The image.
* keypoints The detected keypoints.
* mask Mask specifying where to look for keypoints (optional). Must be a char
* matrix with non-zero value... | ALGO | 0.935338 | 6.669952 |
5c6f73e8-7eb9-467f-bc1d-72cbf4073257 | Momen-G-Ar/problem-solving | Codeforces/Div 4/971-A.cpp | ////////////////////////////////////////////////////////////
// //
// <<<<<<<<<<<< Momen Ghazi Arafeh >>>>>>>>>>>>>> //
// <<<< Don't wait the opportunity create it >>>> //
// //
///////////////... | ALGO | 0.999598 | 5.052974 |
cd3d5364-bd9a-4e6f-8936-e831c0677da0 | pythonman1234/100-codes-in-1-day | triangle_star.cpp | #include <iostream>
using namespace std;
int main()
{
int rows;
rows = 5;
for (int i = 1; i <= rows; i++)
{
for (int j = 1; j <= 1; j++)
{
cout << "*";
}
cout << endl;
}
return 0;
} | ALGO | 0.997075 | 3.715765 |
bc0ca50d-ea3d-4ba4-a8ce-66dbc5ce9678 | PreethiHarshini21/CPP-Practice-Questions | P73twoDarray.cpp | // 2-D ARRAYS [MATRICES]
// Searching a matrix
#include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int arr[n][m];
for (int i = 0; i < n; i++) // taking input of matrix
{
for (int j = 0; j < m; j++)
{
cin>>arr[i][j];
}
... | ALGO | 0.99991 | 4.516665 |
4cbe410f-6a2c-43c2-afeb-16852e2ce024 | shfnr/2023aaib3 | week08/week08-2.cpp | // week08-2.cpp
class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int ans = 0;
int N = mat.size();
for(int i=0; i<N; i++){
ans += mat[i][i];
ans += mat[i][N-1-i];
}
if(N%2==1) ans -= mat[N/2][N/2];
return ans;
}
};
| ALGO | 0.999941 | 5.546576 |
fc554174-7313-4d18-9207-87bcd3c9946a | miruddin11/Algorithms | 2306-create-binary-tree-from-descriptions/2306-create-binary-tree-from-descriptions.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.999836 | 6.620662 |
7ccaa5de-5791-4f5b-8342-4cf3562b749d | prakhar-pipersania/LeetCode-Solutions | Questions Level-Wise/Easy/house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums)
{
if(!nums.size())
return 0;
if(nums.size()==1)
return nums[0];
nums[1]=max(nums[0],nums[1]);
for(int i=2;i<nums.size();i++)
nums[i]=max(nums[i-1],nums[i]+nums[i-2]);
return nums[nums... | ALGO | 0.999865 | 5.947338 |
8d1a232e-4dfb-48e2-ad55-89b28c9c2ce7 | Gj0705/RELOCALIZATION | 第一章 概述/lidar_localization/third_part/gtsam-4.0.2/gtsam_unstable/nonlinear/ConcurrentIncrementalFilter.cpp | /**
* @file ConcurrentIncrementalFilter.cpp
* @brief An iSAM2-based Filter that implements the
* Concurrent Filtering and Smoothing interface.
* @author Stephen Williams
*/
#include <gtsam_unstable/nonlinear/ConcurrentIncrementalFilter.h>
#include <gtsam/nonlinear/LinearContainerFactor.h>
#include <... | ALGO | 0.97495 | 7.657711 |
df5a767b-793b-4182-94de-e8f5d7e41584 | StrongPC123/Far-Cry-1-Source-Full | STLPORT/test/regression/search0.cpp | // STLport regression testsuite component.
// To compile as a separate example, please #define MAIN.
#include <algorithm>
#include <iostream>
#ifdef MAIN
#define search0_test main
#endif
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
using namespace std;
#endif
int search0_test(int, char**)
{
cout<<"Resu... | TEST | 0.857264 | 5.921446 |
e38af536-756d-436e-8a5e-555b50f7bb4d | fab1an111111/Proyecto-python | entrenamiento opencv ruidos/opencv-4.x/3rdparty/carotene/src/add.cpp | #include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <typename T, typename WT>
struct AddWrap
{
typedef T type;
void operator() (const typename internal::VecTraits<T>::vec128 & v_src0,
const typename internal::VecTraits<T>::v... | TOOL | 0.966771 | 6.213745 |
63177f75-eb5f-496a-8036-e677cd495ee6 | ishandutta2007/codeforces | mohammedehab2002/normal/1119/E.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
long long pen=0,ans=0;
while (n--)
{
int a;
scanf("%d",&a);
int tmp=min(a/2LL,pen);
a-=2*tmp;
ans+=tmp+a/3;
pen+=a%3-tmp;
}
printf("%I64d",ans);
} | ALGO | 0.999872 | 3.249365 |
df2e4f14-e2eb-4313-bc43-7ec807f1f2d3 | binji/love-nacl | src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp | #include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Pulley:
// length1 = norm(p1 - s1)
// length2 = norm(p2 - s2)
// C0 = (length1 + ratio * length2)_initial
// C = C0 - (length1 + ratio * length2)
// u1 = (p1 - s1) / norm(p1 - s1)
// u2 = (p2 -... | ALGO | 0.995897 | 6.996031 |
61d164f0-a38a-4bf6-851d-54d472b51146 | zz990099/EasyDeployTool | deploy_core/src/base_stereo.cpp | #include "deploy_core/base_stereo.hpp"
#include "deploy_core/wrapper.hpp"
namespace easy_deploy {
const std::string BaseStereoMatchingModel::stereo_pipeline_name_ = "stereo_pipeline";
BaseStereoMatchingModel::BaseStereoMatchingModel(
const std::shared_ptr<BaseInferCore> &inference_core)
: inference_core_(inf... | ALGO | 0.861139 | 6.816461 |
a306e8a8-60c8-430d-854a-3b67b19b344c | Shaun1280/Program | cpp/Network_Flow/Cost/Napkin.cpp | #include<bits/stdc++.h>
//https://www.luogu.com.cn/problem/P1251
constexpr int MAXN = 4e3 + 6;
constexpr long long Inf = 0x3f3f3f3f3f3f3f3f;
using namespace std;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
while (isdigit(ch)) x = x * 10 +... | ALGO | 0.99951 | 3.740259 |
dadfccd1-383f-4721-ab01-1a03d0ec66d2 | cryptrade-project/cryptradecoin-core | src/qt/rpcconsole.cpp | #include "rpcconsole.h"
#include "ui_rpcconsole.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "peertablemodel.h"
#include "chainparams.h"
#include "main.h"
#include "rpcclient.h"
#include "rpcserver.h"
#include "util.h"
#include "json/json_spirit_value.h"
#include <openssl/crypto.h>
#ifdef ENABLE_WALLE... | TOOL | 0.863955 | 6.577013 |
cf0957b9-f379-4deb-89a2-5a363ca648ca | ishandutta2007/codeforces | everule/normal/1332/C.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
int maxcount(const vector<char>& seq){
int count=1,ans=1;
for(int i=1;i<seq.size();i++){
if(seq[i]!=seq[i-1]){
... | ALGO | 0.999952 | 4.144666 |
aa7137ce-08fc-4b02-b1a0-94a87fb75f55 | NehalKaneria1501/Programming-in-cpp-with-oops-concept | Assessment 5.11.cpp | #include <iostream>
using namespace std;
int main()
{
int num,originalNum,remainder,result=0;
cout<<"Enter a three-digit integer:";
cin>>num;
originalNum=num;
while(originalNum!=0)
{
remainder=originalNum%10;
result+=remainder*remainder*remainder;
originalNum/=10;
}
... | ALGO | 0.99951 | 3.977333 |
ded08d8c-6b8e-4e50-b7df-1ab01fa728e6 | ZephyrZhng/code_win | interesting programs/233primefactor.cpp | #include <cstdio>
#include <cmath>
#include <limits>
using namespace std;
#define MAX numeric_limits<long long>::max()
bool isprime(long long n)
{
for(long long i = 2; i <= sqrt(n); ++i)
{
if(!(n % i))
{
return false;
}
}
return true;
}
void f(long long n)
{
if(isprime(n) && n > 1)
{
printf("%lld\t"... | ALGO | 0.997039 | 3.686832 |
d409973a-e87b-488b-ab68-83d78bf7575b | vittorioerba/FreeEnergyMultimodeQEDpaper | c++/eigen/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.916071 | 6.417363 |
89bfc109-2dc0-4620-a4d7-5f5663a7334b | mir183/CodeForces | 96Magical Sticks/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define endl '\n'
#define fasterio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
int main() {
fasterio;
int t;
cin>>t;
while (t--)
{
... | ALGO | 0.999353 | 5.037035 |
eddcd25b-422c-4f6c-971a-c43785da7ff6 | melrusso8/eecs106a_group_47 | workspace/src/ar_track_alvar/ar_track_alvar/src/IntegralImage.cpp | #include "IntegralImage.h"
namespace alvar {
void IntIndex::update_next_step() {
next_step = step;
estep += step_remainder;
if (estep >= steps) {
estep -= steps;
next_step++;
}
}
IntIndex::IntIndex(int _res, int _steps) {
res = _res;
steps = _steps;
operator=(0);
}
int Int... | ALGO | 0.982583 | 4.55288 |
21723618-c0f8-4ca7-a240-4c227a3c2a33 | danakatheri/2023_winter_cis5 | hw/Assignment #6/Product Table/main.cpp | #include <iostream> //Input/Output Library
#include <iomanip> //Format Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc...
const int COLS=6;
//Function Prototypes
void fillTbl(int [][COLS],int);
void pr... | ALGO | 0.961989 | 4.444906 |
689a0517-c8a2-449e-aa01-016c7c262c63 | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/0500-0599/0573.Squirrel Simulation/Solution.cpp | class Solution {
public:
int minDistance(int height, int width, vector<int>& tree, vector<int>& squirrel, vector<vector<int>>& nuts) {
int ans = INT_MAX;
int s = 0;
for (auto& a : nuts) {
s += f(a, tree);
}
s *= 2;
for (auto& a : nuts) {
int c ... | ALGO | 0.999899 | 5.422746 |
f96aca3b-fb27-439a-b4c5-c3c9659f4c62 | FiveGuysLab/ros2_galactic | src/eProsima/Fast-DDS/src/cpp/utils/UnitsParser.cpp | /*
* UnitsParser.cpp
*
*/
#include <utils/UnitsParser.hpp>
#include <algorithm>
#include <cctype>
#include <cstdint>
#include <limits>
#include <map>
#include <regex>
#include <set>
#include <stdexcept>
#include <string>
namespace eprosima {
namespace fastdds {
namespace dds {
namespace utils {
void to_uppercase... | TOOL | 0.939928 | 7.660233 |
df14350d-d880-4851-a934-56443f2a36fe | artemhula/habits_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.998757 | 6.771107 |
6fcc286f-3ad8-4c84-93cb-4841f5dbec22 | quan-dao/ECN-ARPRO-Open-Projects | inc/astar4puzzle.cpp | #include "astar4puzzle.h"
#include <vector>
#include <algorithm>
AStar4Puzzle::AStar4Puzzle(NodePuzzle initialNode)
{
initialNode_.setCurrentState(initialNode.getCurrentState());
}
bool foundIn(std::vector<NodePuzzle> set, NodePuzzle node)
{
int i = 0;
bool found = false;
while (!found && i < set.size... | ALGO | 0.999713 | 4.463378 |
f51e73ee-191e-4134-909a-4e13e7cadb50 | bmzhong/dev | class/oop/week1-1/first_exercise.cpp | #include <iostream>
#include <map>
#include <set>
#include <string>
#include <fstream>
using namespace std;
map<string, int> m; //将单词作为键放在map中,单词出现的次数作为值,map对string类型默认按字典序排序。
multiset<string> s; //将单词放入multiset中,set会对string类型默认按字典序排序,可储存相同的值。
void read();
void output_to_file();
void output_to_console();
int main()
{
... | ALGO | 0.997241 | 4.717381 |
261905ee-9068-432f-ae9d-3ec530fe934b | phUR99/ps | 2024/24_하반기/12/2411.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define ll long long
int n, m, a, b;
int board[105][105];
int cache[105][105][105];
int solve(int x, int y, int num)
{
if (x == n && y == m)
return num == a;
in... | ALGO | 0.999359 | 4.487467 |
f860a62b-d2df-4ec0-a8c8-1e6774dd36d2 | aakashraawat/Obstacle-Avoidance-ROS | src/turtlebot3_simulations/turtlebot3_gazebo/src/turtlebot3_drive.cpp | /* Authors: Taehun Lim (Darby) */
#include "turtlebot3_gazebo/turtlebot3_drive.h"
Turtlebot3Drive::Turtlebot3Drive()
: nh_priv_("~")
{
//Init gazebo ros turtlebot3 node
ROS_INFO("TurtleBot3 Simulation Node Init");
auto ret = init();
ROS_ASSERT(ret);
}
Turtlebot3Drive::~Turtlebot3Drive()
{
updatecommandVe... | TOOL | 0.898859 | 4.319952 |
18854ef2-b54a-40b8-a5d5-9fac27a6f05a | tinytrashbin/docker_experiment | source/compute.cpp | #include <iostream>
#include <chrono>
#include <assert.h>
#include "timer.hpp"
uint fibonacci(uint n) {
if (n <= 1) return 1;
std::string s = "A";
s.resize(sizeof(s) + 1); // Enforce dynamic memory allocation.
s[0] += (n * n - ((n+1)*(n-1)));
return fibonacci(n-1) + fibonacci(n-2) + (s[0] - 'B');
}
int ma... | ALGO | 0.934478 | 6.492744 |
d55539e3-bee4-4476-a920-5c245b8379f0 | BrunoPB/TP2-FTC | Code/main.cpp | /**
* @author Bruno Pena Baêta (696997)
* @author Felipe Nepomuceno Coelho (689661)
*/
#include <iostream>
#include "pugixml/pugixml.hpp"
#include "algorithms.cpp"
#include <chrono>
#include <fstream>
// #define BASE_PATH "./../" // Debug path
#define BASE_PATH "./../../" // Execution path
FA loadDfaFromFile(bool... | ALGO | 0.974498 | 6.821737 |
04f40720-4b75-493d-800a-a2267ab11064 | GatsLee/code_force | 859_div4_2023_03_19/D.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int T;
int main(void) {
string str;
int n, q;
int l, r, k;
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>T;
while (T--) {
cin>>n>>q;
vector <long long> map(n);
for (... | ALGO | 0.997656 | 3.645046 |
f9179d59-ea86-4eee-9205-fd8a431de472 | ishandutta2007/codeforces | elegia/normal/1000/D.cpp | #include <cstdio>
#include <cstring>
using namespace std;
const int N = 1010, P = 998244353;
int n;
int dp[N], tmp[N];
int main() {
scanf("%d", &n);
dp[0] = 1;
for (int rep = 0; rep < n; ++rep) {
int a;
scanf("%d", &a);
memcpy(tmp, dp, sizeof(tmp));
if (a > 0 && a <= n) {
tmp[a] += dp[0];
if (tmp[a... | ALGO | 0.999894 | 3.859507 |
1fd2866b-26e8-40e5-9d0a-c4acea176d4c | hhhhc-da/Q-learning | Eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A;
A << 1, 2, 2, 3;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
if (eigensolver.info() != Success) abort();
cout << "The eigenvalues of A ... | ALGO | 0.999628 | 3.846247 |
e4936fc9-f422-4c1d-b06f-da7bf4c78d0a | ishandutta2007/codeforces | errorgorn/normal/1610/I.cpp | //
//
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#de... | ALGO | 0.99992 | 4.051366 |
47616ca5-11c8-49ba-8b16-8d26dc92f73e | ishandutta2007/codeforces | square1001/normal/559/B.cpp | #include <string>
#include <iostream>
using namespace std;
string calc(string s) {
int n = s.size();
if (n % 2 == 1) return s;
string sa = calc(s.substr(0, n / 2));
string sb = calc(s.substr(n / 2));
return (sa < sb ? sa + sb : sb + sa);
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
string sa; ci... | ALGO | 0.999997 | 3.282081 |
c7048174-5631-4647-89c3-1ea74e6b79f5 | roastduck/team_homework | usaco_fence/fence.cpp | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=255;
int N, ans, X[maxn], Y[maxn], no[maxn][maxn], f[maxn][maxn];
double dir[maxn];
inline bool cmp(int a, int b) { return dir[a]<dir[b]; }
inline int cross(int x1, int y1, int x2, int y2) { return x1*y2-x2*y1;... | ALGO | 0.99992 | 3.914945 |
f75e2fa5-1e84-4df8-92ad-8095d6b6d401 | achinverma/android-gpuimage-plus | library/src/main/jni/cge/filters/cgeSaturationAdjust.cpp | /*
* cgeSaturationAdjust.cpp
*
* Created on: 2013-12-26
* Author: Wang Yang
*/
#include "cgeSaturationAdjust.h"
const static char* const s_fshSaturation = CGE_SHADER_STRING_PRECISION_M
(
varying vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform float saturation;
uniform float hue;
uniform flo... | TOOL | 0.909674 | 3.8971 |
f964ef5e-ebd5-4022-bb16-5138f0d5cb54 | HHS-Proclub/hhs-pro-club-website | solutions/PRI4/jser015@student.fuhsd.org.cpp | #include <iostream>
#include <vector>
using namespace std;
#define pb push_back
void solve() {
int n; cin >> n;
// index represents... the index, element represents the position of the camel
vector<int> camelIndex(n);
// the index represents the position of the camels(i = 0 -> x = -10^4)
//... | ALGO | 0.999954 | 4.632322 |
c3090ec6-019c-498b-878d-383ecdeddb0a | hbayazid969/beecrowd_Solve | BEGINNER/8.Difference.cpp | /*
https://www.beecrowd.com.br/judge/en/problems/view/1007
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z,a;
cin>>x>>y>>z>>a;
int avg =(x*y)-(z*a);
cout<<"DIFERENCA = "<<avg<<endl;
}
| ALGO | 0.999641 | 3.719701 |
21c1831b-d0b3-4fcb-9419-fa50e1c5ab04 | iiKaran/Data-Structures-and-Algorithims | LinkedList/LeetCodeQuestions/DetectCycle.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
// creating a class named as Node
class Node
{
public:
int val;
Node *next;
Node()
{
val = 0;
next = NULL;
}
Node(int val)
{
next = NULL;
this->val = val;
}
};
class LinkedList
{
Node *head;
Node *tail;
int size;
public:
LinkedList... | ALGO | 0.999887 | 5.401938 |
f77ce20c-c9ad-4b2e-a634-bf8e97840be1 | ImNuam/study-in-army | 백준/이분 탐색/나무 자르기/나무 자르기.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m; // n : 나무의 수, m : 필요한 나무의 길이
vector<int> trees; // 제곧내
int main()
{
cin >> n >> m;
int last = 0;
for (int i = 0; i < n; i++)
{
int tmp;
cin >> tmp;
if (last < tmp)
{
last = tmp;
... | ALGO | 0.999997 | 4.735071 |
7617726f-dc3c-416d-88a9-d791de0b37c9 | vishwajeetsudhanshu/cpp_programming_with_DSA | Sorting/Bubble Sorting/sorting.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
vector<int> v(5);
cout<<"Enter the vector: ";
for(int i=0;i<5;i++){
cin>>v[i];
}
sort(v.begin(),v.end());//)(n logn)
reverse(v.begin(),v.end());
for(int i=0;i<5l;i++){
cout<<v[i]<<" ";
... | ALGO | 0.999714 | 3.618665 |
fc4de9d8-a6ce-4fc3-85fd-261c46c2a8c6 | mohmdhabib/Dice_Roll-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.9988 | 6.76073 |
acf04818-fa12-47a4-b1fd-89e7a24e0772 | cormoran/CompetitiveProgramming | src/contest/others/gcj/2017/DCJR1/A/main.cpp | #include <message.h>
#include <cassert>
#include <cstdio>
#include <pancakes.h>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.... | ALGO | 0.997331 | 3.708962 |
9708f9e2-a27e-4d35-93b0-23d3c256be0a | TodorokiKohei/atcoder | 2020_08/20/rec/arc068d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define all(x) (x).begin(),(x).end() // 昇順ソート
#define rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
ty... | ALGO | 0.999872 | 4.194857 |
fababff0-902b-4787-977e-3133a696f7db | Sunidhi-Tiwari/Leetcode | 123-best-time-to-buy-and-sell-stock-iii/123-best-time-to-buy-and-sell-stock-iii.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int states[2][4] = {INT_MIN, 0, INT_MIN, 0}; // 0: 1 buy, 1: one buy/sell, 2: 2 buys/1 sell, 3, 2 buys/sells
int len = prices.size(), i, cur = 0, next =1;
for(i=0; i<len; ++i)
{
states[next][0] = ma... | ALGO | 0.999969 | 5.934511 |
9277b472-d618-44d0-8b8c-b584c14bf530 | isha-24/Leetcode | Learn - Binary Tree/Lowest Common Ancestor of a Binary Tree.cpp | //https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
/**
* 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:
TreeNode* lowest... | ALGO | 0.999926 | 6.270526 |
1c4eb473-29bf-4942-af83-2477e4ccc3f9 | Ayush13082002/GFG-SOLUTIONS | Medium/Linked List that is Sorted Alternatingly/linked-list-that-is-sorted-alternatingly.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
Node(int x){
data =x;
next = NULL;
}
};
/* Function to print linked list */
void append(struct Node** headRef, struct Node** tailRef, int newData)
{
struct Node* new_node = new Node(newData)... | ALGO | 0.999942 | 5.581566 |
45b38294-6479-4372-b0bf-146fe8fe037f | yzzupgo/MFTCG | Data/abc136_b/HaksenK/ac/6694320.cpp | #include <iostream>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >>n;
int max = 1;
for(int i = 10*10*10*10*10; i > 1 ; i /= 10){
if(n/i > 0) {max=i;break;}
}
int ans;
if(max == 10*10*10*10*10) {
ans = 90909;
for(int i = 0; 1; i++){
if(n < 1000000+i) break;
else ans++;
}
}
else if... | ALGO | 0.999923 | 3.619283 |
8eca8ced-ccdf-4143-be87-4ff790a42d45 | Daily-AC/HNFNU-ACM | 22级通信1班张以琳/Codeforces Round 1022 (Div. 2)/D_Needle_in_a_Numstack.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve() {
int n, k;
cin >> n >> k;
int cnt = 0;
auto check = [&](int len) -> bool {
int llen = len % k, idx = len / k * k + 1;
if (!llen) llen = k, idx -= k;
for (int i = 1; i <= llen; ++i) {
c... | ALGO | 0.999552 | 3.507467 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.