uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f6c1cd04-e4c1-46a9-a77f-2c1fee2e83ab | Centinoughty/leetcode | 994.cpp | // Rotting oranges
// MEDIUM
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
queue<pair<pair<int, int>, int>> q;
int maxTime = 0;
for (int i = 0; i < grid.size(); i ++) {
for (int j = 0; j < grid[0].size(); ... | ALGO | 0.999857 | 6.005245 |
a39034f5-4912-42e4-985b-342ec5d13315 | umutcanbostancii/SoftITo-01-02-instagram-clone | 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 |
0f7bdce2-e484-45b3-bc59-dafb26af1adf | UjuiUjuMandan/yuzu | src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp | #include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
#include "shader_recompiler/backend/glasm/glasm_emit_context.h"
#include "shader_recompiler/frontend/ir/value.h"
namespace Shader::Backend::GLASM {
namespace {
void BitwiseLogicalOp(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b,
... | TOOL | 0.865889 | 7.342521 |
e9dec014-02fe-4f94-b34c-d3ae803b0842 | Doubletake27/CSCI1320 | CSCI 1320/Project/ExtraCredit/ProjHM.EC.cpp | // Henry Meyerson
// 109190761
// CSCI 1320 - 112
// Project - Extra Credit
#include <iostream>
#include <string>
#include <fstream>
#include <ctime>
using namespace std;
int lookUp(string words[], int len, string word);
int main(){
long int t = time(NULL);
// This will be the length and width of the 2D array be... | ALGO | 0.999214 | 4.391653 |
b15f2c63-744a-4b9d-8a6c-a116ab553fba | Vivekg1033/MPL_PROJECT | 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 |
966acc53-8b4a-4d0c-a447-40176aee5f1d | navir-rahman/dsa-module-14-cpp | queue-linked.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
class myQueue
{
public:
Node *head = NULL;
Node *tail = NULL;
int sz = 0;
void push(int val)
{
sz++;
... | ALGO | 0.998221 | 4.07479 |
e75bd957-ead2-4ac1-be66-831fbd70ef7e | idoine-project/frameworks_av | media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "VectorArithmetic.h"
/**********************************************************************************
FUNCTION JoinTo... | ALGO | 0.966101 | 4.802431 |
72f05e55-eebb-4cd1-b2eb-b35e8e4d70c1 | schmmd/chairequalsmoney | Game.cpp | #include "game.h"
void CGame::Move(int dx, int dy)
{
char oldtile = Get(_player.x, _player.y);
char newtile = Get(_player.x + dx, _player.y + dy);
if (oldtile == '@')
Set(_player.x, _player.y, ' ');
else if (oldtile == '+')
Set(_player.x, _player.y, '.');
_player.x += dx;
_player.y += dy;
if (newtile == ... | ALGO | 0.938647 | 3.751293 |
403108d6-cbef-4eba-8a32-20e1e1c82168 | victorsun0926/Learning | C++/test9.cpp | /*
* @Author: Victor Sun
* @Github: https://github.com/victorsun0926/
* @CreateTime: 2020-03-31 14:24:02
* @LastEditTime: 2020-03-31 15:12:26
*/
#include <iostream>
using namespace std;
int main(){
int n=3;
for(int i=1;i<=4;i++){
for(int x=1;x<=n;x++){
cout<<" ";
}
for(i... | ALGO | 0.999954 | 3.161951 |
d355e7ba-22ca-456a-897b-87afe07f862d | zkrguan/Journey_to_Parallel | 5_MPI/Example Code 1/WS08.cpp | // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//#define SIMPLE
//#define SERIAL
#define MPI_SOLUTION
//#define TEST_CONFIG
#ifdef TEST_CONFIG
#include <iostream>
#include <mpi.h>
// Don't forgot to send arguments
int main(int argc, char** argv) {
... | ALGO | 0.999479 | 4.07771 |
bc76749c-aba2-4cf5-a4d5-13dd82bc3350 | PCY00/BOJ_Project | BOJ/1152.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
int cnt = 1;
getline(cin, str);
for (int i = 0; i < str.length(); i++) {
if (str[i] == ' ') {
cnt++;
}
}
if (str[0] == ' ') cnt--;
if (str[str.length() - 1] == ' ') cnt--;
cout << cnt << '\n';
return 0;
} | ALGO | 0.999165 | 3.690865 |
2e04dd1c-489a-45b0-bd56-94e883142f06 | git-bauerseb/leetcode-solutions | problems/2454_second_greater.cpp | #include <bits/stdc++.h>
using namespace std;
struct Comparator {
bool operator()(pair<int,int>& a, pair<int,int>& b) {
return a.first > b.first;
}
};
/*
2,4,0,9,6
Stack: Indc:
2
4 2
4,0 2
9 4,0
*/
class Solution {
pub... | ALGO | 0.999938 | 5.796669 |
ac720715-27b6-46a6-9fc1-1edf0a25a231 | AliOsm/CompetitiveProgramming | a2oj/356. Counting Extra Stars.cpp | #include <iostream>
using namespace std;
int main() {
int i, space, rows, k = 0;
cin >> rows;
for(i = 1; i <= rows; ++i) {
for(space = 1; space <= rows - i; ++space) {
cout << " ";
}
while(k != 2 * i - 1) {
cout << "*";
++k;
}
k =... | ALGO | 0.999877 | 4.123083 |
807a692c-7b37-4b52-928b-240a68dbad5a | inchori/Problem-Solving | DFS_BFS/Perfect_Squares.cpp | #include <vector>
#include <queue>
using namespace std;
class Solution {
public:
vector<int> squares;
queue<pair<int, int>> q;
bool visited[10005];
int answer;
void bfs(int n) {
q.push(make_pair(n, 0));
visited[n] = true;
while (!q.empty()) {
pair<int, int>... | ALGO | 0.999969 | 4.596137 |
16104fea-0c95-4e24-bc80-2e061701daf3 | daeroro/PS | 20.05/Solved_H/17140.cpp | #include <iostream>
#include <queue>
using namespace std;
struct pos{
int x, n;
};
int R, C, K, curR, curC;
int A[105][105];
priority_queue<struct pos> pq;
bool _isCorrect()
{
//cout<<"cur "<<A[R][C]<<"\n";
if(A[R][C] == K) return 1;
else return 0;
}
bool operator<(struct pos a, struct pos b)
{
... | ALGO | 0.999945 | 3.739751 |
05b67e77-0df9-4980-bd82-5eb8ab0ab6fe | IsobelRosenbaum/data-structure-and-algorithms | kruskal.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
#define iAmInevitable ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//map<ll,ll> freq;
//map<ll,ll> :: iterator itr;
//for(itr=freq.begin();itr!... | ALGO | 0.999992 | 4.566586 |
d71d259e-d480-4be9-bd86-88b281b4a5d5 | DeepInMind12345/UEToonShading | Engine/Source/ThirdParty/CryptoPP/5.6.5/include/xtr.cpp | // xtr.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "xtr.h"
#include "nbtheory.h"
#include "integer.h"
#include "algebra.h"
#include "modarith.h"
#include "algebra.cpp"
NAMESPACE_BEGIN(CryptoPP)
const GFP2Element & GFP2Element::Zero()
{
return Singleton<GFP2Element>().Ref();
}... | ALGO | 0.999583 | 4.155697 |
71d31966-ed4d-41a9-889a-ce479836b040 | xanarry/source-code | CPP/霍夫曼编码_数组方法.cpp | #include <iostream>
#include <cstring>
#include <queue>
#include <string>
#include <map>
using namespace std;
struct Node
{
char value;
int weight;
int parent;
int left;
int right;
bool operator< (const Node a) const
{
return weight > a.weight;
... | ALGO | 0.999955 | 3.794368 |
da23c9b9-4e98-4ade-baf9-38a86476bdbd | Hassan-n/cpp-programs | ParkingChargesCalculator.cpp | // calculates parking charges for three customers based on the number of hours they parked their cars
#include <iostream>
#include <iomanip>
using namespace std;
double customer1, customer2, customer3;
void userInput();
double calculateCharges(double);
void displayOutput();
int main() {
userInput();
display... | TOOL | 0.970604 | 4.569255 |
8de253c6-6a61-4738-8f23-470e0d3aad8a | Shahzod010299/provider_with_api | 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 |
dd5245e7-3bc7-41a5-bab8-b5b515cfb972 | vork/PyNanoInstantMeshes | native/ext/eigen/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.999541 | 5.560641 |
3de8d87a-9de3-4e1e-89ea-8a921e86a428 | CodingPO8/ORE | QuantLib/ql/methods/finitedifferences/meshers/exponentialjump1dmesher.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*! \file exponentialjump1dmesher.cpp
\brief mesher for a exponential jump mesher with high
mean reversion rate and low jump intensity
*/
#include <ql/math/incompletegamma.hpp>
#include <ql/math/integrals/gausslobattointeg... | ALGO | 0.998705 | 6.231752 |
3b3ac920-61ce-408c-a1d1-4ef500a54c44 | sufykhan/Codeforces | 98-validate-binary-search-tree/98-validate-binary-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.999961 | 6.702391 |
ddf009f1-56c9-418f-b0f5-e279f52cceb2 | ehnryx/lca | geometry/deprecated/tests/delaunay_pandapreserve.cpp | #pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
#include <bits/stdc++.h>
using namespace std;
#ifdef HENRYX
#include "../delaunay.h"
#else
#include "delaunay.h"
#endif
constexpr char nl = '\n';
using ld = double;
// eps = 1e-9 passed for ld = long double, but failed for ld = double
// eps = 1e-8 passed ... | ALGO | 0.999576 | 5.150908 |
0bf013c0-454f-414c-a6ce-22d4c19121f8 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7088_4.cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
int n, k;
scanf("%d %d", &n, &k);
int g = k;
for (int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
g = gcd(k, x);
}
printf("%d\n", k / g);
for (int i = 0; i < k / g; i++) pr... | ALGO | 0.99997 | 3.462387 |
2bf1d20b-17bf-483c-912a-df2f54be3d22 | Josh24csu087/FOCP--Assignment-1 | c++ assignment-1 FOCP-||/Q3.CPP | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
string input;
cout << "Enter a string: ";
getline(cin, input);
transform(input.begin(), input.end(), input.begin(), ::tolower);
string cleanedStr;
for (char ch : input) {
if (ch != ' ') {
cleanedStr... | ALGO | 0.998884 | 5.06803 |
92c01d14-a18c-4652-8150-75c206ce93a1 | AICP-UL/frameworks_av | media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "Mixer_private.h"
#include "VectorArithmetic.h"
/**************************************************************************... | ALGO | 0.98558 | 5.55645 |
16c5daf5-bbb7-41bf-af32-aa09c40f45c7 | AyoubEd-zz/leetcode | move-zeroes.cpp | /* https://leetcode.com/problems/move-zeroes/
* Solution: Swapping
*/
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int i=0, j=0;
while(i<nums.size()){
if(nums[i]!=0){
swap(nums[j],nums[i]);
j++;
}
i++;
}
... | ALGO | 0.999945 | 6.565022 |
aa786e14-197b-46aa-b9aa-9dbd8d7b9e4a | QbitQuantum/Basics | Исходники/SphereDoubleSidedPlaneContactCalculationTests.cpp | void doSphereDoubleSidedPlaneTest(std::shared_ptr<SphereShape> sphere,
const Quaterniond& sphereQuat,
const Vector3d& sphereTrans,
std::shared_ptr<DoubleSidedPlaneShape> plane,
const Quaterniond& planeQuat,
const Vector3d& planeTrans,
bool expectedIntersect,
... | TEST | 0.889895 | 7.465413 |
5c86f278-ccb1-4e27-8f1b-7ff4a4e4a52b | bielrabasa/PhysicsII_Box2D_Pinball | Physics II - Box2D - Pinball/Box2D/Box2D/Collision/b2Distance.cpp | #include <Box2D/Collision/b2Distance.h>
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
int3... | ALGO | 0.999985 | 4.124007 |
803a3c8e-3cf4-48dc-9280-1f0368cd7e04 | KhanFahad29/pf-lab-task-6 | PF LAB TASK 6/question 2.cpp | #include <stdio.h>
int main() {
int n, i = 2;
printf("Enter a number (>= 1): ");
scanf("%d", &n);
if (n >= 1) {
while (i <= n) {
printf("%d ", i);
i += 2;
}
printf("\n");
} else {
printf("Number must be >= 1\n");
}
return 0;
} | ALGO | 0.974066 | 4.292405 |
a98e03fa-cf13-4ac8-b86d-08c6663f9adf | JeewooC/cpp_contest_practice | codeChef/MXCH.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T; cin >> T;
for (int i = 0; i < T; i++) {
int N, K;
cin >> N >> K;
for (int a = N-K; a <= N; a++) {
cout << a << " ";
}
for (int b = 1; b < N-K; b++) {
cout << b;
if (b != N-K-1) {
cout << " ";
}
... | ALGO | 0.999954 | 4.09866 |
24adce81-2a84-4228-92e7-f343e9fd54aa | shirnschall/Numerik2 | code/precond-vs-cg.cpp | #include <iostream>
#include "Linag/sparsematrix.h"
#include "Linag/densematrix.h"
#include "Linag/vector.h"
#include <chrono>
#include "Linag/Eigen/Dense"
int main() {
srand(5);
linag::DenseMatrix<double> test(201,201);
linag::DenseMatrix<double> pinv(201,201);
linag::Vector<double> b(201);
b.r... | ALGO | 0.947634 | 4.244766 |
2412f5ca-3912-4356-a585-315f2c73f9c4 | zakissimo/nvim-work | leetcode/1014.best-sightseeing-pair.cpp | #include <bits/stdc++.h>
using namespace std;
// @leet start
class Solution {
public:
int maxScoreSightseeingPair(vector<int>& values) {
int n = values.size();
int ans = 0;
int max_left = 0;
for (int i = 0; i < n - 1; ++i) {
int j = i + 1;
max_left = max(m... | ALGO | 0.99995 | 6.459267 |
63486374-1af4-4ada-ba81-aed9f6f7bc10 | rosy-y/LeetCode_1 | Teemo Attacking/Solution.cpp | class Solution {
public:
int findPoisonedDuration(vector<int>& timeSeries, int duration) {
int n = timeSeries.size();
if (n == 1) return duration;
int tot = 0;
for (int i=0; i<n-1; i++) {
if (tot + timeSeries[i] > timeSeries[i+1]) tot += timeSeries[i+1] - timeSer... | ALGO | 0.999858 | 6.717525 |
63a3d39f-de4e-4bdf-8548-390caf547a89 | ros-navigation/navigation2 | nav2_smac_planner/src/node_basic.cpp | #include "nav2_smac_planner/node_basic.hpp"
namespace nav2_smac_planner
{
template<typename Node2D>
void NodeBasic<Node2D>::processSearchNode()
{
}
template<>
void NodeBasic<NodeHybrid>::processSearchNode()
{
// We only want to override the node's pose if it has not yet been visited
// to prevent the case that a... | ALGO | 0.992715 | 6.501094 |
d0045b66-bc87-4e2c-bb50-c7c9258dd335 | WLFJ/ACM-C0de-B1n | 数学/CF-1294A.cpp | #include<iostream>
using namespace std;
int main(void){
int t;
cin >> t;
while( t -- ){
int a, b, c, n;
cin >> a >> b >> c >> n;
int total = a + b + c + n;
int avg = total / 3;
if(total % 3 == 0 && avg - a >= 0 && avg - b >= 0 && avg - c >= 0){
cout << "YE... | ALGO | 0.999778 | 3.558689 |
389c65a6-b34e-4cdf-8e6e-ba748d7844cb | brandrews722/Infix-Queue | InfixEval.cpp | #include "InfixEval.h"
#include "ParenChecker.h"
void InfixEval::readFile(string fileName)
{
ifstream readIn;
readIn.open(fileName);
while (readIn.good())
{
string expression;
getline(readIn, expression);
int num = parseExpression(expression);
cout << expression << " = " << num << endl;
}
}
int InfixEval... | ALGO | 0.966001 | 4.242514 |
2610a76b-79e9-4118-bc19-bb9114343828 | twManu/tk1 | NVIDIA_CUDA-6.5_Samples/6_Advanced/sortingNetworks/main.cpp | /**
* This sample implemenets bitonic sort and odd-even merge sort, algorithms
* belonging to the class of sorting networks.
* While generally subefficient on large sequences
* compared to algorithms with better asymptotic algorithmic complexity
* (i.e. merge sort or radix sort), may be the algorithms of choice fo... | ALGO | 0.999506 | 6.106439 |
bd0d6d47-94c7-40c0-9634-c1fcb15df464 | khanhnamle1994/technical-interview-prep | LeetCode/Merge-Intervals.cpp | // Given a collection of intervals, merge all overlapping intervals.
// For example, given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].
/* Analysis:
To check the intersections between interval [a,b] and [c,d], there are four cases (equal not shown in the figures):
a____b
c____d
a____b
c____d
a_... | ALGO | 0.99994 | 6.469736 |
fd49e152-0cfa-49cc-9548-0346144b959f | YJie-OY/Data-Structure-Learning | 0 .参考代码/TestPairingHeap.cpp | #include <iostream>
#include <vector>
#include "PairingHeap.h"
using namespace std;
// Test program
int main( )
{
PairingHeap<int> h;
int numItems = 4000;
int i = 37;
int j;
cout << "Checking; no bad output is good" << endl;
for( i = 37; i != 0; i = ( i + 37 ) % numItems )
h.inser... | TEST | 0.868411 | 4.411597 |
458a6cca-955f-4824-80ee-380f895f8a53 | tfg1434/cp | Codeforces/1336A.cpp | #include <bits/stdc++.h>
constexpr int maxn = 2e5 + 5;
std::vector<int>conj[maxn];
int n,k,u,v,depth[maxn]={0},size[maxn]={0},det[maxn];
long long ans=0;
int cmp(int a,int b){return a>b;}
int dfs(int u,int f){depth[u]=depth[f]+1;size[u]=1;
for (int i=0;i<conj[u].size();++i){
if ((v=conj[u][i])==f)continue;
size[u... | ALGO | 0.999911 | 4.784021 |
adec589c-5073-4481-bfc5-a7bdded5f34b | Mercury9999/IT001_NhapMonLapTrinhUIT | phepchiadequy/chia.cpp | #include <iostream>
using namespace std;
int modulo(int m, int n) {
if (m == n) return 0;
return m < n ? m : modulo(m - n, n);
}
int main() {
int m, n; cin >> m >> n;
cout << modulo(m, n);
} | ALGO | 0.999965 | 4.157913 |
09039e15-d9b9-488b-87d5-2083485fcbdb | josh1248/cp-training | kattis/2025/04/04_20_ef_easy/ethanol.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long ll;
#define sz(x) ((int)size(x))
#define all(x) begin(x), end(x)
#define rep(i, a, b) for (int i = a; i < (b); i++)
int main() {
ios_base::sync_with_stdio(false);
... | ALGO | 0.999966 | 3.025718 |
5831bf16-6333-4c33-bede-805dcc54c26a | levendlee/data-structure-and-algorithms | c++/leetcode/0061-Rotate_List-M.cpp | // 61 Rotate List
// https://leetcode.com/problems/rotate-list
// version: 1; create time: 2020-02-09 23:19:35;
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* rotateRig... | ALGO | 0.999944 | 5.872648 |
f4750ce0-0d28-4a27-bbb7-e5055c627761 | Justin-Lamberty/P2 | utility.cpp | #include "utility.h"
#include <sstream>
std::vector<std::string> cmd2vec(const std::string& command, char delimiter) {
std::vector<std::string> result;
std::istringstream iss(command);
std::string word;
while (std::getline(iss, word, delimiter)) {
if (!word.empty()) result.push_back(word);
... | TOOL | 0.977836 | 5.551557 |
2512c16d-ab34-4577-9fbb-284c295434d0 | MikeYankeeOscarBeta/Cplusplus_Tic-Tac-Toe | game.cpp | /* Written by: Mikael Jakhelln, HIOA-studentnr: s169961
Tic-Tac-Toe, n pieces on a row to win, with n sized gameboard.
*/
#include "gameboard.cpp"
#include "score.cpp"
#include "player.cpp"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <cstdlib> //is this the same as stdlib?
#i... | ALGO | 0.943398 | 3.442472 |
ef03ca62-5fc5-4386-99f5-584ed0191278 | VillainMod/frameworks_av | media/libstagefright/codecs/amrnb/common/src/l_shr_r.cpp | /*
Filename: /audio/gsm_amr/c/src/l_shr_r.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the L_shr_r function. Sync'ed up
with the current template and fixed tabs.
Description: Updated template. Changed function i... | ALGO | 0.996977 | 7.2722 |
2d1a534a-36ea-4b13-838c-4922ef66bc45 | sunset1995/ACM_ICPC_prac | UVa/2559NumberBaseConvertion.cpp | #include<cstdio>
#define MAX 1000
using namespace std;
char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int ascii[127];
int main(){
int tmpval = 0;
for(int i='0';i<='9';++i) ascii[i] = tmpval++;
for(int i='A';i<='Z';++i) ascii[i] = tmpval++;
for(int i='a';i<='z';++i) ascii[i] = tmpva... | ALGO | 0.998973 | 3.257268 |
99e3ce69-471a-4af9-ae0b-059e68ac82e0 | Hakansabol/tchs-aero-groundcontrol | TCHS-PX4-Autopilot-1.15.0/src/modules/ekf2/EKF/yaw_fusion.cpp | #include "ekf.h"
#include <ekf_derivation/generated/compute_yaw_innov_var_and_h.h>
#include <mathlib/mathlib.h>
// update quaternion states and covariances using the yaw innovation and yaw observation variance
bool Ekf::fuseYaw(estimator_aid_source1d_s &aid_src_status)
{
VectorState H_YAW;
sym::ComputeYawInnovVarA... | ALGO | 0.996598 | 5.934037 |
419361b1-9bfe-45bb-b9bb-406fc15595ab | ngocquys/DSA-PTIT | DSA02028.cpp | #include<bits/stdc++.h>
using namespace std;
#define foru(i,a,b) for(int i=a;i<=b;++i)
#define ford(i,b,a) for(int i=b;i>=a;--i)
#define ii pair<int,int>
#define ll long long
#define fi first
#define se second
#define fill(a,b) memset(a,b,sizeof(a))
const int N=15;
int t,n,k,a,b[N],s,ans;
void tried(int i,int j){
... | ALGO | 0.999686 | 3.433558 |
ae773116-8409-4024-b900-28b64819c04a | raincross7/code-similarity | codes/train_code/problem465/problem465_351.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>
using namespace std;
#define FOR(... | ALGO | 0.999986 | 5.217456 |
2b2f59bb-b352-4468-b1bd-b04ce6ca46a5 | kibeom-kim/Problem-Solving | BOJ/#2749.cpp | #include <iostream>
#include <vector>
using namespace std;
long long N, cnt, mod = 1000000;
vector<int> v;
void solve(){
cnt = 2;
while (1){
v.push_back((v[cnt]+v[cnt-1])%mod);
cnt++;
if (v[cnt] == 0 and v[cnt-1] == 1) break;
}
}
int main(void){
cin >> N;
v.push_back(0);... | ALGO | 0.999984 | 4.127536 |
31545e28-6394-4ac8-bc52-7268a8582559 | igor-pavkov/honours-2024 | Code Examples/DiverseVul Filtered/Secure/9fd10cf630832b36a588c1545d8736539b2f1fb5-12.cpp | static int ReadBlobLZWByte(LZWInfo *lzw_info)
{
int
code;
size_t
one,
value;
ssize_t
count;
if (lzw_info->stack->index != lzw_info->stack->codes)
return(PopLZWStack(lzw_info->stack));
if (lzw_info->genesis != MagickFalse)
{
lzw_info->genesis=MagickFalse;
do
{
... | TOOL | 0.946373 | 5.460803 |
d2febed2-203b-4bb9-af33-6a809e1779d4 | jinlaove17/2024_SSAFY_AlgorithmStudy | Problem_Archive/WEEK_04/Jinju/9282_초콜릿과건포도.cpp | #include <iostream>
#include <cstring>
using namespace std;
const int MAX = 1000000000;
int T, N, M;
int ret = 0;
int dp[51][51][51][51];
int grid[51][51];
int preS[51][51];
// (x,y) 부터 (goalx, goaly) 까지의 2차원 누적합 구하고 dp에 저장
int cutDP(int x, int y, int goalx, int goaly) {
//조각이 1개일 때 리턴
if (x == goalx && y ==... | ALGO | 0.999754 | 4.448721 |
de1f11be-0ab9-45fc-9129-e5d73e8e3f43 | nauel2015/UTN | Curso ATS de c++/12-Pilas.cpp |
// Explicacion de Pilas:
// Una pila es una estructura de datos de entradas ordenadas tales que solo se pueden introducir y eliminar por un extremo llamado cima.
// Las operaciones usuales en la pila son Insertar y Quitar:
// Insertar (push) añade un elemento en la cima de la pila.
// Quitar (pop) elimina o saca un ... | ALGO | 0.994763 | 3.870591 |
dcc28a42-bc2d-457a-b9f5-63438624a739 | Mingda-tech/MingDa_OrcaSlicer | src/libigl/igl/isolines.cpp | #include "isolines.h"
#include <vector>
#include <array>
#include <iostream>
#include "remove_duplicate_vertices.h"
template <typename DerivedV,
typename DerivedF,
typename DerivedZ,
typename DerivedIsoV,
typename DerivedIsoE>
IGL_INLINE void igl::isolines(
const Eigen::MatrixBase<Deriv... | ALGO | 0.905721 | 5.900014 |
18d3939f-4cf0-4ce1-8195-5c2e08ebfacf | AnNingXie/C-Leran | 常识/28-结构体指针.cpp | #include <iostream>
using namespace std;
/*
结构体指针:
通过指针访问结构体中的成员
利用操作符->可以通过结构体指针访问结构体属性
*/
// 自定义结构体 自定义数据类型
struct Student{
string name; // 姓名
int age; // 年龄
int score; // 分数
};
int main(){
// 创建学生的结构体变量
struct Student stu= {"tom", 18, 100};
// 通过指针指向结构体变量
struct Student... | ALGO | 0.901926 | 4.043901 |
5cf67c79-743d-4ca6-a805-2e0ed0cbe3bf | sendoru/problem_solving | source/boj/1146.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1000000;
int main(void)
{
int n;
cin >> n;
vector<vector<ll> > dp(n + 1, vector<ll>(n + 1));
if (n == 1)
{
cout << 1 << '\n';
}
else if (n == 2)
{
cout << 2 << '\n';
}
else
{
dp[3][2] = 1; dp[3][3] = 1;... | ALGO | 0.999923 | 4.113221 |
ccc43140-0767-40c9-adc9-c3340d78bc60 | ishandutta2007/codeforces | jcvb/normal/804/A.cpp | #include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<utility>
#include<functional>
#include<iomanip>
#include<sstream>
#include<ctime>
#include<cassert>
using namespace std;
#de... | ALGO | 0.999696 | 3.674288 |
5c9dbef6-0e88-4429-bb21-72c11f2906b9 | AL-AM1N/Operating-System | disk_scheduling.cpp | #include <iostream>
using namespace std;
int main() {
int head = 50;
int requests[] = {176, 79, 34, 60, 92, 11, 41, 114};
int n = sizeof(requests) / sizeof(requests[0]);
int totalSeekDistance = 0;
int currentHead = head;
cout << "Initial Head Position: " << head << endl;
cout << "Seek S... | ALGO | 0.999978 | 4.643319 |
e0950837-197d-4d8e-9161-7fe2689680e1 | GoTo-Coders/Competitive-Programming | GeeksForGeeks/C Plus Plus/Encrypt_the_string-1.cpp | /*
Problem Statement:
------------------
Bingu was testing all the strings he had at his place and found that most of them were prone to a vicious attack by Banju, his arch-enemy.
Bingu decided to encrypt all the strings he had, by the following method. Every substring of identical letters is replaced by a single inst... | ALGO | 0.999993 | 6.425569 |
d8882aae-fb88-4be3-bf27-47586fbd8093 | Parzival1509/GFG_POTD | 2024/2024-05/GFG_POTD_2024-05-30_String_Subsequence.cpp | // GFG POTD 2024/05/30
// String Subsequence
// Medium
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int countWays(string s1, string s2) {
int n = s1.length(), m = s2.length(), mod = 1e9 + 7;
vector<int> prev(m + 1, 0);
prev[0] = 1;
for (int i = 1; i <= n;... | ALGO | 0.999985 | 6.118848 |
616c7f0e-c903-4209-95f8-b1a559e24672 | rko0211/codeforces-question-solve | colatz_conjecture.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> multiples;
void solve()
{
ll x, y, k;
cin >> x >> y >> k;
while (k > 0 && x != 1)
{
ll dif = (x / y + 1) * y - x;
dif = max(1ll, dif);
ll mini = min(dif, k);
k -= mini;
x += mini;
while ((x % y) == 0)
{... | ALGO | 0.999979 | 3.944812 |
6880f85c-366e-43c8-bc73-5094699cb68e | GordonHaha/AlgorithmExercises | 题集/牛客/华为机试/HJ29.cpp | // https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a
#include <string>
#include <iostream>
using namespace std;
const string dict1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const string dict2 = "BCDEFGHIJKLMNOPQRSTUVWXYZAbcdefghijklmnopqrstuvwxyza1234567890";
string encrypt(... | ALGO | 0.999879 | 4.81348 |
18fdd472-a23c-42ef-8c40-8d5897ff0417 | raincross7/code-similarity | codes/train_code/problem433/problem433_372.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, count = 0;
double sq;
cin >> n;
for (int c = 1; c < n; c++)
{
sq = sqrt((double(n - c)));
if ((int)sq * (int)sq == n - c)
count++;
for (int a = 1; a < sq; a++)
{
if (((n - c) % a) == 0)
count += 2;
}... | ALGO | 0.999852 | 3.871375 |
f5a9f62e-4bbd-4bb7-9f44-749768012214 | glavo99/code-forces | ICPC/sheet1/Z.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
long long a, b, c, d;
cin >> a >> b >> c >> d;
if(b * log(a) > d * log(c)){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
} | ALGO | 0.999479 | 3.577114 |
25be2889-f55b-49d5-bef6-75c67342241c | eggag32/Competitive-Programming | SNSS/Социологическое исследование.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i... | ALGO | 0.999929 | 3.622155 |
db7bc796-fdb3-40cb-ab16-2b0a399cae74 | Chandan193/LeetCode-Solution | 539-minimum-time-difference/minimum-time-difference.cpp | class Solution {
public:
int findMinDifference(vector<string>& t) {
vector<int> arr(t.size());
for (int i = 0; i < t.size(); i++) {
int h = stoi(t[i].substr(0, 2));
int m = stoi(t[i].substr(3));
arr[i] = h * 60 + m;
}
sort(arr.begin(), arr... | ALGO | 0.999241 | 6.043375 |
1ba08cdd-1e81-4c78-835a-2ef9542827c0 | ikkz/codewars | compile-time-number-3-itoa-number-to-string.cpp | #include "common.h"
using integer = unsigned long long;
constexpr char get_digit(integer n) {
return n < 10 ? '0' + static_cast<char>(n) : 'a' + static_cast<char>(n) - 10;
}
template <integer X, integer Base = 10, char... Cs>
struct itoaxx : public itoaxx<X / Base, Base, get_digit(X % Base), Cs...> {};
template <... | TEST | 0.93734 | 6.262334 |
f1ab0d30-1d7d-463b-8a01-e65ec0c40273 | idrecun/kiaa-materijali | 12_13_geometrija/geometrija.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using point = pair<int, int>;
point vec(point a, point b) {
return {b.first - a.first, b.second - a.second};
}
int dot(point u, point v) {
return u.first * v.first + u.second * v.second;
}
int cross(point u, point v) {
return u.firs... | ALGO | 0.999817 | 5.063944 |
f2fd9e09-947f-40f5-b7d5-e2ba7cdd841c | bed-com-06-21/labtesk | Lab_task3/BitwiseOperatorts.cpp | #include <iostream>
using namespace std;
main(){
unsigned int a = 60; //60 = 0011 1100
unsigned int b = 13; //13 = 0000 1101
int c = 0;
c = a & b; //12 = 0000 1100
cout <<"Line 1 - Value of c is : " << c << endl;
c = a | b; //61 = 0011 1... | ALGO | 0.983247 | 3.926217 |
514ec4fd-1ffc-48f9-a250-1a45fded2778 | Dov3123/ASUR12 | gait_control/src/contact_detection.cpp | //
// Created by andres on 22.10.20.
//
#include "../include/contact_detection.h"
ContactDetection::ContactDetection(){
this->force_threshold = FORCE_CONTAT_THRESHOLD;
}
ContactDetection::~ContactDetection(){
}
bool ContactDetection::isFeetStanding(Eigen::Vector3f* force){
/* So far a simple method, but it... | ALGO | 0.965095 | 3.788362 |
e0e8b90e-21ec-4be9-88a5-3fe76b7c94cb | Ritwik7631/Leetcode_Solutions | 347-top-k-frequent-elements/top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
// unordered_maps have tc of O(n)
unordered_map<int,int> mp;
for(auto a : nums)
{
mp[a]++;
}
int n = nums.size();
vector<vector<int>> bucket(n+1);
for(auto [... | ALGO | 0.999994 | 6.113486 |
7f5ada3f-df38-49e3-a7ca-7b1d76bb6de9 | suxutao/LeetcodeList | cn/2872-maximum-number-of-k-divisible-components .cpp | #include "../../../stdc.h"
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
int maxKDivisibleComponents(int n, vector<vector<int>>& edges, vector<int>& values, int k) {
vector<vector<int>>g(n);
int ans=0;
for (auto &i: edges){
... | ALGO | 0.99997 | 5.697844 |
8adef135-0ee6-47e3-95ad-c26b430377f0 | Youngwook-Jeon/algorithm-problems-solving | leetcode/1087_BraceExpansion.cpp | #include <vector>
#include <string>
#include <algorithm>
using namespace std;
class Solution
{
public:
vector<vector<char>> parsedOptions;
vector<string> expand(string s)
{
parse(s);
vector<string> ans;
makeWords("", ans);
return ans;
}
void parse(string &s)
{... | ALGO | 0.998066 | 4.753884 |
d5e831ca-1063-4156-8e9c-512adc5aae26 | ishandutta2007/codeforces | nok0/normal/1141/C.cpp | /**
* author: nok0
* created: 2021.05.27 23:03:11
**/
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#pragma region Macros
// rep macro
#define foa(v, a) for(auto &v : a)
#define REPname... | ALGO | 0.999977 | 4.238214 |
05fe4344-cac4-4b5b-99c1-47a345c37dfb | Janvichaudhary1211/DSA_using_C_and_Cpp_Leetcode | 1616-minimum-difference-between-largest-and-smallest-value-in-three-moves/minimum-difference-between-largest-and-smallest-value-in-three-moves.cpp | class Solution {
public:
int minDifference(vector<int>& nums) {
int n=nums.size();
if(n<=4)
return 0;
partial_sort(begin(nums),begin(nums)+4,end(nums));
nth_element(begin(nums)+4,begin(nums)+(n-4),end(nums));
sort(begin(nums)+(n-4),end(nums));
int result= INT_... | ALGO | 0.999904 | 5.535324 |
675c15ff-116d-418e-b892-037e16edda5f | pankaj0123/Leetcode-Submissions | 46-permutations/46-permutations.cpp | class Solution {
public:
void recur(vector<int> nums, vector<vector<int>>& ans, int i){
if(i>=nums.size()){
ans.push_back(nums);
return ;
}
for(int j=i;j<nums.size();j++){
swap(nums[i],nums[j]);
recur(nums,ans,i... | ALGO | 0.999998 | 6.289556 |
503b1e6c-1622-48f7-8fde-04fb43626ea0 | Dennitz/chdb | src/Processors/Transforms/AggregatingInOrderTransform.cpp | #include <Processors/Transforms/AggregatingInOrderTransform.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <Storages/SelectQueryInfo.h>
#include <Core/SortCursor.h>
#include <Common/logger_useful.h>
#include <Interpreters/sortBlock.h>
#include <base/range.h>
namespace DB
{
AggregatingInOrderTransform::Aggr... | ALGO | 0.984369 | 7.554676 |
11d98423-18e1-4cf7-bd58-0619ffba6d92 | orihehe/BOJ | USACO/14453번_Hoof, Paper, Scissors (Silver).cpp | /*
BOJ 14453 (https://www.acmicpc.net/problem/14453)
H-1, P-2, S-3
i° ٲ۴ٰ ϸ i ̱ ,
iĿ ̱ ٰ ϸ ȴ.
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int arr[100001];
int n, lp, lh, ls, rp, rh, rs, maxS;
int main() {
char x;
scanf("%d", &n);
getchar();
for (int i = 1; i <= n... | ALGO | 0.998166 | 3.378539 |
bcadd4b1-488e-4844-bc0c-86d63553dea1 | millaker/MiGPU-llvm-project | mlir/lib/Query/QueryParser.cpp | #include "QueryParser.h"
#include "llvm/ADT/StringSwitch.h"
namespace mlir::query {
// Lex any amount of whitespace followed by a "word" (any sequence of
// non-whitespace characters) from the start of region [begin,end). If no word
// is found before end, return StringRef(). begin is adjusted to exclude the
// lexe... | TOOL | 0.872434 | 4.504978 |
14457c7d-7b3f-42ac-9c5d-5cb2b9ef3ad8 | Ayush9452/DSA | power_set_love_babber.cpp | #include <bits/stdc++.h>
#define ll long long
#define NL cout << endl;
#define fr(i, n) for (ll i = 0; i < n; i++)
#define rep(i, a, b) for (ll i = a; i <= b; i++)
#define per(i, a, b) for (ll i = a; i >= b; i--)
using namespace std;
void solve(vector<int> nums, vector<int> output, int index, vector<vector<int>> &ans)... | ALGO | 0.99997 | 4.362597 |
46fd7177-1c57-49c6-ab73-2c746b2dd580 | Rizariad88/Ragnarok | src/common/utils.cpp | #include "utils.hpp"
#include <locale.h>
#include <math.h> // floor()
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include "winapi.hpp"
#ifndef F_OK
#define F_OK 0x0
#endif /* F_OK */
#else
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#endif
#include "cbasetypes.hpp"
#include "sh... | TOOL | 0.915648 | 4.785696 |
950a6868-04f9-40b1-9a77-ff879506ea88 | elrudrakssh/Dynamic-Programming | code-force-vault/1068A-Birthday.cpp | #include <cstdio>
typedef long long ll;
int main(){
ll n, m, k, l; scanf("%lld %lld %lld %lld", &n, &m, &k, &l);
ll x = (k + l + m - 1) / m;
printf("%lld\n", (m * x <= n) ? x : -1);
return 0;
}
| ALGO | 0.999926 | 3.009164 |
3a9c93e9-1357-4ecf-a739-c51cbb442844 | hojelse/gapro-exercises | SimpleRenderEngineProject/submodules/SimpleRenderEngine/submodules/glm/test/gtx/gtx_fast_trigonometry.cpp | #define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/ulp.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#include <... | TEST | 0.980005 | 6.223037 |
103e33a7-3423-4775-8b7d-c5dcf4a84e8e | varunsharma10/cpp | CodeForces/ER88Div2B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL);}
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
char arr[101][1001];
void solve()
{
int n,m... | ALGO | 0.999473 | 4.350223 |
9200ec7a-e9c6-4f17-9e69-37e6dcf548ac | thevoid3301/AlgorithmStudy | leetcode/P2141.cpp | #include <iostream>
using namespace std;
const int N = 105, M = 2e4 + 5;
int a[N];
bool f[M];
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
f[a[i]] = true;
}
int ans = 0;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
... | ALGO | 0.999905 | 4.241376 |
41dd2088-02bf-46c5-80de-117cf0a68243 | jrbustosm/uva-solved-exercises | Beat the Spread!/10812.cpp | /*
Beat the Spread!
Jose Ricardo Bustos Molina
s = a+b
r = a-b
a = s-b
r = s-b-b
r = s-2b
b = (s-r)/2
*/
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
while(N--){
int s, r, a, b;
cin >> s >> r;
b = (s-r)/2;
a = s-b;
if(a<0 || b<0 || a-b!=r) cout << "impossible"... | ALGO | 0.999791 | 4.203193 |
165b2913-942f-4c1f-aeb4-1ec4448f7031 | sushamanarsale/Data-Structure-and-Algorithm-Assignments-Letsupgrade- | Bubble_Sort_1D_Array_with_user_input.cpp | // Bubble sort by taking input from user
#include<iostream>
using namespace std;
void bubbleSort()
{
int size, temp;
cout<<"Enter size of elements: ";
cin>>size;
int a[size];
cout<<"Enter "<<size<<" elements of array: "<<endl;
for(int i=0; i<size; i++)
{
cin>>a[i];
}
cout<<"\n";
cout<<"The unsorted el... | ALGO | 0.996426 | 4.177322 |
ddc7546b-ef79-479d-8d05-3c49f82565b2 | BK-Bagchi/52-Programming-Problems-and-Solutions-with-CPP | Problem16.cpp | //A program that shows a given sentence in reverse
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
char sen[50], temp;
cout<<"Enter your word/sentence: \n"; gets(sen);
int len= strlen(sen);
char sen2[len];
int i,j, k, p=0;
for(k=0; k<len; k++)
{
... | ALGO | 0.998245 | 3.233864 |
a43f9585-34d3-4d1b-80e4-67bd5ea02c7b | Anshu1Gupta/Leetcode_-_GFG_Solved_Problems | Reverse alternate nodes in Link List - GFG/reverse-alternate-nodes-in-link-list.cpp | //{ Driver Code Starts
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
/* A linked list node */
struct Node
{
int data;
struct Node *next;
Node(int x){
data = x;
next = NULL;
}
};
struct Node *start = NULL;
/* Function to print nodes in a given l... | ALGO | 0.99987 | 5.843163 |
8a350d9b-e7bb-4cc8-85e1-80118d228986 | siddharth25pandey/CPP-Programming | DP/Dice_Combinations.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
const ll mod = 1e9 + 7;
int dp[1000001];
void init()
{
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
dp[4] = 8;
dp[5] = 16;
dp[6] = 32;
int temp=0;
int temp1=0;
int temp2=0;
int temp3=0;
for(int i=7;i<1000001;i++)
... | ALGO | 0.99999 | 4.92408 |
9d6d3f8e-8d93-4bc3-ab86-ecdf37e14c1b | hfinkel/llvm-project-cxxjit | libcxx/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// nth_element(Iter first, Iter nth, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <vector>
#i... | TEST | 0.932866 | 6.710634 |
5f8a8662-1f30-469b-b2b7-dd26390164b0 | GerardDugal/zavadovskaya_client_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.998733 | 6.76775 |
74062a2f-b341-4fd7-8075-f535f80e125a | AdarshNandanwar/DSA-and-Competitive-Programming | InterviewBit/longest-common-subsequence.cpp | // https://www.interviewbit.com/problems/longest-common-subsequence/
int Solution::solve(string A, string B) {
int n = A.length(), m = B.length();
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
for(int i = n-1; i>=0; i--){
for(int j = n-1; j>=0; j--){
if(A[i] == B[j]) dp[i][j] = 1+dp... | ALGO | 0.999822 | 6.084989 |
38d836e2-bf33-4c94-ad2f-69bcdede57f3 | shubhamgupta1798/coding_question | binary-search/binary-search.cpp | class Solution {
public:
int sea(vector<int>& nums, int target,int left,int right)
{
int mid=(left+right)/2;
if(left>right)
{
return -1;
}
if(nums[mid]==target)
{
return mid;
}
else if(nums[mid]>target)
{
... | ALGO | 0.999982 | 6.192668 |
c42ff6f7-e4ed-41ae-a7c4-2796d38cb6d1 | qhb1001/For-that-dream | Kuangbin/Kuangbin专题六最小生成树/I.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int maxx=105;
int f[maxx],cnt[maxx];
struct ty{
int u,v;
int cost;
}p[maxn];
int n,m,k;
bool cmp(ty a,ty b){
return a.cost<b.cost;
}
void In... | ALGO | 0.999865 | 3.704989 |
041c14da-100f-4e3d-ad68-21c0c84cf1a7 | fartuk/MIPT_DIHT | Sem4/task-2-B/v_2/solution.cpp | #include <condition_variable>
#include <iostream>
#include <mutex>
#include <thread>
class Semaphor {
public:
Semaphor& operator=(const Semaphor&) = delete;
Semaphor(const Semaphor&) = delete;
explicit Semaphor(int count)
: count_(count) {}
void wait() {
std::unique_lock<std::mutex> lock(mtx_);
... | ALGO | 0.995754 | 6.101756 |
b57cde5a-60d4-4a44-9ce0-a18208dccdd5 | Immortanbird/Undergraduate_Codes | Sophomore/Data Structure/17.二叉树的最近的公共祖先/src.cpp | /*
* 设顺序存储的二叉树中有编号为 i 和 j 的两个结点,请设计算法求出它们最近的公共祖先结点的编号和值。
*
* 输入:
* 输入第1行给出正整数n(≤1000),即顺序存储的最大容量;
* 第2行给出n个非负整数,其间以空格分隔。其中0代表二叉树中的空结点(如果第1个结点为0,则代表一棵空树);
* 第3行给出一对结点编号i和j。
*
* 题目保证输入正确对应一棵二叉树,且1≤i,j≤n。
*
* 输出:
* 如果i或j对应的是空结点,则输出:ERROR: T[x] is NULL,其中x是i或j中先发现错误的那个编号;否则在一行中输出编号为i和j的两个结点最近的公共祖先结点的编号和值,其间以一个空... | ALGO | 0.999935 | 3.914739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.