uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
44d0079d-0df5-4be2-beb1-7ed97eb3d6f3 | parakrama1995/elements_of_programming_interviews | linkedlist/8_1_merge_sorted_lists.cpp | #include <iostream>
#include <memory>
using namespace std;
template <typename T>
struct Node{
T data;
Node<T>* next;
};
template <typename T>
class LinkedList
{
public:
LinkedList();
void insertAtEnd(T d);
void printList() const;
Node<T>* getHead();
void setHead(Node<T>* head);
private:
Node<T>* d_head;
vo... | ALGO | 0.999743 | 5.684896 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2017-04-22T04:13:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b8b3065ab... |
b678c3d7-ca51-4ddd-ad36-ccb90255a7fe | Yukimarin/DevC | DemoArrrayMenu.cpp | #include <stdio.h>
int main(){
// Buoc 1: Khai bao mangr arr[n], choice
int arr[50], n, choice;
int position, value;
// Buoc 2: Hien thi menu
do{
printf("---MENU---\n");
printf("1. Nhap vao mang\n");
printf("2. Hien thi mang\n");
printf("3. Them phan tu\n");
printf("4. Sua phan tu\n"... | TOOL | 0.993634 | 3.380687 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-11-20T14:22:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "781beec50ac... |
737f4fbf-8642-4322-8540-3a5697ca0e56 | AbhayDixitDev/cpp-cybrom | 23 june 2024/magic_composite_number_between_range.cpp | //Q2. A Composite Magic number is a positive integer
//which is composite as well as a magic number.
//Composite number: A composite number is a number
//which has more than two factors.
//For example:
//Factors of IO are: 1, 2, 5, 10
//Magic number: A Magic number is a number in which
//the eventual sum of the digit i... | ALGO | 0.999284 | 4.357749 | {
"github_metadata": {
"branch": "main",
"commit_count": 112,
"repo_created_at": "2024-05-27T06:10:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "17e5c84891... |
7bde55b1-61e4-4228-831e-4c65b55ca849 | yoyoqq/CodeForces | 802. Find Eventual Safe States.cpp | class Solution {
public:
vector<int> eventualSafeNodes(vector<vector<int>>& graph) {
int n = graph.size();
vector<int> indegree(n);
vector<vector<int>> adj(n);
for (int i=0; i<n; i++){
for (int node : graph[i]){
indegree[i]++;
adj[node].pus... | ALGO | 0.999968 | 6.353678 | {
"github_metadata": {
"branch": "main",
"commit_count": 486,
"repo_created_at": "2024-03-01T13:04:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "31f718f6d2... |
68ad6651-b028-45d9-94c6-d5994139d50b | svmu92/merklerex | tokenise.cpp | #include <iostream>
#include <vector>
#include <string>
std::vector<std::string> tokenise(std::string s, char del)
{
std::vector<std::string> tokens;
std::string token;
int start, end;
// start = csvLine.find_first_not_of(separator)
start = s.find_first_not_of(del, 0);
// do
do
{
... | TOOL | 0.958942 | 3.973182 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-01T13:48:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71b5a2f5c837... |
ac4c194f-7a22-41e0-96f9-291ac841c2f6 | shashwatw/DSA | DSA-Self Paced Questions/Arrays/who-has-majority.cpp | #include <iostream>
using namespace std;
void majority(int arr[], int n, int x, int y)
{
int countx = 0, county = 0;
for (int i = 0; i < n; i++)
{
if (arr[i] == x)
{
countx++;
}
else if (arr[i] == y)
{
county++;
}
}
if (count... | ALGO | 0.999992 | 4.386235 | {
"github_metadata": {
"branch": "master",
"commit_count": 937,
"repo_created_at": "2023-03-24T05:42:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c497cf49... |
b1ed073e-5be3-4a56-b481-dd8ea7ef865a | raincross7/code-similarity | codes/train_code/problem085/problem085_460.cpp |
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<fixed; cout<<setprecision(12);
#define randomINT mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define newl cout<<"\n"
#define DISP(as) for(auto it : as) cout<<it<<" ";... | ALGO | 0.999863 | 3.632555 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e979c781c089... |
c9fafb29-036f-42b0-8110-7d363d5f904b | ericksav21/Maestria | Semestre 3/Programacion y algoritmos 2/Problemas/UVA_10171/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define INF 100000
#define MAXN 35
using namespace std;
int cost_y[MAXN][MAXN];
int cost_m[MAXN][MAXN];
int n;
int main() {
char type, direct, u, v, ss, sm;
int ener;
while(cin >> n && n) {
for(int i = 0; i < MAXN; i++) {
for(int j = 0; j < MAXN; ... | ALGO | 0.999673 | 3.461839 | {
"github_metadata": {
"branch": "master",
"commit_count": 264,
"repo_created_at": "2017-08-23T20:25:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "180dc918... |
76c29c7b-0768-498c-8647-57a1a62a112a | TomasRandoM/ProgramacionParalela | TP5/ex6.cpp | //Programación paralela y distribuida
//<NAME>
//29/4/2025
//Compilación: mpic++ ex6.cpp -o ex6
//Ejecución: mpirun -np 6 ex6
#include <mpi.h>
#include <iostream>
#include <cstring>
using namespace std;
int Bcast(int source, char *msg, int tam);
int main(int argc, char* argv[]) {
MPI_Init(&argc, &argv);
int... | ALGO | 0.974403 | 4.232384 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2025-03-16T17:08:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c98bf6f67fb... |
a3d5cc4f-d3c1-4edf-a07d-922521258bdd | ElkingD/npme | src/NPME_Bspline.cpp | //Copyright (c) 2025, <NAME>
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writin... | ALGO | 0.996775 | 4.673108 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-03-04T18:17:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "97f06d312fe4... |
ec3fb25e-f8b0-45a1-9855-59a809b6babd | endrycofr/AHP-FUZZY-IOT- | iot_ahp_dan_fuzzy.ino | #include <WiFi.h>
#include "Fuzzy.h"
String apiKey = "<KEY>"; // Enter your Write API key from ThingSpeak
const char *ssid = "akubisa"; // ganti dengan SSID WiFi dan kunci WPA2 Anda
const char *pass = "<PASSWORD>";
const char *server = "api.thingspeak.com";
const int sensor_pin = A0; /* Soil moisture sens... | TOOL | 0.983678 | 5.011003 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-06-04T14:24:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98972a6bfa... |
51e88166-c592-480b-8ff7-3a58147acafa | sachuverma/DataStructures-Algorithms | Leetcode Daily Challenge/July-2021/06. Reduce Array Size to The Half.cpp | /*
Reduce Array Size to The Half
=============================
Given an array arr. You can choose a set of integers and remove all the occurrences of these integers in the array.
Return the minimum size of the set so that at least half of the integers of the array are removed.
Example 1:
Input: arr = [3,3,3,3,5,5,5... | ALGO | 0.999969 | 6.052038 | {
"github_metadata": {
"branch": "master",
"commit_count": 1430,
"repo_created_at": "2020-10-07T10:08:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2049,
"forks": 541,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0c... |
9c2e7392-0a5c-4827-a669-48d4ce6f8fb5 | sitic/SPHinXsys | tests/2d_examples/test_2d_static_confinement/src/static_confinement.cpp | /**
* @file static_confinement.cpp
* @brief 2D dambreak example in which the solid wall boundary are static confinement.
* @details This is the one of the basic test cases, also the first case for
* understanding SPH method for fluid simulation.
* @author <NAME>
*/
/**
* @brief SPHinXsys Library.
*/
#... | ALGO | 0.987249 | 4.362805 | {
"github_metadata": {
"branch": "master",
"commit_count": 253,
"repo_created_at": "2021-08-24T23:46:31.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "Xiangyu-Hu/SPHinXsys",
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"conte... |
407d4bdc-763b-425a-893f-e1ebf8b4a0ac | EgusquizaOreJesus/programacionII | PROGRA II-LAB/S2_Ejercicios/Ejercicio4.cpp | #include "iostream"
using namespace std;
void Ejercicio04(){
int n;
cout << "Ingrese un numero par: " << endl;
cin >> n;
while(n%2 != 0){
cout << "Ingrese un numero par: " << endl;
cin >> n;
}
for(int i = 1;i<=n;i++){
for(int j=1; j<=n; j++){
if(i==1 or i==n... | ALGO | 0.998994 | 3.674536 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-12-12T15:39:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "350bdb3f83... |
82998221-4dda-4162-8710-e520e0b356ed | goyalshreyansh21/advent-of-code | 2023/Day13/p2.cpp | #include <iostream>
#include <fstream>
using namespace std;
int findsplit(vector<string> pattern)
{
for(int i=1; i<=pattern.size()-1; i++)
{
int diff = 0, top = i-1, bottom = i;
while(top>=0 && bottom<pattern.size())
{
for(int j=0; j<pattern[0].size(); j++)
{
... | ALGO | 0.999592 | 3.823313 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-02-08T12:50:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d661a8a2269... |
5126faa2-15fc-4403-9929-834324819164 | ahao214/Algorithm | Ahao.LeetCodeCPP/493. 翻转对.cpp | #include<vector>
#include <algorithm>
using namespace std;
/*
493. 翻转对
给定一个数组 nums ,如果 i < j 且 nums[i] > 2*nums[j] 我们就将 (i, j) 称作一个重要翻转对。
你需要返回给定数组中的重要翻转对的数量。
*/
class Solution {
int res = 0;
public:
int reversePairs(vector<int>& nums) {
int n = nums.size();
vector<int> sorted = nums;
helper(nums, sorted, ... | ALGO | 0.999831 | 5.005822 | {
"github_metadata": {
"branch": "master",
"commit_count": 4359,
"repo_created_at": "2020-09-14T10:24:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8eab727... |
61326d6b-8528-40b6-9742-dbf6e78de70f | luo-cheng2021/openvino | src/core/reference/include/openvino/reference/equal.hpp | // Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <algorithm>
#include <functional>
#include "openvino/reference/autobroadcast_binop.hpp"
#include "openvino/reference/utils/type_util.hpp"
namespace ov {
namespace reference {
namespace func {
template <class... | TOOL | 0.962054 | 7.676397 | {
"github_metadata": {
"branch": "master",
"commit_count": 16635,
"repo_created_at": "2021-02-26T00:25:35.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "openvinotoolkit/openvino",
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 10
},
"file_meta": {
... |
6fdae5be-2f8f-4728-81e5-1da8faed6f9f | rithvick2718/Code-Arsenal | Intern/The_a_b_c question.cpp | #include<iostream>
#include<fstream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
vector<double> solveCubic(double a, double b, double c, double d) {
vector<double> roots;
// Handle degenerate cases
if (fabs(a) < 1e-12) {
// quadratic: bx^2 + cx + d = 0
if ... | ALGO | 0.999441 | 3.681386 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2025-07-09T20:34:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "20e594af500... |
77817e3f-8d48-4df8-af83-77bbd7487b13 | Tanya347/Codes | Interviewbit/Graphs/LevelOrder.cpp | /********************************************************************** QUESTION **************************************************************************************/
/*
Problem Description
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
Input... | ALGO | 0.999997 | 5.536132 | {
"github_metadata": {
"branch": "main",
"commit_count": 511,
"repo_created_at": "2021-12-23T06:41:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "084dde0b1e... |
a36e1a01-bf12-488b-b54f-b24ff8948297 | withhaotian/LeetCode | src/2025/03/0327/2712.cpp | class Solution {
public:
long long minimumCost(string s) {
int len = s.size();
vector<long long> prefix(len);
vector<long long> suffix(len);
prefix[0] = 0;
for (int i = 1; i < len; i++) {
if (s[i] == s[i-1]... | ALGO | 0.999932 | 4.37709 | {
"github_metadata": {
"branch": "main",
"commit_count": 37,
"repo_created_at": "2025-03-23T12:05:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9999fe71c0e... |
e0887454-075c-4519-8c39-d690d446a920 | mahmode/bmp_dxt1_converter | bmp_dxt_converter/RangeEncoder.h | /**
RangeEncoder.h
Purpose: Implementation of a color range fit algorithm for choosing c0 and c1 in a DX1 compressed block.
The idea is to calculate the principal axis in the block color space (using principal component analysis "PCA")
and choose the min and max points on the principal axis as c0 and c1. Implementation... | ALGO | 0.986815 | 7.136408 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-03-27T10:04:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb963f11eb... |
4fbad3b3-faee-456f-bc74-fa263608a7e4 | mattbelcik/BINARY-SEARCH-TREE | bstDictionary.h | #ifndef _BST_DICTIONARY_H
#define _BST_DICTIONARY_H
#include <cstdint> // for uint32_t
#include <stdexcept> // for domain_error
static const uint32_t
NULL_INDEX = 0xffffffff,
DEFAULT_INITIAL_CAPACITY = 16;
template <typename KeyType, typename ValueType>
class BSTDictionary
{
public:
uint32_t getCount(u... | TOOL | 0.979253 | 4.946774 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-09-28T18:38:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dcdd8fd7b9f9... |
ac617c29-2f85-49c7-b0e2-d9c934f27630 | sarahovey/parallel-programming | project4/prog.cpp | //Project 4
//Farm simulator
//Agent I'm adding: Wheat King cat
//TODO add nowCat functions for cat agent
/*cat idea:
every month, there is a random chance for the cat to appear
appearance is random, based on temp and precipitation
if he appears, the deer are shooed away*/
#include "stdio.h"
#include <omp.h>
#include... | ALGO | 0.994995 | 4.545152 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2018-05-07T00:53:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "60e0db5b3e... |
6cf7088d-1c88-4ff9-b6c8-bd79bc91a706 | panther03/bombyx | tests/explicit/nqueens.cc | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <stdint.h>
#include "cilk_explicit.hh"
#if CILKSAN
#include "cilksan.h"
#endif
#ifdef SERIAL
#include <cilk/cilk_stub.h>
#endif
unsigned long long todval (struct timeval *tp) {
return tp->tv_sec * 1000 * 1000 + tp->tv_usec... | ALGO | 0.999851 | 4.202401 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2025-05-09T11:36:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 11,
"pull_requests": 0
},
"file_meta": {
"content_id": "16292873c1... |
5547439d-ef0e-4950-9363-501774dbb257 | VSFe/Algorithm | CPP/step/SCC/16367.cpp | /*
Problem: TV Show Game (16367)
Tier: Platinum 3
Detail: Mr. Dajuda, who is famous for a TV show program, occasionally suggests an interesting game for the audience and gives them some gifts as a prize. The game he suggested this week can be explained as follows.
The k(> 3) lamps on the stage are all turned off at th... | ALGO | 0.999972 | 4.03362 | {
"github_metadata": {
"branch": "master",
"commit_count": 194,
"repo_created_at": "2019-11-30T10:00:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4678924... |
dc59c0f5-214a-428d-a1db-3adeab45b6b3 | openharmony/communication_wifi | wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_config_file_spec.cpp | /*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... | TOOL | 0.901879 | 3.645048 | {
"github_metadata": {
"branch": "master",
"commit_count": 11182,
"repo_created_at": "2021-08-26T07:42:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b3810d... |
530aa3b7-188b-4cad-9b05-127e86c640a0 | Vesion/Misirlou | arsenal/datastructure/list/Partition.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode(int val) : val(val), next(NULL) {}
};
//Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or eq... | ALGO | 0.99999 | 5.568884 | {
"github_metadata": {
"branch": "master",
"commit_count": 525,
"repo_created_at": "2016-02-04T08:08:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d605759... |
def22c06-bc30-4dcf-af3f-f2007d864049 | code6/playground | leetcode/t.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <bitset>
#include <algorithm>
using namespace st... | ALGO | 0.999907 | 3.722046 | {
"github_metadata": {
"branch": "master",
"commit_count": 96,
"repo_created_at": "2012-11-04T04:59:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 8,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "6c840c32d... |
f7628934-eba6-43c9-bdd6-34e4505f9fae | isfahanUacm/UICPC | 2024/UICPC Regional/Round #6/submits/H/Maya/Accepted/56014626_AC_Maya2_H.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
T power(T a, int64_t b) {
assert(b >= 0);
T res{1};
while (b) {
if (b & 1) {
res = res * a;
}
a = a * a;
b >>= 1;
}
return res;
}
#ifdef DEBUG
#include "/home/mohammad/code/debug.h"
#els... | ALGO | 0.999871 | 3.811447 | {
"github_metadata": {
"branch": "main",
"commit_count": 113,
"repo_created_at": "2021-09-15T16:29:50.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 8,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1cd4f67d7cc... |
3570a8f0-0a22-4625-acc5-9c176a802a0d | hereismari/Programming | algorithms/ds/segtree_2D/code.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1000;
int t[2*N][2*N];
int n, m;
#define zero INT_MIN
#define f(x,y) max(x,y) // change here
#define apply(x,y) x+=y // change here
int query(int x1, int y1, int x2, int y2) {
x1 += n;
x2 += n;
y1 += m;
y2 += m;
int res = zero;
for ... | ALGO | 0.99955 | 3.130423 | {
"github_metadata": {
"branch": "master",
"commit_count": 138,
"repo_created_at": "2015-05-20T19:54:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 24,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f3548b... |
9e6bfdb7-70cd-4271-9aa9-2018d3ecd570 | mdrasel101126/xpsc-batch-4 | week_1/day_7/C_Number_of_Equal.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll n, m;
cin >> n >> m;
vector<ll> a(n);
vector<ll> b(m);
for (ll i = 0; i < n; i++)
{
cin >> a[i];
}
for (ll i = 0; i < m; i++)
{
cin >> b[i];
}
ll l = 0, r = 0, cnt1 = 0, cnt... | ALGO | 0.99997 | 3.632755 | {
"github_metadata": {
"branch": "main",
"commit_count": 45,
"repo_created_at": "2024-03-16T17:26:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ef06cd9210e... |
acfeb0df-9537-4d19-8143-9a470c69b73d | yanuartadityan/cxx-tutorial | tutor_hackerrank_solver/new_year_chaos.cpp | //
// Created by <NAME> on 11/8/2019.
//
#include "challenges.h"
#include "helper/string_split.h"
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <cstring>
using namespace std;
int minimumBribes(int t, vector<int> &q, int *max_step);
void new_year_chaos(void){
int n;
... | ALGO | 0.999674 | 4.142423 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2019-06-03T02:34:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "49a9ff049... |
072927dd-5094-4db3-a43f-fc1c11fd1330 | cdlwhm1217096231/DataStruct_and_Algorithms | 剑指offer练习代码/10.二叉树_重建二叉树.cpp | #include <iostream>
#include <vector>
using namespace std;
// 要求:已知一棵树的前序和中序遍历,重建这棵树!
// 二叉树的节点结构
struct BinaryTreeNode{
int val;
BinaryTreeNode *left;
BinaryTreeNode *right;
BinaryTreeNode(int x):val(x), left(NULL),right(NULL){}
};
class Solution{
public:
BinaryTreeNode *reConstructBina... | ALGO | 0.999979 | 5.425344 | {
"github_metadata": {
"branch": "master",
"commit_count": 76,
"repo_created_at": "2019-03-28T03:42:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "170765b28... |
f43cf747-7f9e-49e3-ac00-2275dfad2140 | hcu5555/tonatiuh | TonatiuhProject/plugins/ShapeParabolicRectangle/src/ShapeParabolicRectangle.cpp | /***************************************************************************
Copyright (C) 2008 by the Tonatiuh Software Development Team.
This file is part of Tonatiuh.
Tonatiuh program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fr... | ALGO | 0.977355 | 6.28288 | {
"github_metadata": {
"branch": "master",
"commit_count": 947,
"repo_created_at": "2015-04-30T03:11:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 20,
"pull_requests": 0
},
"file_meta": {
"content_id": "79212c2... |
8536deec-66ce-4a2a-8357-b47d3e8b9c70 | viing937/codeforces | src/355C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n, l, r, Ql, Qr;
cin >> n >> l >> r >> Ql >> Qr;
vector<int> w(n);
cin >> w[0];
for ( int i = 1; i < n; ++i )
{
cin >> w[i];
w[i] += w[i-1];
}
int ans = w[n-1]*r + (n-1)*Qr;
... | ALGO | 0.99932 | 3.544178 | {
"github_metadata": {
"branch": "master",
"commit_count": 896,
"repo_created_at": "2015-03-26T03:28:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "925be166... |
004f1cc0-3598-4e9a-8956-fb3b52f7853c | Filikec/competitive-programming | kattis/chartingprogress.cpp | #include <iostream>
using namespace std;
int R,C;
int Count[100];
int get_line(){
int count = 0, length = 0;
char c;
while ((c=cin.get())!='\n'&&!cin.eof()){
length++;
if (c=='*') count++;
}
if (cin.eof()) return -2;
if (!length) return -1;
if (!C) C = length;
return ... | ALGO | 0.999441 | 3.263973 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-03-31T18:30:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af519f7301df... |
6629484b-2117-45b5-a199-a1bd90cc7c0e | amrithm98/Competitive-Coding | Coding-Ninjas/Assignment-4-Number-Theory/card_game.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;
map<int,int> returnPrimeFactors(long k)
{
map<int,int> primeFactors;
while(k % 2 == 0)
{
primeFactors[2]++;
k /=2 ;
}
for(int i = 3; i <= sqrt(k) ; i++)
{
whi... | ALGO | 0.999811 | 4.205266 | {
"github_metadata": {
"branch": "master",
"commit_count": 188,
"repo_created_at": "2017-08-14T13:14:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 48,
"forks": 31,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "54afaf... |
3183025d-3b38-4b21-a632-8314dd5ac399 | alexandraback/datacollection | solutions_2749486_0/C++/fastblood/bsmall.cpp | #include <stdio.h>
#include <math.h>
#include <memory.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cassert>
using namespace std;
#define pb push_back
#define mp make_pair
#define _(a, b) memset(a, b, sizeof(a))
typedef long long ... | ALGO | 0.999974 | 3.574281 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ead11f0c... |
74660ea6-726c-40f7-a1c0-3f00380e6e88 | pafin10/CompetitiveProgrammingExercises | competitive programming/graphs/roadConstruction.cpp | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <bitset>
#include <numeric>
#include <set>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <array>
#include <deque>
#includ... | ALGO | 0.999929 | 3.390369 | {
"github_metadata": {
"branch": "main",
"commit_count": 31,
"repo_created_at": "2023-09-09T12:04:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e32b2ef2917... |
0ad333fc-3f2d-4d06-b69d-66bbe7f4d2b8 | dillonhuff/qecode | autogen/auto_line_line.cpp | #include <ralg/root_counting.h>
using namespace std;
using namespace ralg;
#define EPSILON 1.0e-4
bool within_eps(const double a, const double b, const double eps) {
return fabs(a - b) < eps;
}
std::vector<rational> test_points_from_roots(const std::vector<rational>& roots) {
if (roots.size() == 0) { return {};
}... | ALGO | 0.998518 | 5.124181 | {
"github_metadata": {
"branch": "master",
"commit_count": 160,
"repo_created_at": "2017-05-16T21:11:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8b222e98... |
02e77043-0c24-4597-a0b9-588bbe6bb0d1 | AadeshSalecha/IIT-Bombay-CS101x | Graded_Program2.cpp |
//Author : <NAME>
//Course : Nand2Tetris
//Date : March 2016
#include <iostream>
using namespace std;
// Please write your code, within the "BEGIN-END" blocks given below.
// A "BEGIN-END" block is identified as follows :
//
// "//// BEGIN: Some string DONT_ERASE_xx_yy"
//
//
// "//// END: Some other st... | ALGO | 0.999131 | 4.296337 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2016-09-12T11:31:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7cfca93ec... |
0913f516-9ab8-4aa2-b6eb-afe58268f5f6 | anaoliveira04/Codigos | ACOS47.cpp | //ACOS47 - <NAME>
//<NAME> - 01/06/023
#include <stdio.h>
#include <stdlib.h>
void IniciaTab (char t[3][3]); // inicia um novo jogo, preenchendo o tabuleiro com pontos
void MostraTab (char t[3][3]); // apresenta o tabuleiro no console
void ObtemJogadaUsu (char t[3][3]); // pede 2 coordenadas ao usuário, verifica se ... | ALGO | 0.999772 | 3.90658 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-10-24T18:30:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ffc6b7db13e1... |
ec0a57e1-5d0f-4204-b9e8-fd7189361e4e | MoamenAhmedMostafa/Competitive-programming | UVA/UVA 10199.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define clr(v,d) memset(v, d, sizeof(v))
const double EPS = 1e-8;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>P;
const ll mod = l... | ALGO | 0.999919 | 3.931751 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2018-03-02T06:47:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59a9d5a9a... |
c0edee04-89ec-432f-bb8f-56e811d99d3a | samadeep/NITH_Sem3_OOPS | bank.cpp | // 7. Write a C++ program to count the number of persons inside a bank, by increasing count whenever a person
// enters a bank , using an increment (++) operator overloading function, and decrease the count whenever a person
// leaves the bank, using a decrement (--) operator overloading function inside the class.
#inc... | ALGO | 0.989431 | 3.933527 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-11-12T18:38:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8cbb37cb169e... |
b125defc-20b8-4972-9e46-dd72d62fc52f | side-projects-all/works | Leetcodes/linked_list/q_369.cpp | /*
Given a non-negative integer represented as a linked list of digits, plus one to the integer.
The digits are stored such that the most significant digit is at the head of the list.
Example 1:
Input: head = [1,2,3]
Output: [1,2,4]
Example 2:
Input: head = [0]
Output: [1]
Constraints:
The number of no... | ALGO | 0.999961 | 5.931259 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2025-01-03T05:24:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cc9f24cf59a... |
a15ca8ac-5800-4e69-8c85-e2f1e80676a4 | AstridChiguichon/LAB9 | LabDepuracionFIBONACCI.cpp | #include <iostream>
#include <stdexcept> // Se incluye para poder lanzar excepciones
using namespace std;
// Función recursiva para calcular Fibonacci, lanzando una excepción si el número es negativo
int fibonacci(int n) {
if (n < 0) {
throw invalid_argument("Error: No existe Fibonacci de un número nega... | ALGO | 0.995743 | 5.675185 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2025-03-25T03:29:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2106b54da... |
5d07be7c-9eeb-466a-a7de-043b49ca9678 | nishantkj911/codes | removeLoopInList.cpp | */
/*The function removes the loop from the linked list if present
You are required to complete this method*/
void removeTheLoop(Node *head)
{
if (!head)
return;
//Your code here
for(Node *temp = head; temp != NULL; temp = temp->next)
{
for (Node *temp2 = head; temp2 != temp... | ALGO | 0.998379 | 3.91889 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2019-07-18T06:13:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c6c0e89392... |
240fb83d-ed08-4e86-a728-29bd02a58bed | malazad/Reservoir | Simulation/ndnSIM /apps/ndn-consumer-zipf-mandelbrot.hpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2011-2015 Tsinghua University, P.R.China.
*
* This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
* contributors.
*
* ndnSIM is free software: you can redistribute it and/or modify it under the term... | ALGO | 0.988362 | 5.349613 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2022-01-30T21:40:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9abcb9137026... |
87150867-64b0-4cee-81ed-0487374766e7 | chenxli/Leetcode | 14.longest-common-prefix.cpp | /*
* @lc app=leetcode id=14 lang=cpp
*
* [14] Longest Common Prefix
*
* https://leetcode.com/problems/longest-common-prefix/description/
*
* algorithms
* Easy (33.97%)
* Likes: 1546
* Dislikes: 1423
* Total Accepted: 521.1K
* Total Submissions: 1.5M
* Testcase Example: '["flower","flow","flight"]'
... | ALGO | 0.999738 | 6.147202 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-08-14T15:24:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3a26de8b1a... |
44aecee9-a2b5-4b9e-bfc5-bde8c7f1d50e | ComradeMohan/CSA5153_Cryptography | Q40.cpp | #include <stdio.h>
#include <string.h>
void frequency_analysis(char *ciphertext, int *freq) {
int len = strlen(ciphertext);
for (int i = 0; i < len; i++) {
if (ciphertext[i] >= 'A' && ciphertext[i] <= 'Z') {
freq[ciphertext[i] - 'A']++;
}
}
}
void substitute(char *ciphertext, c... | ALGO | 0.999987 | 4.328599 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-07-17T07:11:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "34d878d0a9f4... |
c579e882-6d9f-40d7-94c9-a7ce08ca1cef | dwilliamson/GDMagArchive | jul98/Lander/Code/OGL/Spray/Matrix.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// Matrix.cpp : implementation file
//
// Purpose: Implementation of Matrix Math Routines
//
// Created:
// JL 2/18/98
// Revisions:
//
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 199... | ALGO | 0.99755 | 4.358403 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-10-31T14:00:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 93,
"forks": 7,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "20a9f20c3... |
22b7b03c-0f6f-4c49-8cfd-8addc7b19c2e | AMReX-Astro/Castro | Source/hydro/trace_plm.cpp | #include <Castro.H>
#include <Castro_util.H>
#ifdef RADIATION
#include <Radiation.H>
#endif
#include <cmath>
#include <slope.H>
#include <reconstruction.H>
#include <flatten.H>
using namespace amrex;
using namespace reconstruction;
void
Castro::trace_plm(const Box& bx, const int idir,
Array4<Real... | ALGO | 0.999595 | 3.820648 | {
"github_metadata": {
"branch": "main",
"commit_count": 9932,
"repo_created_at": "2015-01-21T20:10:37.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 322,
"forks": 101,
"issues": 92,
"pull_requests": 25
},
"file_meta": {
"content_id": "e839... |
1c825fe9-04a1-4763-b187-78fe2b3c8472 | chuanEgg/codes | Sprout/s80.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+5;
int a[maxn], tr[maxn*4];
int combine(int a, int b){
return min(a,b);
}
void build(int idx, int l, int r){
if(l == r){
t... | ALGO | 0.999979 | 5.35622 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2022-05-18T11:32:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "01d848cfa... |
c666c38d-0b67-4eb3-9e73-dc10e7dde5d3 | ZigengWang/HOS | src/main_bispectrum_best_mem.cc | #include <iostream>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <complex>
#include <fftw3.h>
#include "debug_hosa.h"
#include "config.h"
using namespace std;
#ifdef DEBUG_MODE
#include <sys/resource.h>
#endif
enum TYPE {REAL, IMAG};
// read only the first series
void ReadData(string& in_fil... | ALGO | 0.999667 | 4.770047 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-08-29T15:10:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "728141bebb... |
97b9e2ec-5edb-406f-a2ad-e2abce47862b | oceanbase/oceanbase | src/storage/lob/ob_lob_retry.cpp | /**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BAS... | ALGO | 0.939515 | 6.932462 | {
"github_metadata": {
"branch": "develop",
"commit_count": 18841,
"repo_created_at": "2021-05-31T14:36:17.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9275,
"forks": 1759,
"issues": 441,
"pull_requests": 77
},
"file_meta": {
"content_id"... |
4bec6a81-e77d-420b-a355-7513b0d64044 | akash4-sys/DSA | Leetcode/Medium/59.cpp | #include "../../headers.h"
class Solution
{
int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
public:
vector<vector<int>> generateMatrix(int n)
{
int i = 0, j = -1, d = 0, x = 1, steps[2] = {n, n - 1};
vector ans(n, vector<int>(n, 0));
while (steps[d % 2])
{
f... | ALGO | 0.999975 | 5.461649 | {
"github_metadata": {
"branch": "main",
"commit_count": 272,
"repo_created_at": "2022-07-17T09:39:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1d67840f73... |
080d1bdc-afef-42a6-876b-74325b367657 | Anjiang-Wei/taco | legion/johnsonMM/taco-generated.cpp | #include "cblas.h"
#include "taco_legion_header.h"
#include "taco_mapper.h"
#define TACO_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
using namespace Legion;
typedef FieldAccessor<READ_ONLY,double,2,coord_t,Realm::AffineAccessor<double,2,coord_t>> AccessorROdouble2;
typedef ReductionAccessor<SumReduction<double>,true,2,coord... | ALGO | 0.999246 | 4.232215 | {
"github_metadata": {
"branch": "distal-pldi-2022",
"commit_count": 3362,
"repo_created_at": "2022-07-04T19:23:14.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "rohany/taco",
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"con... |
90a0b557-e5c9-4734-a05c-ced14436c740 | vesslanjin/OpenLB_v0.8 | src/complexDynamics/mrtLatticeDescriptors.hh | /* This file is part of the OpenLB library
*
* Copyright (C) 2006, 2007 <NAME>
* E-mail contact: <EMAIL>
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Pub... | TOOL | 0.909102 | 5.658227 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2016-06-08T02:22:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0370415c26... |
f4485ece-98f1-43cf-b838-58a4bc1437e6 | IvanNoritsin/OSMS | Lab 5/Lab5.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
vector<int> generate_random_packet(int size){
vector<int> packet;
for (int i = 0; i < size; i++){
packet.push_back(rand() % 2);
}
return packet;
}
vector<int> computeCRC(const vector<int>& packet, const vector<int>... | ALGO | 0.999031 | 5.023453 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2024-09-19T02:13:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "972cc06a0d... |
a65e9595-8a9b-49e6-9d7b-84d05a024da7 | Account1-Anurag/DSA-GFG | CP COURSE/Queue/Lecture01.cpp | #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <ioman... | ALGO | 0.99877 | 3.244769 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-06-10T18:26:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f62ba91ae141... |
39f8d90c-247c-4471-ab76-1abb6c4f93ec | Superm4n97/competetive-programming | Extra/LCA 02.cpp | #include <bits/stdc++.h>
#define pb(a) push_back(a)
#define ll long long int
#define scd(a) scanf("%d",&a)
#define mp(a,b) make_pair(a,b)
#define scl(w) scanf("%I64d",&w)
#define scdd(a,b) scanf("%d %d",&a,&b)
#define srt(a) sort(a.begin(),a.end())
#define... | ALGO | 0.999973 | 4.251648 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-12-16T18:34:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6e757d9ed... |
24b60c29-863c-4aa0-80c9-c5bcf81faa14 | bytendpixel/Leetcode-Solution | Most Stones Removed with Same Row or Column.cpp | class Solution {
public:
int removeStones(vector<vector<int>>& stones) {
int n = stones.size();
build(n);
for (int i = 0; i < n; i++) {
int r = stones[i][0], c = stones[i][1];
if (!row_first.count(r)) {
row_first[r] = i;
... | ALGO | 0.999361 | 5.413625 | {
"github_metadata": {
"branch": "main",
"commit_count": 1011,
"repo_created_at": "2024-06-30T18:16:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0dff421ac... |
811ee649-cc06-4eea-9515-a542a66c0a99 | benebsiny/PP-final | quicksort_std_thread.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <chrono>
#include <cmath>
#include <cstring>
#include "commons/helper.hpp"
int threadCount = 8;
int totalDepth = 3; // log2(8) = 3
ll n = 0;
int threshold = 5;
// Partition 函數
ll partition(std::vector<ll> &arr, ll low, ll high)
{
ll pivot = arr[high... | ALGO | 0.999734 | 5.101878 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2024-01-04T12:17:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3c38d9615... |
a006d2f5-1833-4e0f-90d3-ce6b2e2aad93 | wwwwodddd/Zukunft | luogu/P4838.cpp | #include <bits/stdc++.h>
using namespace std;
int p = 19260817;
void mul(int a[3][3], int b[3][3]) {
int w[3][3] = {};
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
w[i][j] = (w[i][j] + (long long)a[i][k] * b[k][j]) % p;
}
}
}
memcpy(a, w, sizeof w);
}
int F... | ALGO | 0.999976 | 4.364123 | {
"github_metadata": {
"branch": "master",
"commit_count": 206,
"repo_created_at": "2018-12-31T17:17:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6349943... |
56b62736-5afd-49a2-9bb5-fc842281e808 | gaurav-kc/Advanced_problem_solving | Assignment2/2019201045_Q2.cpp | #include<iostream>
#define LEFT 1
#define RIGHT 2
#define ROOT 0
using namespace std;
typedef struct no{
int val;
int height;
int left_count;
int right_count;
struct no* left;
struct no* right;
struct no* parent;
int child;
}n;
n* root;
int replace;
void print(n* root)
{
cout<<"\n"... | ALGO | 0.999974 | 3.368144 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-11-14T11:46:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae73172624... |
a90cd701-1fa9-4a33-8f61-4741842830bd | scottmcguire/libra-code | src/qchem/molint/Overlaps.cpp | /*********************************************************************************
* Copyright (C) 2015 <NAME>
*
* This file is distributed under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
* See th... | ALGO | 0.996869 | 5.109218 | {
"github_metadata": {
"branch": "master",
"commit_count": 264,
"repo_created_at": "2016-11-17T19:10:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a70f60e2... |
e670dff8-2bb3-486d-9a6c-8bdce09ce5b8 | smarttigerfly/CS106B_Assignment_2020Winter | CS106/Library/collections/priorityqueue.h | /*
* File: priorityqueue.h
* ---------------------
* This file exports the <code>PriorityQueue</code> class, a
* collection in which values are processed in priority order.
*
* @version 2020/09/12
* - simplify interface in preparation for install
* @version 2019/04/09
* - renamed private members with underscor... | TOOL | 0.9991 | 3.836961 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-01-26T13:45:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fe8fa902eb... |
16a8a68b-4b44-43b9-9255-59236e1065e6 | looneyd-rohit/SDE-Challenge | Stacks&Queues/Sum-Of-Subarray-Ranges.cpp | // Leetcode 2104
class Solution {
public:
long long subArrayRanges(vector<int>& nums) {
int n = nums.size();
stack<int> st;
st.push(-1);
long long ans = 0;
// to get the largest, maintain a non increasing sequence
nums.push_back(INT_MAX);
for(int i=0; i<=n; i... | ALGO | 0.999945 | 6.109962 | {
"github_metadata": {
"branch": "main",
"commit_count": 65,
"repo_created_at": "2023-06-05T14:32:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "36f8f17d6b7... |
21223454-6e09-4e2a-88b1-7f179cb9e413 | wym6912/ACM-ICPC_wym6912 | XDU/1062.cpp | //#define NOSTDCPP
#ifndef NOSTDCPP
#include <bits/stdc++.h>
#else
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstring>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>... | ALGO | 0.999862 | 3.439986 | {
"github_metadata": {
"branch": "master",
"commit_count": 363,
"repo_created_at": "2017-08-09T05:04:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e7c6b7aa... |
903dc9bb-39b3-41e2-80b9-aeda75415ed2 | Bhuvanmc/Code-Library | dynamic_programming/trapping_rain_water/trapping_rain_water.cpp | /*
Problem Description - https://leetcode.com/problems/trapping-rain-water/description/
Test Cases -
Input: [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
*/
#include<iostream>
#include<vector>
using namespace std;
int trapRainWater(int *arr, int n)
{
if(n < 3)
return 0;
vector<pair<int,int>>indexes;
... | ALGO | 0.999991 | 5.863419 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2022-04-08T17:05:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "932e02ecfb6... |
e440534a-d170-4256-985c-bfdc77fe5539 | dnbaker/sketch | include/blaze/blaze/math/UniUpperMatrix.h | //=================================================================================================
/*!
// \file blaze/math/UniUpperMatrix.h
// \brief Header file for the complete UniUpperMatrix implementation
//
// Copyright (C) 2012-2020 <NAME> - All Rights Reserved
//
// This file is part of the Blaze library. Y... | TOOL | 0.905237 | 6.513018 | {
"github_metadata": {
"branch": "main",
"commit_count": 1275,
"repo_created_at": "2016-11-21T19:41:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 155,
"forks": 14,
"issues": 6,
"pull_requests": 0
},
"file_meta": {
"content_id": "08d7c7... |
65d73a40-c83a-43af-bb3f-8c15f93bda61 | akshitkumar450/-cpp-codes | strings/anagram string.cpp | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
// anagram means to check permutaion of string and frequency should also be same
// O(nlogn)
bool anagram(string & s1,string &s2){
if(s1.length() !=s2.length()) return false;
// sort the strings and after sorting string will be in same order
... | ALGO | 0.999954 | 4.54668 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2021-05-30T15:50:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "316c99683... |
ff9e749f-0518-4e4b-8b5d-a3504261bf84 | devmourya44/DSA-Practice | Easy/Largest number with given sum/largest-number-with-given-sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return Largest Number
class Solution
{
public:
//Function to return the largest possible number of n digits
//with sum equal to given sum.
string largestNumber(int n, int sum)
{
strin... | ALGO | 0.999615 | 5.378298 | {
"github_metadata": {
"branch": "main",
"commit_count": 1516,
"repo_created_at": "2022-11-22T18:28:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0ff694ce... |
d0aea58f-889c-4431-a4be-604678538489 | e-n-f/dlib-face | swap.cpp | // Following:
//
// http://dlib.net/dnn_face_recognition_ex.cpp.html
// https://github.com/ageitgey/face_recognition/blob/master/face_recognition/api.py
// for vasprintf() on Linux
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <dli... | DATA | 0.972988 | 4.456384 | {
"github_metadata": {
"branch": "master",
"commit_count": 214,
"repo_created_at": "2018-07-29T19:19:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "82d9828b... |
58fdd016-8fca-4e00-8f77-68c19d92873c | Big0ak/singular-decomposition | svd.cpp | #include "svd.h"
SVD::SVD()
{
}
SVD::SVD(Solving solving)
{
}
SVD::~SVD()
{
}
bool SVD::solve(Matrix A, int n, int m, Matrix& U, Matrix& S, Matrix& V)
{
bool conjugate = false;
if (m > n)
{
A.transposition();
std::swap(n, m);
conjugate = true;
}
Matrix A_t(A);
std::vector<double> eigenvalues;
Mat... | ALGO | 0.999876 | 4.025468 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2024-03-23T12:22:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f3da568d... |
2d3d0823-02dd-46d0-8df7-dc637a03a3ae | Wild-Donkey/Code | Luogu/P4000-P4199/P4001_ICPC_Beijing_2006.cpp | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define Wild_Donkey 0
using namespace std;
inline unsigned RD() {
unsigned intmp(0);
char rdch(getc... | ALGO | 0.999954 | 3.25794 | {
"github_metadata": {
"branch": "main",
"commit_count": 182,
"repo_created_at": "2021-02-23T08:38:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "265a6b2cbb... |
f9b4c55b-2b93-4bbe-9971-fd58abc59b61 | Poseidon0070/Cryptography | RSA.cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {if (b == 0) return a; return gcd(b, a % b);}
double find(int phi){
for(int i = phi-1;i >= 1; i--){
if(gcd(phi,i) == 1) return i;
}
}
int main()
{
double p1,p2;
cout << "Enter the first prime number p1 : "; // 13
cin >> ... | ALGO | 0.999993 | 5.087064 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2023-11-24T08:54:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0669132a11... |
db23dfa5-5f20-420c-ae3b-2b203879b93e | hgoose/leetcode | cat/trees/diameter/main.cc | #include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <unordered_map>
#include <queue>
#include <utility>
#include <cmath>
#include <bitset>
#include <array>
#include <map>
#include <limits>
#include <numeric> // std::accumulate
#include <climits> // INT_MAX, INT_MIN, ...
#include <tuple>
... | ALGO | 0.999575 | 5.703085 | {
"github_metadata": {
"branch": "master",
"commit_count": 68,
"repo_created_at": "2025-01-24T15:55:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "37321d8bd... |
bf405866-c481-490d-ac09-030b7bcad0da | CEA-LIST/Cingulata | tests/old_bfv/wiretap/wiretap.cxx | /*
(C) Copyright 2017 CEA LIST. All Rights Reserved.
Contributor(s): Cingulata team (formerly Armadillo team)
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under t... | ALGO | 0.998843 | 3.649795 | {
"github_metadata": {
"branch": "master",
"commit_count": 273,
"repo_created_at": "2017-11-14T14:42:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 407,
"forks": 42,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "7fcd3e... |
bc5390dd-e7fb-476d-a9e6-aeb41461653b | AreHumphrey/FEFU_1st-course | 2_semester/OAiP/Cats/09B.cpp | #include <fstream>
#include <stack>
#include <vector>
#include <bitset>
const int MAXN = 100005;
int n, m;
std::vector<int> g[MAXN];
std::bitset<MAXN> used;
void dfs(int v) {
std::stack<int> s;
s.push(v);
used[v] = true;
while (!s.empty()) {
int u = s.top();
s.pop();
for (int ... | ALGO | 0.999763 | 4.196408 | {
"github_metadata": {
"branch": "master",
"commit_count": 391,
"repo_created_at": "2022-12-28T13:17:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0b0a537f... |
c9aa5742-443a-4331-a437-d48d4f3ba3b5 | hadam1011/DSA-PTIT | DSA07013.cpp | #include <bits/stdc++.h>
using namespace std;
#define tests() int t; cin >> t; while (t--)
#define For(i,a,b) for(int i=a; i<b; i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FORD(i,a,b) for(int i=a; i>=b; i--)
#define ForD(i,a,b) for(int i=a; i>b; i--)
typedef long long ll;
int n, m;
int MOD = 1e9 + 7;
i... | ALGO | 0.999965 | 4.226557 | {
"github_metadata": {
"branch": "main",
"commit_count": 324,
"repo_created_at": "2022-02-09T12:33:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a792616e2... |
906ebda0-817f-4172-a5d2-192e05a7346f | listenviolet/Lab | leetcode/239-Sliding-Window-Maximum-monotonic-queue-value.cpp | class Solution{
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k)
{
deque<int> q;
vector<int> ans;
for(int i = 0; i < nums.size(); ++i)
{
while(!q.empty() && nums[i] > q.back()) q.pop_back();
q.push_back(nums[i]);
const int s = i - k + 1;
if(s < 0) continue;
ans.push_back(q.fron... | ALGO | 0.9999 | 6.363931 | {
"github_metadata": {
"branch": "master",
"commit_count": 330,
"repo_created_at": "2018-02-07T08:33:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1db547d1... |
1cb4ee52-a2ea-442a-9db1-8eb27b0056d3 | fallowu/slim_hardware_qcom_media | mm-video/vidc/vdec/src/omx_vdec.cpp | /*--------------------------------------------------------------------------
Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source... | TOOL | 0.933602 | 4.629532 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2013-08-28T13:36:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3601185ab7... |
ac5634e5-1b61-4687-bc18-9af1b655b75a | alexandraback/datacollection | solutions_5669245564223488_0/C++/Omelianenko/b.cpp | #include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<vector>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define l first
#define r second
#define mp make_pair
#define ll long long
#define pb push_back
#define bro pair<int, int>
#define all(a) (a).begin(), (a).end()
co... | ALGO | 0.999934 | 3.329064 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3a594c581... |
d89dec7a-b657-465c-b9a0-779a4f4b2961 | jjwdi0/PS-Library | contest/olympiad/JOI/2020_B.cpp | #include <bits/stdc++.h>
#define kill() return puts("-1"),0
using namespace std;
using pr = pair<int, int>;
int N, K;
char A[200005];
deque<int> dq[3];
int main() {
scanf("%d %d %s", &N, &K, A + 1);
for(int i=1; i<=N; i++) {
if(A[i] == 'J') dq[0].push_back(i);
if(dq[0].size() == K) break;
}
if(dq[0].size() !=... | ALGO | 0.999914 | 3.408187 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2020-11-27T11:16:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8a3677334... |
535232e6-78ad-4ba9-b00c-79ccc35a2775 | mlebeur/merlin | merlin/TreeFlips.cpp | //////////////////////////////////////////////////////////////////////
// merlin/TreeFlips.cpp
// (c) 2000-2007 <NAME>
//
// This file is distributed as part of the MERLIN source code package
// and may not be redistributed in any form, without prior written
// permission from the author. Permission is grante... | ALGO | 0.963871 | 4.999681 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-01-11T13:04:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "e39e57dcd3... |
74222106-ff23-42ab-bd52-7bfc795f936e | lk2023060901/aether | framework/net/http/http_server.h | #pragma once
#include "http_types.h"
#include "http_parser.h"
#include "http_builder.h"
#include "../core/asio_base.h"
#include "../asio/tcp_acceptor.h"
#include <asio.hpp>
#include <memory>
#include <functional>
#include <unordered_map>
#include <vector>
#include <regex>
#include <thread>
#include <mutex>
namespace ... | WEB | 0.965508 | 7.187764 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-07-11T19:20:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4a282d7df5fe... |
6a601f43-8a46-43a3-a063-25e351698564 | nunezraul/flightsimulator6 | gsim/gs_mat.cpp | /*=======================================================================
Copyright 2010 <NAME>. All Rights Reserved.
This software is distributed for noncommercial use only, without
any warranties, and provided that all copies contain the full copyright
notice licence.txt located at the base folder of the ... | ALGO | 0.993302 | 5.565997 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2015-12-02T02:52:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad144a674... |
f42dbb0e-18db-4c6c-a961-200491501d7a | violinmulya/Program-CPP_TLS24 | main.cpp | 2/*
NAMA : <NAME>
NIM : XX/XXXXXX/AA/XXXXX
TUGAS : Big Scene - TLS 2024
JUDUL : Kalkulator Sederhana
*/
// LIBRARIES/PUSTAKA YANG DIGUNAKAN
#include <iostream> // Untuk input dan output.
#include <cmath> // Untuk fungsi aritmetika seperti pow, sqrt, round, dan sebagainya.
#include <ioma... | ALGO | 0.991061 | 5.738565 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-09-14T03:46:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae3e7125583b... |
6cdd8757-590f-48c7-933f-c65a050e40b8 | nktkr/Cpp-Beginner-Level-Programs | 3-Patterns/10-Program-to-print-INDIA-pattern.cpp | // Program to print INDIA Pattern using "INDIA" string and loops
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string anystring="INDIA";
for (int i = 0; i < anystring.size(); i++)
{
for (int j = 0; j <= i; j++)
{
cout << anystring[j];
}
cout << "\n";
}
r... | ALGO | 0.996393 | 5.485751 | {
"github_metadata": {
"branch": "master",
"commit_count": 49,
"repo_created_at": "2023-03-06T03:49:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "daa0320ff... |
0fff589f-16e4-4211-b59c-e84eff168b0e | Marlin-Phone/code | c/C语言/文件打开关闭练习.cpp | #include <stdio.h>
int main() {
int i, j, m;
int num[10];
FILE *fp;
fp = fopen("shuju.txt", "r");
if (fp == NULL) {
printf("无法打开输入文件\n");
return 1;
}
for (i = 0; i < 10; i++) {
fscanf(fp, "%d", &num[i]);
}
fclose(fp);
for (i = 0; i < 9; i++) {
... | ALGO | 0.999911 | 3.544319 | {
"github_metadata": {
"branch": "main",
"commit_count": 179,
"repo_created_at": "2025-01-09T06:37:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "917d8811f4... |
d7902c32-d961-4fae-b560-d72b4e51c822 | architjain2002/DSA-Notes | Arrays/38.1.Best_time_to_buy_and_sell_stocks_II_recursion.cpp | class Solution
{
public:
int find(int ind, vector<int> &v, bool buy)
{
if (ind >= v.size())
return 0;
if (buy) // if we are buying then next time we will sell else next time we will buy
{ //-prices[i], because bought stock of prices[i], expend money, !buy because next... | ALGO | 0.999991 | 5.264589 | {
"github_metadata": {
"branch": "master",
"commit_count": 329,
"repo_created_at": "2022-06-30T15:12:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b40bddd1... |
b8bce6df-4339-4e27-8576-c90e973e2114 | samuelm2/Samupath | Samupath/BVHAccelerator.cpp | #include "pch.h"
#include "BVHAccelerator.h"
#include "MidpointComparer.h"
#include <iostream>
BVHBuildNode * BVHAccelerator::recursive_build(std::vector<BVHObjectInfo>& build_data, int start, int end, int * total_nodes, std::vector<GeometricObject*>& ordered_objs)
{
(*total_nodes)++;
BVHBuildNode *node = new BVHBu... | ALGO | 0.989347 | 5.141369 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-03-29T05:09:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "851346d42... |
5aa8b8db-1758-4c6c-a12c-75c358d9bae7 | EasyGenon/structurki | sortings/sortings/shaker_sort.cpp | #include "shaker_sort.h"
template <typename T>
void shaker_sort(T arr[], int size) {
bool swapped = true;
int start = 0;
int end = size - 1;
while (swapped) {
swapped = false;
for (int i = start; i < end; ++i) {
if (arr[i] > arr[i + 1]) {
T temp = arr[i];
... | ALGO | 0.999729 | 5.505465 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-11-20T09:30:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7bc829ecb3ac... |
7d4fc22e-6159-4ad1-b646-3f506c6fa0b5 | KimYehyun/Algorithm | 백준/Silver/28471. W키가 빠진 성원이/W키가 빠진 성원이.cc | #include <iostream>
#include<queue>
#include<string.h>
using namespace std;
int n, Fx, Fy, cnt;
int dx[7] = { 0,-1,0,-1,-1,1,1 }; //1
int dy[7] = { 1,0,-1,1,-1,1,-1 }; //0
char arr[2001][2001];
bool visited[2001][2001];
void bfs(int i, int j) {
queue<pair<int, int>>q;
visited[i][j] = 1;
q.push({ i,j });
... | ALGO | 0.999624 | 4.323312 | {
"github_metadata": {
"branch": "master",
"commit_count": 693,
"repo_created_at": "2023-04-03T08:53:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "210caba1... |
8bab3173-529a-42ea-8408-34fb33c2b775 | JacobianDet/CompeteUp | 530/stree.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp std::make_pair
typedef long long ll;
std::vector<int> G[100001];
ll mdx[100001], gx[100001];
bool dfs_vis1(int s, int p)
{
bool ax = 1;
if(p != -1)
{
if((gx[s] != -1) && (gx[s] < mdx[p]))
ax = 0;
mdx[s] = std::max(mdx[p], gx[s]);
}
if(gx[s] >= 0)
... | ALGO | 0.999862 | 3.438647 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2018-08-04T16:37:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "3740840648... |
78a4dda1-2f2e-4f2e-a8a9-cb05f80b0e95 | conradsoon/competitive_programming | codeforces/round743/A_Countdown.cpp |
#include <bits/stdc++.h>
using namespace std;
//TYPEDEFS
typedef long int l;
typedef unsigned long int ul;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> v... | ALGO | 0.99959 | 4.161743 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2021-06-07T07:44:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6f452655... |
4c081929-0a35-4c31-bcf6-22de6d4580cc | QianMo/GPU-Pro-Books-Source-Code | GPU-Pro-1/03_Rendering Techniques/02_NPReffectsusingtheGeometryShader/NPRGS/TriMesh/src/TriMesh_bounding.cc | /*
<NAME>
Princeton University
TriMesh_bounding.cc
Bounding box and bounding sphere.
*/
#include <stdio.h>
#include <float.h>
#include "TriMesh.h"
#include "bsphere.h"
// Find axis-aligned bounding box of the vertices
void TriMesh::need_bbox()
{
if (vertices.empty() || bbox.valid)
return;
dprintf("Computing b... | TOOL | 0.983159 | 5.408524 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2018-04-25T02:50:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 688,
"forks": 349,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "06050... |
24760b6b-ec18-458f-ab4a-48ea10a1c6ec | natanalmeida03/competitive-programming | codeforces/Round_952/d.c++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define pb push_back
#define F first
#define S second... | ALGO | 0.999923 | 3.392726 | {
"github_metadata": {
"branch": "main",
"commit_count": 83,
"repo_created_at": "2023-04-12T21:35:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a29e7cf838f... |
887f843e-3949-4c28-a5c6-83bbfadfe3db | EPFL-LAP/dynamatic | lib/Transforms/ArithReduceStrength.cpp | //===- ArithReduceStrength.cpp - Reduce stregnth of arith ops ---*- C++ -*-===//
//
// Dynamatic is under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------... | ALGO | 0.97183 | 6.2745 | {
"github_metadata": {
"branch": "main",
"commit_count": 962,
"repo_created_at": "2022-11-28T13:54:10.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 124,
"forks": 34,
"issues": 60,
"pull_requests": 28
},
"file_meta": {
"content_id": "a886b4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.