uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
26a17f73-736e-40ef-a1c2-0ce5ed8bfbc7 | xyz20000/LP3 | DAA/DAA cpp/DAA Pract1.cpp | #include <iostream>
using namespace std;
int fibonacciRecursive(int n) {
if (n <= 1)
return n;
return fibonacciRecursive(n - 1) + fibonacciRecursive(n - 2);
}
int main() {
cout<<"Enter the number";
int n;// Change the value of n for different Fibonacci numbers
cin>>n;
cout << "Fibonacc... | ALGO | 0.999882 | 5.233139 |
284f1faf-8738-4c81-a446-ea41f3bdb805 | pvarna/UP | Exercises/PointersDynamicMemory/squareElementsArrays.cpp | #include <iostream>
int* squareElements (int begin, int end);
int main ()
{
int* a = squareElements(1, 10);
for(int i = 1; i < 10; ++i)
{
std::cout << *(a + i) << std::endl;
}
delete a;
return 0;
}
int* squareElements (int begin, int end)
{
int* ints = new int[end-begin];
for... | ALGO | 0.891927 | 3.695171 |
a817f518-a9db-4aba-b7c7-47260741c741 | nrysk/atcoder | ABC/abc296/c.cpp | // clang-format off
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
template <class T> using V = std::vector<T>;
template <class T, class E> using P = std::pair<T, E>;
#define rep(i, n, m) for (int i = n; i < (int)(m); ++i)
#define rrep(i, n, m) for (i... | ALGO | 0.999997 | 4.968566 |
510c5061-d942-452a-86da-2e03d07f3db0 | RiisDev/Roblox-Executor-Sources | 2018 Sources/Danghui - V3rmillion/danghui/danghui/Libraries/curl/util.cpp | #include "cpr/util.h"
#include <cctype>
#include <cstdint>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
namespace cpr {
namespace util {
Header parseHeader(const std::string& headers) {
Header header;
std::vector<std::string> lines;
std::istringstream stream(headers);
{
... | TOOL | 0.955198 | 6.503913 |
649194a8-43a1-4273-bf6a-04f6314eab20 | HnpawsPham/CP-PROBLEMS | CSES/ROUND-TRIP-II.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, st, en;
vector<vector<int>> a((int)1e5 + 1);
int parent[(int)1e5 + 1];
int check[(int)1e5 + 1] = {0};
bool dfs(int u)
{
check[u] = 1;
for (auto v : a[u])
{
if (check[v] == 0)
{
parent[v] = u;
if(d... | ALGO | 0.999933 | 4.707179 |
95e26d43-d88b-4442-96e2-747c6822b065 | PranavMahara/CPP | Chapter-1/2b-Operators.cpp | // Operator type Operators Precedence
/* UnArReLoCoAs
Unary (!, ++, ––, +, –) Highest
Arithmetic Multiplicative (*, /, %)
Additive (+, –)
Relational Inequality (<, >, <=, >=)
Equality (==, !=)
Logical And &&
... | ALGO | 0.994384 | 3.393956 |
f99588af-e4db-49a2-9530-e0b398151308 | XimBlockProject/XimBlock-Core | src/rpcblockchain.cpp | #include "base58.h"
#include "checkpoints.h"
#include "clientversion.h"
#include "main.h"
#include "rpcserver.h"
#include "sync.h"
#include "txdb.h"
#include "util.h"
#include "utilmoneystr.h"
#include "accumulatormap.h"
#include "accumulators.h"
#include <stdint.h>
#include <univalue.h>
using namespace std;
extern ... | WEB | 0.904135 | 6.118542 |
1ae9cce1-bb1b-4415-9474-274355fe4d09 | chrisant996/list-redux | chooser.cpp | // vim: set et ts=4 sw=4 cino={0s:
#include "pch.h"
#include "chooser.h"
#include "scan.h"
#include "list_format.h"
#include "input.h"
#include "output.h"
#include "colors.h"
#include "ellipsify.h"
#include "ecma48.h"
#include "sorting.h"
#include "help.h"
#include <algorithm>
static const WCHAR c_clreol[] = L"\x1b[... | TOOL | 0.881997 | 6.652681 |
07175e68-7b63-41f2-a175-9ec8af51840a | Mohsin-Kn/cpp_oop | lab 3/Q1.cpp | #include<iostream>
using namespace std;
int main()
{
int number;
cout << "Enter the number: ";
cin >> number;
int rows; int cols;
cout << "Enter the number of rows you want: "<<endl;
cin >> rows;
cout << "Enter the number of columns : "<<endl;
cin >> cols;
int position=1;
while... | ALGO | 0.894426 | 3.228217 |
490d953f-6f73-4a66-a5cb-caf148897128 | NG-Geeks/Leetcode_POTD | 2009. Minimum Number of Operations to Make Array Continuous.cpp |
link->>https://leetcode.com/problems/minimum-number-of-operations-to-make-array-continuous/description/
class Solution
{
public:
int minOperations(vector<int> &nums)
{
int n = nums.size();
set<int> unique(nums.begin(), nums.end());
nums.clear();
int ans = n;
for (int n... | ALGO | 0.999959 | 5.852051 |
382e0d2f-1118-43c9-9e5e-7cebc95edff3 | SuryaPratapSinghRana/DSA | dynamic programming/striver_dp/2D_3D_DP/q7NinjaAndhisfriends.cpp | #include <bits/stdc++.h>
int func(int i,int j1,int j2, vector<vector<int>> &grid, vector<vector<vector<int>>> &dp)
{
if(j1<0 || j1>=grid[0].size() || j2<0 || j2>=grid[0].size())
return -1e8;
if(i==grid.size()-1){
if(j1==j2)
return grid[i][j1];
else
return grid[i][j1... | ALGO | 0.999933 | 4.663968 |
d19c96be-51a2-491b-a452-aad63d98ea16 | remyvnkhiemtruong/ICPC | training/Uva/548.cpp | // written at 15:22 on 05 Aug 2017
#include <bits/stdc++.h>
#define IOS std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);
#define filename ""
#define setfile() freopen(filename".in", "r", stdin); freopen(filename".ans", "w", stdout);
#define resetfile() freopen("/dev/tty", "r", stdin); f... | ALGO | 0.999749 | 3.749428 |
bed9e0a6-87d5-41c4-bd7d-997b4483ea60 | Sharafabdullah/CompetitiveProgramming | cses/SortingAndSearching/SecondPass/Towers.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repd(i, a, b) for (int i = a; i >= b; --i)
#define pb push_back
#define B begin()
#define E end()
#define clr(x) memset(x,0,s... | ALGO | 0.999887 | 4.415478 |
0fd0ad0c-72b6-4bbf-b3d1-2b2458012b54 | ldiamond830/GameGraphicsProgramming | OfflineRayTracing/OfflineRayTracing/OfflineRayTracing.cpp | // OfflineRayTracing.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//#include "rtweekend.h"
#include "camera.h"
#include "hittable_list.h"
#include "sphere.h"
#include "material.h"
int main() {
hittable_list world;
auto ground_material = make_shared<lambertian>(c... | ALGO | 0.985664 | 5.704348 |
492be919-33e8-4e2f-8ccf-e44ef2e9e133 | jychoi927/problem-solving | algospot/dynamic-programming/jumpgame.cpp | #include <iostream>
#include <cstring>
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;
const int MAX = 101;
int arr[MAX][MAX];
int d[MAX][MAX];
int n;
int dp(int x, int y){
if (x > n || y > n)
return 0;
if (x == n && y == n)
return 1;
if... | ALGO | 0.999646 | 4.619601 |
ce9a7061-7454-4357-aad6-6ebfb42abf18 | jttmtv/matrix | matrix.cpp | #include <omp.h>
#include <ctime>
#include <cmath>
#include <chrono>
#include <cstring>
#include <cblas.h>
#include <iostream>
#include <exception>
#include <immintrin.h>
using namespace std;
using namespace chrono;
typedef long long llong;
typedef unsigned long long ullong;
typedef unsigned int uint;
typedef unsigned ... | ALGO | 0.999459 | 5.012136 |
e9677230-4bf8-42b8-a829-79da16e82f2f | BandhiyaHardik/Leetcode_Solutions | daily_problems/1376_Time_Needed_to_Inform_All_Employees.cpp | class Solution {
public:
int numOfMinutes(int n, int headID, vector<int>& manager, vector<int>& informTime) {
queue<int> t;
t.push(headID);
int ans = informTime[headID];
vector<vector<int>> graph (n);
for (int i=0; i<manager.size(); i++){
if ( manager[i]!= -1){
... | ALGO | 0.999849 | 6.039857 |
fd27e4fe-c8ee-4803-915f-e641810088dd | Noctiz-Jin/Halloween-Candy-Rush-Night | Halloween/cocos2d/cocos/3d/CCObjLoader.cpp | //
// version 0.9.6: Support Ni(index of refraction) mtl parameter.
// Parse transmittance material parameter correctly.
// version 0.9.5: Parse multiple group name.
// Add support of specifying the base path to load material file.
// version 0.9.4: Initial suupport of group tag(g)
// vers... | TOOL | 0.910821 | 3.284203 |
5f90f130-99ad-466d-b724-c8055123c8f1 | sarvex/leetcode-s | solution/1400-1499/1446.Consecutive Characters/Solution.cpp | class Solution {
public:
int maxPower(string s) {
int ans = 0, t = 0;
for (int i = 0; i < s.size(); ++i) {
if (i == 0 || s[i] == s[i - 1])
++t;
else
t = 1;
ans = max(ans, t);
}
return ans;
}
}; | ALGO | 0.999978 | 5.704022 |
0d3924f1-5566-4fe9-b859-a1bbc9ea5d76 | Kharanshu31/June-leetcode | UniquePaths.cpp | class Solution {
public:
int uniquePaths(int m, int n) {
if(m==1 || n==1)
return 1;
vector<vector<int>>dp(n+1,vector<int>(m+1));
dp[1][1]=1;
// for(int i=0;i<=n;i++)
// dp[i][0]=0;
// for(int j=0;j<=m;j++)
// dp[0][j]=0;
fo... | ALGO | 0.999926 | 6.151046 |
7c581c93-e203-4f54-9391-9ddbaf0432bc | Singhdhiru/DSA-with-c-plus | Array/addtwoarr.cpp | // addition of two array and store on third array
#include <iostream>
using namespace std;
int thirdarr(int arr[], int brr[], int size)
{
// addition of two array
int crr[10];
for (int i = 0; i < size; i++)
{
crr[i] = arr[i] + brr[i];
}
// printing the array
cout << "we found additio... | ALGO | 0.998968 | 4.589009 |
8e1d040a-15ff-4284-8d98-7290462a9585 | Mayank-mic/All-codes | Graphs/LC-(M)- Minimum Number of Vertices to Reach All Nodes.cpp | // Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and
// an array edges where edges[i] = [fromi, toi] represents a directed edge from node fromi to node toi.
// Find the smallest set of vertices from which all nodes in the graph are reachable.
// It's guaranteed that a unique solution exis... | ALGO | 0.999982 | 6.078456 |
99ca8252-1ca1-43a3-9f36-cb44ac58bea6 | jiangchuan617/Algorithm-and-DataStructure | 02-Sorting-Basic/04-Selection-Sort-Detect-Performance/main.cpp | #include <iostream>
#include "SortTestHelper.h"
using namespace std;
template<typename T>
void selectionSort(T arr[], int n){
for(int i = 0 ; i < n ; i ++){
int minIndex = i;
for( int j = i + 1 ; j < n ; j ++ )
if( arr[j] < arr[minIndex] )
minIndex = j;
swap(... | ALGO | 0.985499 | 4.98289 |
ff9451cc-8347-4b02-a92c-243f7de9308c | babayaga-13/Competitive-Programming | CODEFORCES/div.3/C_Sofia_and_the_Lost_Operations.cpp | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type, less<T... | ALGO | 0.999886 | 4.010203 |
f73f3eaf-c591-4eb0-bf43-c8b4517eb501 | Yash5588/leetcode | 968-beautiful-array/beautiful-array.cpp | class Solution {
public:
vector<int> beautifulArray(int n) {
vector<int> res = {1};
while(res.size() < n) {
vector<int> temp;
for(auto &i : res) {
if(2*i - 1 <= n) temp.push_back(2*i-1);
}
for(auto &i : res) {
if(2*i <= ... | ALGO | 0.999871 | 5.593314 |
4db38f59-cdc2-406c-b173-23eafbd8eca1 | Jxint001/OJ_homework | previous_code/***P1009/p1009.cpp | //ans=1!+2!+...+n!
#include<iostream>
using namespace std;
int main()
{
int i,j,k,n,store[50][100]={0},ans[100]={0};
cin>>n;
//把每组阶乘存储在第0行到第n-1行的数组中
for(k=0;k<n;++k){//从第一到第n个阶乘
store[k][0]=1;
for(i=2;i<=k+1;++i){//乘数
for(j=0;j<100;++j){//位数
store[k][j]*=i;//如果无需进位,则数组的后面(相当于数字的前面)全是0
}
for(j... | ALGO | 0.999973 | 3.791277 |
a5c23bb2-cfae-4a1e-a8a0-2af0c5d6c69e | baconpaul/airwin2rack | src/autogen_airwin/Console8LiteChannelProc.cpp | #ifndef __Console8LiteChannel_H
#include "Console8LiteChannel.h"
#endif
namespace airwinconsolidated::Console8LiteChannel {
void Console8LiteChannel::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
... | ALGO | 0.948626 | 4.474524 |
bd394f73-c9d1-4e83-812d-60ae6053b400 | vinci-grape/Rectifier | output/ChatGPT/avatar/Java/C++/atcoder_ABC070_B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
if (c > b) {
cout << 0 << endl;
} else if (a > d) {
cout << 0 << endl;
} else if (a < c) {
cout << min(b, d) - c << endl;
} else {
... | ALGO | 0.999827 | 4.169764 |
d18cf2be-77ac-406f-a359-e528ba07b08e | zhr5/Algorithm | PAT/PAT-B/1016 部分A+B (15 分).cpp | #include<stdio.h>
int P(long long A,int Da);
int main()
{
long long A,B;
int Da,Db,Pa,Pb;
while(scanf("%lld%d%lld%d",&A,&Da,&B,&Db)!=EOF)
{
Pa=P(A,Da);
Pb=P(B,Db);
printf("%d",Pa+Pb);
}
return 0;
}
int P(long long A,int Da)
{
int P=0,count=0,k=1;
while(A>0)
{
if(A%10==Da)
count++;
A/=10;
}
for(in... | ALGO | 0.999439 | 3.196568 |
b2e9cacb-95e4-4dd0-9041-92ddaddf0a50 | shailahirji/PhoneBookApp2 | App.cpp | /*
* App.cpp
* This class contains the main method for PhoneBook Application
* Underlying data structure for this application is a Binary Search Tree
*
* Created on: Nov 21, 2017
* Author: Shaila Hirji
* Supervisor:Dr Fatma Serce
*/
#include<iostream>
#include<fstream>
#include <sstream>
#include "B... | TOOL | 0.978846 | 4.422741 |
1406c5ea-f823-4924-86b1-1f8511495e56 | ExsoKamabay/Games | 01 Tetris/main.cpp | #include <SFML/Graphics.hpp>
#include <time.h>
using namespace sf;
const int M = 20;
const int N = 10;
int field[M][N] = {0};
struct Point
{int x,y;} a[4], b[4];
int figures[7][4] =
{
1,3,5,7, // I
2,4,5,7, // Z
3,5,4,6, // S
3,5,4,7, // T
2,3,5,7, // L
3,5,7,6, // J
2,3,4,5, // O
};
bo... | TOOL | 0.941687 | 4.211047 |
23d07820-e1c5-4a59-a59e-a58ba17f4c34 | Chribela/Self_Driving_car | project_10_MPC_control/src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.995991 | 4.306757 |
563a345a-6529-425b-be80-6621c62691eb | kanu-CH/Code360-Solution | Set_Matrix_Zeros.cpp | #include <bits/stdc++.h>
void setZeros(vector<vector<int>> &matrix)
{
int n = matrix.size();
if (n == 0) return;
int m = matrix[0].size();
if (m == 0) return;
unordered_set<int> rows, cols;
// Step 1: Identify all rows and columns that need to be zeroed
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999354 | 6.970368 |
7efee195-1efa-4e21-a49d-be9c8421015a | nampluskr/coding_test | solved_old/221001_물류허브/solution_stl.cpp | #if 1
// STL 6572 ms
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
#define NUM_CITIES 600
#define INF INT32_MAX
struct Data {
int x;
int cost;
bool operator<(const Data& data) const { return cost > data.cost; }
};
unordered_map<int, int> cityMap;
vector<vector<Data>> ci... | ALGO | 0.999778 | 4.426093 |
69f34edf-d371-4a4e-8998-dcece25a749d | daicx21/AIX | src/systemc/tests/systemc/misc/user_guide/chpt11.6/mean.cpp | /*****************************************************************************
mean.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.99942 | 4.625693 |
9c74cbe9-6875-41a7-9a01-fac2b3687365 | Anubhav12345678/competitive-programming | inordersuccesorinAbstvvimp.cpp | struct node * inOrderSuccessor(struct node *root, struct node *n)
{
// step 1 of the above algorithm
if( n->right != NULL )
return minValue(n->right);
// step 2 of the above algorithm
struct node *p = n->parent;
while(p != NULL && n == p->right)
{
n = p;
p = p->parent;
}
re... | ALGO | 0.999999 | 4.565581 |
12169e46-2c82-4e70-b7cd-d6cf53ea1840 | Hapusny/My-code | 扫雷/扫雷.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <easyx.h>
#include <windows.h>
#include <time.h>
#include <stdlib.h>
void hidewindow()
{
HWND hwnd = GetForegroundWindow();
if (hwnd)ShowWindow(hwnd, SW_HIDE);
}
void addmine(int num, int arr[11][11])
{
int i, j;
int place, judge;
int arr_place[10] = { 0 };
srand((unsig... | ALGO | 0.993718 | 3.038946 |
c0cfc2cc-9b11-4c48-88f1-b18182ec426d | YeonHoo-Kim/ACM | 4153.cpp | // 4153.cpp
// ﰢ
#include<cstdio>
#define SWAP(x,y){int t; t=x;x=y;y=t;}
int main() {
int a, b, c;
while (1) {
scanf("%d %d %d", &a, &b, &c);
if (a == 0 && b == 0 && c == 0)
break;
if (c < a)
SWAP(c, a);
if (c < b)
SWAP(c, b);
if (c*c == a * a + b * b)
printf("right\n");
else
printf("wron... | ALGO | 0.999889 | 3.522665 |
56294d02-f483-4dcc-83a4-89ec8e2c260e | Bonik0/lab_os | lab5-6/control.cpp |
#include "soket.h"
#include "AVL-tree.hpp"
pid_t create_process() {
pid_t pid = fork();
if (pid == -1) {
throw std::runtime_error("fork error!\n");
}
return pid;
}
int main(){
Socket socket;
AVL_tree tree;
std::string s;
int id;
while(std::cin >> s){
if (s ==... | WEB | 0.98515 | 4.027213 |
0c8707ee-84ba-42b3-9660-50daae805c1e | ishandutta2007/codeforces | realcomplex/normal/731/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
#define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL);
#define TEST freopen("in.txt","r",stdin);
#define _ones(a) __builtin_popcount(a)
... | ALGO | 0.999995 | 3.881649 |
b098a9f7-1cce-4794-b6cd-539399ae4bb9 | justin-schwinn-0/LayeredBfs | main.cpp | #include <iostream>
#include <fstream>
#include <memory>
#include <vector>
#include <string>
#include <sstream>
#include <thread>
#include <chrono>
#include <functional>
#include <climits>
#include "Node.h"
#include "Connection.h"
#include "Utils.h"
#include "LayeredBfsAlg.h"
struct NodeInfo
{
int distNode;
N... | WEB | 0.883407 | 4.0454 |
0d1c8c32-1fc7-474e-9aaf-332b7e0aaace | Garimachandra1917/CP_Problems | 0035-search-insert-position/0035-search-insert-position.cpp | class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int n = nums.size();
int low =0;
int high = n-1;
int ans = n;
while(low<=high)
{
int mid = (low+high) /2 ;
if(nums[mid]>= target)
{
... | ALGO | 0.999957 | 6.257426 |
19dc8dc1-b3e2-417e-9552-b3761bb3e566 | pongsaphol/submission | programming/1091.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 3e5 + 5;
int n,dp[MAXN];
vector<int> g[MAXN];
int main() {
// freopen("r", "r", stdin);
scanf("%d",&n);
for(int i = 1; i <= n; ++i) dp[i] = 1;
for(int i = 1; i < n; ++i){
int u, v;
scanf("%d%d", &u, &v);
g[u].pus... | ALGO | 0.980372 | 3.991381 |
27e20c9d-c08d-42ef-b3f4-efe3e8fe5869 | sarthaknarain2x/DSA-Practice | LeetCode/find k closest elements.cpp | class Solution {
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
priority_queue <pair<int, int>> pq;
vector<int> ans(k);
int j=0;
for(int i=0; i<arr.size(); i++) {
pq.push(make_pair(abs(arr[i]-x), arr[i]));
if(pq.size() > k) {
... | ALGO | 0.999998 | 5.608111 |
42ce8c97-c6d7-4702-9d55-a1c5c5c94251 | yjaiswal05/Face-recognition- | opencv/OpenCV 4.5.2.tar/opencv-opencv-39d2578/modules/dnn/src/layers/detection_output_layer.cpp | #include "../precomp.hpp"
#include "layers_common.hpp"
#include "../op_cuda.hpp"
#include "../op_inf_engine.hpp"
#include <float.h>
#include <string>
#include "../nms.inl.hpp"
#ifdef HAVE_OPENCL
#include "opencl_kernels_dnn.hpp"
#endif
#ifdef HAVE_DNN_NGRAPH
#include "../ie_ngraph.hpp"
#if INF_ENGINE_VER_MAJOR_GT(IN... | ALGO | 0.981921 | 3.855954 |
37bdc5ad-ae18-48f5-b1cb-b447dfa20806 | bae-sh/BOJ | Problems/2858.cpp | #include<iostream>
using namespace std;
int R, B, L, W;
int main() {
cin >> R >> B;
for (int i = 1;; i++) {
L = i;
W = (R + 4 - 2 * L) / 2;
if (L*W == R + B) {
if (L > W) {
cout << L << " " << W;
}
else {
cout << W << " " << L;
}
break;
}
}
} | ALGO | 0.999558 | 3.532499 |
bbc403b0-d2c4-4576-bfde-eb5013e223f6 | rasheeq123/DSA | tcs/octal_to_decimal.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
int num, remainder, digit=0;
cin>>num;
int power=0, decimal=0;
while(num>0)
{
remainder= num%10;
digit= remainder* pow(8,power);
decimal+=digit;
num=num/10;
power++;
}
... | ALGO | 0.998989 | 3.79534 |
0edeac6a-3269-45db-9354-7fd9bc23b4f1 | andrewObrien98/Cplusplus | Lesson2/Lesson2/Lesson2.cpp | #include <iostream>
using namespace std;
int main()
{
int intMax = INT_MAX;
cout << intMax << endl;
cout << intMax + 1 << endl;
system("pause>0");
}
| TOOL | 0.865036 | 3.102795 |
c699d0d6-ec35-4e23-815d-ae8a53d4bc77 | LZP206/proj_cpp | 0_learning/标准模板库STL/16_STL常用算法/1_遍历算法.cpp | /*
常用遍历算法:
- for_each(iterator beg, iterator end, _func);
- beg 开始迭代器
- end 结束迭代器
- _func 函数或者函数对象
- transform()(iterator beg1, iterator end1, iterator beg2, _func);
- beg1 源容器开始迭代器
- end1 源容器结束迭代器
- beg2 目标容器开始迭代器
-_func 函数或者函数对象
*/
#include <iostream>
using namespace std;
#include <a... | ALGO | 0.99435 | 5.022678 |
a06526b3-0cac-4af6-8959-d35b505eeb49 | Mulab11/cntt2016-hw1 | TC-SRM-560-div1-500/wwt.cpp | /*
先把所有点的坐标都*2,二分答案。可以发现,对于一个最终在(x,y)的点,要在k步后能搞到(x,y),那么他周围必然有一个2k*2k的点阵(每次x+2,y+2这样),
那么直接把一开始所有的点都搞出来,然后模拟一遍就好了。可以发现,答案最多不会超过|x|+|y|=140(否则显然会搞出来一些新点)
*/
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
const int xy[4][2] = {{1,1},{1,-1},{-1,1},{-1,-1}};
class DrawingPointsDivOne
{
public:
... | ALGO | 0.999977 | 4.045685 |
12d50102-d493-4114-a545-d1fea126c50f | ttamx/Competitive-Programming | ICPC/2024_Chula_Internal/J.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N=3e5+5;
struct Fenwick{
int n;
int t[N];
void init(int _n){
n=_n;
for(int i=1;i<=n;i++){
t[i]=0;
}
}
void update(int x,int v){
for(int i=x+1;i<=n;i+=i&-i){
t[i]+=... | ALGO | 0.999919 | 3.915069 |
47c1edfa-5671-4be2-baaf-bbe0707e610c | arpan-dhatt/mlx | mlx/backend/accelerate/reduce.cpp | #include <cassert>
#include <simd/vector.h>
#include <vecLib/vDSP.h>
#include "mlx/backend/common/reduce.h"
#include "mlx/primitives.h"
namespace mlx::core {
namespace {
template <typename T, typename VT>
struct MinReduction {
T operator()(const T& a, const T& b) {
return std::min(a, b);
}
VT operator()... | ALGO | 0.986629 | 6.919698 |
55e4aa60-5aa3-4e28-a14a-726c70cfd412 | Chet8n/InterviewPrep | 19. Trees ( BT and BST )/BST nodes in a range.cpp | /**
BST nodes in a range
Problem Description
Given a binary search tree of integers. You are given a range B and C.
Return the count of the number of nodes that lies in the given range.
Problem Constraints
1 <= Number of nodes in binary tree <= 100000
0 <= B < = C <= 109
Input Format
First argument is a root node... | ALGO | 0.999954 | 5.418958 |
0eea41dc-3139-447f-b2d1-88a806aed508 | estherlin/dual-laplace | src/circumcentre3d.cpp | #include "circumcentre3d.h"
#include <cmath>
#include <vector>
#include <iostream>
#include <Eigen/Dense>
void circumcentre3d(
const Eigen::MatrixXd& A,
Eigen::Vector3d& c){
// Find number of vertex points
int n = A.rows();
if (n == 1)
{
// If number of vertex points is 1, the centre is the point
... | ALGO | 0.999342 | 5.829388 |
6331244f-e283-4f5d-a4a4-1cc175c6d732 | SteBog/PickPoker | 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 |
1c4ed7f1-b126-41a2-8f1b-b5a87fedf438 | InnovatorMind/ZeroToHeroDSAPractice | 4. STL/Containers/Vector/problem2.cpp | // Print all elements of a vector using a loop.
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> numbers = {10, 20, 30, 40, 50};
// for (int i = 0; i < numbers.size(); i++) {
// cout << numbers[i] << " ";
// }
// another variation
for (int num : n... | ALGO | 0.996542 | 3.744101 |
03bfc7e3-4504-4e3c-910d-57edea548932 | all0fme/LeetCode-Solutions | DFS of Graph - GFG/dfs-of-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return a list containing the DFS traversal of the graph.
void dfs(int node,vector<int>&vis,vector<int> &ans,vector<int> adj[])
{
vis[node] = 1;
ans.push_... | ALGO | 0.999983 | 6.556098 |
a364228a-4d04-4437-8573-11c432384343 | Deepak-png981/Data_Structures_And_Algorithms | Left View of Binary Tree - GFG/left-view-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
vector<int> leftView(struct Node *root);
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->... | ALGO | 0.99945 | 6.827102 |
c6c1bea7-44d9-4d49-bb35-94662b90e20c | iMjayant17/PracticeLeet | 142-linked-list-cycle-ii/linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *check(ListNode *fast,ListNode* slow){
while(fast!=slow){
fast = fast->next;
slow = slow->n... | ALGO | 0.999882 | 5.773777 |
0ec624f1-6fa1-4d9f-b38c-a028c07e32ad | albertoCrego/Crego-Printer-3D | Marlin/src/gcode/calibrate/G34_M422.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include "../../module/motion.h"
#include "../../module/probe.h"
#if HOTENDS > 1
#include "../../module/tool_change.h"
#endif
#if HAS_LEVELING
#include ... | TOOL | 0.857722 | 7.077739 |
da26c1c3-db77-4ea6-922a-dc82ae699dcb | beehive-lab/Maxine-Graal | src/share/vm/opto/lcm.cpp | #include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/block.hpp"
#include "opto/c2compiler.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/machnode.hpp"
#include "opto/runtime.hpp"
#ifdef TARGET_ARCH_MODEL_x86_32
# include "adfiles/ad_x86_32.hpp"
#endif
#ifdef TA... | ALGO | 0.913259 | 7.808155 |
21ab1e75-3e29-47b6-be24-4b7886e0748e | PratheekB/suv | llvm/llvm/lib/CodeGen/EdgeBundles.cpp | #include "llvm/CodeGen/EdgeBundles.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/r... | TOOL | 0.920881 | 7.527339 |
dc22e2cd-73b2-4f70-9b4c-49550f6ef6a7 | raincross7/code-similarity | codes/train_code/problem258/problem258_436.cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;
void solve()
{
string s;
cin >> s;
for(int i = 0; i < 3; ++i)
{
... | ALGO | 0.999874 | 3.896311 |
854a0f9d-e93f-4838-854e-61a0e65d58c2 | xrisk/2018 | Codeforces/985B.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
#ifdef __APPLE__
freopen("input.txt", "r", stdin);
#endif
int n, m;
cin >> n >> m;
vector<int> cnt(m);
vector<vector<int> > adj(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < ... | ALGO | 0.999987 | 4.801279 |
095f43be-1d11-409f-b952-72c36b793be5 | rdrf2838/CP3 | 11631.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <fstream>
#include <queue>
#include <stack>
using namespace std;
typedef pair<i... | ALGO | 0.999841 | 3.954243 |
e06e7292-abb2-474f-9a16-1b34d387cbb4 | AshokDon/Numbery_Theory | Tetrahedron.cpp | //A. Tetrahedron
//link : https://codeforces.com/gym/316783/problem/A
//solution
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int32_t mod = 1e9+7;
//ll mod = 1e9+7;
struct matrix{
ll mat[4][4];
};
void TakeInput(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freop... | ALGO | 0.999971 | 4.450863 |
98b8f6f7-6473-4ecc-8102-4afcafdf5102 | goelashwin36/coding-interviews-prep | Arrays/heapSort.cpp | /*
* Author: Ashwin Goel
*/
/*
https://leetcode.com/problems/sort-an-array
Before reading this solution, it is recommended to have a basic knowledge of
heaps and the working of standard methods like maxHeapify(), buildMaxHeap()
This solution is a very simple implementation of Heaps.
*/
#include <bits/stdc++.h>
us... | ALGO | 0.999946 | 6.005415 |
e8b50a4f-50bc-42af-a0e0-d67d85c6bc31 | mark2b7mil/TandonBridgeNYU | mm11602_hw9_q1.cpp | #include <iostream>
#include <string>
#include <algorithm>
int wordCounter(std::string str);
std::string justLettersLowerCase(std::string str);
void lowerCase(std::string& str);
void printLetterCount(std::string str, std::string alphabet);
int main()
{
std::string alphabet = "abcdefghijklmnopqrstuvwxyz";
std::stri... | TOOL | 0.987879 | 5.359444 |
db128636-e72c-47e1-931e-e34390d25968 | lineCode/FactoryEngine | Processing/Octree.cpp |
#include <Processing/Octree.h>
#include <Graph/PointNode.h>
#include <Render/Primitive.h>
#include <Main/GLError.h>
namespace ftr {
Octree::Octree(Box sBox)
:mMaxCapacity(10)
,mMaxDepth(9)
,mSize(0)
,mUpdateSize(true)
,mIsInvalid(true)
{
mRootNode = Split(new Leaf(sBox));
}
Octree::~Octree(... | ALGO | 0.895879 | 6.460552 |
49848206-cd11-4d2b-b8de-a10dba027c5c | NasmeenI/ComOlympic | Camp_2/2)algorithm/7)Dynamic_programing/Code/Genetic.cpp | #include <bits/stdc++.h>
#define N 102
using namespace std;
int dp[N][N];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
string s1,s2;
cin >> s1 >> s2;
s1.insert(s1.begin() ,'0');
s2.insert(s2.begin() ,'0');
for(int i=1;i<s1.size();i++){
for(int j=1;j<s2.size();j++){
... | ALGO | 0.999945 | 3.995201 |
ffd6f822-a8c7-4747-9006-67cb75b07dd8 | Jhon-H/Competitive-programming-Notebook- | code/flows/dinic.cpp | #include "template.h";
struct Edge {
int u, v;
ll cap, flow = 0;
Edge(int u_, int v_, ll cap_) {
u = u_;
v = v_;
cap = cap_;
}
};
struct Dinic { // O(V^2 * E)
vector<Edge> edges;
vector<vi> adj;
int n, m = 0, s, t;
vi level, ptr;
queue<int> q;
vi S, T; set<int> Ss;
Dinic(int n_, int... | ALGO | 0.998652 | 4.572377 |
62b05271-024a-438b-971a-190c00017856 | PurpleSwords/LeetCode | code/linked-list/easy/160.相交链表.cpp | /*
* @lc app=leetcode.cn id=160 lang=cpp
*
* [160] 相交链表
*
* https://leetcode-cn.com/problems/intersection-of-two-linked-lists/description/
*
* algorithms
* Easy (60.81%)
* Likes: 1272
* Dislikes: 0
* Total Accepted: 295.9K
* Total Submissions: 486.5K
* Testcase Example: '8\n[4,1,8,4,5]\n[5,6,1,8,4,5... | ALGO | 0.999941 | 5.434062 |
a95ee778-6045-4528-8ea9-65d18763399c | evgenlad/Numerical-methods | Reflections_method/Reflections_method_branched/nev.cpp | #include "b.h"
double nev(double *A, int n, int m) //строчная норма для алгоритма(максимальная сумма модулей элементов строки)
{
double m6, m7;
m6 = 0;
m7 = 0;
for(int i = 0; i < m; i++)
{
m6 = 0;
for (int j = 0; j < m; j++)
{
if (A[i*n + j] > 0)
... | ALGO | 0.999707 | 3.576249 |
fe15077c-d649-4d8b-8612-ae7b97f7c677 | tenshoukijp/nobu6hd_mod_hd_version_sdk | HD.version.SDK/GameDataStructDaimyo.cpp | #include "GameDataStruct.h"
// SL喼̃XgԂB^[喼gĂ̂ŒӁB
vector<int> getDaimyoList(BOOL isIncludeTurnDaimyo) {
vector<int> list;
for (int iDaimyoID = 0; iDaimyoID < GAMEDATASTRUCT_DAIMYO_NUM; iDaimyoID++) {
// ^[喼͊܂܂Ȃ
if (!isIncludeTurnDaimyo) {
// ^[喼ȂpX
if (iDaimyoID == nb6turn.daimyo - 1) {
continue;
}
... | ALGO | 0.859284 | 4.713788 |
c8a588f5-72ea-4e0f-9215-ae34fd146f53 | jpdotcom/comp_prog-archive | Auto_Upload_Codeforces/Codeforces_Round_836_Div_2/B_XOR_Average.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define FOR(a) for(int i=0;i<a;i++)
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
typedef std::vector<long long> vi;
typedef std::pair<int,int> pi;
typedef long long ll;
#defin... | ALGO | 0.9997 | 3.661344 |
f67a1e1f-7982-4455-98bc-b040c287c06e | ria2004teressa/day-1--algo--assignment | DSA/pattern2.cpp | /*
2
4
7
A
AB
ABC
ABCD
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<=i;j+... | ALGO | 0.99952 | 4.741704 |
b951d320-27d5-43cf-b17a-833113dbbfa6 | ishandutta2007/codeforces | leaf1415/normal/487/B.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
... | ALGO | 0.999952 | 3.173399 |
eeeaaa96-1acb-4f9e-ad44-811b97a796ec | Jikky1618/AtCoder | ARC/ARC150-199/ARC150/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t;
cin >> t;
for(int i = 0; i < t; i++){
int n,k; string s;
cin >> n >> k >> s;
vector<int> ps0(n + 1), ps1(n + 1);
for(int i = 0; i <... | ALGO | 0.999966 | 4.554275 |
94cd5b89-5c22-46fd-b58d-0891448c8cc9 | nikeshsraj10/algorithms-datastructure | CPlusPlus/lastStoneWeight.cpp | #include <iostream>
#include <vector>
#include <queue>
class Solution {
public:
int lastStoneWeight(vector<int>& stones) {
priority_queue<int> stonesMH;
for(int ele: stones)
stonesMH.push(ele);
while(stonesMH.size() > 1){
int stone1 = stonesMH.top();
ston... | ALGO | 0.999885 | 5.165367 |
1ced445f-2cc8-4996-84a6-192262f0d5b3 | Logic-XD/DMOJ-Problems | UCC Coding Competition '20 P2 - Optimal Skiing.cpp | //#pragma GCC optimize ("Ofast")
//#pragma GCC target ("avx2")
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define debug cout<<"HERE"<<endl;
#define ell "\n"
#define all... | ALGO | 0.999902 | 3.254526 |
99a03937-f9b7-4b3d-b86e-bc0205800644 | Mahfuz60/data-structure-algorithm | Problem solving/vowel.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
char c;
cin >> c;
switch (c)
{
case 'a':
cout << "vowel";
break;
case 'e':
cout << "vowel";
break;
case 'i':
cout << "vowel";
break;
case 'o':
cout << "vowel";
break;
case 'u':
cout << "vowel";
break;
... | ALGO | 0.998043 | 4.00049 |
c8255045-3e37-4d19-9f58-9008b75e9f5b | Ajayt110/CPP | 34. Binary Search.cpp | #include<iostream>
using namespace std;
void b_search(int a[],int low, int high,int search)
{
int mid;
mid=a[(low+high)/2];
while(low<=high)
{
if(mid==search)
{
cout<<"\n\nSearch Element is found at position "<<(low+high)/2+1<<" in array after sorting.\n";
break;
}
else if(search<mid)
{
h... | ALGO | 0.999948 | 4.112349 |
b5572165-22d6-4360-82c5-3bf1e4dc7bf2 | TrellixVulnTeam/MyGem5_QW7F | src/systemc/tests/systemc/misc/cae_test/general/arith/subtract/decrement/decrement.cpp | /*****************************************************************************
decrement.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-14
*****************************************************************************/
/****************************************************************************... | ALGO | 0.996582 | 4.54326 |
81550138-c086-4ab6-be1e-45ed5d8733f4 | zaintahir2025/cpp-codes | Insertion Sort/Insertion Sort.cpp | /*
1. Start with the second element.
2. Compare it with elements before it.
3. Shift larger elements to the right.
4. Insert the current element in its correct position.
5. Repeat for all elements.
Algorithm
A: Array
N: Length of Array A[]
Start Algorithm
For i= 1 to N-1 do
value = A[i] //hold value
j = i-1 //backwar... | ALGO | 0.999975 | 5.989724 |
9fca621f-b2a6-4544-886d-402fdf4df1a6 | fredrickhang/lammps | src/GPU/pair_lj_cut_coul_msm_gpu.cpp | /* ----------------------------------------------------------------------
Contributing author: Trung Dac Nguyen (ORNL)
------------------------------------------------------------------------- */
#include "pair_lj_cut_coul_msm_gpu.h"
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include ... | ALGO | 0.99845 | 6.052766 |
a2216d13-3073-47c8-84fa-bb368187b995 | nexus4ever/android_system_core | adb/adb_auth_host.cpp | #define TRACE_TAG AUTH
#include "sysdeps.h"
#include "adb_auth.h"
#include "adb_utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "adb.h"
/* HACK: we need the RSAPublicKey struct
* but RSA_verify conflits with openssl */
#define RSA_verify RSA_verify_mincrypt
#include "mincrypt/rsa.h"
#u... | TOOL | 0.867646 | 6.346922 |
6a304b78-bfe7-44fa-ad41-501ca5c55bd2 | rajyan/AtCoder | others/PGBattle2020/C.cpp | #ifdef _DEBUG
#include "../../../library/src/debug_template.hpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#includ... | ALGO | 0.999918 | 4.354834 |
e8cca65c-7513-41f8-bc22-51c2540e313d | BinWang0213/3rdParty-hoomd-blue-MSVC | hoomd-v2.9.0/hoomd/extern/Eigen/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.986263 | 3.669638 |
031371d8-385e-4a8f-b266-3ad846cb1320 | AChen24562/C-Plus-plus | ET580/Day 2 Class I/Practice/Final_work/GCD_wrapper.cpp | #include <iostream>
using namespace std;
class Fraction{
private:
int numerator;
int denominator;
int gcdRec(int n, int d);
public:
// accessors
int getNumerator();
int getDenominator();
// mutators
void setNumerator(int n);
void setDenominator(int d);
int getGCDRec();
};//End of Class
//Exter... | ALGO | 0.99686 | 6.058449 |
12d2de01-d150-4b59-91be-595b700cfdb5 | shepardo/geeksforgeeks | graphs/count-number-nodes-given-level-using-bfs/count-number-nodes-given-level-using-bfs.cpp | // C++ Program to print
// count of nodes
// at given level.
// from https://www.geeksforgeeks.org/count-number-nodes-given-level-using-bfs/
#include <iostream>
#include <list>
using namespace std;
// This class represents
// a directed graph
// using adjacency
// list representation
class Graph {
// No. of vertices... | ALGO | 0.999977 | 5.54529 |
a6a9057b-be19-4c66-949e-de94ecb24a2b | sky-bro/AC | leetcode.com/0700 Search in a Binary Search Tree/main.cpp | #include <iostream>
#include <vector>
#include "leetcode.hpp"
using namespace std;
class Solution {
public:
TreeNode* searchBST(TreeNode* root, int val) {
while (root && root->val != val) {
root = root->val > val ? root->left : root->right;
}
return root;
}
}; | ALGO | 0.999847 | 6.106867 |
2529fc48-2c66-4de0-bb29-df3966effc0b | kimgaryoung/codetree-TILs | 241106/정수의 최솟값/minimum-value-of-an-integer.cpp | #include <iostream>
using namespace std;
int func(int a, int b, int c)
{
if(a>b&&b<c)
{
return b;
}
else if(a<b&&a<c)
{
return a;
}
else if(a>c&&c<b)
{
return c;
}
}
int main() {
// 여기에 코드를 작성해주세요.
int k,m,n;
cin>>k>>m>>n;
cout<<func(k,m,n);
ret... | ALGO | 0.99995 | 3.756367 |
1f3a68a1-0b96-4202-ae07-d630c664df01 | anrdnet/Skyport-gl | MortarAnimation.cpp |
#include "MortarAnimation.h"
const real MortarAnimationData::StartHeight = 1.0;
void MortarAnimationData::Update(real t)
{
VectorF4 v = (myEnd - myStart)*t + myStart;
real c = StartHeight;
real b = 2*(myHeight - StartHeight + sqrt(myHeight*myHeight - myHeight * StartHeight));
real a = -b-c;
v[Y] ... | TOOL | 0.897969 | 4.121508 |
5cab804c-0c8e-42ec-855a-a153912dc763 | MaheshSharan/LeetCode_Automation | solutions/0000-0099/0045.Jump Game II/Solution.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int ans = 0, mx = 0, last = 0;
for (int i = 0; i < nums.size() - 1; ++i) {
mx = max(mx, i + nums[i]);
if (last == i) {
++ans;
last = mx;
}
}
return ans;
}
}; | ALGO | 0.999996 | 6.180237 |
016842eb-2cff-414b-bd6b-a2d514ad0fae | tahsina-azam/My_codes | Practice/double ended queue.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,m,i,j,k,l,count,tt,c,e;
string s;
vector<int> v;
vector<int> d;
vector<int>p;
cin>>t;
for(i=0;i<t;i++)
{
count=0;
cin>>n>>m;
for(j=0;j<m;j++)
{
cin>>s;
if(s=="pushLeft")
{
cin>>k;
if(count<n)
{
d.push_back(1);
p.push_back(k... | ALGO | 0.999806 | 3.876386 |
2747dcea-d08f-4c08-9402-16a6029f9049 | ammyCodex/PatternsInCpp | swapaltern.cpp | #include<iostream>
using namespace std;
void printarray(int *arr,int n )
{
cout<<endl;
int i =0;
while(i<n)
{
cout<<arr[i]<<" ";
i+=1;
}
}
void swapArray(int *arr, int n)
{
for(int i =0;i<n;i+=2)
{
if(i+1<n)
{
swap(arr[i],arr[i+1]);
}
... | ALGO | 0.999213 | 3.969873 |
60df3fab-296c-4b30-878f-2361b9655d15 | ishandutta2007/codeforces | sugim48/normal/766/C.cpp | #define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#i... | ALGO | 0.999959 | 3.477184 |
0ddaf2ed-d31d-4bf4-8ac7-c9c442e4a98c | Nikita-mnd/lesson52main | task06/logic.cpp | #include <iostream>
using namespace std;
bool isAutomorphic(int num) {
int square = num * num;
while (num > 0) {
if (num % 10 != square % 10) return false;
num /= 10;
square /= 10;
}
return true;
} | ALGO | 0.994223 | 4.099027 |
1db7e4e0-adbb-45e7-9afb-4bedeeb2e1a5 | redbarron23/OSU | CS161/04/simple_validation.cpp | #include <iostream>
using std::cout;
using std::endl;
using std::cin;
/*
a demonstration of simple and somewhat smarter input validation
*/
int main()
{
char input_char = '!'; //initialize to known bad value
cout << "Please enter a lower-case letter: ";
cin >> input_char;
//simple check, doe... | TOOL | 0.879609 | 5.803244 |
0e0f61b7-c587-455a-b527-e6835c669ff2 | NCTp/DailyBaekJoonRaid | 11_Sort/11651_좌표_정렬하기_2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
typedef struct
{
int x;
int y;
} coord;
int main()
{
std::vector<coord> Coords;
int n;
std::cin >> n;
for (int i = 0; i < n; i++)
{
coord temp;
std::cin >> temp.x >> temp.y;
Coords.push_back(temp);
}
std::sort(Coords.begin(), Coords.end(), ... | ALGO | 0.99988 | 4.938295 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.