uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
69f38b30-9c25-4755-92fa-202a9de42bf0 | Ayush242/codingninjas | Recursion 2/Replace Character Recursively.cpp | // Given an input string S and two characters c1 and c2, you need to replace every occurrence of character c1 with character c2 in the given string.
// Do this recursively.
// Input Format :
// Line 1 : Input String S
// Line 2 : Character c1 and c2 (separated by space)
// Output Format :
// Updated string
// Constrain... | ALGO | 0.999888 | 5.086335 |
b5ee67a0-c7d8-408a-bf8b-9e57aabc1850 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_13241_7.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> prime_division(int64_t n, int K) {
vector<int> ret;
for (int64_t i = 2; i * i <= n; i++) {
int cnt = 0;
while (n % i == 0) {
n /= i;
cnt++;
}
if (cnt % K) {
ret.push_back(i);
ret.push_back(cnt % K);
}
}
if (n >... | ALGO | 0.999911 | 4.059581 |
b2a43deb-d308-4377-b2b2-74be393fb02f | ss5ssmi/OJ | hdu/2073.cpp | #include<stdio.h>
#include<math.h>
double longc(int x,int y){
double sum;
int s,i;
s=x+y;
if(x==0&&y==0){
return 0;
}
sum=0;
for(i=1;i<=s;i++){
sum+=sqrt(i*i+i*i);
if(i!=1){
sum+=sqrt((i-1)*(i-1)+i*i);
}
}
sum+=1.0;
sum-=sqrt(2)*y;
return sum;
}
int main(){
int t,x1,y1,x2,y2;
scanf("%d",&t);
wh... | ALGO | 0.998793 | 3.43443 |
faba6ea8-4606-48ae-8dc7-ad2d86f1df66 | mohitpandey94/SPOJ-Solutions | spoj/ODWS/ODWS-14430811.cpp | #include <bits/stdc++.h>
#include <cstring>
#ifndef ONLINE_JUDGE
#define gc getchar
#else
#define gc getchar_unlocked
#endif
#define ll long long
#define nl() printf ("\n")
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pi(x) printf ("%d",x)
#define pl(x) printf ("%lld",x)
#define pc(x) printf ("%c... | ALGO | 0.999952 | 4.575089 |
d8277624-71bb-4c69-98a7-26f55e4f0063 | BhavyamSanghavi/AI-Cloud-Computing | SelectionSort.cpp | void selectionSort(vector<int> &arr) {
int n = arr.size();
for (int i = 0; i < n - 1; ++i) {
// Assume the current position holds
// the minimum element
int min_idx = i;
// Iterate through the unsorted portion
// to find the actual minimum
for (int j = i + 1; j... | ALGO | 0.999951 | 5.272509 |
9a9925eb-8327-461a-983d-ff368aaffbc4 | ibayashi-hikaru/allegro-legato | lammps/src/KSPACE/pppm_disp_tip4p.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing authors: Amalie Frischknecht and Ahmed Ismail (SNL)
Rolf Isele-Holder (Aachen University)
------------------------------------------------------------------------- */
#include "pppm_d... | ALGO | 0.989297 | 6.350523 |
4959cbb4-db33-4a93-8762-c17a6ce30292 | henry3446/henry3446.github.io | WBE3D/hw5/main.cpp | #include <stdio.h>
#include <stdlib.h> // for atof
#include <math.h>
void rose (double &posX,double &posY,double &x, double &y)
// K, t: call by value
// x, y: call by reference
{
int isReflectedX = 0;
int isReflectedY = 0;
if(posY > 70 || posY < -70){
y = y * -1;
if(posY > 0){
posY = 6... | ALGO | 0.995992 | 3.693679 |
6bfecc25-951d-43d2-9200-c869aade5fd6 | saumyap48/leetcode | 2215-finding-3-digit-even-numbers/2215-finding-3-digit-even-numbers.cpp | class Solution {
public:
vector<int> findEvenNumbers(vector<int>& digits) {
unordered_set<int>nums;
int n=digits.size();
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
for(int k=0; k<n; k++){
if(i==j || j==k || i==k ){
continue;
... | ALGO | 0.999855 | 5.8182 |
30bb5091-8414-443c-973f-4e9afe363839 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11073_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
if (n == 1 || n == 2) {
cout << -1;
return 0;
}
for (i = n; i >= 1; i--) cout << i << " ";
}
| ALGO | 0.999838 | 4.506571 |
a5e9db38-1912-4e34-a0fa-2b24fb029612 | alexandraback/datacollection | solutions_5662291475300352_0/C++/vishalkarve15/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define ll long long
int d[1010];
int h[1010];
int m[1010];
int main()
{
int t;
scanf("%d",&t);
for(int tt=1;tt<=t;tt++)
{
int n;
scanf("%d",&n);
for(int i=0;i<n... | ALGO | 0.999829 | 3.268267 |
1f97f126-a106-4784-b62c-8edeb4dc8815 | iSaaC2909/Deep-Learning-Library-in-cpp | src/utils/metrics.cpp | #include "metrics.h"
#include <algorithm> // For std::count
float Metrics::accuracy(const std::vector<int>& true_labels, const std::vector<int>& predicted_labels) {
int correct = 0;
for (size_t i = 0; i < true_labels.size(); ++i) {
if (true_labels[i] == predicted_labels[i]) {
++correct;
... | ALGO | 0.94274 | 6.871644 |
19a34d80-be77-4f55-9429-5753111ee538 | Parthib13/Outsbook | Outsbook - Professor's homework.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int ans = (n*(n+1))/2;
cout<<ans;
}
| ALGO | 0.999019 | 4.78451 |
fab2576e-f608-443b-9d5b-c04059b701f5 | CarlosLoeza/Intro_To_AI_Spring_2021 | Project1_Search_Algorithms/Problem.cpp | //
// Problem.cpp
// Project1_Search_Algorithms
//
//
#include "Problem.hpp"
#include <iostream>
using namespace std;
// Checks to see if our zero index can move up
vector<int> Problem::move_up(vector<int> init, int zero_index){
// checks to make sure we can move our zero up
int top_spot_index = zero_index-3... | ALGO | 0.999925 | 5.085421 |
b457dca1-4b3e-4c5c-9151-3ac682dbd415 | KostyaTymko/Priority_queue | ProirityQueue/ProirityQueue/List.cpp | #include "List.h"
using namespace std;
List::List()
{
Head = Tail = nullptr;
length = 0;
}
void List::AddHead(int n,int p)
{
Elem * temp = new Elem();
temp->prev = nullptr;
temp->data = n;
temp->priority = p;
temp->next = Head;
//
if (Head != nullptr) Head->prev = temp;
//
if (length == 0) Head... | ALGO | 0.992016 | 4.039441 |
040b4c1b-382f-4fe5-9a46-7e4f887ffab8 | StefanShivarov/introduction-to-programming-fmi-2024-25 | Week 02/Pract. 02/Task01.cpp | #include <iostream>
using namespace std;
int main() {
int n, sum = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
sum += k;
}
cout << sum << endl;
return 0;
}
| ALGO | 0.997237 | 4.284322 |
c01d1cfd-d1ea-4a74-be5c-5692db673f3c | vochi/core-intern-test | effect_sandbox/3rd/opencv/samples/cpp/tutorial_code/features2D/Homography/pose_from_homography.cpp | #include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
namespace
{
enum Pattern { CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
void calcChessboardCorners(Size boardSize, float square... | ALGO | 0.99856 | 6.123724 |
23ba0ac6-5054-4722-bd55-362fd554dddb | Chicaogo/WinCode | 刷题/洛谷刷题/暴力出奇迹/P1958 上学路线_NOI导刊2009普及(6).cpp | #include<bits/stdc++.h>
inline int read()
{
int x = 0,t = 1; char ch = getchar();
while(ch < '0' || ch > '9'){if(ch == '-') t = -1; ch = getchar();}
while(ch >= '0' && ch <= '9'){x = x*10+ch-'0'; ch = getchar();}
return x*t;
}
void dfs(int x,int y);
int map[20][20];
int a,b,n,ans;
inline void init()
{
a = read... | ALGO | 0.99984 | 3.678416 |
7c3c4906-f61f-4700-b3f5-d1b41b4eed04 | BWbwchen/Coding_Practice | 2019_spring/9328-Queueing_I.cpp | #define DEBUG
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
#ifdef DEBUG
freopen ("in.in", "r", stdin);
#endif
string cmd, k;
queue<string > q;
while (cin >> cmd) {
if (cmd == "Push") {
cin >> k;
q.push(k);
}
... | ALGO | 0.996804 | 4.230946 |
7812919d-b24c-44d0-a93e-43cd38d6e9be | zhibekkazbek/pp1-22B030546 | informatics/lab3/C.cpp | /*Дан массив, состоящий из целых чисел. Напишите программу,
которая подсчитывает количество положительных чисел среди элементов массива.*/
#include <iostream>
using namespace std;
int main(){
int n, cnt=0; cin >> n;
long long arr[n];
for(int i=0; i<n; i++){
cin >> arr[i];
if(arr[i]>0){
... | ALGO | 0.999954 | 4.290966 |
fe96ea7d-ceb3-4988-94af-e2c362c253e2 | coin-or/Cbc | examples/interrupt.cpp | #include <cassert>
#include <iomanip>
#include "CoinPragma.hpp"
#include "CbcModel.hpp"
#include "OsiClpSolverInterface.hpp"
#include "CbcSolver.hpp"
#include "CoinTime.hpp"
//#############################################################################
/*************************************************************... | ALGO | 0.996417 | 5.959997 |
1597c642-d431-440d-872c-2ae21498e034 | guifalci/bitcoinzero | src/protocol.cpp | #include "protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#ifndef WIN32
# include <arpa/inet.h>
#endif
namespace NetMsgType {
const char *VERSION = "version";
const char *VERACK = "verack";
const char *ADDR = "addr";
const char *INV = "inv";
const char *GETDATA = "getdata";
cons... | TOOL | 0.863799 | 6.09633 |
b5c2912d-c03e-433f-8110-42bb29dd8e5c | Robin329/CPlusPlusThings | C-Plus-Plus/data_structures/circular_queue_using_linked_list.cpp | #include <iostream>
struct node {
int data;
struct node* next;
};
class Queue {
node* front = nullptr;
node* rear = nullptr;
public:
Queue() = default;
void createNode(int val) {
auto* nn = new node;
nn->data = val;
nn->next = nullptr;
front = nn;
rear ... | ALGO | 0.999066 | 5.005837 |
557fb768-2b1d-48bd-94fd-0552753411e1 | npjtwy/CppPrimerEx | 第五章/第五章/5_14.cpp | #include "iostream"
#include <string>
using namespace std;
//ͳĵʳֵߴ
void main()
{
string str, max_str;
string perstr = "\0";
int cnt = 0, max_num = 0;
while (cin >> str)
{
if ( str == perstr)
{
++cnt;
if (cnt > max_num)
{
max_num = cnt;
max_str = str;
}
}
else
{
cnt = 0;
}
pe... | ALGO | 0.997846 | 3.675089 |
4e63e711-99bc-4ede-b8d2-cbc8264f21e2 | Aka2210/Leetcode | 33. Search in Rotated Sorted Array/LeetCode33Ex.cpp | #include<iostream>
#include<vector>
#include<unordered_set>
#include <algorithm>
#include <math.h>
using namespace std;
class Solution {
public:
int search(vector<int>& nums, int target) {
int low = 0;
int high = nums.size() - 1;
while (low <= high) {
int mid = low + (... | ALGO | 0.99993 | 5.063244 |
9344af73-3114-4866-b4bb-26fc9e7144f0 | tanprodium/23521407_BTTH2 | baitap_7/Polygon.cpp | #include "Polygon.h"
Polygon::Polygon() : n(0), x(nullptr), y(nullptr) {}
Polygon::~Polygon() {
delete[] x;
delete[] y;
}
void Polygon::Nhap() {
do {
cout << "Nhap so dinh cua da giac (n > 2): ";
cin >> n;
} while (n <= 2); // Số đỉnh phải lớn hơn 2
x = new float[n]; // Khởi tạo ... | TOOL | 0.890536 | 5.139641 |
11ca4b0b-9090-4fd9-a71d-5716570dce7f | kv-vamc/Data-Structures-Algortihms | Trees/Binary Tree Postorder Traversal.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.999892 | 5.952102 |
00ed4b2c-f03c-4ba7-862f-6a297e6425a7 | GuyWithXM5/veritas_hackndroid | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
00b0f7ef-06d4-42f9-8239-499b7ec8804b | PandaBoi/Coursera_UCSD_DSA_Specialization | Course2_2003291203/week1_basic_data_structures/3_network_simulation/process_packages.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
struct Request {
Request(int arrival_time, int process_time):
arrival_time(arrival_time),
process_time(process_time)
{}
int arrival_time;
int process_time;
};
struct Response {
Response(bool dropped, int s... | ALGO | 0.999731 | 4.743963 |
da6be310-23d7-4613-ba49-67f4d18dc349 | zhxxcdlj/HCut_AOHierarchy_Quality | main.cpp | #include "tree4cn.h"
template <typename TreeType>
void processTreeType(string &imgPath, TreeType &tree, ofstream &QFile, const string &basePath, int omega, double *bandweights) {
// Process the tree and write the results
for (int j = 1; j <= 3; ++j) {
Mat gt = imread(basePath + "GT" + to_string(j) + ".... | DATA | 0.946038 | 4.722153 |
b062fa29-643e-4a7e-9d34-4911cc2827eb | vinamrajain19/Leetcode_Submissions | 1011-capacity-to-ship-packages-within-d-days/1011-capacity-to-ship-packages-within-d-days.cpp | class Solution {
public:
bool f(vector<int> &w,int days,int val){
int c = 0;
int ans = 1;
int i = 0;
while(i<w.size()){
if(w[i] > val) return false;
if(c + w[i] <= val){
c += w[i];
}
else{
ans++;
... | ALGO | 0.999996 | 5.451583 |
b0a558fc-91bc-4f2f-9857-c6b18233bc36 | tttak/tnk- | source/shogi.cpp | #include <sstream>
#include <iostream>
#include "shogi.h"
#include "position.h"
#include "search.h"
#include "thread.h"
#include "tt.h"
// ----------------------------------------
// const
// ----------------------------------------
const char* USI_PIECE = ". P L N S B R G K +P+L+N+S+B+R+G+.p l n s b r g k +p+l+n... | ALGO | 0.984698 | 4.879001 |
cc045686-7fae-4465-97cd-d374516de800 | iit2024/cg | line clipping.cpp | //line clipping
#include<iostream.h>
#include<stdlib.h>
#include<math.h>
#include<graphics.h>
#include<dos.h>
typedef struct coordinate
{
int x;
int y;
char code[4];
}PT;
void drawwindow();
void drawline(PT p1,PT p2,int cl);
void check_line (PT p1,PT p2);
PT setcode(PT p);
int visibility (PT p1,PT p2);
PT resetendp... | ALGO | 0.999665 | 3.794847 |
8a54ddb6-4c9d-4c77-b6e6-52c1da2c0236 | HoangVietAnh09/DSA | contest8/b6.cpp | #include <bits/stdc++.h>
using namespace std;
int a[1001][1001], c[1001][1001], n, m;
void solve(){
int x, f, s;
memset(c, -1, sizeof(c));
queue<pair<int, int>> qp;
qp.push({1, 1});
c[1][1] = 0;
while(!qp.empty()){
pair<int, int> p = qp.front();
f = p.first, s = p.second;
... | ALGO | 0.999972 | 4.188415 |
219d61e8-ce62-444f-be06-ee123ffa7816 | PrasadThorve/DSA | Practice HackerRank/linkedListTraversal.cpp | #include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList {
public:
S... | ALGO | 0.999739 | 5.413627 |
2f61a883-d7d1-47f7-b03f-4dff706749f2 | skrewbar/PS | Baekjoon/platinum/13012.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define ASSERT(x) assert(x)
#else
#define ASSERT(ignore) ((void)0)
#endif
using namespace std;
vector<int> getSuffixArray(const string& s) {
int n = s.size();
vector<int> sa(n), nsa(n), rank(n), nrank(n), cnt(n);
for (int i = 0; i < n; i++)
sa[i] = i;... | ALGO | 0.99994 | 4.516503 |
2a022ee7-27b7-4027-aba7-f348c72b95e5 | Kevin-Silva/Cpp-Estudos | Magic Number/main.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int magic;
int guess;
magic = rand();
cout << "Enter your guess: ";
cin >> guess;
if (guess == magic) cout << "** Right **";
else cout << "... Sorry you'r wrong ..." << "The Right number was: " << magic;
return 0;
} | TOOL | 0.96718 | 3.405832 |
16eb2144-632e-49c6-998d-1d038a1c6b9c | AndySomogyi/chombo | versions/3.1/releasedExamples/AMRGodunov/srcPolytropic/PolytropicPhysics.cpp | #ifdef CH_LANG_CC
#endif
#include "LoHiSide.H"
#include "PolytropicPhysics.H"
#include "PolytropicPhysicsF_F.H"
#include "LGintegrator.H"
#include "NamespaceHeader.H"
PolytropicPhysics::PolytropicPhysics(const Real& a_smallPressure)
:
GodunovPhysics()
{
m_smallPressure = a_smallPressure;
}
PolytropicPhysic... | ALGO | 0.970711 | 6.750134 |
9c5ec57e-b771-42da-8918-fb3562dc78c6 | Rainboylvx/pcs | poj/2889/2.cpp | #include<map>
#include<vector>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const long long mod=1e9+7;
typedef long long ll;
const int maxn=130;
int real_map[maxn][maxn];
int ans=0;
int flag=0;
int some[maxn][maxn];
int all[maxn][maxn];
int none[maxn][maxn];
void BronK... | ALGO | 0.999965 | 4.260602 |
4c52456c-67df-4da8-aea0-4784ef84d314 | codewithaman07/My-questions | 905-length-of-longest-fibonacci-subsequence/length-of-longest-fibonacci-subsequence.cpp | class Solution {
public:
int lenLongestFibSubseq(vector<int>& arr) {
int n = arr.size(), ans = 0;
vector<vector<int>>dp(n, vector<int>(n,0));
unordered_map<int,int>mp;
for(int i = 0; i<n; i++){
int num = arr[i];
mp[num] = i;
for(int prev = 0; prev<... | ALGO | 0.999873 | 5.460329 |
c53594c1-93d6-46f7-b842-51edb589cf18 | LHS-11/Algorithm | 프로그래머스/level1/시저 암호 (char형 사칙연산 조심).cpp | #include <string>
#include <vector>
using namespace std;
string solution(string s, int n) {
string answer = "";
// 아스키코드 값을 조작할 때, char 형에 연산을 하지말고
// int 형에다가 계산을 하고 string 에 더할 때 (char) 로 형변환 해서 진행
int x;
for (auto c : s) {
if (c >= 'A' && c <= 'Z') {
x = c + n;
... | ALGO | 0.999879 | 6.047309 |
3d31dfdd-1433-4fd6-be15-033bec2e24b2 | zheng327/my_leetcode | P105/main.cpp | /*
* 105. ǰй
* preorder inorder preorder Ƕ inorder ͬһ빹ڵ㡣
*
* ʾ 1:
* : preorder = [3,9,20,15,7], inorder = [9,3,15,20,7]
* : [3,9,20,null,null,15,7]
*
* ʾ 2:
* : preorder = [-1], inorder = [-1]
* : [-1]
*/
#include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNo... | ALGO | 0.999974 | 6.036959 |
47066ebf-b799-46aa-815b-135ebf5bc4d3 | annu3902/Leetcode_Problems | 1940-maximum-xor-for-each-query/maximum-xor-for-each-query.cpp | class Solution
{
public:
std::vector<int> getMaximumXor(std::vector<int> &nums, int maximumBit)
{
std::vector<int> result(nums.size(),0);
int mask = 0;
for(int i = 0 ; i <maximumBit ; i++)
{
mask<<=1;
mask++;
}
if(result.size() < 2)
... | ALGO | 0.999962 | 5.171346 |
009030b7-919a-4612-8efb-58c2a64ca661 | MehrajShakil/Dynamic-Programming- | Complete Dynamic Programming Practice - Noob to Expert | Topic Stream 1 | Colin Galen/M. Journey.cpp | /// BISMILLAHIR RAHMANIR RAHEEM
/// ALLAH IS WATCHING ME
/// Every soul shall taste death.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
/// order_of_key return number of elements less than x.
/// find_... | ALGO | 0.999985 | 4.007535 |
06673088-afd3-4182-9b9c-db67eabfa287 | ishandutta2007/codeforces | hitman623/normal/340/A.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<int,pii>
#define all(a) (a).begin(),(a).end()
#define x first
#define y ... | ALGO | 0.999893 | 4.205001 |
5fb91fab-c8ec-4815-9e6a-924f7fb0166f | PritamMagdum/Daily-DSA-Practice | Medium Problems/2938. Separate Black and White Balls.cpp | class Solution {
public:
long long minimumSteps(string s) {
long long swap = 0;
int n = s.length();
int black = 0;
for(int i = 0;i<n;i++){
if(s[i]=='0'){
swap += black;
}else{
black += 1;
}
}
return s... | ALGO | 0.999918 | 6.077573 |
66d53d9f-fda2-4589-b839-4a1dbc21b8a7 | hermanumrao/text_completion_NLP | 01sentence_completion_NPL/main.cpp | #include <cctype>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <map>
#include <random>
#include <sstream>
#include <string>
#include <vector>
namespace fs = std::filesystem;
std::string file_reader(std::string folderPath) {
// reading all the content from all the files
std::string combin... | TOOL | 0.92631 | 6.316214 |
608c134d-70f8-4d90-80e6-1cbd8a34595b | HITS-MCM/gromacs-ramd | src/gromacs/modularsimulator/andersentemperaturecoupling.cpp | /*! \internal \file
* \brief Defines Andersen temperature coupling for the modular simulator
*
* \author Pascal Merz <<EMAIL>>
* \ingroup module_modularsimulator
*/
#include "gmxpre.h"
#include "andersentemperaturecoupling.h"
#include <vector>
#include "gromacs/domdec/domdec_struct.h"
#include "gromacs/math/fu... | ALGO | 0.98966 | 6.501521 |
5e8a0768-e595-4ef8-afa7-ba4464d9235a | hoaghiepp/SPOJ_PTIT | PTIT125C.cpp | #include <bits/stdc++.h>
using namespace std;
struct Data
{
int close, open;
Data(int c, int o)
{
close = c;
open = o;
}
Data()
{
close = 0;
open = 0;
}
};
int n, k, a, b;
Data arr[1000006];
vector<int> res;
void init()
{
cin >> n >> k;
for (int i ... | ALGO | 0.999967 | 4.22407 |
9dd92eec-f39c-4c26-a647-4657568828d2 | Marina-Ananyeva/Cpp_Primer_Lippman_Solutions | Chapter 1/Items1.cpp | #include <iostream>
#include "Sales_item.h"
int main()
{
Sales_item item1, item2;
std::cin >> item1 >> item2;
std::cout << item1 + item2 << std::endl;
return 0;
}
| TOOL | 0.946028 | 4.556389 |
13b712b9-6ad4-4d4b-857a-011a24b13154 | gaoxam123/CP | DP_Greedy/leetcode/1743.cpp | // https://leetcode.com/problems/paint-house-iii/description/
#include <bits/stdc++.h>
using namespace std;
int m, n, target, a[105], cost[105][25], dp[105][25][105], ans = 1e9;
int main() {
cin >> m >> n >> target;
for(int i = 1; i <= m; i ++) {
cin >> a[i];
}
for(int i = 1; i <= m; i ++) {... | ALGO | 0.99995 | 4.385064 |
2eac1692-700d-4d4f-9c24-060562e224ca | AbdurRoufCSE/URI-Online-Judge-Solutions | 1199.cpp | #include<bits/stdc++.h>
using namespace std;
string x="FEDCBA";
int main()
{
string str;
while(cin>>str)
{
if(str[0]=='-')break;
if(str[1]=='x')
{
int si=str.length()-2-1;
int g;
long long dec=0;
for(int i=2;i<str.length();i++)
... | ALGO | 0.989498 | 3.609324 |
0dee7a1a-64d2-4b67-92c0-24a16f894524 | SChakraborty04/ParallelMergeSortProject | src/app/main.cpp | #include<iostream>
#include"sorting/mergeSort.hpp"
#include"sorting/parallelMergeSort.hpp"
#include<vector>
#include<chrono>
int main(int argc,char *argv[]){
const int size=10000000;
std::vector<int>nums(size);
std::vector<int>parallelNums(size);
for(int i=0;i<size;i++){
nums[i] = rand()%size;
... | ALGO | 0.999584 | 5.154311 |
ae064152-3b1d-41ba-ae3f-7f2e9d2e25b8 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11629_13.cpp | #include <bits/stdc++.h>
using namespace std;
bool s1;
char o;
int Read() {
bool f = 1;
while (!isdigit(o = getchar()))
if (o == '-') f = 0;
int res = o ^ 48;
while (isdigit(o = getchar())) res = (res << 3) + (res << 1) + (o ^ 48);
return f ? res : -res;
}
int n, m, dp[100006], sum[100006], sz[100006], Q[... | ALGO | 0.999894 | 4.654139 |
df75b536-1e2e-4715-b372-702d3a57370c | msalahuddin267/XPSC | Week 06/Day 2/Parking Charges.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, y, h;
cin >> x >> y >> h;
cout << x + (h-1)*y << endl;
}
| ALGO | 0.996491 | 3.479034 |
58a76b09-fcac-4ccd-be44-2f2377e00405 | liddiard/cs32 | practice/recursion/factorial.cpp | #include <iostream>
using namespace std;
int factorial(int n)
{
if (n == 1)
return 1;
else return n * factorial(n-1);
}
int main()
{
cout << factorial(5);
}
| ALGO | 0.999626 | 4.34669 |
2af0077f-8580-42a5-b4e9-e3eb36bee49d | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p02682/p02682_num9_parsed.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, k;
cin >> a >> b >> c >> k;
if(k <= a) {
cout << k << endl;
} else {
cout << a - (k - (a + b)) << endl;
}
return 0;
}
| ALGO | 0.999577 | 3.071532 |
3d66f335-ee1c-4400-962e-ef82d2b5d038 | anuragpratap05/DSA | Map and heap/revision2/class2/215_Kth_Largest_Element_in_an_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int findKthLargest(vector<int> &nums, int k)
{
priority_queue<int, vector<int>, greater<int>> pq;
for (int i = 0; i < k; i++)
{
pq.push(nums[i]);
}
for (int i = k; i < nums.size(); i++)
{
int probabale3rdLargestEle = pq.top();
... | ALGO | 0.999975 | 4.748376 |
ed4c365e-b1de-4706-acc2-c8fbcc5a0c7f | RobotMa/axxb_calibration | matlab/new_mean/codegen/lib/mean_double_convl_2nd/mrdivide.cpp | // Include Files
#include "rt_nonfinite.h"
#include "mean_double_convl_2nd.h"
#include "mrdivide.h"
#include <stdio.h>
// Function Definitions
//
// Arguments : double A[16]
// const double B[16]
// Return Type : void
//
void b_mrdivide(double A[16], const double B[16])
{
double b_A[16];
int in... | ALGO | 0.999871 | 3.598125 |
a2b2f3a5-14c9-40d0-8c8d-6cddae88bc0a | ansh04196/ReviseWithArsh-6Companies30Days-Challenge | Goldman Sachs/05-flip-matrix.cpp | class Solution {
public:
map<vector<int>,int>mp;
int m,n;
Solution(int m, int n)
{
this->m=m;
this->n=n;
}
vector<int> flip()
{
int m1=rand()%m;
int n1=rand()%n;
while(mp[{m1,n1}]!=0)
{
m1=rand()%m;
n1=rand()%... | ALGO | 0.999493 | 3.159625 |
a1fa0b41-2a95-4350-bb6d-99fab824cb09 | ianlw/2023-II | Algoritmos_Paralelos_y_Distribuidos/lab1/ejercicio08.cpp | #include <atomic>
#include <thread>
#include <iostream>
#include <mutex>
using namespace std;
std::atomic<int> counter(0); // contador atmico
int counter3 = 0; // para demostrar el incremento seguro de un contador compartido
mutex mu;
void safe_increment_atomic() {
// usa un contador atmico
for (int j = 0;... | TOOL | 0.975907 | 5.4936 |
8658f9e7-c63c-48a4-8863-8efb127e1ad2 | Leafuke/MineBackup | MineBackup/basic_func.cpp | #include <string>
#include <map>
#include <filesystem>
#include <fstream>
#include <Windows.h>
using namespace std;
// עѯ
string GetRegistryValue(const string& keyPath, const string& valueName)
{
HKEY hKey;
string valueData;
if (RegOpenKeyExA(HKEY_CURRENT_USER, keyPath.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)... | TOOL | 0.902639 | 4.337156 |
072fa816-fadd-489f-b066-7f47f0e22e66 | saumya1singh/DSAImportantQuestionScratch | Amazon_Interview_Questions/Easy/Binary_Tree_Tilt.cpp | /*
Problem Link: https://leetcode.com/problems/binary-tree-tilt/
*/
/**
* 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... | ALGO | 0.999986 | 6.939861 |
b772c459-9ac7-4fb1-b8f0-0193eaf2e1c9 | kmjp/procon | yuki/1001-2000/1501-1600/1520.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999886 | 4.686937 |
1842f4dc-647a-4bb2-b9a6-7f5483770f8a | seo-rii/ps.old | baekjoon/12865/12865_1.cpp | //2020 SEORII®. All right reserved.
//Code created on 2020-11-16
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, k, an = 1;
cin >> n >> k;
vector<int> w(n), v(n), li(k + 1);
li[0] = 1;
for (int i = 0; i < n; ++i) cin >> w[i]... | ALGO | 0.999991 | 3.672481 |
1c4a00e0-886e-479b-8cc8-5693cd1806ab | boogahead/codecodecode | solved/13418.cpp | #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <tuple>
using namespace std;
typedef tuple<int, int, int>info; // cost from to
vector<int>ranked, parent;
vector<info>routes;
int ans = 0;
int find(int a)
{
if (parent[a] == a)return a;
return parent[a] = find(par... | ALGO | 0.999773 | 3.750167 |
a27a0827-a617-43ec-9116-2349aff119d7 | arthur-bouton/PathPlanning3D | third_party/libigl/libigl/include/igl/sortrows.cpp | #include "SortableRow.h"
#include "sort.h"
#include "colon.h"
#include "IndexComparison.h"
#include <vector>
// Obsolete slower version converst to vector
//template <typename DerivedX, typename DerivedIX>
//IGL_INLINE void igl::sortrows(
// const Eigen::DenseBase<DerivedX>& X,
// const bool ascending,
// Eigen::P... | ALGO | 0.993818 | 6.803739 |
394abe88-08b6-4b92-bbac-0b2e8888ac2d | sarvex/leetcode-ksh | lcof2/剑指 Offer II 046. 二叉树的右侧视图/Solution.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.999891 | 6.409476 |
98e9edb0-b44e-417b-8cb1-9b18f5b55937 | HarshK213/dsa | 15_Recursion/AllSubset.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void PS(vector<int> &arr, vector<int> &ans, int i){
if(i == arr.size()){
cout << "[ ";
for(int i : ans) cout << i << " ";
cout << "]";
cout << endl;
return ;
}
ans.push_back(arr[i]);
... | ALGO | 0.998941 | 5.148194 |
4bd19d2e-eb9d-4062-ac43-5f1110576bea | joririarte/UBP | RIC/AED/Practicos/Practico 4/TP-listasEnlazadas/main.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data) {
this->data = data;
this->next = nullptr;
}
};
class LinkedList {
public:
Node* head;
LinkedList() {
this->head = nullptr;
}
void addNode ( int data) {
... | ALGO | 0.988199 | 4.29529 |
d4550c7a-79bb-400f-9860-2182adda41e9 | wuillou8/SuperRepository | Simulations/Finance/ToyPricer/EIGEN/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.999702 | 5.283265 |
ca7c745b-3b58-4153-a517-10350acf17ca | raincross7/code-similarity | codes/train_code/problem306/problem306_427.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
a.push_back(1e10);
int l;
cin >> l;
vector<vector<int>> table(n, vector<int>(20)... | ALGO | 0.999947 | 3.996543 |
a512e776-aca2-49b1-a7ce-7b2d54c0a184 | liangkang233/leetcode-cpp | 206.反转链表.cpp | /*
* @lc app=leetcode.cn id=206 lang=cpp
*
* [206] 反转链表
*/
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
// @lc code=st... | ALGO | 0.999858 | 5.714554 |
89931d66-d129-41e8-833e-911906d8df01 | PixelAmp/AssortedCplus | Euler/3 Largest prime factor.cpp | //The prime factors of 13195 are 5, 7, 13 and 29.
//What is the largest prime factor of the number 600851475143 ?
#include <iostream>
using namespace std;
bool isPrime(unsigned long long num)
{
cout << "checking prime" << endl;
unsigned long long div = 2;
while (div < (num/2))
{
if (!(num%div... | ALGO | 0.999926 | 4.769101 |
a37ce6b9-8cd2-42ce-84f4-e4f0d3246dc7 | MOHIT914908/leetcode | 2130-maximum-twin-sum-of-a-linked-list/2130-maximum-twin-sum-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
int pairSum(ListNode*... | ALGO | 0.999991 | 5.643557 |
5d129813-d33b-414b-ac24-bebb31bcf259 | FarizalSE/TPM_Tugas1 | 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.998756 | 6.772262 |
1a4cd1d8-72f1-4b2c-b3be-f982b6e1cf52 | Veljko28/cpp-data-algrtms | codeforces/147/Polygon.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <queue>
#include... | ALGO | 0.99949 | 4.797027 |
fd3d6817-62bd-4d16-92c3-e74d980894ac | ginkage/aoc2024 | 24/24b.cpp | #include "../lib.hpp"
typedef function<int(int, int)> fun_t;
enum op_t {
op_and,
op_or,
op_xor
};
static map<string, op_t> name_op = {
{ "AND", op_and },
{ "OR", op_or },
{ "XOR", op_xor }
};
static map<op_t, fun_t> op_fun = {
{ op_and, [](int a, int b) { return a & b; } },
{ op_or, ... | ALGO | 0.999581 | 4.843803 |
5c3370ea-feff-46b9-bff9-ea7d49aff6f3 | elenaisnanocat/codetree-TILs | 240625/가운데에서 시작하여 빙빙 돌기/snail-start-from-center.cpp | #include <iostream>
#define MAX_N 100
#define DIR_NUM 4
using namespace std;
int dr[DIR_NUM] = {0, -1, 0, 1};
int dc[DIR_NUM] = {-1, 0, 1, 0};
int n, r, c, dir;
int arr[MAX_N][MAX_N];
bool InRange(int r, int c) {
return 0 <= r && r < n && 0 <= c && c < n;
}
int main() {
cin >> n;
int nr = n - 1;... | ALGO | 0.999968 | 3.568605 |
5c3b3b78-0f0d-4141-a376-c3b96631e8c6 | Team-PyRated/PyRated | Final/Dataset/B2016_Z2_Z3/student8599.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <iomanip>
#include <cmath>
int SumaDjelilaca(long long n)
{
int suma(0);
for(int i=1; i<=fabs(n); i++) {
if(n%i==0)
suma+=i;
}
return suma;
}
int BrojProstihFaktora(long long int n)
{
int broj(0);
for(int i=2; i<=fabs(n); i+... | ALGO | 0.999254 | 3.914397 |
ad408ace-753a-409b-b8d0-52595ba51757 | AnkerLeng/Cpp-0-1-Resource | 第5阶段-C++提高编程资料/提高编程能力资料/代码/第三阶段-录制代码/01 set容器/01 set容器/08 set容器_排序(自定义类型).cpp | #include<iostream>
using namespace std;
#include <string>
#include <set>
//setԶ
class Person
{
public:
Person(string name, int age)
{
this->m_Name = name;
this->m_Age = age;
}
string m_Name;
int m_Age;
};
class comparePerson
{
public:
bool operator()(const Person&p1 , const Person&p2)
{
//
return p1... | TOOL | 0.983332 | 4.06443 |
87eb99da-b55e-4991-8954-7ef1dda5e67c | wjhyyds/miniob2 | deps/common/lang/mutex.cpp | //
// Created by Longda on 2010
//
#include "common/lang/mutex.h"
#include "common/log/log.h"
namespace common {
std::map<pthread_mutex_t *, LockTrace::LockID> LockTrace::mLocks;
std::map<pthread_mutex_t *, int> LockTrace::mWaitTimes;
std::map<long long, pthread_mutex_t *> LockTrace::mWaitLocks;
std::map<long long, s... | TOOL | 0.857151 | 5.51897 |
c8efa1d1-2df1-43e2-918b-c290c162798e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6154_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
const int maxm = maxn * 20;
long long st[maxm], siz[maxm], sum[maxm];
int n;
int fa[maxn << 1], maxr[maxn << 1], minl[maxn << 1], A[maxn], B[maxn];
int now;
int L[maxm], R[maxm], RT[maxn];
long long ans;
void build(int &x, int l, int r, int px) {
... | ALGO | 0.999952 | 3.61043 |
c5ae93aa-f671-433c-b5db-e97328e923a6 | ishandutta2007/codeforces | q-w-q-w-q/normal/889/E.cpp | #include <cstdio>
#include <iostream>
#include <queue>
using namespace std;
typedef long long i64;
int n;
priority_queue<pair<i64, i64>> q;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
i64 t;
cin >> t;
q.push(make_pair(t - 1, 0));
for (int i = 1; i != n; i++) {
cin >> t;... | ALGO | 0.999929 | 3.392515 |
caee2d69-2a3c-4710-8dc5-819a58d5909f | judmorenomo/Competitive-Programming | CF/cf103b.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int xa, ya, xb, yb;
cin >> xa >> ya >> xb >> yb;
if(xa > xb)swap(xa, xb);
if(ya > yb)swap(ya, yb);
int n;
cin >> n;
vector<pair<pair<int, int >, int > > rad;
for(int i = 0; i < n; i++){
int x, y, r;
cin >> x >> ... | ALGO | 0.99985 | 3.775586 |
0474197d-90e3-4413-839f-26db00e05184 | Laxmikant3/Dsa_cpp | 15. Tree/2. Centroid_of_Tree.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> Centroid(vector<ll> g[], ll n)
{
vector<ll> centroid;
vector<ll> sz(n);
function<void(ll, ll)> dfs = [&](ll u, ll prev)
{
sz[u] = 1;
bool is_centroid = true;
for (auto v : g[u])
if (v != pre... | ALGO | 0.99995 | 4.868508 |
3f8e1278-a4d7-4506-95fc-ebef421a89f2 | ishandutta2007/codeforces | zlobober/normal/375/A.cpp | #include <cstdio>
#include <memory.h>
#include <algorithm>
#include <cstring>
#include <cassert>
using namespace std;
const int N = 1000500;
char buf[N];
char dig[] = "1689";
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int main()
{
gets(buf);
bool was[10];
int n = strlen(buf);
int pt = n - 1;... | ALGO | 0.999905 | 3.543193 |
569d3c2f-2e70-4183-a389-9fc05177043a | Lucii-666/LeetCode | Problem_80.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int j = 0;
for (int num : nums) {
if (j < 2 || num != nums[j - 2]) {
nums[j++] = num;
}
}
return j;
}
};
| ALGO | 0.999922 | 6.689183 |
df1d8b27-132a-4757-805e-fdcbd4eab2c4 | eKorayem/Problem-Solving | mostafa_saad_sheet/Team.cpp | // link: https://codeforces.com/contest/231/problem/A
#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
int sol = 0;
for(int i=0;i!=n; ++i){
int count = 0;
for(int j=0; j!=3; j++){
int t; cin >> t;
count += t;
}
if(count>=2) sol+... | ALGO | 0.999709 | 3.896508 |
fe23a112-a9a7-47d1-b8f9-9a6b09c6c9b1 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/11/1107/personal_submission/cf1254a_reoden.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int T;
std::cin >> T;
while (T--) {
int r, c, k;
std::cin >> r >> c >> k;
std::vector<std::string> grid(r);
for (auto &s : grid) std::cin >> s;
auto gao = [&](int i... | ALGO | 0.999469 | 4.984258 |
505ec947-58eb-40ac-8f9c-8f1a58d7184a | ZipS1/Cpp-BST | BinarySearchTree/BinarySearchTree.cpp | #include "BinarySearchTree.h"
bool BinarySearchTree::insert(int value)
{
SearchResult result = findEmptyPlaceFrom(root, Side::Root, value);
if (result.parent == nullptr && result.side != Side::Root)
return false;
switch (result.side)
{
case Side::Left:
result.parent->left = new Node(result.parent, value);
... | ALGO | 0.999532 | 5.142153 |
ed849688-3d5a-4ad9-a895-d456a521e571 | ArefinAlter/ProblemSolving | atcoder/arc109/B.cpp | #include<bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n; cin >> n;
++n;
n *= 2;
long long p = sqrtl(n * 1.0);
while (p * (p + 1) <= n) ++p;
while (p * (p + 1) > n) --p;
cout << n / 2 - p << '\n';
return 0;
} | ALGO | 0.999819 | 4.172615 |
b9473e5f-90ed-4583-9289-af46a4a25e48 | greg7mdp/primer | 10/use-istream-iter.cpp | #include <algorithm>
using std::copy;
#include <iterator>
using std::istream_iterator; using std::ostream_iterator;
#include <vector>
using std::vector;
#include <iostream>
using std::cin; using std::cout; using std::endl;
int main() {
vector<int> vec;
istream_iterator<int> in_iter(cin); // read ints from cin
i... | TOOL | 0.862124 | 5.256057 |
ad8209d3-c04f-4dfb-bfb8-9df518703816 | PinkArmor/C-PTIT | xau pangram de.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin,s);
set<char> se;
for(int i=0; i< s.size(); i++){
se.insert(s[i]);
}
if(se.size()==26){
cout << "yes";
}
else cout << "no";
}
| ALGO | 0.999943 | 4.10192 |
c437ef1e-bb71-4ff3-9a69-a9c9c6f53eee | Vineet-Pandey/code_practice | apple_stocks.cpp | //
// Created by vineet on 4/26/24.
//
#include <iostream>
#include<vector>
#include <algorithm>
#include <cassert>
auto getMaxProfit (std::vector <int> stock_prices){
assert(stock_prices.size()>2);
int max_profit =0;
int temp_profit;
for(int i=0;i<stock_prices.size()-1;i++){
for (int j = i+1; j<stock_prices.size... | ALGO | 0.99896 | 6.168247 |
160c6cdc-5215-49ad-a43f-14333f6e3116 | kevinboehmisch/Laboratory_Projects | Object_Oriented_Systems_CPP/Laboratory_Project_16/main.cpp |
#include <iostream>
#include <vector>
using namespace std;
class Point
{
double _x;
double _y;
public:
// Konstruktor mit Parametern
Point(double x = 0.0, double y = 0.0);
// Verschiebt einen Punkt
void move(double dx, double dy);
// gibt den Punkt auf der Konsole aus
void print(bool nl = true);
};
// Im... | ALGO | 0.87659 | 4.385359 |
851cc305-c284-4360-87ef-1bf1821ca1d9 | HimanshuJo/GFGPOTDSolutions | KCLosestElements/KClosestElements.cpp | /*
https://www.geeksforgeeks.org/problems/k-closest-elements3619/1?utm_source=geeksforgeeks&utm_medium=newui_home&utm_campaign=potd
*/
//{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class CustomComparator{
... | ALGO | 0.999963 | 5.396545 |
2418ca3c-b7e0-4321-a5e4-f5109c8b46bc | harishcarpenter1/Data.Structures.and.Algorithms. | Easy/Minimum Cost To Make Two Strings Identical/minimum-cost-to-make-two-strings-identical.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int findMinCost(string x, string y, int costX, int costY) {
int n = x.size();
int m = y.size();
vector<int> dp0(m+1, 0), dp1(m+1,0);
for(int i{1}... | ALGO | 0.99975 | 6.183436 |
87b81f28-6f7d-4458-a99b-30b338e057ec | mateor/pdroid | android-2.3.4_r1/tags/1.23/frameworks/base/media/libstagefright/codecs/amrnb/common/src/gmed_n.cpp | /*
Pathname: ./audio/gsm-amr/c/src/gmed_n.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Put file into template and first pass at optimization.
Description: Made changes based on comments from the review meeting. Used
pointers instead of index a... | ALGO | 0.999989 | 6.58524 |
77cd5c27-b2ee-4b6a-8a46-38df5fb84950 | ADITISHARMA-22/DSA-Questions | 7. Delete Tail of Circular Linked List - GFG/7.-delete-tail-of-circular-linked-list.cpp | // { Driver Code Starts
//Initial Template for C++
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node * next;
Node (int x)
{
data=x;
next=NULL;
}
};
Node *newNode(int data)
{
Node *temp=new Node(data);
retur... | ALGO | 0.999696 | 5.360864 |
8841b0da-7930-4955-8f4c-c91aedc97c85 | abxhr/Open-DSA | Algorithms/Sorting/Union_of_two_sorted_arrays/main.cpp | #include<bits/stdc++.h>
using namespace std;
void naive(int a[], int n1, int b[], int n2){
int c[n1+n2];
for(int i=0; i<n1; i++){
c[i] = a[i];
}
for(int i=0; i<n2; i++){
c[n1+i] = b[i];
}
sort(c,c+(n1+n2));
for(int i=0; i<n1+n2; i++){
if(i==0 || c[i]!=c[i... | ALGO | 0.999983 | 3.536672 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.