uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8bbe1dae-39fd-4ccf-9fbc-154fb66d360f | WhatTheMUCK/Olympiad-Programming | Тренировки по алгоритмам 1.0 от Яндекса/Занятие 2 (Линейный поиск)/C. Ближайшее число/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, x, difference, differencePrev;
cin >> n;
vector <int> vec(n);
for (int i = 0; i < n; i++)
cin >> vec[i];
sort(vec.begin()... | ALGO | 0.999991 | 4.047606 |
2347ee73-4d50-40b6-9e55-7105cf102764 | manpreet-mann/DS-and-Algorithms | loop4.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int i = 2;
while (i < n)
{
if (n % i == 0)
{
cout << "Not Prime for " << i << endl;
}
else
{
cout << "Prime for " << i << endl;
}
i++;
}
} | ALGO | 0.999087 | 3.684615 |
3ecae5e8-22ea-44aa-8f0b-d92ba74b9402 | Knight-Devil/Competitive-Programming | Goal_Parser.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string command;
cin >> command;
for (int i = 0; i < command.size(); i++)
{
if (command[i] == 'G')
cout << 'G';
else if (command[i] == '(' && command[i + 1] == ')')
{
cout << 'o';
i++;
... | ALGO | 0.998045 | 3.459203 |
ab495a5d-bb98-430e-9e78-308338c11308 | lacorreia65/Statistics-Data-Science-Sample | Graphical Models/IsingModel2D.cpp | // IsingModel2D.cpp : This subsystem emules a 2D Ising Model with boundary conditions
//
// Author - Luis Alvaro Correia
//
// Date - Jan 7th 2021
//
#include <iostream>
#include <cmath>
#include <ctime>
#include <fstream>
#include <string>
#include <Windows.h>
// #include "matplotlibcpp.h"
// namespace plt = matpl... | ALGO | 0.976638 | 5.191429 |
eae48aa4-fdf9-416e-b053-7c23ba2a995f | xujie-nm/Leetcode | 59_Spiral_Matrix_Two.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<vector<int> > generateMatrix(int n){
vector<vector<int> > res;
for (int i = 0; i < n; i++) {
res.push_back(vector<int>(n, 1));
}
if(n <= 1)
return res;
int num = 1;
int i = 0, j = 0;
int cou... | ALGO | 0.999375 | 3.886897 |
4967029b-f1d1-4417-91f0-263fb7e009c6 | sakshiiiis/lessonCode | main.cpp | #include <iostream> // Include necessary header
//int addition(); // Function declaration
int main() {
int secretNumber = 7; // Secret number to guess
int guess; // Variable to store the player's guess
std::cout << "Welcome to the Number Guessing Game!" << std::endl;
std::cout << "Guess the secret nu... | ALGO | 0.898385 | 3.396276 |
c6217ece-9194-4619-9870-eba219ee80ba | HeitorLRM/TR1_qt | main.cpp | #include <unistd.h>
#include <stdexcept>
int Tmain(int argc, char *argv[]);
int Rmain(int argc, char *argv[]);
int main(int argc, char *argv[]) {
int pid = fork();
switch (pid) {
case -1:
throw std::runtime_error("fork error");
return -1;
case 0:
// Child process
Rmain... | TOOL | 0.851843 | 5.876812 |
53b9cdc3-86ae-4aeb-a71f-40637f0eea7c | theomkargharge/DSA | Recursion/isArraysorted.cpp | //
// #include <bits/stdc++.h>
// using namespace std;
// void print(){
// int n;
// cin>>n;
// int row = 1;
// int start ;
// while(row<=n){
// int col = 1;
// while(col<=row){
// if(row%2==0){
// cout<<"* "<<" ";
// }
// if(row%2!=0) cout<<... | ALGO | 0.999806 | 4.151335 |
75f80883-5207-4cb9-ba40-bae5efcc4922 | zFa3/CP_problems | 1941B_CF_RudolfAnd121.cpp | /*
ID: zFa3
TASK: Rudonf and 121
LANG: C++
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solution(){
vector<ll> arr;
ll a, b;
cin>>a;
for(int i=0;i<a;i++)
{
cin>>b;
arr.push_back(b);
}
for (int i=0;i<arr.size()-2;i++){
if (arr[i] < 0){
... | ALGO | 0.999588 | 4.021421 |
c903c4cf-8929-4508-80bc-16b26e34400a | KsArt-IT/RickAndMorty-Flutter | 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.998518 | 6.772262 |
4da82f87-e0ad-45ab-980c-5f52b2dead94 | matsumoto2004/icpc | mitanai/__old_library/math/sum_of_geometric_sequences.cpp | // v[i] = {a_i, r_i}
// where sequence i is a_i / (1 - r_i * x)
// calc [x^i] (sum of sequences) for i in [0, m)
// time complexity : O(n log^2 n + m log m)
fps sum_of_geometric_sequences(const vector <pair<mint, mint>> &v, int m) {
int n = SZ(v);
vector <pair<fps, fps>> q;
rep(i, n)
q.eb(fps({v[i].... | ALGO | 0.999863 | 4.312831 |
c56f60a6-5e56-4810-8c54-85d40e3689fd | palilo815/ps | baekjoon/1000/1952.cpp | #include<bits/stdc++.h>
using namespace std;
#define loop(i,n) for(int i=0;i<n;++i)
bool visited[100][100];
int mov[4][2] = { -1,0,0,1,1,0,0,-1 };
int main()
{
cin.tie(NULL), cout.tie(NULL);
ios::sync_with_stdio(false);
int row, col, r = 0, c = 0, D = 0, ans = -1;
cin >> row >> col;
while (1) {
... | ALGO | 0.999975 | 3.592613 |
76679ee3-f26e-4a75-b2d6-eb1263febb83 | Pri-27ya/Codeforces-Questions | A_Hongcow_learns_the_cyclic_shift.cpp | #include <iostream>
#include <string>
using namespace std;
void rotateLeft(string& s) {
char temp = s[0];
for (int i = 0; i < s.length() - 1; i++) {
s[i] = s[i + 1];
}
s[s.length() - 1] = temp;
}
int main() {
string s, orig;
int count = 0;
cin >> s;
orig = s;
do {
... | ALGO | 0.999958 | 4.317711 |
716fb676-9ebc-4226-aca8-afc33c11b128 | islam-abdel-halem/Problem-Solving | C++/Sheet Assiut/Sheet#2-Loops/V. PUM.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int count = 0;
int i = 1;
while (1)
{
if (count == n)
{
break;
}
if (i % 4 == 0)
{
cout << "PUM" << endl;
i++;
count++;
... | ALGO | 0.999866 | 3.713111 |
c3bd0ea6-4821-446f-aeb3-f2d307bea322 | ankitkumarsingh007/Data-structures-Algorithms | 326-power-of-three/326-power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n<1)
return false;
while(n!=1 && n%3==0)
n/=3;
return n==1;
}
}; | ALGO | 0.999254 | 6.072514 |
26ddd18b-e205-4fd8-8c3e-b03313b79065 | Goldie13/Practice_CPP | src/8_containers/74_stack.cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
/*
problem statement is
string of characters like [{("''")}] - true
string of characters like [{("<''")}] - false
*/
auto printStack = [](const auto &st) {
auto printSt{st};
auto size = printSt.size();
... | ALGO | 0.981152 | 5.648581 |
c3538d52-8b45-4df3-9d59-cbeb09b192b5 | GOOTEAKIM/algo | C++/programers_basic/programers_basic/p_181907.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solutoin(string my_string, int n);
int main() {
string my_string;
int n;
cin >> my_string;
cin >> n;
cout << solutoin(my_string, n) << endl;
return 0;
}
string solutoin(string my_string, int n) {
str... | ALGO | 0.999735 | 3.936557 |
c9b860e8-0f9e-4812-b6af-1e2305c03bae | anaksubuh/sinauce | Modul 2/Modul2_Manipulator.cpp | /*-----------------------------------
Nama Program : Input dan Output
Nama : Johanes Septiawan
NPM : 2024050116
Tanggal Buat : 17 Februari
-----------------------------------*/
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int num = 37;
double pi = 3.14159... | ALGO | 0.892318 | 3.784863 |
d9867133-8c9c-4501-ba78-10a801f13adf | Kuldeep8081/DSA_problems_and_solutions | 780-max-chunks-to-make-sorted/max-chunks-to-make-sorted.cpp | class Solution {
public:
int maxChunksToSorted(vector<int>& arr) {
int size=arr.size();
vector<int>prefixMax(begin(arr),end(arr));
vector<int>suffixMin(begin(arr),end(arr));
for(int i=1;i<size;i++){
prefixMax[i]=max(prefixMax[i],prefixMax[i-1]);
}
for(i... | ALGO | 0.999953 | 5.530611 |
a6b9d936-7f01-44a5-8622-9e911c3b758c | akashbkrish/LeetCodes | generate-parentheses/generate-parentheses.cpp | class Solution {
public:
void backtrack(int open, int close, string s, vector<string> &ans, int n){
if(s.size()==2*n){
ans.push_back(s);
return;
}
if(open<n){
s.push_back('(');
backtrack(open+1, close, s, ans, n);
s.pop_back();... | ALGO | 0.999884 | 6.179958 |
8396504f-d165-42b6-9ed4-7cb55146f001 | sarvex/leetcode-zsh | solution/0700-0799/0739.Daily Temperatures/Solution.cpp | class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
int n = temperatures.size();
vector<int> ans(n);
stack<int> stk;
for (int i = 0; i < n; ++i) {
while (!stk.empty() && temperatures[stk.top()] < temperatures[i]) {
ans[stk.t... | ALGO | 0.999988 | 6.658303 |
54e656ba-1db1-4490-bb89-c19db492827a | PaulWagener/WiiMadness | source/level/Block.cpp | #include "Block.hpp"
Vector3 Orientation::decomposition(const Vector3& v) const
{
Vector3 a = v - origin;
float d = (vx ^ vy) * normal;
float dx = (a ^ vy) * normal;
float dy = (vx ^ a) * normal;
float dz = (vx ^ vy) * a;
return Vector3(dx / d, dy / d, dz / d);
}
Vector2 Square::texCoords(int vertex) const
{
... | TOOL | 0.960938 | 3.501317 |
9c28569d-406f-44a0-8124-1383f6647cce | rapel02/competitive-programming | UVa/11966.cpp | #include<bits/stdc++.h>
#define EPS 1e-9
using namespace std;
struct Point{
double x,y;
}star[1500];
int p[1500],h[1500];
double sqr(double x)
{
return x*x;
}
double dist(int a,int b)
{
return sqrt(sqr(star[a].x - star[b].x) + sqr(star[a].y - star[b].y));
}
int par(int a)
{
if(p[a]==a) return a;
return p[a] =... | ALGO | 0.999739 | 4.153424 |
1ef448e3-5f6f-4d9c-93ea-5064585ce1a6 | kashishvaish/LeetCodeSolutions | MinimumNumberOfOperationsToMakeArrayEmpty.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
// Time Complexity: O(n)
// Space Complexity: O(n)
unordered_map<int, int> map;
for(int i: nums) {
map[i]++;
}
int total = 0;
for(auto [key, freq]: map) {
if(freq == 1) ret... | ALGO | 0.999963 | 6.137591 |
a062bb40-00a3-4eeb-810e-bf35c13ded45 | unzela/Problem-solving | Basics/9.GCD.cpp | // GCD(a,b) = GCD(a-b, b), a>b
// GCD(a,b) = GCD(b-a, a), a<b
// GCD(a,b) = GCD(a%b, b), a>b
// LCM(a,b)*GCD(a,b)=a*b
// LCM= (a*b)/GCD(a,b)
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (a == 0)
return b;
if (b == 0)
return a;
while (a > 0 && b > 0) {
if (a > b) {
a = a ... | ALGO | 0.999294 | 5.744629 |
cd24bcc6-f305-4d2b-8c4f-430f3781e7fb | stxcker/mutiny_csgo_public | CSGOFullv2/Interfaces.cpp | #include "precompiled.h"
#include "Interfaces.h"
void(__fastcall *pUTIL_ClipTraceToPlayers) (const Vector&, const Vector&, unsigned int, ITraceFilter *, trace_t *);
void(__fastcall *pUTIL_ClipTraceToPlayers2) (const Vector&, const Vector&, unsigned int, ITraceFilter *, trace_t *, float);
CClientState *g_ClientState;
... | TOOL | 0.978152 | 5.378709 |
386cdf8d-4db7-4683-98b4-0ea58111fd7f | jaiskid/Linklist | insertAttail.cpp | #include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node *next;
node(int d){
data=d;
next=NULL;
}
};
node *insertAthead(node*&head,int data){
node *n=new node(data);
n->next=head;
head=n;
}
void print(node*head){
while(head!=NULL){
cout<<head->data<<" ";
head=head->next;
}
}
node* b... | ALGO | 0.977049 | 3.181223 |
e2160bf3-d0ac-4b7c-838b-b24b7bc4f291 | Tanvin2442002/Code-Forces | Not_too_far_Replacement.cpp | #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define float long double
#define vf(v) (v).begin(), (v).end()
#define vr(v) (v).rbegin(), (v).rend()
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)
#define in cin.tie(NULL)
#define out cout.tie(NULL)
... | ALGO | 0.999709 | 3.778439 |
df1e0c8f-8e22-487b-8400-d011ba72a040 | Winterleaf/OmniEngine.Net | Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp | #include "btMinkowskiPenetrationDepthSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
... | ALGO | 0.999522 | 5.929208 |
6eb93816-5b4d-4060-b179-185ec4344fe7 | pylgrym/basin | src/CanSee.cpp | #include "stdafx.h"
#include "CanSee.h"
#include "Bresenham.h"
#include "cellmap/cellmap.h"
CanSee::CanSee()
{
}
CanSee::~CanSee()
{
}
bool CanSee::canSee(CPoint a, CPoint b, class Map& map, bool onlyEnvir) {
/* JG, consider: we might want different variants - seeing through walls versus seeing through other mobs.... | ALGO | 0.9609 | 4.858833 |
564d5f50-425e-4d13-985b-18fcda7b7d42 | codepilgrimz/hyperNEAT | boost_1_57_0/libs/numeric/ublas/doc/samples/vector_slice.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
vector_slice<vector<double> > vs (v, slice (0, 1, 3));
for (unsigned i = 0; i < vs.size (); ++ i)
... | ALGO | 0.953359 | 3.141449 |
6b0aded1-7ec6-48ad-8915-26d6ba722761 | jun6292/Algorithm | 프로그래머스/lv1/12982. 예산/예산.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> d, int budget) {
int answer = 0;
int sum = 0;
sort(d.begin(), d.end());
for (int i = 0; i < d.size(); i++){
sum += d[i];
if (sum > budget)
... | ALGO | 0.999743 | 4.902303 |
d9b92c3b-b1b0-4129-ab3f-ad982d4447fd | pankakan/C-Public | v40/gallonlitreconverter.cpp | #include <iostream>
#include <cmath>
using namespace std;
int gallonPerMile;
float kmPerMile = 1.609;
float litrePerGallon = 3.785;
int main()
{
cout << "How many miles per gallon does your car do?";
cin >> gallonPerMile;
float literPerMil = round(((gallonPerMile * litrePerGallon)/kmPerMile*10)*100)/100;... | TOOL | 0.990743 | 3.783975 |
28f0ba49-d98b-4b78-9255-b6088b0d8642 | Ritik2703/Competitive-coding-tips | leet_code_problems/reverse_words.cpp | /*
* Given a string, you need to reverse the order of characters in each word within a sentence
* while still preserving whitespace and initial word order.
*
* Example:
* Input: She loves chocolate
* Output: ehs sevol etalocohc
*
* Approach:
* Use two indices to figure out non-whitespace characters,... | ALGO | 0.999979 | 6.025835 |
7253dce0-47f9-48de-aec4-5528866d69a8 | EdoPalmieri2022/c-programs | stringhe/es 9 pag 62.cpp | /*#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
string leggival(){
string str;
do{
cout<<"inserimento stringa: ";
getline(cin,str);
} while(str.length()>=100);
return str;
}
int main(){
int i;
string s1;
s1=leggival();
string s2;
s2.resize(s1.size() * 2);
for (i=0;... | TOOL | 0.98819 | 4.025143 |
8e53f628-ab74-4909-9760-2d61de537d7f | Charanreddy27/Leetcode-GFG-solutions | StriverAtoZSheet/Strings/Roman to Integer/roman.cpp | class Solution {
public:
int romanToInt(string s) {
int ans=0;
unordered_map <char,int> mp{
{'I',1},{'V',5},{'X',10},{'L',50},{'C',100},{'D',500},{'M',1000}};
for(int i=0;i<s.size();i++){
if(mp[s[i]]<mp[s[i+1]]){
//for cases such as IV,CM, XL, etc...
ans=... | ALGO | 0.999716 | 6.390018 |
66aae60c-1f32-4f4d-9f54-3a662d5bfdc9 | singh-pranjal-2004/DSAQuestions | 1615-range-sum-of-sorted-subarray-sums/range-sum-of-sorted-subarray-sums.cpp | class Solution {
public:
typedef pair<int, int> P;
int m = 1e9 + 7;
int rangeSum(vector<int>& nums, int n, int left, int right) {
priority_queue<P, vector<P>, greater<P>> pq;
for (int i = 0; i < n; i++) {
pq.push({nums[i], i});
}
int result = 0;
for (in... | ALGO | 0.999993 | 5.492311 |
41987e81-b748-475f-8e7d-d9b15936c573 | DannyStoyanov/Algorithms | Graph algorithms/BFS.cpp | #include "Graph.h"
// Breadth First Search (BFS) algorithm
// Time complexity: O(n+m)
// n - number of vertices, |V| = n
// m - number of edges, |E| = m
std::vector<size_t> Graph::BFS(size_t start) const {
std::vector<size_t> result;
std::vector<bool> visited(V, false);
std::queue<size_t> q;
q.push(st... | ALGO | 0.999783 | 5.710798 |
6bc52e2b-5d9d-4bd8-acf6-91bd84030027 | lclpsoz/competitive-programming | CF/101972/C.cpp | #include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
//#define x first
//#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = ... | ALGO | 0.999675 | 3.649628 |
83a89537-cd5e-489c-9f2d-9edca26da049 | SatyamSidana/leetcode | 803-cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.cpp | class Solution {
public:
int findCheapestPrice(int n, vector<vector<int>>& flights, int src, int dst, int k) {
vector<vector<pair<int,int>>>ad(n);
for(auto i:flights){
ad[i[0]].push_back({i[1],i[2]});
}
vector<int>v(n,INT_MAX);
v[src]=0;
queue<pair<int,pai... | ALGO | 0.999721 | 5.572255 |
ac83bd6c-a2ab-4faf-9935-264012ec4ffe | Subrat29/CrackYourPlacement | Day11/18. 4Sum/sol2.cpp | #include <bits/stdc++.h>
using namespace std;
// sc: n + no of quadlets
// tc: n^3
// a + b + c = target - d
vector<vector<int>> fourSum(vector<int> &nums, int target)
{
int n = nums.size();
set<vector<int>> st;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
... | ALGO | 0.999901 | 5.226227 |
8e281ef7-ba43-4c0f-95a6-2939b84abaff | vinay-kumar99/Hactoberfest2022 | C++/trie.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
long long arr[100];
void solve()
{
long long n, temp, remain, k, x, ans = 0;
cin >> n >> x;
ll exp = log2(n);
bool flag = false;
if (exp & 1 &... | ALGO | 0.999912 | 4.773092 |
4a6c651a-4d30-4d30-946a-b99bcb7a13d4 | ilboglions/AlgoLab-2023 | Week13/DHL/src/main.cpp | #include <iostream>
#include <vector>
#include <climits>
#define LIM 1000000
using namespace std;
void solve(){
int n; cin>>n;
vector<int> a(n);
vector<int> b(n);
for(int i=0; i < n; i++)
cin>>a[i];
for(int i=0; i < n; i++)
cin>>b[i];
vector < vector<int> > costs(n+1, vector<int>(n+1, LIM));
cost... | ALGO | 0.99989 | 3.360525 |
c0de1bb6-b1b9-4dd1-b80c-1beff58329c0 | kaustub1234/Strivers-SDE-Sheet-Challenge | Binary Trees[Miscellaneous]/kthLargestInStream.cpp | #include <bits/stdc++.h>
class Kthlargest {
public:
priority_queue<int, vector<int>, greater<int>> pq;
int K;
Kthlargest(int k, vector<int> &arr) {
// Write your code here.
K = k;
for(auto &num : arr) {
pq.push(num);
if(pq.size() > K)
pq.pop();... | ALGO | 0.99997 | 5.174708 |
4b30662d-5a4b-4cb6-8e39-b99671f9b3b7 | TanishSinghTak/CF_Submissions | codeforces/1804/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define Fast_io ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define endl '\n' //Comment out if interactive
#define int long long // comment if Space limit exceeds
const int N = 1e5+10; //change to 32000 if TLE happens for prime factors
const int ... | ALGO | 0.999901 | 3.954345 |
656aebeb-4287-4fca-91d1-0844ba3d9e13 | ThoseBygones/ACM_Code | AOJ/AOJ NTL_1_E.cpp | /*
********************************************************************************
* Author: ThoseBygones
* Version: V1.0
* Date: 2018-07-08
* Subject: ACM-ICPC
* Language: C/C++11
* OJ: AOJ
* Algorithm:
********************************************************************************
* Algo-Descripti... | ALGO | 0.999752 | 3.747981 |
0b34461b-cb8b-4bad-9c77-e3789e1c338e | ishandutta2007/codeforces | abdude824/normal/580/A.cpp | //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ll long long int
#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define W(x) int x;cin>>x;while(x--)
#define fr(n) for(int i=n-1;i>=0;i--)
#... | ALGO | 0.999952 | 4.225388 |
4e6eeb99-9a73-44b7-b0d3-83295953df5a | AraragiEro/newk | .history/HJ24_20210317002905.CPP | #include<iostream>
#include<vector>
#include<set>
#include<string>
using namespace std;
int main(){
vector<string> I;
set<string> R;
vector<vector<string>> output;
int INum=0;
cin>>INum;
for(int i=0; i<INum;i++){
string input;
cin>>input;
I.push_back(input);
}
i... | ALGO | 0.998395 | 3.67135 |
22e7892d-7e06-4713-88c1-3d827e1ab40a | GOR-OM/DSA-Problem-for-placement | Binary Tree/Maximum Sum Path Of A Binary Tree.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
class BinaryTreeNode
{
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data)
{
this->data = data;
left = NULL;
right = NULL;
}
};
int maxPathSumHelper(BinaryTreeNode... | ALGO | 0.999967 | 6.422754 |
6fa7cee4-56b4-4f8d-b192-2517e3595c88 | baonguyedinh3001/cplus | Task2/Task2_7.cpp | #include <iostream>
#include <cmath>
#include <string>
#include <utility> // For std::swap
#include <vector>// as array but can add and remove the element in array
int main(){
int x = 100;
int* p1 = &x; // Pointer 1 points to x
int* p2 = p1; // Pointer 2 copies address (shallow copy)
std::cout<<"x = "<< *p1 <<... | TOOL | 0.94818 | 3.601537 |
266ab0bb-bf20-4415-a7b6-07b2f646d7e0 | CodeBySushant/SolvedLeetcode | leetcode-main/leetcode-main/solution/2500-2599/2505.Bitwise OR of All Subsequence Sums/Solution.cpp | class Solution {
public:
long long subsequenceSumOr(vector<int>& nums) {
vector<long long> cnt(64);
long long ans = 0;
for (int v : nums) {
for (int i = 0; i < 31; ++i) {
if (v >> i & 1) {
++cnt[i];
}
}
}
... | ALGO | 0.999967 | 5.707177 |
f85a76fe-81b4-4914-b879-ac1cc4b4981a | vanikkanen/schoolwork | Programming2/03/random_numbers/main.cpp | #include <iostream>
#include <random>
#include <string>
using namespace std;
void produce_random_numbers(unsigned int lower, unsigned int upper, unsigned int seed)
{
default_random_engine gen(seed);
uniform_int_distribution<int> distr(lower, upper);
bool on_going = true;
while (on_going) {
c... | TOOL | 0.865986 | 4.757581 |
76fe8328-9350-4979-afd8-2c7e297838a8 | AbhishekKr2001/DSA-DataStructuresandAlgorithms | Array/searchInSortedArray.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[] = {5, 6, 7, 2, 3, 4};
int mid, key = 4;
int start = 0, last = 5;
cout << "the program starts" << endl;
while (start < last)
{
mid = (start + last) / 2;
cout << mid << endl;
if (arr[mid] == key)
{
... | ALGO | 0.999764 | 3.808433 |
dc2de3c5-d219-4677-916c-74d192aa31a2 | himanshuagarwal407/LeetCode_GFG_Problems | 1502-can-make-arithmetic-progression-from-sequence/1502-can-make-arithmetic-progression-from-sequence.cpp | class Solution {
public:
bool canMakeArithmeticProgression(vector<int>& arr) {
sort(arr.begin(), arr.end());
int n=arr.size(), diff=arr[1]-arr[0];
for(int i=2; i<n; i++)
if(arr[i]-arr[i-1] != diff)
return false;
return true;
... | ALGO | 0.999878 | 5.710557 |
29fa166f-2324-46bb-a649-05c45f2a1aff | BrainSaver/BeakJoon-ascode | BeakJoon-cpp-files/일반 수학 1/1193 분수찾기/BeakJoon1193.cpp | /*https://www.acmicpc.net/problem/1193
문제
무한히 큰 배열에 다음과 같이 분수들이 적혀있다.
1/1 1/2 1/3 1/4 1/5 …
2/1 2/2 2/3 2/4 … …
3/1 3/2 3/3 … … …
4/1 4/2 … … … …
5/1 … … … … …
… … … … … …
이와 같이 나열된 분수들을 1/1 → 1/2 → 2/1 → 3/1 → 2/2 → … 과 같은
지그재그 순서로 차례대로 1번, 2번, 3번, 4번, 5번, … 분수라고 하자.
X가 주어졌을 때, X번째 분수를 구하는 프로그램을 작성하시오.
입력
첫째 줄에 X(... | ALGO | 0.999774 | 4.782085 |
39212ba4-91a6-40ca-a012-8c7f58226b3f | Rafid13iit/FirstYearSecondYear_Codes | Bplus_TP_edit.cpp | #include<iostream>
using namespace std;
struct BPlusNode {
int *keys;
BPlusNode **childPtrs;
bool isLeaf;
int numKeys;
} *root = NULL, *newNode = NULL, *currentNode = NULL;
BPlusNode* createNode() {
int i;
BPlusNode* newNode = new BPlusNode;
newNode->keys = new int[6]; // Order 6
newNo... | ALGO | 0.999988 | 5.276056 |
d6fb7cd4-263c-42b5-862e-0e25dfc70739 | ishandutta2007/codeforces | felerius/normal/463/D.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <limits>
#include <numeric>
#include <optional>
#include <string>
#include <tuple>
#include <vector>
// Contest: 20 - 2100 <= Codeforces Rating <= 2199 (https://a2oj.com/ladder?ID... | ALGO | 0.999936 | 4.616352 |
991c4be0-090b-4b41-aa7b-eab3b3c5661d | bzs14fsu/CAP5726_Project1 | ext/eigen/unsupported/doc/examples/MatrixFunction.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
std::complex<double> expfn(std::complex<double> x, int)
{
return std::exp(x);
}
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::... | ALGO | 0.999621 | 4.365858 |
28328949-77f4-418a-8208-be7c3afd8f4e | gabsizinio/CP | NeetCode/Stack/Evaluate_Reverse_Polish_Notation.cpp | #include <vector>
#include <string>
#include <stack>
class Solution {
public:
int evalRPN(std::vector<std::string>& tokens) {
// Usar 'long' na pilha previne overflow em casos de teste com números grandes.
std::stack<long> s;
for (const std::string& token : tokens) {
// Verific... | ALGO | 0.999741 | 6.702199 |
25a88293-e8b8-4e59-8975-f77238957a54 | lih627/python-algorithm-templates | LeetCodeSolutions/LeetCode_0628.cpp | class Solution {
public:
int maximumProduct(vector<int>& nums) {
int min1 = INT_MAX, min2 = INT_MAX, max1 = INT_MIN, max2 = INT_MIN, max3 = INT_MIN;
for (int x: nums) {
if (x < min1) {
min2 = min1;
min1 = x;
} else if (x < min2) {
... | ALGO | 0.999986 | 5.776658 |
050a9413-ebfe-4372-9314-632d671a9d8c | PlabonKumarsaha/Problem_Solutions_OJ | Codeforces/CF755A.cpp | #include<stdio.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
if(n==1)
{
printf("3\n");
continue;
}
if(n==2)
{
printf("4\n");
continue;}
if(n%2==1)
{
printf("1\n");
}
else
printf("%d\n",n-2);
}
} | ALGO | 0.999967 | 3.504037 |
00ecb605-7709-4347-9049-3ca97a90b312 | anjalim28/Leet-Code | august 2023/aug_2.cpp | class Solution
{
public:
int n;
vector<vector<int>> ans;
unordered_set<int> s;
void solve(vector<int> &temp, vector<int> &nums)
{
// all the elements have been found.
if (temp.size() == n)
{
ans.push_back(temp);
return;
}
// finding e... | ALGO | 0.999996 | 6.20002 |
b4db8a45-3470-491e-8171-070e0a3aaabd | vikrammitra/snap | snap-exp/multimodal-dev/multimodal.cpp | #include "stdafx.h"
#include <Snap.h>
#include <stdio.h>
#include <omp.h>
void MergeNodeTables(const TVec<PTable>& NodeTables, const Schema& NodeSchema, THash<TStr,TInt>& Hash, TStrV& OriNIdV) {
TInt Index = 0;
for (TVec<PTable>::TIter it = NodeTables.BegI(); it < NodeTables.EndI(); it++) {
PTable Table = *it... | DATA | 0.959323 | 5.257082 |
3d5cd159-1871-4532-a455-019d9ff2b6b8 | krish141-desai/opps | Inheritance Polymorphism/8.cpp | /*
Write a program to Mathematic operation like Addition, Subtraction,
Multiplication, Division Of two number using different parameters and
Function Overloading
*/
#include <iostream>
using namespace std;
int add(int a, int b) {
return a + b;
}
int subtract(int a, int b) {
return a - b;
}
int multiply(in... | TOOL | 0.947903 | 5.264436 |
d3f384c1-53ca-43de-b754-80c28ac2d027 | xtremi/para-mesh-generator | para-mesh-generator/math_utilities.cpp | #include "math_utilities.h"
unsigned power_floor(unsigned x) {
int power = 1;
while (x >>= 1) power <<= 1;
return power;
}
unsigned power_ceil(unsigned x) {
if (x <= 1) return 1;
int power = 2;
x--;
while (x >>= 1) power <<= 1;
return power;
} | ALGO | 0.994634 | 5.543975 |
1126bdd6-9cc5-4095-8252-ad9c6a50f810 | trueos/trueos | contrib/llvm-project/llvm/lib/Transforms/IPO/ConstantMerge.cpp | #include "llvm/Transforms/IPO/ConstantMerge.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "ll... | TOOL | 0.99294 | 7.819944 |
f0141b46-8834-4cdf-bb9d-215c2263b684 | zhenliatbrown/Multiscale_Coupling | src_gpu/fix_addforce.cpp | #include "string.h"
#include "stdlib.h"
#include "fix_addforce.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "domain.h"
#include "region.h"
#include "respa.h"
#include "input.h"
#include "variable.h"
#include "memory.h"
#include "error.h"
#include "force.h"
using namespace LAMMPS_NS;
using name... | TOOL | 0.929203 | 6.206491 |
97948cd7-e05c-41f3-bd49-452f34aa3fbc | ishandutta2007/codeforces | .o/normal/356/C.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include... | ALGO | 0.999961 | 3.597363 |
02e1bf01-1ff4-4528-b831-b32f46b72369 | Cartallum/llvm-project-cbe-rustc | llvm/lib/Transforms/Utils/LCSSA.cpp | #include "llvm/Transforms/Utils/LCSSA.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LoopPass.h"
#i... | ALGO | 0.994193 | 7.613509 |
9ae5f1e2-508b-47d0-8fc4-ccaa9bf5dc0e | WuDeluan/Data-Structures-and-Algorithm-Analysis-in-C | Final Exam2.cpp | void PreOrder(Tree T)
{
if(T == NULL)
return ;
printf("%d ",T->Key);
PreOrder(T->Left);
PreOrder(T->Right);
}
void InOrder(Tree T)
{
if(T == NULL)
return ;
InOrder(T->Left);
printf("%d ",T->Key);
InOrder(T->Right);
}
void PostOrder(Tree T)
{
if(T == NULL)
return ;... | ALGO | 0.999935 | 4.12236 |
e801740c-ade7-4a32-9e73-62278bea574b | RohanVashisht003/class-code | lecture 15/stackclass.cpp | // stackclass
#include <iostream>
using namespace std;
template<typename T>
class node{
public:
T data;
node<T>* next;
node(T x){
data=x;
next=NULL;
}
};
template<typename T>
class stack{
public:
node<T>* head;
int cnt;
stack(){
head=NULL;
cnt=0;
}
void push(T x){
cnt++;
node<T>* n=new node... | ALGO | 0.996326 | 3.819241 |
d61b78ff-175b-435b-bc81-27c47b0f460f | TimTam725/Atcoder | ABC/c149/a.cpp | #include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000... | ALGO | 0.99966 | 3.240202 |
988b4ee0-2eef-4d48-b0c5-8a3156c76dbc | peacefullyquietly/baekjoon_study | JEJE/seg-tree/mo's/sequences_and_queries_5.cpp | using namespace std;
int sq = 1;
int N, Q;
long long cnt[MAX];
long long ans[MAX];
vector<int> arr;
typedef struct _Query {
int s, e, idx;
bool operator < (const _Query &o) const {
if(s/sq != o.s/sq) return s < o.s;
else return e < o.e;
}
} Query;
vector<Query> order_arr;
inline void setS... | ALGO | 0.999873 | 4.263304 |
b6a1d66c-4906-4383-9a1f-4eb23abc44b9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8837_2.cpp | #include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef int ll;
typedef pair<ll,ll> P;
typedef double db;
const ll INF = 0xfffffff;
ll n,k;
ll c[5000],r[5000];
ll d[5000]... | ALGO | 0.999878 | 3.329019 |
42151f4d-40cb-463d-8bfc-fd75c5922b91 | Ishan-77/DSA | Kth largest element in a stream - GFG/kth-largest-element-in-a-stream.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> kthLargest(int k, int arr[], int n) {
// code here
vector<int>ans;
priority_queue<int,vector<int>,greater<int>> pq(arr,arr+k);
for(int i=0;i<k-1... | ALGO | 0.999947 | 5.82518 |
ab543a74-3a86-453d-a734-c19aff35f1dd | Dewedseed/CST-Learning | CPP-XCJ/5-Function/5.7-Project/base16.cpp | #include "base16.h"
#include <string>
#include <vector>
// encoding table
static const std::string base16_enc_tab {
"0123456789ABCDEF"
};
// decoding table
static const std::vector<char> base16_dec_tab {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 ~ 9
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 ~ 19... | ALGO | 0.990686 | 6.35601 |
3bb5024d-d7ce-4ddc-a049-5d72d1474561 | clay-arras/leetcode-submissions | find-the-safest-path-in-a-grid/Time Limit Exceeded/5-14-2024, 7:18:19 PM/Solution.cpp | // https://leetcode.com/problems/find-the-safest-path-in-a-grid
class Solution {
public:
int N;
vector<vector<int>> g;
void fill(int i, int j) {
queue<pair<int, int>> q;
vector<vector<int>> d(N, vector<int>(N, INT_MAX));
q.push({i, j});
d[i][j] = 0;
g[i][j] = 0;
... | ALGO | 0.999964 | 5.929811 |
3ce06222-944b-4021-bf0a-7dd53ebc7e60 | phumipatc/C_Competitive_Programming | C++ - 2560/2_1_Camp/Test_1/Peatt_Switch.cpp | /*
Task :
Author : Phumipat C.
School : RYW
Language :C++
*/
#include<bits/stdc++.h>
using namespace std;
int a[100100];
int main()
{
int n,ans=0,minn=1e9,idx;
cin >> n;
for(int i=0;i<n;i++) cin >> a[i];
sort(a,a+n);
for(int i=0;i<n;i++){
idx=upper_bound(a,a+n,2*(a[i]))-a;
ans=... | ALGO | 0.999963 | 3.801548 |
f522eefe-b0ca-4d8d-b3f9-6a737d1eb2e3 | sowmith1999/bdwgc-gmp_test | src/bst_woGC.cpp | #include <iostream>
struct Node
{
int data;
Node *left;
Node *right;
Node(int value)
{
data = value;
left = nullptr;
right = nullptr;
}
};
class BST
{
private:
Node *root;
Node *insertNode(Node *node, int value)
{
if (node == nullptr)
{
... | ALGO | 0.999791 | 6.358969 |
10a598ad-d0c8-4a75-9206-95d3af58ba4f | master-hkshenoycse/CP | Contests/Codeforces/Div2_1015/B.cpp | #include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#defin... | ALGO | 0.999225 | 3.822167 |
32cf2c95-9dc1-4e26-a139-815440c3450f | mannmehta04/Data-Analysis-and-Algorithms | LeetCode_Problems/kthLargestEle.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue <int, vector<int>, greater<int> > pq;
for(int i=0;i<nums.size();i++){
pq.push(nums[i]);
... | ALGO | 0.999895 | 4.720651 |
fb03c900-96ea-47ff-ab18-8f017ce5cc51 | iam-munagala/Data-Structures-And-Algorithms- | 003. Longest Substring Without Repeating Characters.cpp | /*
Given a string s, find the length of the longest
substring without repeating characters.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Example 3:
Input: s = "pwwkew"
... | ALGO | 0.999973 | 6.585093 |
5d6304aa-0e62-410d-9e53-32cdd7fa2348 | ishandutta2007/codeforces | joeywheeler/normal/526/B.cpp | #include <bits/stdc++.h>
#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())
using namespace std;
int c[100000];
int main() {
int n; scanf("%d", &n);
n = (1<<(n+1))-1;
FO(i,2,n+1) {
scanf("%d", &c[i]);
}
int res = 0;
for (int i = n; i >= 1; i--) {
in... | ALGO | 0.999872 | 4.17597 |
98c9630c-0ad2-4c22-8410-b3bcbd3ce2f5 | LeonOfTheNap/AISP | labosi/lab-1/2021-22/by_CrazyFreak/z01.cpp | /**
Napišite funkciju čiji je prototip:
void ispis (float polje[], int n) ;
koja kao argumente prima polje polje(tj. pokazivač na početak polja), čiji su elementi tipa float i broj
članova polja (n) te rekurzivno ispisuje negativne članove polja od prvoga prema zadnjemu.
Primjer: za polje [0, -1.2, 2.5, 3.1, -4.17, 5.1... | ALGO | 0.994398 | 3.983115 |
b862d20e-e92d-476f-a5f6-10823d65f22d | Jounson/The-List-Storage-of-Stack | mystack.cpp | #include"pch.h"
#include"mystack.h"
#include<stdlib.h>
void initStack(Stack* s)
{
s->top = (Node*)malloc(sizeof(Node));
s->top->next = NULL;
}
bool isStackFull(Stack* s) { return 0; }
bool isStackEmpty(Stack* s)
{
return s->top->next == NULL;
}
/* ѹջջѹڵ */
void push(Stack* s, char ch)
{
Node* cur = (Node*)malloc(s... | ALGO | 0.978603 | 3.194646 |
5748f78d-2bb9-4f00-aac0-87285f7e876b | TRISHUL-1/C-PROGRAMS | Array/set_matrix_zeroes.cpp | #include<iostream>
#include<vector>
using namespace std;
void zeroMatrix(vector<vector<int>>& matrix){
int n = matrix.size();
int m = (n > 0) ? matrix[0].size() : 0;
int col0 = 1;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if(matrix[i][j] == 0){
matrix... | ALGO | 0.999517 | 5.277811 |
870af7d6-9150-4e3d-95c5-df2d6bf54440 | brpapa/algorithms | solutions/codeforces/1223-C.cpp | /*
miscellaneous > binary search > on answer
difficulty: medium
date: 26/Apr/2020
by: @brpapa
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> prices;
ll x, a, y, b, K;
// calcula o maior k possível em [1 .. ans] e testa se ele é suficiente, pois prioriza os tickets mais... | ALGO | 0.999819 | 3.82029 |
597b62c9-c539-4f4d-a62f-5f5683242fce | y-shindoh/pc_challenge_book | 3.1/q_3.1.3b.cpp | /* -*- coding: utf-8; tab-width: 4 -*- */
/**
* @file q_3.1.3b.cpp
* @brief 「プログラミングコンテストチャレンジブック」の§3.1 p.131の問題の回答
* @author Yasutaka SHINDOH / 新堂 安孝
* @note see http://www.amazon.co.jp/2-ebook/dp/B00CY9256C/ .
*/
/*
メモ:
牛舎間の距離をminヒープに置き、
同ヒープの要素数が牛の数より1小さくなるまで、以下の操作を繰り返す。
1. 最小要素をminヒープから取り出す。
2. 最小要... | ALGO | 0.999775 | 3.664925 |
3e7cc549-5632-41d3-ac3f-dfe9bc1946b2 | Eckry/Problems | codeforces/2048C/2048C.cpp | #include <bits/stdc++.h>
using namespace std;
#define optimize() \
cin.tie(0); \
cin.sync_with_stdio(0); \
ios_base::sync_with_stdio(0); \
cout.tie(0);
void solve()
{
string s;
cin >> s;
int cero = -1;
vector<int> y = {0, 0};
vector<vector<int>> XOR(2, y);
X... | ALGO | 0.999803 | 3.698889 |
3b21ef97-e759-4a48-9655-c2359b632f14 | Sudhanshu2306/Leetcode | 0020-valid-parentheses/0020-valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> st;
bool flag=true;
for(auto it:s){
if(it=='(' || it=='{' || it=='[') st.push(it);
else{
if(!st.empty() && ((it==')' && st.top()=='(') || (it=='}' && st.top()=='{') || (it==']' && st.top()==... | ALGO | 0.99959 | 6.410794 |
73a411a8-193b-4a71-aa98-3b4bc57fe2cb | LOG1000/A2016 | client-windows/winsparkle/3rdparty/wxWidgets/src/common/datetimefmt.cpp | // ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// -------------------------------------------------... | TOOL | 0.953879 | 5.663819 |
a130c347-0b76-4f85-b1e8-5e5c351c8a81 | raitonakatani/newEngine | GameTemplate/k2EngineLow/ExEngine/Photon/Demos/etc-bin/cocos2d/cocos/math/Mat4.cpp | #include "math/Mat4.h"
#include <cmath>
#include "math/Quaternion.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
Mat4::Mat4()
{
*this = IDENTITY;
}
Mat4::Mat4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
float m31, float m32, f... | TOOL | 0.962204 | 7.262756 |
9d2061d5-782c-4db5-8196-efc9df47ef45 | FAKERINHEART/CODE | ACM/1208.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int n;
vector<int> t[25];
void find(int block, int& location_block, int& layer_block)
{
for(int i = 0; i < n; i++)
{
for(int j = 0; j < t[i].size(); j++)
{
if(t[i][j] == block)
{
location_block = i;
layer_block = j;
... | ALGO | 0.998487 | 3.999775 |
8252e688-cee1-4961-b427-cac710ce71fd | shiv-sk/GFG-questions | Difficulty: Easy/Middle of a Linked List/middle-of-a-linked-list.cpp | //{ Driver Code Starts
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
// Initial template for C++
struct Node {
int data;
struct Node* next;
Node(int x) {
data = x;
next = NULL;
}
};
void printList(Node* node) {
while (node != NULL... | ALGO | 0.999436 | 6.395693 |
e844eda4-bff5-4a7a-9280-5973c1302ce6 | Michaelmilk/leetcode | lt2/recursive/Binary Tree Preorder Traversal.cpp | #include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
void solve(TreeNode *root, vector<int> &ans)
{
if (NULL == root)
{
return;
}
ans.push_back(root->val);
solve(root->left, ans);
... | ALGO | 0.999964 | 5.576111 |
388f5c19-e6c1-4cbd-8eb9-6e543530d8f5 | Defish996/cppNet | OJ/oj_server/questions/11/tail.cpp | #ifndef COMPILER_ONLINE
#include "header.cpp"
#endif
void Test1()
{
vector<int> v = {1, 2, 3, 4, 5, 6};
int max = Solution().Max(v);
if (max == 6)
{
std::cout << "Test 1 .... OK" << std::endl;
}
else
{
std::cout << "Test 1 .... Failed" << std::endl;
}
}
void Test2()
{
... | ALGO | 0.997477 | 5.205981 |
9e8e0a03-75bd-4336-97b5-fd7e5c6d86ce | gruprsvp/grup | 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 |
969eb0c9-9516-4357-8fec-db8332c27621 | Kamal-Bhagchandani/GeeksforGeeks | GfG - 160/141.Undirected_Graph_Cycle.cpp | /*
Question Link: https://www.geeksforgeeks.org/batch/gfg-160-problems/track/graph-gfg-160/problem/detect-cycle-in-an-undirected-graph
*/
class Solution {
public:
bool dfs(int i, int p, vector<vector<int>>& adj, vector<bool>& vis){
vis[i] = true;
for(int neighbor : adj[i]){
if(!vis[ne... | ALGO | 0.999956 | 5.969262 |
1c0f76de-7086-48e3-a2d4-5ccfff8d58b5 | fervensong/PengollinCoin | src/Common/StringTools.cpp | #include "StringTools.h"
#include <fstream>
#include <iomanip>
namespace Common {
namespace {
const uint8_t characterValues[256] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, ... | TOOL | 0.937482 | 5.923031 |
7fd93961-f354-4df8-86d2-d25ed8d613d1 | lesyeuxdelamour/DSAStudyingPTIT | Divide and Conquer/DSA04008.cpp | #include <bits/stdc++.h>
#define _sinusoid_() int main()
#define endl "\n"
#define faster(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
class MaTran
{
public:
ll X[2][2];
friend MaTran operator * (MaTran a, MaTran b)
{
MaTran c;... | ALGO | 0.999819 | 4.736897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.