uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
6eacaa34-1300-4340-ab77-8e0e0801327e | atharv-bhadange/LeetCode | Medium/236_lowestCommonAncestor.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution
{
public:
bool dfs(TreeNode *p, vector<TreeNode *> &path, TreeNode *k)
{
if (p == nullptr)
... | ALGO | 0.999959 | 5.673691 |
59ed190c-d2ea-4361-a4b5-de9c5b5da7ce | kimsoosoo0928/cpp_basic_study | cpp_04_2/cpp_04_2.cpp |
/* ํจ์์ ์ค๋ฒ๋ก๋ฉ */
#include <iostream>
void print(int x) {
std::cout << "int : " << x << std::endl;
}
/*void print(char x) {
std::cout << "char : " << x << std::endl;
}*/
void print(double x) {
std::cout << "double : " << x << std::endl;
}
int main() {
int a = 1;
char b = 'c';
double c = 3.2f;
print(a);
print(... | TOOL | 0.965264 | 5.231953 |
53fa291c-0ef4-40b0-9a08-0cb389aaf119 | Acka1357/ProblemSolving | BeakjoonOJ/17000/17232_์๋ช
๊ฒ์.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
char map[301][101][102];
int cum[101][102];
int main()
{
int R, C, T, K, A, B;
scanf("%d %d %d %d %d %d", &R, &C, &T, &K, &A, &B);
for(int i = 1; i <= R; i++)
scanf("%s", map[0][i] + 1);
for(int t = 0; t < T; t++){
for(int r = 1; r <= R; r++)
fo... | ALGO | 0.999858 | 3.004423 |
90b039d0-f388-4ad2-bf90-2fe4786c70eb | FraizeX/pp1 | lab6/lab_f.cpp | #include <iostream>
#include <vector>
using namespace std;
string validstring(const string& s, const int& n){
string ans;
int counter = 0;
for(size_t i = 0; i < s.size(); i++){
char a = s[i];
if(isdigit(a)){
counter++;
}
if (counter == n){
ans =... | ALGO | 0.999873 | 4.755516 |
890e3039-2a68-4f68-8e0b-b0a1b8c51618 | hajimeIppo-cmd/cp-codes | Baekjoon OJ/06000-06999/6241.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
const int INF = 1e9 + 7;
const int MAX = 100, MAXV = 4 * MAX;
int st = 0, en = MAXV + 1;
vector<int> adj[MAXV + 5];
int c[MAXV + 5][MAXV + 5], f[MAXV + 5][MAXV + 5];
int level[MAXV + 5], work[MAXV + 5];... | ALGO | 0.998369 | 4.153984 |
5b266976-96e5-4d33-93dd-cf25f082fd1e | dedsec29/AoC2024 | Day8-2.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
bool safe(int i,int j,int n) {
return 1 <= i && i <= n && 1 <= j && j <= n;
}
void solve() {
int n = 50;
unordered_map<char, vector<pair<int,int>>> coordinates;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
... | ALGO | 0.999872 | 4.023697 |
8357b03b-f245-45c0-832e-ee06db325ec8 | sudeep217/Design-and-Analysis-of-Algorithm | 8. bubble sort (2).cpp | #include <stdio.h>
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
swap(&arr[j], &arr[j + 1]);
}
... | ALGO | 0.99968 | 5.129429 |
67c1a2e1-2a45-4991-9e36-abc1cc86a302 | japersik/itmo_algorithms_and_data_structures | task_11_1067/1067.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct directory{
map<string, directory *> children;
};
void getOrder(directory* const parent, string tab_current) {
string tab = " ";
tab += tab_current;
map<string, directory *> sorted_children(parent->children.begin(), parent->chil... | ALGO | 0.999204 | 4.536073 |
ce8f2aaa-caa3-44ad-8bbf-b18061ecb926 | Mikey54367/cpluscplus | 3-17/3-17/test.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//ฦฑสฑ
int maxProfit(vector<int>& prices, int fee) {
int n = prices.size();
vector<int> dp1(n);
vector<int> dp2(n);
dp1[0] = -prices[0];
for (int i = 1; i < n; ++i)
{
dp1[i] = max(dp1[i - 1], dp2[i - 1] - prices[i... | ALGO | 0.999552 | 4.506615 |
3ae8657e-57a7-4a18-9d6e-b542309d45d5 | sahroush/Competitive-Programming-Submissions | Atcoder/C++14 (GCC 5.4.1)/abc154_b/10027388.cpp | N = int(input())
def solve(N):
if (N % 2 == 1):
return 0
d = N // 10
ans = d
while d:
d //= 5
ans += d
return ans
print(solve(N)) | ALGO | 0.999925 | 3.935198 |
a0c3bc2e-04d3-4bd7-a592-97b7b16360e5 | pranavsindura/CompetitiveProgramming | uva/516.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define mod 1000000007
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#defin... | ALGO | 0.99983 | 3.698791 |
74b6c6fb-d0ba-499c-ac2b-682412286d2f | algphello/mt6735-hardware | ti/omap4-aah/camera/OMXCameraAdapter/OMXFD.cpp | /**
* @file OMXFD.cpp
*
* This file contains functionality for handling face detection.
*
*/
#include "CameraHal.h"
#include "OMXCameraAdapter.h"
namespace Ti {
namespace Camera {
const uint32_t OMXCameraAdapter::FACE_DETECTION_THRESHOLD = 80;
status_t OMXCameraAdapter::setParametersFD(const android::CameraParamete... | TOOL | 0.883541 | 6.43605 |
a3749c4f-b5ab-4376-8f91-849e092f641c | lufeurac/Tad-arboles | TestArbolBinario.cpp | #include<iostream>
#include "ArbolBinario.h"
using namespace std;
void pereza()
{
cout<<endl<<endl;
}
int main()
{
ArbolBinario<int> arbol(1);
if(arbol.insertar(1,2))
cout << "Se inserto el nodo correctamente" << endl;
else
cout << "No se inserto el nodo" << endl;
if(arbol.inserta... | ALGO | 0.998845 | 5.190248 |
ac9c7c5e-1c04-47fd-9fcc-fdba81f5573d | PhoenixAthens/DataStructures-Essentials | DataStructures-Essentials/CodeChef/Below1000/Nearest-Exit.cpp | #include "../Below500/all.h"
int main(){
int t;
cin >> t;
while(t--){
int x;
cin >> x;
int north = x-1;
int south = 100-x;
if(north<south)cout<<"LEFT\n";
else cout<<"RIGHT\n";
}
}
| ALGO | 0.999992 | 3.426252 |
a8b11bca-57f4-41f9-a330-b49ce77ef57a | Killg0d/2Sem | dsa/week5/evalpost.cpp | #include <iostream>
#include <stack>
using namespace std;
int evaluate(char *p)
{
stack<int> s;
for (int i = 0; p[i] != '\0'; i++)
{
if (p[i] == ' ') // if it is space we skip one
continue;
if (isdigit(p[i]))
{
int num = 0;
while (isdigit(p[i]))... | ALGO | 0.99971 | 4.131669 |
cf85605d-acdb-4618-b67d-5d8f958946dd | marcuspeh/leetcode-solutions | 0621-task-scheduler/0621-task-scheduler.cpp | class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
unordered_map<char, int> cache;
for (auto task: tasks) cache[task]++;
int m = 0;
vector<int> counts;
for (auto [task, count]: cache) {
counts.push_back(count);
m = max(m,... | ALGO | 0.999985 | 6.905728 |
f9eaac04-20d5-4d23-8872-16c609009ea5 | Dakshatk/100daysofcode | day88.cpp | #include <iostream>
#include <sstream>
#include <queue>
#include <vector>
#include <string>
using namespace std;
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
// Build tree from level-order tokens
TreeNode* buildTree(const vec... | ALGO | 0.999477 | 6.345291 |
f4b8ab28-29f8-4034-948f-8c5996313aa3 | firiexp/library | test/aoj0415.test.cpp | #define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0415"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using uint = unsigned;
... | ALGO | 0.999651 | 4.193397 |
c5da4d09-7368-49ff-89b2-aa8b43568b13 | AnkitChauhan39/CSES-problems | Introductory Problems/WeirdAlgorithm.cpp | #include<bits/stdc++.h>
using namespace std ;
int main(){
long long n ;
cin>>n ;
vector<long long> nums ;
while(n!= 1) {
nums.push_back(n) ;
if(n%2 == 0 ){
n = n/2 ;
}else{
n = 3 * n +1 ;
}
}
nums.push_back(1);
for(int i = 0 ; ... | ALGO | 0.999994 | 5.177668 |
1f88bf14-fc5b-429c-ac7b-f5016518defe | mhdfaizal03/assignment_yebelo | 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.998776 | 6.763923 |
5d5974e2-4c45-4a6e-b987-673b36ac31b1 | DerpFest-Devices/device_xiaomi_santoni | data-ipa-cfg-mgr/hal/src/PrefixParser.cpp | /* External Includes */
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <vector>
/* Internal Includes */
#include "IOffloadManager.h"
#include "PrefixParser.h"
/* Avoiding namespace pollution */
using IP_FAM = ::IOffloa... | TOOL | 0.856401 | 6.408634 |
83eaa160-efad-4ece-a7e9-999babd65ec4 | m2417181901/C-practise | ๅ็ญๅญ333.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MO=1e9+7;
const int opps[]={0,4,5,6,1,2,3};
struct Mat {
int r,c;
ll el[10][10];
Mat() {}
Mat(ll x) {
r=c=6;
memset(el,0,sizeof(el));
for (int i=1;i<=r;i++) {
el[i][i]=x;
}
}
... | ALGO | 0.999975 | 4.535182 |
c5e3661c-6295-432f-9e73-18cbad3ecee5 | ishandutta2007/codeforces | andreikkaa/normal/1302/C.cpp | /*
* C++11 code template for contests.
* @author: Andrei Kalendarov
* @e-mail: <EMAIL>
*/
//#define ANDREIKKAA_ALLOCATOR
const int _ML = 228;
const char _inpf[] =
#if defined(ANDREIKKAA)
"input.txt"
#else
""
#endif
;
const char _outf[] =
#if defined(ANDREIKKAA)
""
#else
""
#endif
;
#i... | ALGO | 0.999662 | 5.144353 |
75a58b3f-6f8a-440b-89c7-5e596828264b | mhchia/practice | c_cpp/testing/exam/test.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main(void)
{
double a = 2;
cout << sqrt(a) << endl;
}
| ALGO | 0.992191 | 3.273059 |
eaf21459-14c5-496f-b097-f3c51831a7d1 | thegamer1907/Code_Analysis | DP/2033.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m; cin>>n>>m;
int arr[n], q[m], dp[n];
for(int i=0; i<n; i++) cin>>arr[i];
for(int i=0; i<m; i++) cin>>q[i];
unordered_set<int> s;
s.insert(arr[n-1]);
dp[n-1] = 1;
for(int i=n-2; i>=0; i--){
if(s.find(arr[i])!=s.end()){
dp[i] = d... | ALGO | 0.999994 | 3.890654 |
198a4f7c-d242-495b-be0c-07307b352b98 | sinian666/code_86_7 | cpp_ๅฏๆฌ23/chapter_backtracking/preorder_traversal_iii_compact.cpp | /**
* File: preorder_traversal_iii_compact.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
vector<TreeNode *> path;
vector<vector<TreeNode *>> res;
/* ๅๅบ้ๅ๏ผไพ้ขไธ */
static void preOrder(TreeNode *root) {
// ๅชๆ
if (root == nullptr || root->val == 3) {
ret... | ALGO | 0.999908 | 5.640774 |
e84e71ac-0a86-4c2b-8e05-922e44515672 | alexandraback/datacollection | solutions_2463486_0/C++/jsalot/main.cpp | #include <iostream>
#include <map>
#include <vector>
#include <stack>
#include <fstream>
#include <math.h>
#define LOG_ERROR std::cout << "ERROR IN LINE: " << __LINE__ << std::endl
#define NO_TYPE long long
NO_TYPE A, B;
// 1234567
// 2000000 - 9999999 (9-1)*10ห3
// 1300000 - 1999999 (9-2)*10ห2
// 1240000 - 1200000 ... | ALGO | 0.99928 | 5.583029 |
869bb1ec-7f3b-43ac-84e2-bc80777813ae | aivy45/AssignMent-Ineuron | PPTProgram/Assignment-1 Arrays/Q3.cpp | /*
๐ก **Q3.** Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with O(log n) runtime complexity.
**Example 1:**
Input: nums = [1,3,5,6], target = 5
Output: 2
*/... | ALGO | 0.999994 | 6.964923 |
b33ed84c-0325-4012-836e-d10476b26e76 | libcy/acoustic1d | main.cpp | #include <iostream>
#include "forward.h"
using namespace std;
int main() {
double *c0 = mat::create(nx);
for (int i = 0; i < nx; i++) {
c0[i] = (double)1 + sin((double)i / 10)*sin((double)i / 20) / 5;
}
int nrx[nrt];
int nsx[nst];
for (int i = 0; i < nrt; i++) {
nrx[i] = (int)(nx*(i + 1) / (nrt + 1) + 0.5... | ALGO | 0.999914 | 3.678485 |
8ecf0ce4-553d-49df-9d3b-713146655573 | TuanMeta1003/AOV-DumpSkinID | jni/TuanMeta/IL2CppSDKGenerator/Il2Cpp.cpp | //
// Fixed by musk.
//
#include "Il2Cpp.h"
// ========================================================================================================================================== //
#define IL2CPP__TAG "TuanMetaโIl2CppSdk"
#define IL2CPP_LOGI(...) __android_log_print(ANDROID_LOG_INFO,IL2CPP__TAG,__VA_ARGS__)
#d... | TOOL | 0.977627 | 5.226132 |
684248f0-9d70-4a6e-b4bc-fd58933e83d9 | manmohanaeir1/Cpp-2sem- | oop/pointerToObject/poiterCall.cpp | #include<iostream>
using namespace std;
class pointer
{
int a,i;
public:
void mul();
};
void pointer::mul()
{
cout<<"enter any number you want multiplication ";
cin>>a;
for(i=1;i<=10;i++)
{
//cout<<a" * " << i<<a*i<<endl;
cout <<a <<" * " <<i << " = " <<a*i <<endl;
}
}
int main()
{
... | ALGO | 0.981222 | 3.416113 |
b25e64fb-d11f-41f9-94b0-4149259b232f | yuxiangliu-beginner/leetcodeQuestions | constructBinaryTreeFromPreorderandInorder.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.999989 | 6.047847 |
a43bca61-0082-4413-ac1a-8315ad999a6a | PedroH2003/Programacao-Cplusplus | Contests/IFTM_MARATON/Provas_Antigas_01/N.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int y; cin >> y;
y = 2024 - y;
y *= 2;
y = 2024 - y;
cout << y << endl;
return 0;
} | ALGO | 0.99625 | 3.581713 |
0a205cfd-ea5b-439e-8250-bdb8097a8981 | albertgarciamestre/GarciaAlbert_AR2 | TAG/TAG/PlayerF.cpp | #include "PlayerF.h"
PlayerF::PlayerF()
{
Map map;
for (int i = 3; i < map.numRows; ++i) {
for (int j = 4; j < map.numColumns + 1; ++j)
{
if (map.map[i][j] == '#')
{
firstX = i;
xPos = i;
firstY = j;
yPos = j;
}
}
}
}
void PlayerF::movePlayerF(int dir, char** map)
{
if (map[xPos][y... | ALGO | 0.859388 | 3.260659 |
1c3dc0f7-72e6-48c8-a4eb-b7ad8b9f59fd | VaishnavShelke/DS-Algo | Dynamic Programming/Maximum difference of zeros and ones in binary string.cpp | class Solution{
public:
int maxSubstring(string S)
{
return maxDiff(S);
}
int maxDiff(string str){
int maxZero[str.size()+1]; maxZero[0] = 0;
//int maxOnes[str.size()+1]; maxOnes[0] = 0;
// "0101000010110"
for(int i = 0; i<str.size() ; i++){
if(str[i] == '0'){
maxZero[i+1] ... | ALGO | 0.999893 | 5.340574 |
d32867d5-375f-4c29-aa31-ea5ffad62edf | SinghRajan41/code | my_codeforces_solutions/singh_rajan41/normal/1696/A.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;
void solve();
ll add_mod_m(ll a, ll b,ll m);
ll sub_mod_m(ll a,ll b,ll m);
ll mul_mod_m(ll a,ll b,ll m);
ll div_mod_m(ll a,ll b,ll m);
ll extended_euclid(ll a,ll b, ll *x,ll * y);
ll binExp_Mod_M(ll a,ll b,ll m);
ll... | ALGO | 0.999905 | 4.320518 |
7b2e0cbb-d329-497b-ae3a-3e2cdd31e47b | Nur-Alam-Limon/Competitive-Programming | Vjudge/TFC 16.12.20/easy but hard.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n,mx=0,ans=0;
cin>>n;
ll a[n+5];
for(ll i=0;i<n;i++)
{
cin>>a[i];
mx=max(mx,a[i]);
}
ll div[mx+5]={0};
... | ALGO | 0.999912 | 4.087648 |
1403e3b3-2011-4270-9e77-46682e0e4bc9 | moto6/Coding_TEST | MINCO/165/165_1.cpp | #include <cstdio>
int main() {
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
for(int j=0 ; j<c ; j++) {
for(int i=a ; i<=b ; i++) {
printf("%d ",i);
}
puts("");
}
return 0;
}
| ALGO | 0.999783 | 3.505564 |
0905d464-108a-4586-9516-d875b06cec0f | ishandutta2007/codeforces | nigus/normal/1490/B.cpp | #pragma GCC optimize("O3") //
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int... | ALGO | 0.999831 | 4.033195 |
45614e0a-5e7d-421e-9136-7a1a76996311 | ishandutta2007/codeforces | heart_blue/normal/1676/F.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.99974 | 3.758725 |
0eb2c929-efad-47b2-be78-5060de0de7d6 | preronaghosh/Data-Structures-and-Algorithms | Recursion/printOnlyOneSubsetWithTargetSum.cpp | /* Write a program to print only 1 subsets/subsequence of an array which meets the target sum k */
#include <vector>
#include <iostream>
using namespace std;
constexpr int targetSum = 2;
void printArray(vector<int>& vec) {
if (vec.size()==0) {
cout << "Null" << endl;
return;
}
for (a... | ALGO | 0.999885 | 5.992256 |
6c2d0bfc-9edb-4c8f-9418-99a590e3dc0d | anushkagupta2408/clang | insertionsort.cpp | /*#include<iostream>
using namespace std;
void insertionsort(int arr[],int n){
int i,j,key;
for(i=1;i<n;i++){
key=arr[i];
j=i-1;
while(j>=0 && arr[j]>key){
arr[j+1]=arr[j];
j=j-1;
}
arr[j+1]=key;
}
}
int main(){
int arr[]={2,5,8,12,1};
int n =sizeof(arr)/sizeof(arr[0]);
insertionsort(arr,n... | ALGO | 0.999934 | 4.406808 |
214b2261-4041-45c2-a90f-63d6ed2616ec | GaurishIIITNR/CP-Problems-Solutions-2 | Tyre_problem.cpp | //Created by LALU PRASAD YADAV
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
ll tc; cin>>tc;
while(tc--)
{
ll a,b;
cin>>a>>b;
cout<<(2*a+(4*b))<<"\n";
}
} | ALGO | 0.999253 | 4.085949 |
a35e5df2-7188-4563-9147-ebf88a81ff7c | Programming-god/zk-snarks | SEAL/seal/util/polyarithmod.cpp | #include "seal/util/uintcore.h"
#include "seal/util/uintarith.h"
#include "seal/util/uintarithmod.h"
#include "seal/util/polycore.h"
#include "seal/util/polyarith.h"
#include "seal/util/polyarithmod.h"
#include "seal/util/polyfftmultmod.h"
using namespace std;
namespace seal
{
namespace util
{
void mu... | ALGO | 0.989963 | 5.889207 |
7b169c2b-b839-43b1-a9aa-39ece36cd4da | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/apm/kruskal/train/0c00b533-ee87-4e5f-b34a-6c336fad3c19.cpp | #include <bits/stdc++.h>
using namespace std;
vector <tuple<int,int,int>> v;
vector<pair<int, int>> ans;
vector <int> ind;
int n, m, cost;
int root(int x) {
if(ind[x] == x) {
return x;
}
return (ind[x] = root(ind[x]));
}
void fabricaDeUnire(int x, int y) {
ind[ind[y]] = ind[x];
}
... | ALGO | 0.999948 | 4.023808 |
e3595f20-4e23-49c6-b29b-41541fd843b6 | heavenMOJANG/ICPC | .history/luogu/P2774 ๆนๆ ผๅๆฐ้ฎ้ข_20241102215224.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
constexpr int N = 1e4 + 10;
constexpr int M = 2e5 + 10;
struct Edge {int to, nxt, vol;}e[M];
int m, n, a[110][110], s, t;
int hea... | ALGO | 0.999983 | 4.15975 |
46a3ac3f-eaea-4319-9116-e9f850f793f0 | anhhducc/NMLT_IT001.L11 | Chuong03/Bai037/Bai037.cpp | #include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;
void Nhap(int[], int&);
void Xuat(int[], int);
bool ktDoiXung(int);
int TongDoiXung(int[], int);
int main()
{
int b[100];
int k;
Nhap(b, k);
cout << "\nMang ban dau: ";
Xuat(b, k);
cout << "\nTong cac gia tri doi xung= ";
int kq = Tong... | ALGO | 0.99904 | 3.969769 |
387d4b5d-47cf-4a4a-951a-1bf43b08e0e3 | harshanand1/cdoechefcontest | contest117/WEPCH.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int h, x, y1, y2, k;
cin >> h >> x >> y1 >> y2 >> k;
int p1 = ceil(h * 1.0 / x);
int p2 = min((int)ceil(h * 1.0 / y1), k);
if (p2 == k) p2 += max((int)ceil((h - k * y1) * 1.0 ... | ALGO | 0.999831 | 3.188923 |
092eb4bf-3525-457f-a7fc-4a5bf71cfa21 | SadmanHafizShuvo21/codeforces | Phone_Call.cpp | #include <bits/stdc++.h>
using ll = long long;
struct Event {
ll time;
int type; // 0: ringing_end, 1: call_end, 2: call_initiation
int X, Y;
ll D;
Event(ll t, int ty, int x, int y, ll d) : time(t), type(ty), X(x), Y(y), D(d) {}
bool operator>(const Event& other) const {
if (time != oth... | ALGO | 0.999864 | 5.203445 |
c8f0496a-8a95-4769-ae01-25b6c4fc178f | ustcyyw/algorithm | luogu/datastructure/seg_tree/special_info/CF2045I.cpp | /**
* @Time : 2024/12/27-9:26 PM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc : CF2045I 2100 ๆฐๆฎ็ปๆ ็บฟๆฎตๆ ๅบ้ดไธไธๅๅ
็ด ็ไธชๆฐ
*/
/*
* ๆณขๆตชๅบๅไธญ ไธคไธชx๏ผไธคไธชyไน้ด็้ด้ๅไธบ1 ๅนถไธๆ นๆฎๅฎไน f(x,y) = f(y,x)
* ๅฏนไบๆๅฎ็xๅy, ๅจๆพๆ้ฟๆณขๆตชๅบๅ็ๆถๅ ๅ
้ๅฐxๆ่
yๅฐฑ้ๆฉ ็ถๅๅๆขๅปๆพๅฆๅคไธไธชๆฐ๏ผไปฅๆญค็ฑปๆจ
* ๅจๆซไธ้ๆฐ็ป็ๆถๅ ๆไธพๅฐnums[i]ๆถ๏ผไธๅฆจๅ่ฎพ x = nums[i]ๅฐฑๆฏๆณขๆตชๅบๅ็... | ALGO | 0.999986 | 4.648995 |
1b895206-1ee6-440c-bd97-915d0e15e34e | w407022008/Firmware_PX4_v1.14.2 | src/modules/mc_pos_control/Takeoff/Takeoff.cpp | /**
* @file Takeoff.cpp
*/
#include "Takeoff.hpp"
#include <mathlib/mathlib.h>
#include <lib/geo/geo.h>
void TakeoffHandling::generateInitialRampValue(float velocity_p_gain)
{
velocity_p_gain = math::max(velocity_p_gain, 0.01f);
_takeoff_ramp_vz_init = -CONSTANTS_ONE_G / velocity_p_gain;
}
void TakeoffHandling::... | TOOL | 0.99289 | 6.582621 |
e8db6152-0fa3-42de-9835-559dc3034053 | Md-DinIslam/Problem_Solved_Mixed_Platform | Plus_One.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int size = digits.size()-1;
for(int i = size ; i>=0;i--){
if(digits[i] != 9){
//digits[i] += 1;
digits[i]++;
break;
}
else{
digits[i... | ALGO | 0.999913 | 6.52949 |
56747ae8-65da-4bdd-8b00-b66341a747a4 | jun23314/codetree-TILs | 240712/n๊ฐ ์ค์ m๊ฐ ๋ฝ๊ธฐ/n-choose-m.cpp | #include <iostream>
#include <set>
using namespace std;
set<int> s;
int n, m;
void printing(){
for(auto i: s){
printf("%d ", i);
}
printf("\n");
}
void choose(int curr_idx, int now){
if(curr_idx == m+1){
printing();
return;
}
for(int i = now + 1; i <= n; ++i){
... | ALGO | 0.999776 | 3.760566 |
e7fd0d5f-8e25-4c14-b561-ac627cd5dd0c | abdullah-al-tamim/Codeforces | Practice/D_Coprime.cpp |
#include <bits/stdc++.h>
using namespace std;
int mem[1005][1005];
bool coprime(int a, int b)
{
if (__gcd(a, b) == 1)
return true;
else
return false;
}
int main()
{
int t;
cin >> t;
for (int tc = 0; tc < t; tc++)
{
// cout << "HELLO" << endl;
memset(mem, 0, 1005... | ALGO | 0.999577 | 3.540612 |
5635fdde-f2e0-472d-975d-2b2bd63afb7c | AndrioHanania/Bellman_Ford_and_Dijkstra_algorithm_CPP | myAlgorithm.cpp | #include "myAlgorithm.h"
#define MinusOne -1
namespace vrt
{
void myAlgorithm::belmanFord(Graph* G, int dst, int src, float& FinalWeight)
{
int numOfVertex = G->getNumberOfVertex();
float* d = new float[numOfVertex];
int* p = new int[numOfVertex];
init(d, p, numOfVertex, src);
for (int j = 1; j < numOfVert... | ALGO | 0.999558 | 3.705334 |
04c33acc-c13a-400d-ace3-49981eda5740 | rachit77/DSA-solutions | 387-first-unique-character-in-a-string/387-first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
unordered_map<char,int> mp;
for(auto it:s)
mp[it]++;
for(int i=0;i<s.length();i++)
{
if(mp[s[i]]==1)
return i;
}
return -1;
}
}; | ALGO | 0.999846 | 5.908306 |
a49edab6-6b77-4dcc-8dca-9073213e1735 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6374_4.cpp | #include <bits/stdc++.h>
using namespace std;
namespace yspm {
inline long long read() {
long long res = 0, f = 1;
char k;
while (!isdigit(k = getchar()))
if (k == '-') f = -1;
while (isdigit(k)) res = res * 10 + k - '0', k = getchar();
return res * f;
}
const long long N = 1010;
char ans[N][N];
long long... | ALGO | 0.999755 | 4.93487 |
ede712a0-1399-4af5-bafc-dc1989402619 | ravikantmahto2410/Programming-language | Recursion/Recursion4/02_subArrayByrecurmet2.cpp | #include<iostream>
#include<vector>
using namespace std;
void subArray(vector<int> v, int arr[], int n, int idx){
if(idx==n){
for(int i=0;i<v.size();i++){
cout<<v[i];
}
cout<<endl;
return;
}
subArray(v,arr,n,idx+1);
if(v.size()==0 || arr[idx-1]==v[v.size()-1])... | ALGO | 0.999943 | 4.269645 |
bbf8bdcc-1fda-4a7d-a9aa-a06fb4279ad1 | rogeryoungh/code-of-acm | src/Luogu/8x/P8240.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int ____ = (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), 1);
// END OF HEADER | Author: Roger Young
// #define int ll
using pii = pair<int, ll>;
using pll = pair<ll, ll>;
const int N = 4E5 + 10;
const ll INF = 1E18;
vector<pll> G1[N], G2[N],... | ALGO | 0.999983 | 4.999112 |
e5201bd4-28d9-42f3-8139-e832e34a92b8 | Ria-Srivastava/cafeteria-project | legacy/Cafeteria_CLI_Menu.cpp | #include <iostream>
#include <string>
#include <limits>
using namespace std;
int viewMenu();
int updateMenuItem();
void menuManagement();
void orderManagement();
void menuList();
// Structure to hold order details
struct Order {
int orderId;
int itemId; // itemId to store the menu item associated with the ... | TOOL | 0.900574 | 7.163937 |
c27a0892-0c73-4bca-8498-8ad5a037d649 | Elevenchain/wallet | src/test/util/blockfilter.cpp | #include <test/util/blockfilter.h>
#include <chainparams.h>
#include <node/blockstorage.h>
#include <validation.h>
bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter)
{
CBlock block;
if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensu... | TOOL | 0.902407 | 6.844151 |
f244b558-9260-481f-8874-30928f5c58ed | C-2023-4-6/8202220718-- | ๅฎ้ชไธใๅ/ๅฎ้ชไธcppๆไปถ/5.cpp | #include <iostream>
using namespace std;
int apple_num(int day){
int num=1;
while(day>1){
num=(num+1)*2;
day--;
apple_num(day);
}
return num;
}
int main(){
int day=10;
cout<<"าปีชฮช:"<<apple_num(day)<<"\n";
return 0;
}
| ALGO | 0.999776 | 3.122412 |
0e69f8e1-1309-4eb3-adb8-6f683043a9a6 | LifeIsRightward/Baekjoon | Solved/Silver/Silver3_12789.cpp | #include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// ์น์ฐฌ์ด ์์ ํ์ ์
int num = 0;
int temp = 0;
// 0๋ถํฐ ์์๋๋ก ์ฆ๊ฐํ ์ซ์
int cmpnum = 1;
// ๊ฒฐ๊ณผ String
... | ALGO | 0.999968 | 4.891592 |
d9e4c0b8-c5c4-48cc-83fd-a4f0f28297d7 | linkeLi0421/no-remove-no-reorder | llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp | #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Option/ArgList.h"
#i... | TOOL | 0.958239 | 7.673613 |
fd074b62-957c-42a0-a826-2542b5e1f179 | bmzhong/dev | luogu/luogu2/1542.cpp | #include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
int n, xi, yi, si;
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
... | ALGO | 0.999899 | 3.798672 |
91598ef4-0bad-4c1e-898a-20dd095db8e6 | nikki12061995/Tops | Looping statement/Q.25L.cpp | //25. (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n)
#include<stdio.h>
int main(){
int n,sum=0;
printf("Enter the number of term:");
scanf("%d",&n);
for(int i=1;i<=n;i++){
sum = (sum + (i*i));
}
printf("%d",sum);
}
| ALGO | 0.99966 | 3.219909 |
77209aa7-1ac0-4f16-a059-02bf05e95d67 | damantadi/oop-lab | lab assignmnets/lab4/q3.cpp | //function overloading
#include <iostream>
using namespace std;
int vol(int a)
{
return a * a * a;
}
float vol(float r)
{
return (4 * 3.14 * r * r * r) / 3;
}
float vol(float r, int h)
{
return (3.14 * r * r * h) / 3;
}
int main()
{
int a;
cout << "enter the side of cube :" << endl;
cin >> a;
... | ALGO | 0.977285 | 3.555102 |
f7d5059b-b877-4881-92a9-e41b67915693 | georgehodgkins/Zhuque_artifact | clobber-pmdk/llvm/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class normal_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
#include <cstddef>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
in... | TEST | 0.9699 | 4.224656 |
7648488f-8ae0-4174-832b-c7f5baac128e | sarvex/leetcode-cyber | solution/0600-0699/0666.Path Sum IV/Solution.cpp | class Solution {
public:
int ans;
unordered_map<int, int> mp;
int pathSum(vector<int>& nums) {
ans = 0;
mp.clear();
for (int num : nums) mp[num / 10] = num % 10;
dfs(11, 0);
return ans;
}
void dfs(int node, int t) {
if (!mp.count(node)) return;
... | ALGO | 0.999913 | 6.689327 |
0383514f-569a-4318-a2a1-79260047547c | andrewaarestad/ode-system-fitting-with-boost-and-nlopt | boost_1_77_0/libs/geometry/doc/src/examples/geometries/adapted/c_array.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[c_array
//` Small example showing the combination of an array with a Boost.Geometry algorithm
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs:... | TOOL | 0.872863 | 3.897976 |
49455423-d586-4d81-821c-f41174833db9 | pkushal148/cp | cf/c_11/3.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
void solve()
{
int n,a;
cin>>n>>a;
vector<int> ships(n);
for(int i=0;i<n;i++)
{
cin>>ships[i];
}
int s=0,e=n-1;
int cnt=0;
while(a>0)
{
int mini=min(ships[s],ships[e]);
if(a<2*mini)
{
br... | ALGO | 0.999831 | 3.901949 |
c7a9130f-2929-49c3-bb10-eb67de0cabe5 | brlcad/randan | main.cpp | #include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <ctime>
#define DECLARE_C(x) extern "C" { \
void seed_##x(long seed); \
int rand_##x(void); \
} \
extern int __x
#define DECLARE_CPP(x) \
void seed_##x(long seed); \
int rand_##x(void)
DECLARE_C(rand);
DECLARE_C(random);
DECLA... | TEST | 0.953857 | 5.130427 |
8d24a41e-926b-42f4-a39f-acc9c94e29de | ar1nd0m/ar1nd0m | cp codes/B_Swap_and_Delete.cpp | /*เฅ เคตเคพเคธเฅเคฆเฅเคตเคพเคฏ เคจเคฎเค*/
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios::sync_with_stdio(0); cin.tie(0);
#define fx(i, x, y) for (int i = x; i < y; i++)
#define f(i,y) for (int i = 0; i < y; i++)
#define mx_e(a) *max_element(a.begin(), a.end())
#define mn_e(a) *min_element(a.begin(), a.end())
#define vin... | ALGO | 0.999804 | 4.459164 |
2113bec9-ca0e-4bed-9b72-20de66d41d1b | Fdfvbt/Top-academy-education | 06.02.2023/ะฑัะผะฑะพะบั.cpp | #include <iostream>
using namespace std;
void print(int**a, int size, int size2){
for(int i=0; i<size; i++){
cout<<"\n";
for(int j=0; j<size2; j++){
cout<<a[i][j]<<" ";
}
}
cout<<"\n";
}
void init(int** a, int size1, int size2, int d1, int d2){
srand(time(NULL));
for(int ... | ALGO | 0.964187 | 3.330173 |
d636ec6f-0720-4b1f-a97e-d3e2affa4a02 | raincross7/code-similarity | codes/train_code/problem340/problem340_195.cpp | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=(b);i++)
#define em emplace_back
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define mkp make_pair
#define pii pair<int,int>
#define oi ios::sync_wit... | ALGO | 0.999781 | 3.563056 |
b0cab4d8-146c-42b7-b46d-7ea8ef82f4c5 | lxjfzlxj/Codeforces | Codeforces Round 876 (Div. 2)/A.cpp | # include <bits/stdc++.h>
# define report(args...) return printf(args), void()
int max(int x,int y) {return x>y?x:y;}
void _() {
int n,k,i,ans=0;
scanf("%d%d",&n,&k);
for(i=1;i<n;i++) ans=max(ans,(i+k-1)/k+(n-i+k-1)/k);
printf("%d\n",ans);
}
int main() {
int T=1;
scanf("%d",&T);
while(T--) _();
return 0;
}
| ALGO | 0.999638 | 3.873248 |
5ad67873-80a6-46c0-835d-d1c670618fda | sarvex/leetcode-beef | solution/0800-0899/0839.Similar String Groups/Solution.cpp | class Solution {
public:
vector<int> p;
int numSimilarGroups(vector<string>& strs) {
int n = strs.size();
p.resize(n);
for (int i = 0; i < n; ++i) p[i] = i;
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j)
if (check(strs[i], strs[j]))
... | ALGO | 0.999965 | 5.838858 |
1362f26a-062e-450b-8184-c4c98e8d3aa8 | 00light00/PAT | Basic/B1019.cpp | #include<iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
scanf("%d", &n);
do {
int num[4];
int cnt = 1;
for (int i = 0; i < 4; i++) {
num[i] = n / cnt % 10;
cnt *= 10;
}
sort(num, num + 4);
int max = 0, min = 0;
for (int i = 0; i < 4; i++) {
max = max * 10 + num[3 - i]... | ALGO | 0.997249 | 3.557096 |
76ae3aee-af03-4a25-9dd6-c7fc26457b18 | XoDeR/AlgoRecap2017 | DynamicProgramming/MaximumProductRodCutting/MaximumProductRodCutting02.cpp | #include <bits/stdc++.h>
using namespace std;
int rodCut(int n)
{
// T[i] stores maximum profit achieved from rod of length i
int T[n + 1];
// rod of len i has at-least cost i
for (int i = 0; i <= n; i++)
T[i] = i;
// consider rod of length i
for (int i = 2; i <= n; i++)
{
// divide the rod of length i ... | ALGO | 0.99972 | 4.446609 |
3a78fc78-1447-409f-9dee-d2af14091b81 | yagyaraj234/DSA | 06. Matrices/DiagonalMatrices.cpp | #include<bits/stdc++.h>
using namespace std;
class diagonal{
private:
int *A;
int n;
public:
diagonal(){
n=2;
A= new int[2];
}
diagonal(int n){
this->n=n;
A=new int[n];
}
~diagonal(){
delete []A;
}
void set(int i,int j,int k );
in... | ALGO | 0.997998 | 3.398976 |
2cff81b1-01c9-4f5f-b204-943d8961f27e | nisarg9636/flutter-console-shop | 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.99874 | 6.767714 |
a52832fa-1dbf-4ab2-a8c4-5424c833792d | omuomuMG/AtCoder | dp/dp_i.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
int main()
{
int n;
cin >> n;
vector<double> p(n);
for (int i = 0; i < n; i++)
{
cin >> p[i];
}
vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0));
dp[0]... | ALGO | 0.999952 | 4.594368 |
bf95dcc3-1f47-49e8-b680-8c733e45e259 | sukiand/LeetCode-LintCode | flipBits.cpp | #include <iostream>
using namespace std;
int flipBits(int A[], int n){
int start = -1, end = -1;
int mark = 1;
int count = 0;
for (int i = 0; i < n; i++){
if (count == 0){
if (A[i] == 0){
count++;
start = i;
}
}
if (count > 0){
if (A[i] == 0){
count++;
}
else {
count--;
if... | ALGO | 0.999733 | 4.060064 |
042b9bc6-2dc1-428c-b3a1-058be82d4c96 | cubercsl/The-road-to-ACMer | Summer2019/NEERC/B.cpp | #include <bits/stdc++.h>
using namespace std;
char s[105][105];
int main()
{
int n;
scanf("%d", &n);
if (n == 2) return puts("-1"),0;
printf("%d\n", 100);
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
s[i][j] = '.';
if(n % 2 == 0) s[98][1] = 'o';
for(int i... | ALGO | 0.999591 | 3.636314 |
7dc95536-3833-409f-81d1-0c77988278ae | kimyu0218/algorithm | Baekjoon/17000-17999/17503.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<int, int> pi;
typedef long long ll;
bool cmp(const pi &p1, const pi &p2) { // ๋์ ์ค๋ฆ์ฐจ์
return p1.second < p2.second;
}
struct cmp2 {
bool operator () (const pi &p1, const pi &p2) { // ์ ํธ๋ ๋ด๋ฆผ์ฐจ์
... | ALGO | 0.999994 | 5.0907 |
d67aa675-77ec-47e6-9c2b-4c73fc1aea9a | basilmannekudi/project-viewer | uploads/2521c3e7b8e943ec679fb7908a7bd8a1.cpp | #include <iostream>
using namespace std;
int main() {
int a;
cout << "Enter the number: ";
cin >> a;
// Clear input buffer
cin.ignore(1000, '\n'); // Ignore up to 1000 characters until '\n' is found
if (a % 2 == 0) {
cout << "The given number is EVEN" << endl;
} else {
co... | ALGO | 0.96777 | 4.902588 |
5c0b1c83-3b1b-49ec-83f4-334ba7315116 | dfp2500/DS2024 | ejercicio_grupo/windows/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.998793 | 6.76073 |
4a3315a6-2eef-45b0-9cb3-f6a2055ee449 | hankkkwu/SDCND-Model_Predictive_Control_Quizzes | polyfit/src/Eigen-3.3/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999705 | 3.908823 |
dabca571-f60d-45f1-a404-79a6242b12ed | Rimuroy112/STL_And_Competitive_Programming_Phase_0 | Vjudge1/UniqueNumberBitManipulation.cpp | #include<iostream>
using namespace std;
int unique(int arr[],int n)
{
int xorsum = 0;
for(int i=0; i<n; i++)
{
xorsum = xorsum ^ arr[i];
}
return xorsum;
}
int main()
{
int arr[] = {2,4,6,3,6,4,2};
cout<<unique(arr,7)<<endl;
return 0;
}
| ALGO | 0.999886 | 4.91106 |
8326e1fc-d253-48b3-bead-d30d43802601 | vedmandal/Binary-Tree | Deserialize.cpp | #include<iostream>
#include<vector>
#include<string>
#include <sstream>
using namespace std;
class node{
public:
int val;
node*left;
node*right;
node(int val){
this->val=val;
}
};
int idx=0;
node*construct_tree(vector<int>arr){
if(arr.size()==0 || arr[idx]==-1){
idx++;
... | ALGO | 0.999935 | 4.666435 |
fc991d80-f118-4eef-99e6-440c3344af70 | blockidchain/blockidcoin | src/collateral.cpp | #include <amount.h>
#include <util.h>
/**
* The number of blocks that both new and old MN collateral value will
* be accepted, for smoother transition.
*/
const unsigned int COLLATERAL_TRANSITION_BLOCKS = 100;
/**
* Determine the masternode collateral value based on block height
*/
CAmount CollateralRequired(int... | ALGO | 0.94703 | 7.322238 |
b9ec84ce-34c3-476c-9735-11068be8d7fa | corentinartaud/graphics | ThirdParty/FreeImage-3170/Source/OpenEXR/IlmImf/ImfLut.cpp | //-----------------------------------------------------------------------------
//
// Lookup tables for efficient application
// of half --> half functions to pixel data,
// and some commonly applied functions.
//
//-----------------------------------------------------------------------------
#include <ImfLut.h>
#incl... | TOOL | 0.988691 | 6.553575 |
61806c1d-0822-4361-8b77-8115350dd536 | nisheetkaran/LeetCode | Shortest Distance in a Binary Maze - GFG/shortest-distance-in-a-binary-maze.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int shortestPath(vector<vector<int>> &grid, pair<int, int> source,
pair<int, int> destination) {
... | ALGO | 0.999979 | 6.033786 |
df2f931a-3c8e-4a48-9a0e-87e6efed73cc | BilhaqAD07/AlgoritmaStrukturData | PRAKTIKUM ASD/Pertemuan 2/Latihan1.cpp | #include <iostream>
using namespace std;
void swap(int* x, int* y){
int temp = *x;
*x = *y;
*y = temp;
}
int main()
{
int a, b;
cin >> a >> b;
swap(&a,&b);
cout << a << endl << b;
return 0;
}
| ALGO | 0.999921 | 3.865028 |
87d32fb4-6f6a-45d7-a911-f8649c1813f2 | nshciei45/problem-solutions | Examples and Problems/Structures/ex10.cpp | #include <bits/stdc++.h>
using namespace std;
struct sterling
{
int pounds;
int shillings;
int pence;
};
int main()
{
sterling shel;
char ch='.';
double decip;
cout<<"Enter amounts(decimal): ";
cin>>decip;
shel.pounds=decip;
float ster=(decip-shel.pounds)*20;
shel.shillings=ster;
float pen=(ster-shel.shi... | ALGO | 0.922479 | 3.737318 |
8290f6fe-d76c-44c5-8487-3b9fc4ebfc2b | chaehni/AlgoLab | 2019/week4/buddy_selection/src/algorithm.cpp | #include <iostream>
#include <vector>
#include <algorithm>
// BGL includes
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/max_cardinality_matching.hpp>
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> graph;
typedef boost::graph_traits<graph>::edge_descriptor edge_desc;
typ... | ALGO | 0.999572 | 4.750857 |
9415fcf3-d355-4904-85e5-1ed43fce4e10 | baimanbk/algorithm-and-data-structure | lab_9/D.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct Node {
string val;
Node *next;
Node (string x) {
this->val = x;
this->next = NULL;
}
};
struct LL {
Node *head;
Node *cur;
int size;
LL () {
this->head = ... | ALGO | 0.999888 | 3.832288 |
2095b4c6-776d-45de-9c28-0b39e9609f24 | ishandutta2007/codeforces | kuribohg/normal/710/B.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN=300010;
int n,a[MAXN];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1);
printf("%d\n",a[(n+1)/2]);
return 0;
} | ALGO | 0.999944 | 3.702945 |
32a24152-1ae6-4d8e-886b-2b6858ddd36c | sshjj/note | leetcode/้ๅฝ/83.ๅ ้คๆๅบๅ่กจไธญ็้ๅคๅ
็ด .cpp | //็ปๅฎไธไธชๆๅบ้พ่กจ๏ผๅ ้คๆๆ้ๅค็ๅ
็ด ๏ผไฝฟๅพๆฏไธชๅ
็ด ๅชๅบ็ฐไธๆฌกใ
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(!head || !head->next)return head;
... | ALGO | 0.999931 | 5.204015 |
2fe7aac4-a4b3-40c2-986e-08b4a570379a | Ankitsharma991/DSA | Love_Babar_CheatSheet/Array/overlapping_intervals.cpp | class Solution {
public:
vector<vector<int>> overlappedInterval(vector<vector<int>>& intervals) {
// Code here
sort(intervals.begin(), intervals.end());
vector<vector<int>> ans;
int n=intervals.size();
for(int i=0;i<n;i++){
if(ans.empty() || ans.back()[1]<in... | ALGO | 0.999987 | 5.95827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.