uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e97960c6-7ed4-4af9-abce-b06a3dac70fd | shpark5938/Algorithm | 프로그래머스/크레인인형뽑기게임.cpp | #include <string>
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
int solution(vector<vector<int>> board, vector<int> moves) {
int answer = 0;
stack<int> st;
for (int i = 0; i < moves.size(); i++) {
for (int j = 0; j < board.size(); j++) {
if (board[j][moves[i] - 1] != 0) { // 0 ƴ... | ALGO | 0.999294 | 5.202802 |
b8a8a955-b732-40be-b37d-cb94219862be | Gerges-Rezk/Tourist-Attraction | 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 |
446be419-06cf-4b3e-bf3a-93d20f5645d7 | esl-sun/PX4-Autopilot-Murray-Louw | src/modules/mc_pos_control/Takeoff/Takeoff.cpp | /**
* @file Takeoff.cpp
*/
#include "Takeoff.hpp"
#include <mathlib/mathlib.h>
#include <lib/ecl/geo/geo.h>
void Takeoff::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 Takeoff::updateTakeof... | TOOL | 0.991377 | 6.455595 |
6f04b889-6219-4e8f-a532-dd5756bcb688 | lucaski2/Competitive-Programming | AtCoder/1DCountry/main.cpp | #include <bits/stdc++.h>
#define ll long long
#define mint 2147483647
#define mod 1e9 + 7
#define en '\n'
using namespace std;
int overlap_1d(int a1, int a2, int b1, int b2) {return max(0, min(a2, b2) - max(a1, b1));}
int overlap_2d(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2){ return overla... | ALGO | 0.999829 | 4.621092 |
b181525c-22fc-4d1b-8c9f-e07d513fdd5f | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11821_0.cpp | #include <bits/stdc++.h>
const int MAXN = 18 + 5;
const int MAXS = (1 << 18) + 5;
using namespace std;
inline void chk_max(long double &a, long double b) {
if (a < b) a = b;
}
int n, maxs;
long double a[MAXN][MAXN];
long double dp[MAXS][MAXN];
long double gao(int s, int i) {
if (dp[s][i] >= -0.5) return dp[s][i];
... | ALGO | 0.999945 | 3.686882 |
36ac072e-41d9-452e-9aa6-c98e915ec4ba | sajjadul404/Problem_solving | Codeforcs Sheet 3/D_Positions_in_array.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < n; i++) {
if (arr[i] <= 10) {
cout << "A[" << i << "] = " << arr[i] << endl;
}
}
return 0;
}
| ALGO | 0.989432 | 3.899688 |
cbcfad39-9141-437a-a8cd-204ed0c85a13 | sinhadiptiprakash/dsa | Dynamic Programming/maximum_path_sum.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int maximumPath(int n, vector<vector<int>> matrix)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (i != 0)
{
if (j == 0)
... | ALGO | 0.999941 | 4.653128 |
8ea97d23-1b76-47d6-aa20-9de4fa8fbdd5 | Virddav/Reproduction_UCMP | src/optiroute/routing.cpp | // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
#include "routing.h"
#include <math.h>
#include <climits>
#include <iostream>
#include <sstream>
#include <algorithm>
#include "config.h"
#include "dynexp_topology.h"
#include "network.h"
#include "tcppacket.h"
#include "tcp.h"
#include "ndp.h"
// #defin... | ALGO | 0.999768 | 5.103883 |
4b06fb9b-b1bc-47e5-bdcf-617b02eb18ce | swarupSikder/codeForces | 219774_g.cpp | //author: Swarup Sikder
//judge: ...
//problem: ...
#include <bits/stdc++.h>
using namespace std;
int main(){
//-----------------//
// input //
//-----------------//
long long int n;
cin>> n;
long long int a[n];
for(int i=0; i<n ;i++){
cin>> a[i];
}
//-----... | ALGO | 0.999995 | 3.981158 |
69cc49eb-a1a7-4f71-b3ef-8ec17df27171 | luoyongheng/opencv_add_contrib | opencv_contrib-3.4.1/modules/reg/src/mapper.cpp | #include "precomp.hpp"
#include <opencv2/imgproc.hpp>
#include "opencv2/reg/mapper.hpp"
namespace cv {
namespace reg {
////////////////////////////////////////////////////////////////////////////////////////////////////
void Mapper::gradient(const Mat& img1, const Mat& img2, Mat& Ix, Mat& Iy, Mat& It) const
{
Siz... | ALGO | 0.965115 | 6.122109 |
a677e099-5c4d-47d2-8811-f406af81ee12 | colinblundell/mojo-apps | third_party/skia/src/pathops/SkPathOpsTightBounds.cpp | #include "SkOpEdgeBuilder.h"
#include "SkPathOpsCommon.h"
bool TightBounds(const SkPath& path, SkRect* result) {
// turn path into list of segments
SkTArray<SkOpContour> contours;
SkOpEdgeBuilder builder(path, contours);
if (!builder.finish()) {
return false;
}
SkTArray<SkOpContour*, tr... | TOOL | 0.957984 | 5.772457 |
ac5faf36-422e-405d-95a3-c5c3b2dfba00 | alekseylopez/Nebula-Chess-Engine | src/MagicBitboards.cpp | #include "nebula/MagicBitboards.hpp"
#include <vector>
namespace nebula
{
std::array<uint64_t, 102400> MagicBitboards::rook_attacks;
std::array<uint64_t, 5248> MagicBitboards::bishop_attacks;
std::array<uint64_t*, 64> MagicBitboards::rook_attack_ptr;
std::array<uint64_t*, 64> MagicBitboards::bishop_attack_ptr;
std... | CONFIG | 0.984559 | 5.538378 |
b994ced2-09b7-4456-a01a-ac9627de5e53 | aanu2021/Leetcode-Solutions | 721-accounts-merge/721-accounts-merge.cpp | class Solution {
public:
int Parent[10005];
int Rank[10005];
int find(int x){
if(Parent[x]==x){
return x;
}
int temp=find(Parent[x]);
return Parent[x]=temp;
}
void Union(int x,int y){
int lx=find(x);
int ly=... | ALGO | 0.999928 | 6.172904 |
f7e911ec-7684-4982-ac3a-e8d45b3aac13 | ishandutta2007/codeforces | fqw/normal/341/C.cpp | #include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
#d... | ALGO | 0.999992 | 3.727645 |
3c0443b1-ac12-4dda-add3-a13de5dbb823 | josuehfa/DAASystem | CoreSystem/lib/CGAL/examples/BGL_polyhedron_3/kruskal_with_stored_id.cpp | #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <iostream>
#include <list>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 ... | ALGO | 0.994772 | 5.298333 |
2a8a0b1d-564b-4e92-ad53-81e7fe806e87 | Aadi1909/Leetcode | 3427-special-array-ii/special-array-ii.cpp | class Solution {
public:
vector<bool> isArraySpecial(vector<int>& nums, vector<vector<int>>& queries) {
int N = nums.size();
vector<int> violations(N, 0);
for (int i = 0; i < N - 1; ++i) {
if (nums[i] % 2 == nums[i + 1] % 2) {
violations[i] = 1;
}
... | ALGO | 0.999581 | 5.630287 |
b7dc13e9-98db-43d3-85f6-5c6b58705a81 | ishandutta2007/codeforces | anadi/normal/1331/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>
const int N = 1e6 + 7;
const int MX = 1e9 + 7;
int main(){
int x;
scanf("%d", &x);
vector <int> ans(6, 0);
for(int i = 0; i < 6; ++i)
ans[i] = (x ... | ALGO | 0.999689 | 3.700706 |
d8d7946e-39a6-44b0-b8b8-fb09d3adbf7b | Badstu/leetcode-exercises | src/172.cpp | class Solution {
public:
int trailingZeroes(int n) {
int count = 0;
while(n >= 5){
count += n / 5;
n = n / 5;
}
return count;
}
}; | ALGO | 0.999603 | 6.317704 |
258169ed-ba7a-42a8-95c0-374182c818c2 | lasersson/aoc15 | src/06.cpp | #include <aoc.h>
#define GRID_WIDTH 1000
#define GRID_HEIGHT 1000
static bool LightOnGrid[GRID_WIDTH * GRID_HEIGHT];
static int LightBrightnessGrid[GRID_WIDTH * GRID_HEIGHT];
enum action
{
Action_Unknown,
Action_TurnOn,
Action_TurnOff,
Action_Toggle,
};
struct pos
{
int x, y;
};
static output
Solve(input Input... | ALGO | 0.942234 | 6.0701 |
0b0ac997-9800-4a39-86c1-5a7b6817e85b | kazunetakahashi/atcoder | 2019/0526_ABC128/past2/C.cpp | #define DEBUG 1
/**
* File : C.cpp
* Author : Kazune Takahashi
* Created : 5/17/2020, 4:42:45 PM
* Powered by Visual Studio Code
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cs... | ALGO | 0.999969 | 4.809306 |
1faf7148-da21-4676-8808-8cd46d6a4a85 | ishandutta2007/codeforces | ronnie007/normal/174/C.cpp | #include<iostream>
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
using namespace std ;
#define MAXN 100007
#define inf 1000000007
int n ;
int a[ MAXN ] ;
int LEAVES ;
int tr[ 5 * MAXN ] ;
int lazy[ 5 * MAXN ] ;
void init ( int where , int val ) {
while ( where != 0 ) {
t... | ALGO | 0.999948 | 3.489402 |
3b543645-8fe0-4441-8528-cccb6cff5203 | anuj758/cses-problemset-solution | introductory-problems/24_gridDescription.cpp | #include <iostream>
#include <vector>
#include <functional>
using namespace std;
bool isValid(int x, int y) {
return (x >= 0 && y >= 0 && x < 7 && y < 7);
}
void solve() {
string s;
cin >> s;
vector<vector<bool>> vis(7, vector<bool>(7, false));
int dx[] = {0, 0, 1, -1}; // Directions: L, R, D, U
... | ALGO | 0.999894 | 4.085288 |
912a2472-668a-40b2-9a83-fd5f0ed03578 | shahjigar556/6Companies30Days | GoldmanSachs/3_productLessThanK.cpp | class Solution{
public:
int countSubArrayProductLessThanK(const vector<int>& a, int n, long long k) {
long long int p=1;
int start=0;
int cnt=0;
for(int i=0;i<n;i++)
{
p*=a[i];
if(a[i]>=k)
{
start=i+1; // new start
... | ALGO | 0.999741 | 4.551501 |
c05d9aa0-27d6-455e-832c-b01effd8aba3 | donglongping/UnrealEngine | Engine/Source/Runtime/Experimental/ChaosVehicles/ChaosVehiclesCore/Private/SteeringSystem.cpp | #include "SteeringSystem.h"
namespace Chaos
{
void FAckermannSim::CalculateAkermannAngle(float Input, float& OutSteerLeft, float& OutSteerRight)
{
FSteeringUtility::CalculateAkermannAngle(true, Input * SteerInputScaling, C2, R1, R2, OutSteerLeft, LeftRodPt, LeftPivot);
FSteeringUtility::CalculateAkermannAngle(f... | ALGO | 0.959723 | 5.899815 |
3d8448ee-717e-4ee8-864b-99bb83caf9b8 | SWEG-2015EC-Batch/KM | ETS0863_15_Mahlet_Belay/ClassActivity3_1/Playing with Digit/frequency.cpp | #include <iostream>
using namespace std;
int main(void)
{
int num, temp;
int one, two, three, four, five;
int zero, six, seven, eight, nine;
one = two = three = four = zero = five = six = seven = eight = nine = 0;
cout<<"Enter number: ";
cin>>num;
while (num > 0)
{
temp = num... | ALGO | 0.999492 | 3.572562 |
d7140280-5bd7-4c2a-b00d-2ffa95fd4454 | lucianmot/codechef-problems | 775 - C++ - Buy Lamps.cpp | // C++ - Buy Lamps
// Rating - 775
// https://www.codechef.com/problems/BUYLAMP
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, k, x, y;
cin >> t;
while(t--) {
cin >> n >> k >> x >> y;
int answer = 0;
if ( x <= y ) {
answer+= x * n;
} else {
answer+= x * k... | ALGO | 0.99599 | 3.470314 |
4259bd70-a949-4db4-abaf-dae2cd105806 | sshockwave/Online-Judge-Solutions | EZOJ/1618.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
T i=0;char c;
while(!isdigit(c=getchar())&&c!='-');
bool flag=c=='-';
flag?(c=getchar()):0;
... | ALGO | 0.999995 | 3.22501 |
0e9e8120-6f8a-45fa-b3e0-8874bbed2d38 | goyalyash82/GFG | Difficulty: Easy/Minimum Cost of ropes/minimum-cost-of-ropes.cpp | class Solution {
public:
int minCost(vector<int>& arr) {
// code here
int cost=0;
priority_queue<int,vector<int>,greater<int>>pq(arr.begin(),arr.end());
while(pq.size()>1){
int min1=pq.top();
pq.pop();
int min2=pq.top();
pq.pop();
... | ALGO | 0.99999 | 5.262469 |
9aa400a5-4b58-4b00-9b0c-fe3f613311ac | Hesh0629/solved_boj_problems_in_army | boj/2531.cpp | #include <bits/stdc++.h>
using namespace std;
int n,d,k,c,x;
vector<int>v;
map<int,int>mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int ans=0;
cin>>n>>d>>k>>c;
for(int i=0;i<n;i++){
cin>>x;
v.push_back(x);
}
for(int i=0;i<n;i++)
v.push_back(v[i]);
mp[c]++;
f... | ALGO | 0.99997 | 3.581697 |
8e0bb93e-a777-4090-92ce-180e48a06312 | BoleynSu/CompetitiveProgramming | archives/problemset/codeforces.com/261C.cpp | //begin #include <Core>
/*
* Package: StandardCodeLibrary.Core
* */
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <utility>
#include <vector>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
... | ALGO | 0.999977 | 3.74693 |
1e22d69a-950a-4aa9-b569-89d20fc21de2 | FuChaolei/algorithm | cn/C++/question/___Offer_39_________________LCOF.cpp | // @algorithm @lc id=100310 lang=cpp
// @title shu-zu-zhong-chu-xian-ci-shu-chao-guo-yi-ban-de-shu-zi-lcof
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include "algm/algm.h"
using namespace std;
class Solution
{
// @test([3,3,4])=3
public:
int majorityElement(vector<int> &n... | ALGO | 0.99985 | 5.718592 |
434347f4-0d85-4859-b116-58c5601320dc | doneni/boj_study | 1182/main.cpp | #include <iostream>
#define MAX 20
using namespace std;
int N = 0;
int S = 0;
int ans = 0;
int a[MAX] = { 0, };
void dfs(int idx, int sum)
{
if(idx == N)
return;
if(sum + a[idx] == S)
ans++;
dfs(idx + 1, sum);
dfs(idx + 1, sum + a[idx]);
}
int main()
{
cin.tie(NULL); cout.tie(NULL... | ALGO | 0.99995 | 3.752992 |
74a4b231-9340-41d7-b50a-48cb73c086a4 | arshdeep/Programming | editdistance.cpp | #include<iostream>
using namespace std;
int smallest(int x, int y, int z){
return std::min(std::min(x, y), z);
}
int editDistRec(char *a, char *b, int n, int m)
{
if (n == 0 && m == 0)
return 0;
if (n > 0 && m == 0)
return n;
if (m > 0 && n == 0)
return m;
int x = editDistRec(a, b, n - 1, m) + 1;
in... | ALGO | 0.999994 | 4.502704 |
63bd1ac4-02f6-48f5-a109-54c0bc77bfb8 | ShawnShawnYou/EnhanceGraph | apps/utils/compute_groundtruth_for_filters.cpp | #include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <random>
#include <limits>
#include <cstring>
#include <queue>
#include <omp.h>
#include <mkl.h>
#include <boost/program_options.hpp>
#include <unordered_map... | DATA | 0.98213 | 3.840153 |
e7e4fdc7-6997-416e-86ba-e4d2a47411cf | hasnat0006/CP_SOLUTION | YouKnowWhoAcademy/Phase 02/1. Basic Number Theory/19.Divisors_of_factorial.cpp | //!-----------------------------------------------------!//
//! Author: YUSUF REZA HASNAT !//
//! Created: 15|10|2024 00:34:10 !//
//!-----------------------------------------------------!//
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#inclu... | ALGO | 0.999879 | 5.870965 |
0dbad3e6-e5e9-4815-adec-f147b803f1d6 | imvskalhans/DSA-Codes | Easy/Find duplicates in an array/find-duplicates-in-an-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<int> duplicates(int arr[], int n) {
// code here
vector<int> ans;
map<int, int> mp;
for (int i = 0; i < n; i++) {
mp[arr[i]]++;
}
... | ALGO | 0.999492 | 6.387257 |
637b5b4a-9132-4ebc-a630-f222c87a6795 | thegamer1907/Code_Analysis | Graphs/2487.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int n;
vector<int> adj[10001];
int color[10001];
int dfs(int cur,int c){
int res=0;
if(c!=color[cur]) {
res++;
c=color[cur];
}
for(auto &it:adj[cur]) {
res+=dfs(it,c);
}
return res;
}
int main() {
scanf("%d",&n... | ALGO | 0.999449 | 3.743617 |
5f86e719-f9d3-41a7-9a0c-c15daa216e6e | sl1296/acm-code | poj-2385-2 Accepted.cpp |
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[1010];
int dp[1010][35];
int main(){
int t,w;
while(~scanf("%d%d",&t,&w)){
for(int i=0;i<t;i++)scanf("%d",&a[i]);
memset(dp,0,sizeof(dp));
if(a[0]==1)dp[0][0]++;else dp[0][1]++;
for(int i=1;i<t;i++... | ALGO | 0.999882 | 3.684006 |
576a2117-861e-4c8a-a8dd-901f89f8e1f9 | wilmercastrillon/Ejercicios-Uva-Judge-Online | Competitive Programming 3/String Processing/String Matching/10010 Where's Waldorf.cpp | #include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;
typedef pair<int, int> ii;
char tab[60][60], cad[60];
int mf[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int mc[] = {0, 1, 1, 1, 0, -1, -1, -1};
int m, n, len;
ii par;
bool igual(char q, char w){
if(q>'Z') q = (q-'a')+'A';
if(w>'Z') w = (w... | ALGO | 0.999876 | 3.518125 |
c272b70b-4e8d-4af9-ba8a-ea7b906dcb1e | SitalLamichhane/Cms | 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 |
8753002c-709c-4de8-8155-263b888e9a32 | OsawaKousei/2DRoboPrac_ws | ros2_ws/src/nav_real/src/diff_drive_node.cpp | #include <functional>
#include <memory>
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "drive_msgs/msg/diff_drive.hpp"
# include <bits/stdc++.h>
using namespace std::chrono_literals;
class DiffDriveNode : public rclcpp::Node {
public:
//public変数を宣言... | TOOL | 0.963915 | 5.517394 |
2ae08fd0-d9df-4650-9e99-9c9e17f27065 | bharatr21/leetcode-problems | 0145-binary-tree-postorder-traversal/0145-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.999968 | 6.23518 |
3f83d205-0d96-4c92-9b7d-ff67ac2e62f0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8151_92.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k, l, c, d, p, nl, np;
int ans;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
ans = min({(k * l) / n, c * d, p * np}) / n;
cout << ans;
}
| ALGO | 0.999266 | 3.456335 |
0609d2c4-d591-4533-a43c-229cd122b187 | Canzova/DSA | Two Pointers/Arrays/Rotate Array.cpp | /*
Question Name : 189. Rotate Array
Time Complexity : O(N)
Space Complexity : O(1)
class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
k = k % n;
int start = 0;
int end = n - 1;
while(start <= end){
swap(nums[start++], nums[en... | ALGO | 0.999931 | 6.365091 |
35e1b06a-b23c-4f16-a53e-03d3be743764 | ishandutta2007/codeforces | holyk/normal/1514/A.cpp | #include <bits/stdc++.h>
#define perr(a...) fprintf(stderr, a)
#define dbg(a...) perr("\033[32;1m"), perr(a), perr("\033[0m")
template <class T, class U>
inline bool smin(T &x, const U &y) {
return y < x ? x = y, 1 : 0;
}
template <class T, class U>
inline bool smax(T &x, const U &y) {
return x < y ? x = y, 1 : 0;
... | ALGO | 0.998314 | 4.578817 |
6eb13473-8689-4c43-8b8e-98b6b0d2265d | sinian666/codes_102_4 | cpp_副本10/chapter_array_and_linkedlist/list.cpp | /**
* File: list.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化列表 */
vector<int> list = {1, 3, 2, 5, 4};
cout << "列表 list = ";
printVector(list);
/* 访问元素 */
int num = list[1];
cout << "访问索引 1 处的元素,得到 n... | ALGO | 0.91366 | 5.017362 |
262f9539-e651-4c3e-bf3c-47b8a9353083 | HieuAnh87/University | Cplus/Cplus_PTIT/Searching_6.cpp | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
void input(int a[], int n){
for(int i = 0; i < n; ++i){
cin >> a[i];
}
}
void run(){
int n; cin >> n;
int a[n+1], res;
input(a,n);
int min = abs(a[0] + a[1]);
for(int i=0; i<n-1; i++){
for(int ... | ALGO | 0.999982 | 4.565199 |
ebbfb63b-6335-4132-a8c1-41ed32bd3279 | NipunSyn/DSA-CPP | DSA/code/Recursion/questions/substrings.cpp | #include<iostream>
using namespace std;
void substring(string s, string ans){
if(s.length() == 0){
cout<<ans<<endl;
return;
}
char ch = s[0];
string ros = s.substr(1);
substring(ros, ans);
substring(ros, ans+ch);
}
int main(){
string s = "abc";
substring(s, "");
r... | ALGO | 0.999955 | 3.770161 |
1180d8de-d70d-48d9-a49e-beb88d11bd02 | nickobard/PA2-Programming-and-Algorithmics-2 | hw02/main.cpp | #ifndef __PROGTEST__
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <climits>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <memory... | ALGO | 0.918307 | 4.810534 |
ccc75a3b-320e-41c3-8975-502de7fb9f32 | colin-arnet/DSL-crypto-bench-tls | Vitis_Libraries/solver/L1/tests/qr_inverse/kernel/kernel_qr_inverse_0.cpp | #include "kernel_qr_inverse.hpp"
#include "xf_solver_L1.hpp"
extern "C" int kernel_qr_inverse_0(hls::stream<MATRIX_IN_T>& matrixAStrm,
hls::stream<MATRIX_OUT_T>& matrixInverseAStrm) {
int is_singular;
xf::solver::qrInverse<ROWSCOLSA, MATRIX_IN_T, MATRIX_OUT_T>(matrixAStrm, ma... | ALGO | 0.993731 | 4.317617 |
9d830ef1-310b-4e79-b671-d8f8ce706d58 | M45UDrana/DS-Algo-Problem-Solving | codeforces/526B.cpp | #include <bits/stdc++.h>
using namespace std;
int n, ans = 0, L, R;
const int N = pow(2, 11);
vector<int>lght(N, 0), sumlt(N, 0);
int bfs(int u)
{
if(L <= u and u <= R)
return lght[u];
int sum1 = bfs(u*2);
int sum2 = bfs(u*2+1);
ans += abs(sum1 - sum2);
return lght[u] + max(sum1, sum2);
}... | ALGO | 0.999843 | 4.053016 |
560004c9-903a-47d8-98c6-49afecf23dbf | NurMuhammadCSE/Interview-Problems | reverseWords.cpp | #include <iostream>
#include <sstream>
#include <algorithm>
using namespace std;
string reverseWords(string str) {
stringstream ss(str);
string word, result = "";
while (ss >> word) {
reverse(word.begin(), word.end());
result += word + " ";
}
return result;
}
int main() {
str... | ALGO | 0.999288 | 5.97074 |
84c1d3d5-2a91-44da-9cd7-79fef6ec1f58 | tongfs/leetcode | 2682.找出转圈游戏输家.cpp | /*
* @lc app=leetcode.cn id=2682 lang=cpp
* @lcpr version=21910
*
* [2682] 找出转圈游戏输家
*/
#include "mylib.h"
// @lc code=start
class Solution {
public:
vector<int> circularGameLosers(int n, int k) {
vector<bool> st(n);
for (int i = 1, cur = 0; !st[cur]; i++) {
st[cur] = true;
... | ALGO | 0.99996 | 5.330767 |
24ef8682-d83c-47b0-8131-abee5fd77f40 | zznew/Algorithms-Problems | LQ10_CB_特别数的和/main.cpp | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long LL;
bool check(int num)
{
while(num)
{
int temp = num % 10;
if(temp == 2 || temp == 0 || temp == 1 || temp == 9){
return true;
}
num /= 10;
}
return false;
}
int main()
{
... | ALGO | 0.99953 | 4.135181 |
044cc7eb-632d-428c-be80-36cd5f567606 | tao73bot/codes | codeforces_1486_A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while(t--)
{
long long n,i,s=0,b,cnt=0;
cin >> n;
//d=n*(n-1)/2;
long long a[n];
for(i=0;i<n;i++){
cin >> a[i];
... | ALGO | 0.999881 | 3.882226 |
769d7b6a-88ac-4cb0-b898-7928075e2c33 | ustcyyw/algorithm | luogu/dp/status/CF895C.cpp | /**
* @Time : 2024/3/7-1:01 PM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc :
*/
/*
* 70以内的质数只有19个
* 乘积是否是平方数 只取决于质因子是否出现了偶数次 因此可以用状态表示奇偶性
* 由于元素的值 <= 70 可以先将相同值的元素合并奇数
* 因为选择同一个值奇数次 1次、3次、等等 乘起来之后质因子出现次数的奇偶性都一致。选择偶数次也一样
* 如果前面的状态是pre,当前值对应的状态是s
* 将当前值选择奇数次 与前面的数相... | ALGO | 0.999977 | 4.83746 |
b2648a9b-dfac-4baa-a440-57b989f6c9e5 | Nguyen-sean/Marlin_Kingroon_KP3S_SEAN | Marlin-2.1.1/Marlin/src/feature/bedlevel/abl/bbl.cpp | #include "../../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#include "../bedlevel.h"
#include "../../../module/motion.h"
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"
#if ENABLED(EXTENSIBLE_UI)
#include "../../../lcd/extui/ui_api.h"
#endif
LevelingBili... | ALGO | 0.982457 | 6.210967 |
10009602-db9b-4141-bd80-912b878180d6 | AceRNorth/gdsims | src/BoundaryStrategy.cpp | #include <cmath>
#include "BoundaryStrategy.h"
/**
* Calculates the shortest periodic distance between two points.
* @param[in] p1 first point
* @param[in] p2 second point
* @return The shortest distance between the points.
*/
double ToroidalBoundaryStrategy::distance(const Point &p1, const Point &p2)
{
doub... | ALGO | 0.999727 | 5.076979 |
46464d2f-2619-4665-b44f-ab11a3b3a797 | abhiram22MH1A4267/Github-Problems | Difficulty: Easy/Floor in a Sorted Array/floor-in-a-sorted-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int findFloor(vector<int>& arr, int k) {
// Your code here
int n = arr.size(), ans = -1;
for(int i = 0; i < n; i++){
if(arr[i] <= k){
ans = i;
... | ALGO | 0.999913 | 5.736459 |
ec5fb976-d2bd-4fb4-a48a-48963a88f4cd | MoeinGhaniyoun/LLVM-SLH-RISCV | libcxx/test/std/algorithms/alg.sorting/alg.merge/ranges_merge.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// <algorithm>
// template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
// weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
// class Proj2 = identity>
// ... | TEST | 0.99644 | 7.67309 |
836f2a6c-5ff5-4af6-994e-7fce4a7a4432 | jamesbut/NeuroEvo | examples/inverse_dct_example.cpp | /*
This example shows how an indirect encoding
(inverse DCT) can be employed to solve the AND
boolean domain.
*/
#include <experiment.h>
#include <phenotype/phenotype_specs/network_builder.h>
#include <domains/boolean_functions/and.h>
#include <genetic_operators/selection/roulette_wheel_selection.h>
#inclu... | ALGO | 0.999839 | 6.588304 |
eb24d959-8579-4e8d-a148-65c23f883d7e | ikuo-suyama/competitive-programming | abc130/abc130_b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE \
ifstream in("abc130/abc130_b.txt"); \
cin.rdbuf(in.rdbuf());
#define print_vec(v) ... | ALGO | 0.999976 | 4.32557 |
b8183528-753a-4893-909d-24cb775903a4 | Nisshiy24/GE3 | DirectXTex/DirectXTexNormalMaps.cpp | #include "DirectXTexP.h"
using namespace DirectX;
using namespace DirectX::Internal;
namespace
{
#pragma prefast(suppress : 25000, "FXMVECTOR is 16 bytes")
inline float EvaluateColor(_In_ FXMVECTOR val, _In_ CNMAP_FLAGS flags) noexcept
{
XMFLOAT4A f;
static XMVECTORF32 lScale = { { { 0.2125f... | ALGO | 0.98043 | 7.594088 |
48362de3-dd79-4ec4-80ec-1a21f7e24ec9 | pedroarthurob/CompetitiveProgramming | uporto/semana03/spoj-K-query.cpp | /*
* Nome do arquivo: spoj-K-query.cpp
* Autor: Pedro Arthur de Oliveira Barreto
* Data de criação: 15/11/2024
* Descrição:
* Plataforma:
* Solução:
*/
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define MAX 30005
// De... | ALGO | 0.999965 | 5.604754 |
dba44a9c-17fb-4805-b0c0-23f37c0d1945 | ishandutta2007/codeforces | -imc-/normal/388/A.cpp | #include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
using namespace std;
int main()
{
int nBoxes;
scanf("%d", &nBoxes);
vector<int> d(nBoxes);
for (int i = 0; i < nBoxes; i++)
scanf("%d", &d[i]);
vector<bool> taken(nBoxes);
int nTaken = 0, answer = 0;
while(nTaken != nBoxes)
{... | ALGO | 0.999925 | 4.230357 |
da87477c-a6e1-4b48-9aa5-b45aabc17e02 | showmanlee/HowCanISolveThisQuestion | HackerRank/30 Days of Code/Day26_NestedLogic.cpp | // Day 26: Nested Logic
// https://www.hackerrank.com/challenges/30-nested-logic/problem
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a, b, c, x, y, z;
cin >> a >> b >> c >> x >> y >> z;
int res = 0;
if (c > z)... | ALGO | 0.994568 | 4.120724 |
9272f28e-7080-46ad-acf6-7c9f9b52df30 | wanglaiqi/LeetCode | 02AddDigit/addDigit.cpp | #include<stdio.h>
#include<iostream>
using namespace std;
/*
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
*/
class Solution
{
public:
int addDigits(in... | ALGO | 0.99989 | 5.880877 |
1ed4d578-1b45-4310-a213-e93915b8567c | XiangQiu42/PrivGGAN | evaluation/orca/orca.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <iostream>
#include <fstream>
#include <set>
#include <sstream>
#include <unordered_map>
#include <algorithm>
using namespace std;
typedef long long int64;
typedef pair<int,int> PII;
typedef struct { int first, second... | ALGO | 0.998684 | 3.38655 |
c3d55b47-955a-4fb0-812e-40f68b0b8e3d | daviddoria/Examples | c++/VXL/VNL/Minimize/LMTest.cpp | #include <iostream>
#include <vnl/vnl_least_squares_function.h>
#include <vnl/algo/vnl_levenberg_marquardt.h>
using namespace std;
class DistanceFunction : public vnl_least_squares_function
{
public:
DistanceFunction(int dof, int num_res, bool with_grad) : vnl_least_squares_function(dof, num_res, with_grad ? use_g... | ALGO | 0.999843 | 5.145198 |
7feaca80-7192-4fdb-906c-6deb1a9898be | DainoJung/Clone_App | shake_count_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998813 | 6.761023 |
ef1689bf-8981-4bd1-a50d-2b1d71a49703 | voucher-coin/voucher-coin | src/rpcdump.cpp | #include "bip38.h"
#include "init.h"
#include "main.h"
#include "rpcserver.h"
#include "script/script.h"
#include "script/standard.h"
#include "sync.h"
#include "util.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include "wallet.h"
#include <fstream>
#include <secp256k1.h>
#include <stdint.h>
#include <boos... | WEB | 0.941623 | 5.968992 |
3e440db3-ddd6-4b4c-a2b1-3463e126276b | bacnm/esp32_map_stracking | 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 |
9abea4ed-6f67-45dd-916d-0038c8949fe9 | aazannoorkhuwaja/C-plus-plus-CBL-Project | Arrays/qns13.cpp | //13. Write a program to check if an array is a palindrome.
#include<iostream>
using namespace std;
int main ()
{
int size;
bool palindro=true;
cout <<"Enter the size of array :"<<endl;
cin>>size;
int arr[size];
cout <<"Enter the elements of the array:"<<endl;
for(int i=0;i<size;i++)
{
... | ALGO | 0.976965 | 3.683982 |
13138fd7-28ab-4f87-acc0-b2184a31990b | alokprinc/CPP_DS_ALGO-main | stack _and_queue/infix.cpp | #include <bits/stdc++.h>
using namespace std;
int precedence(char optr)
{
if (optr == '+')
{
return 1;
}
else if (optr == '-')
{
return 1;
}
else if (optr == '*')
{
return 2;
}
else if (optr == '/')
{
return 2;
}
}
int operation(int v2, int... | ALGO | 0.999904 | 4.304264 |
5d80e0cc-d5b2-4905-8dc8-be1b8c9d7a5a | ZzzzzzS/EasyMVS | core/DenseReconstruction/PatchMatchStereo/pms_util.cpp | #include "pms_util.h"
#include <vector>
#include <algorithm>
PColor pms_util::GetColor(const uint8* img_data, const sint32& width, const sint32& height, const sint32& x, const sint32& y)
{
auto* pixel = img_data + y * width * 3 + 3 * x;
return {pixel[0], pixel[1], pixel[2]};
}
void pms_util::MedianFilter(const floa... | ALGO | 0.995016 | 5.80331 |
4b0bb0c3-50b7-4f39-bda5-f5875f45838f | Amanzhol-1/ADS_KBTU | LAB 6/c.cpp | #include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;
int main() {
int n, min_dist = INT_MAX;
cin >> n;
vector<int> a(n); vector<int> ans;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
map<pair<in... | ALGO | 0.999984 | 3.626457 |
9149ff33-c803-4fdd-858d-4f247418ddb9 | spexcher/ICPC_Assiut_Sheet_3_Arrays | G_Palindrome_Array.cpp | #define MOD 1000000007
/*-------------------------------Start Snippet------------------------------------------
AUTHOR: spexcher
Name: Gourab Modak
email: <EMAIL>
Institution: Indian Institute of Technology Madras(BS UG Data Science 4 year) + Jalpaiguri Government Engineering College (B. Tech UG CSE 4 year)
Github: htt... | ALGO | 0.999965 | 4.375197 |
ccf2e65b-f32e-484f-a92a-d1b86a00e945 | shreya77077/Design-Analysis---Algo | priorityqueue.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
vector<int> sortArrayUsingPriorityQueue(vector<int>& nums) {
priority_queue<int, vector<int>, greater<int>> pq(nums.begin(), nums.end());
vector<int> result;
while (!pq.empty()) {
result.push_back(pq.top());
pq.pop(... | ALGO | 0.99999 | 6.198947 |
dcc28c4f-05a8-4585-9eb3-cded8a5dc783 | ssolaric/leetcode-patterns | Arrays/Hard/lc41-first-missing-positive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
int n = nums.size();
for (int& x : nums) {
if (x < 1 || x > n) {
x = n + 1;
}
}
// Similar idea to https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array
... | ALGO | 0.999978 | 5.547418 |
8fad3fcb-43a0-451b-b00e-5ec2676283d3 | linouk23/leetcode | 363.cpp | // 363. Max Sum of Rectangle No Larger Than K - https://leetcode.com/problems/max-sum-of-rectangle-no-larger-than-k
#include "bits/stdc++.h"
#include "gtest/gtest.h"
using namespace std;
// Trick: submatrix -> contiguous subarray of rows -> Kadane 1D + 2 pointers
// Instead of Kadane -> prefix sums in place using se... | ALGO | 0.999689 | 6.436791 |
875db133-603e-49aa-b19e-8a28e919b281 | raincross7/code-similarity | codes/train_code/problem465/problem465_480.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;
bool check(vector<int> d, int x) {
int sum... | ALGO | 0.999986 | 3.926216 |
b482bc9a-aae1-412b-b1d4-e61dc6ad2a0d | itjks3/data_structure | src/chapter02/2-15/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include "base.h"
#include "linklist_array.h"
void visit(LinkList S, int head)
{
int index = S[head].cur;
while (index > 0)
{
printf("%d ", S[index].data);
index = S[index].cur;
}
printf("\n");
}
Status equal(ElemType e1, ElemType e2)
{
return e1 == e2 ? TRUE : FALSE;
... | ALGO | 0.999068 | 3.450764 |
7d4940a4-1322-4b1e-8f0d-d0716074dc2b | EagleEyeKestrel/Leetcode | 5001-/5196. 队列中可以看到的人数/O(nlogn).cpp | class Solution {
public:
vector<int> canSeePersonsCount(vector<int>& heights) {
int n = heights.size();
vector<int> res(n, 0);
vector<int> v, val;
for (int i = n - 1; i >= 0; i--) {
int id = upper_bound(val.rbegin(), val.rend(), heights[i]) - val.rbegin();
if ... | ALGO | 0.999995 | 6.3565 |
1e3bb5d2-1d82-415f-9ff1-e9db186b541c | sabujss/XPSC | week 2/day 4/C_Most_Similar_Words.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
vector <string> v(n);
for(int i=0;i<n;i++)
{
cin>>v[i];
}
int mn=INT_M... | ALGO | 0.999979 | 4.826753 |
b3b558b9-acd6-493a-ae43-8e7ed7670413 | BillyLjm/LeetCode-Problems | 1140-Stone_Game_II.cpp | /*******************************************************************************
* 1140-Stone_Game_II.cpp
* Billy.Ljm
* 26 May 2023
*
* =======
* Problem
* =======
* https://leetcode.com/problems/stone-game-ii/
*
* Alice and Bob continue their games with piles of stones. There are a number
* of piles arrang... | ALGO | 0.999823 | 5.8535 |
4e930665-c9d3-4eb7-9db1-b9de660cf943 | Sumanth-NR/CompetitiveProgramming | Platforms/AtCoder/abc358/E_Alphabet_Tiles.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int P = 998244353;
class Z {
int val = 0;
public:
constexpr Z() = default;
template<class T> constexpr Z(const T &v): val((P + v%P) % P) {}
constexpr Z(const Z &z) = default;
constexpr int operator ()() const { return v... | ALGO | 0.999973 | 4.628504 |
6226c694-0210-4f39-b41a-96203830ad17 | Nirav-1999/Character-Deformer | eigen/doc/examples/TemplateKeyword_flexible.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
template <typename Derived1, typename Derived2>
void copyUpperTriangularPart(MatrixBase<Derived1>& dst, const MatrixBase<Derived2>& src)
{
/* Note the 'template' keywords in the following line! */
dst.template triangularView<Upper>() = src.template... | TOOL | 0.992684 | 5.804369 |
7eddf791-6786-49ea-a82c-9a53d2707429 | Moremar/advent_of_code | aoc_2022/c++/day21/main.cpp | #include "../day21/part1.h"
#include "../day21/part2.h"
using namespace std;
using namespace Day21;
int main(int argc, char* argv[]) {
const auto start = chrono::high_resolution_clock::now();
const string inputFilePath = argc > 1 ? argv[1] : "../day21/data.txt";
// part 1
const auto parsedPart1 =... | ALGO | 0.985305 | 4.92476 |
f32b85d3-71cf-46f1-bed0-57a719e82000 | AnshulChaturvedi/Anshul-Codes | 0074-search-a-2d-matrix/0074-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& mat, int target) {
int r = 0;
int c = mat[0].size()-1;
while(r<mat.size() && c>=0){
int curr = mat[r][c];
if(curr == target) return true;
else if(curr < target) r++;
else{
... | ALGO | 0.999981 | 6.295672 |
5008ea9e-7221-4676-85ef-e5825155531c | thomas1111111/PHY480_demastri_turnin | session_11/GslOde.cpp | // file: GslOde.cpp
//
// Definitions for the GSL versions of the Ode and Rhs C++ classes.
//
// Programmer: Dick Furnstahl <EMAIL>
//
// Revision history:
// 02/10/09 Original version using ode_test.cpp as a guide.
//
//*****************************************************************
// include files
#in... | ALGO | 0.994283 | 7.727273 |
2ffa8359-63c9-4af4-8774-2fabdd88e00b | ishandutta2007/codeforces | sys/normal/1101/E.cpp | #include <bits/stdc++.h>
using namespace std;
int n,maxx,maxy;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
char ch=getchar();
while(!(ch=='+'||ch=='?')) ch=getchar();
if(ch=='+')
{
int x,y;
scanf("%d%d",&x,&y);
if(x>y) swap(x,y);
maxx=max(maxx,x),maxy=max(maxy,y);
}
else
{
int x... | ALGO | 0.999939 | 3.395212 |
1eebbc37-da7f-40ef-8220-ec23ad0b0254 | Bhargavpatil16/PW_Assignment | loops 1/ASCII.cpp | //Write a program to print all the ASCII values and their equivalent characters of 26 alphabets using a while loop.
#include<iostream>
using namespace std;
int main(){
int i=65;
while(i<=90){
cout<<i<<" "<<char(i)<<endl;
i++;
}
return 0;
}
| TOOL | 0.980257 | 3.074087 |
104fb993-acdd-4873-b26d-6f7111722312 | DevanshBamrara/200DaysOfCode | Day117/find-minimum-in-rotated-sorted-array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int start = 0, end = nums.size() - 1;
int n = nums.size();
int ans = 0 ;
if(nums[start]<=nums[end])
return nums[start];
while(start<=end){
int mid = start + (end - start)/2;
int next... | ALGO | 0.999996 | 5.300079 |
2acd6977-ba14-45d2-ad05-63cd4b0147a8 | jacysun/2D_3D_Modeling | Project4/GLSLExperiment/helper.cpp | #include "helper.h"
#include <iostream>
#include <string>
CTMStack *top = NULL;
void initStack(mat4 matrix) {
CTMStack *temp = (CTMStack*)malloc(sizeof(CTMStack));
temp->matrix = matrix;
temp->next = top;
top = temp;
}
void pushMatrix() { // copy top matrix and add it above previous top
CTMStack *temp = (CTMSta... | ALGO | 0.947105 | 4.379256 |
060d743a-5210-4a4f-9704-ad6e218776bc | agaltsevstas/leetcode | easy/SingleNumber.cpp | // Time: O(n)
// Memory: O(1)
// arr = [7, 5, 7]
// 7 -> 111
// 5 -> 101
// 7^5= 010 -> 2
// 2^7= 101 -> 5
class Solution {
public:
int singleNumber(vector<int>& nums)
{
int result = 0;
for (const auto& num : nums)
result ^= num;
return result;
}
};
| ALGO | 0.999889 | 5.875169 |
ce66726a-50a5-4be6-b3e5-f04b771ab223 | literate-t/algol | programmers/test.cpp | #include <cstdio>
#include <vector>
#include <unordered_set>
#include <cmath>
using namespace std;
int solution(int N, int number)
{
int answer = 0;
vector<unordered_set<int>> d(9);
for (int i = 1; i <= 8; ++i)
{
int sum = 0;
int count = i;
while (count)
sum += N * p... | ALGO | 0.999685 | 4.690903 |
65d63c33-404a-4c22-abb1-abed466c35e8 | ut2310/codeforces | codeforces/946/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 200005
#define ALPHABETSIZE 26
#define ll long long
int main()
{
ll t; cin >> t;
while(t-->0){
string s; cin >> s;
if(s[0] == 1){
bool flag = true;
for(int i = 1; i < s.size(); i++){
if(s[i] != 0)... | ALGO | 0.999887 | 4.490122 |
f03e1590-ddf1-4e92-9c50-01b2ff788620 | ss5ssmi/OJ | codeforce/CF_482A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,k,s[100010];
cin>>n>>k;
for(int i=1;i<=n;i++){
s[i]=i;
}
int tmax=s[k+1],tmin=s[2];
for(int i=2;i<=k+1;i++){
if(i%2==0) s[i]=tmax--;
else s[i]=tmin++;
}
for(int i=1;i<=n;i++){
printf("%d",s[i]);
printf("%c",i==n?'\n':' ');
}
return 0;
}... | ALGO | 0.999945 | 3.091836 |
98b8119c-b985-46c5-81e9-7cad79e45c02 | ishandutta2007/codeforces | subconscious/normal/1028/D.cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
using namespace std;
const int N=4e5+5,P=1e9+7;
typedef long double ld;
typedef long long ll;
map<int,int>mp;
set<int>st,ha,ed;
int n,x,opt[N],cnt0,cnt1;
char s[10];
bool check(){
//for(auto pr:mp)if(pr.second==0)pr.second=1;
st.clear();ha.clear();ed.clea... | ALGO | 0.999958 | 3.848047 |
594636d3-c87b-4837-bba4-927875c26a64 | vabridgers/llvm-project-dev | libc/src/math/copysign.cpp | #include "src/__support/common.h"
#include "utils/FPUtil/ManipulationFunctions.h"
namespace __llvm_libc {
double LLVM_LIBC_ENTRYPOINT(copysign)(double x, double y) {
return fputil::copysign(x, y);
}
} // namespace __llvm_libc
| ALGO | 0.993919 | 5.531131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.