uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c34e9a8b-4e34-4b99-9322-8e178a5578a2 | PunnyOz2/POSN-Programming | Camp 2/PT_Town center.cpp | /*
TASK:
LANG: CPP
AUTHOR: Pun~
SCHOOL: CRU
*/
#include<bits/stdc++.h>
using namespace std;
struct A{
int i,j,w;
bool operator<(const A&o)const{
return w>o.w;
}
};
priority_queue<A> q;
int p[1010],cou[1010];
int fin(int i){
if(p[i]==i)return i;
return p[i]=fin(p[i]);
}
int ma... | ALGO | 0.999971 | 3.607019 |
648f9b8c-2156-4866-b85f-a0256d1bc1c5 | DigvijayMane21/cpp_programming | DSA Expression conversion.cpp | #include<iostream>
#include<stdlib.h>
#define maxSize 10
using namespace std;
int indx=-1;
string arr[maxSize+1];
void push(string k)
{
if(indx==maxSize)
{
cout<<"Overflow."<<endl;
}
else
{
arr[++indx]=k;
}
}
string pop()
{
if(indx==-1)
{
cout<<"Underflow."<<en... | ALGO | 0.999808 | 3.865248 |
38c506fd-11bc-47f1-ab43-2cb9a3f77867 | windun/CSC718 | integral/integral.cpp | #include <iostream> // cout
#include <mpi.h>
#include <stdlib.h> // malloc
#define INTERVALS 1000000
int main (int argc, char* argv[])
{
// Actually, just let each part calculate the
// range that they will be using. For now, let
// assume a range of 0.0 - 1.0 and 1000000 intervals
// use the rank to determine ... | ALGO | 0.999756 | 4.850623 |
96af90e2-9a86-41b9-abde-06f3f428d7df | mmmine/pta_basiclevel | 1049.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int n;
cin>>n;
double num[100001];
for(int i=0;i<n;i++){
cin>>num[i];
}
double sum=0;
for(int i=0;i<n;i++){
sum = sum + ((i+1)*num[i]*(n-i));
}
cout<<setiosflags(ios_base::fixed)<<setprecision(2)<<sum<<endl;
return 0;
} | ALGO | 0.999741 | 3.827768 |
f49253df-c363-450f-8de1-c369bfbd7b21 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/tc_generated_progs_cpp/p02577/p02577_num5_parsed.cpp | #include <iostream>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for (auto a : S) ans += a - '0';
cout << ((ans % 9 == 0) ? "Yes" : "No") << "\n";
}
| ALGO | 0.999882 | 4.390884 |
9b778115-112b-41a2-8115-3963394d22d7 | dlcgold/rlpbwt | lib/rlpbwt_bv.cpp | //
// Created by dlcgold on 28/01/22.
//
#include "../include/rlpbwt_bv.h"
rlpbwt_bv::rlpbwt_bv(const char *filename, bool verbose) {
std::ifstream input_matrix(filename);
if (input_matrix.is_open()) {
std::string header1;
std::string header2;
std::string line;
std::string garb... | DATA | 0.983529 | 4.415613 |
414b2009-ea61-4d11-a971-50dd7d174945 | jdw1042710/AlgorithmStudy | 2342.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> Feet;
int N;
const int INF = 400001;
vector<vector<int>> cache;
vector<int> steps;
int GetStepCost(int cur, int next)
{
if(next == 0) return 0;
if(cur == next) return 1;
if(cur == 0) return 2;
if(abs(cur - next) == 2) ... | ALGO | 0.999931 | 3.87484 |
75b697e8-cd76-459b-86b6-808cb578cc2d | ravikiranbvn/repobvn | cpp/stl/Concurrency/FooBar_leet.cpp | #include <iostream>
#include <functional>
#include <thread>
#include <mutex>
#include <condition_variable>
using namespace std;
void printFoo() {
cout << "foo";
}
void printBar() {
cout << "bar";
}
class FooBar {
public:
FooBar(int n) {
m_times = n;
m_turn = 0;
}
... | TOOL | 0.970112 | 6.111236 |
ef5d6cd1-a890-48e0-85b3-98d03d90fc31 | shl0402/Solitaire-Game | move.cpp | #include "card.h"
#include "move.h"
#include <vector>
#include <iostream>
using namespace std;
// Function to flip the stock deck, i.e. table[7], the next card not shown will be shown, if there is more than 3 cards shown, the prev >3 cards will be hidden
// Input: vector<vector<Card> > &table, the cards in the game t... | ALGO | 0.987009 | 3.945162 |
21e254ee-6916-4916-b981-8e5c498e656e | zzalscv2/MERLIN_2017 | Merlin/BeamDynamics/ParticleTracking/CouplerWakeFieldProcess.cpp | #include "BeamDynamics/ParticleTracking/CouplerWakeFieldProcess.h"
#include "BeamDynamics/ParticleTracking/ParticleBunch.h"
#include "BeamDynamics/ParticleTracking/ParticleBunchUtilities.h"
#include "AcceleratorModel/StdComponent/SWRFStructure.h"
#include "AcceleratorModel/StdComponent/TWRFStructure.h"
#include "Accel... | TOOL | 0.948674 | 5.442603 |
fc8cb2f2-e4de-4edd-bb51-6d102f6d91a0 | AnantTirupati/DSA | functions/add3.cpp | #include <iostream>
using namespace std;
void printSum(int a, int b, int c){
int sum = a+b+c;
cout << "Sum is: " << sum << endl;
}
int main(){
printSum(3,4,7);
return 0;
} | TOOL | 0.978139 | 4.080555 |
079db989-2e62-4f2c-9d70-ac83a25aa507 | Gurmeet-Singh657/LeetCode-GFG | Seating Arrangement - GFG/seating-arrangement.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
bool is_possible_to_get_seats(int n, int m, vector<int>& seats){
int count=0;
for(int i=0;i<m;i++)
{
... | ALGO | 0.999857 | 6.626249 |
04cc251b-0b03-4c37-99d8-db6a0150a5d8 | iammarajul/competitive_programming | Codeforecs/934B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
cin>>x;
if(x>36)
cout<<-1<<endl;
else
{
if(x%2==0)
{
for(int i=0;i<x/2;i++) cout<<"8";
}
else
{
for(int i=0;i<x/2;i++) cout<<"8";
cout<<"6";
}... | ALGO | 0.999699 | 4.175655 |
db1193a5-0244-4afe-afd0-33acce732ae2 | KishanDESE/Edge_AI | Annamolly detection in Arduino/kmeans_1d/kmeans.cpp | #include <Arduino.h>
//////////////////////////////////////////////////////////////////////////////////
// University: Indian Institute of science
// Course: Edge AI
//
// Create Date: 16.04.2024 07:17:59
// Design Name: Anomaly detection using kmeans
// Module Name: kmeans.h
// Project Name: Anomaly detection liabr... | ALGO | 0.994495 | 4.797926 |
60eb809c-2d8c-4e4a-a473-d00ddea073a3 | ryan-vanostrand/ryan-vanostrand.github.io | assets/Server and Banker/Server.cpp | #include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "CV.h"
#include "Lock.h"
#include "Server.h"
Server::Server(){
//seeding our random function.
srand(time(NULL));
for(int i = 0; i < philosophers; i++){
max[i] = rand() % (initialChopsticks - 1... | ALGO | 0.996204 | 3.881867 |
96861626-a303-4990-9831-3fb39e3b67fd | Zoe305/Algorithm | BOJ/1158.cpp | #include <iostream>
#include <queue>
using namespace std;
queue<int>yo;
int main(){
int N, K;
cin >> N >> K;
for(int i = 1; i <= N; i++) yo.push(i);
cout << "<";
while(yo.size() > 1){
for(int i = 1; i < K; i++){
int val = yo.front();
yo.pop();
yo.push(... | ALGO | 0.999983 | 3.551187 |
bf9fb3e7-aeab-4d9c-b303-deb59685b9f5 | heydi20/MOVIII-DRAWER-izquierda | 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 |
61555f05-ccc8-4d04-ba84-a2f3a6ba16b3 | copskim/LeetCode | GitHubCPPS/1207UniqueNumberOfOccurrences.cpp | class Solution {
public:
bool uniqueOccurrences(vector<int>& arr) {
unordered_map<int, int> occBrd;
sort(arr.begin(), arr.end());
int occCnt = 0;
for (int i = 0; i < arr.size(); i++) {
occCnt++;
if ((i + 1) >= arr.size()) {
if (occBrd.find(occC... | ALGO | 0.999872 | 6.00422 |
d7816f7a-a89a-411f-a1db-75d2e55ceead | Deserve82/KK_Algorithm_Study | Keonwoo/BOJ_15685_드래곤커브.cpp | #include <iostream>
#include <vector>
using namespace std;
using pii = pair<int, int>;
int n, map[101][101];
const int dy[] = { 0, -1, 0, 1 };
const int dx[] = { 1, 0, -1, 0 };
void draw(int y, int x, int dir, int target) {
vector<pii> vec;
int end_y = y + dy[dir], end_x = x + dx[dir];
map[end_y][end_x] = 1;
... | ALGO | 0.999661 | 4.730076 |
c8dfb414-8276-41c5-a980-1ffbb23a7093 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt4/Codenet/p02400/590715155/response_7.cpp | #include <iostream>
using namespace std;
int main() {
const double PI = 3.141592653589;
double r;
cin >> r;
double pi_r = PI * r;
cout << pi_r * r << " " << 2 * pi_r << "\n";
return 0;
} | ALGO | 0.979075 | 3.759724 |
5c8db383-838c-4f86-bd1b-29f201979788 | 2013612/CP-algorithm | AtCoder/abc368/abc368C.cpp | #include<iostream>
using namespace std;
int n, a[200006];
long long ans;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
ans += a[i] / 5 * 3;
int x = a[i] % 5;
while (x > 0) {
ans++;
if (ans % 3 == 0) {
x -= 3;
} else {
x--;
}
}
}
printf("%lld\n",... | ALGO | 0.99992 | 3.610766 |
56a7f309-b3da-4e9a-a45f-c23b258175ac | muaytau/zkprover | obsolete/keccak2/keccak2_rho.cpp | #include "keccak2_state.hpp"
/*
Keccak-f Rho permutation.
Steps:
1. For all z such that 0 ≤ z <w, let A′ [0, 0, z] = A[0, 0, z]
2. Let (x, y) = (1, 0)
3. For t from 0 to 23:
a. for all z such that 0 ≤ z <w, let A′[x, y, z] = A[x, y, (z – (t +1)(t + 2)/2) mod w]
b. let (x, y) = (y, (2x + 3y) mod 5)
4. Return A′... | ALGO | 0.999582 | 5.400963 |
d68b7558-4e18-4410-b30b-c91b01591e96 | Will-Tsang422/ustc-2023-robogame-cyberminer | source/Src/avoid_obstacle.cpp | #include "../Inc/avoid_obstacle.hpp"
void detect_obstacle(Mat& img)
{
//if (temp.empty())
//{
// cout << "图片加载失败" << endl;
// return Rect();
//}
Size origin_size = img.size();
Size shrink_size = img.size();
Size best_size;
double ks = 1.1;
Mat result;
Mat shrink = img.clone();
double minVal, maxVal, maxall... | ALGO | 0.996877 | 3.797295 |
fe84e4b1-48f7-47e6-a47a-05f7b25840aa | echo1999/FHEtool | openfhe-development/src/pke/lib/scheme/bgvrns/bgvrns-pke.cpp | /*
BGV implementation. See https://eprint.iacr.org/2021/204 for details.
*/
#define PROFILE
#include "cryptocontext.h"
#include "scheme/bgvrns/bgvrns-cryptoparameters.h"
#include "scheme/bgvrns/bgvrns-pke.h"
namespace lbcrypto {
DecryptResult PKEBGVRNS::Decrypt(ConstCiphertext<DCRTPoly> ciphertext, const PrivateKe... | ALGO | 0.972216 | 6.307876 |
7fb69813-535d-405e-bc36-2bc768220330 | PetterS/easy-IP | third-party/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.995336 | 4.26067 |
895ea0b9-27a9-42ff-b3bb-160786a38c46 | Githubiswhat/LeetCode | C++/src/Solution701_800/Solution721.cpp | //
// Created by windows on 2023/3/2.
//
#include "Solution721.h"
#include <functional>
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;
vector<vector<string>> accountsMerge(vector<vector<string>>& accounts) {
int n = accounts.size();
u... | ALGO | 0.999687 | 5.919822 |
8eb05dfe-cd52-4935-a1ce-1544743f84af | rishabh-in/DSA | Lecture 3 (Patterns)/pattern1.cpp | // Pattern 1
// ☆☆☆
// ☆☆☆
// ☆☆☆
#include<iostream>
using namespace std;
int main() {
int i = 1;
int n;
cin>>n;
while(i <= n) {
int j = 1;
while(j <= n) {
cout<<"☆";
j++;
}
cout<<endl;
i++;
}
} | ALGO | 0.99981 | 3.524785 |
a3fda6cb-c33d-4944-b54e-98cb07574f5d | shwetanknaveen/OnlineCoding | Leetcode/Contests/Randoms/Weekly 255/Minimize the Difference Between Target and Chosen Elements.cpp | //Problem link - https://leetcode.com/problems/minimize-the-difference-between-target-and-chosen-elements/
class Solution {
public:
int nRow,nCol;
int solve(int row,int sum,vector<vector<int>> &mat,int &target,vector<vector<int>> &dp)
{
if(row>=nRow) return abs(sum-target);
if(dp[r... | ALGO | 0.999997 | 5.877598 |
b8af5615-cdf5-469c-8be0-1a587b77c512 | yeh-sudo/Leetcode | 34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
if ((int)nums.size() == 0){
return {-1, -1};
}
int l = 0, r = (int)nums.size() - 1;
int idx1 = -1, idx2 = -1;
while (l <= r){
int mid = l + (r - l) / 2;
if (n... | ALGO | 0.999952 | 6.572467 |
dad0b0f6-8c75-41b1-b96a-cd466de5aead | jeyan-s/Competitive-Programming-Solutions | Codefores Solutions/2023-09-24-Educational Codeforces Round 155 (Rated for Div. 2)/B-Chips on the Board.cpp | // Link to Problem Statement
// https://codeforces.com/contest/1879/problem/B
#include <bits/stdc++.h>
using namespace std;
int main()
{
int test_case; cin >> test_case;
while (test_case--)
{
long long n, s1 = 0, s2 = 0, m1 = int(1e10), m2 = int(1e10), rslt = 0; cin >> n;
vector<long long> l... | ALGO | 0.999988 | 3.965219 |
f73c5a3f-5168-41b8-a09e-668cd099b5f7 | uvansh/DSA_Questions | Hashing(Hash Table)/SubWithSum.cpp | #include<iostream>
#include<unordered_set>
using namespace std;
bool sumWithSub(int arr[],int size,int sum){
for(int i = 0;i<size;i++ ){
int curr_sum = 0;
for(int j = i;j<size;j++){
curr_sum +=arr[j];
if(curr_sum==sum){
return true;
}
}
... | ALGO | 0.999936 | 5.410036 |
7d7d98ee-ff23-4688-b30a-16b297eb2f2a | mengjin-su/p16ecc | cc_source_9.1/p16e/pic16e5.cpp | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <time.h>
#include "../common.h"
extern "C" {
#include "../cc.h"
}
#include "../sizer.h"
#include "../pcoder.h"
#include "../display.h"
#include "pic16e.h"
#include "pic16e_asm.h"
#include "pic16e_reg.h"
#include "pic16e_inst.h"
voi... | TOOL | 0.935246 | 3.087429 |
7b4d5631-53d5-410f-82a1-2ab6aaafe6f7 | AlePatata/GatasOnly-cheatsheet | graphs.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> pli;
const int INF = 1e9;
/* BFS Busqueda a lo ancho
necesita:
grafo vector<int> graph
nodo inicial a partir del cual recorrer el grafo
*/
int BFS(int begin) {
vector<int> ... | ALGO | 0.999762 | 4.659214 |
649598ff-7d38-4685-a0c0-c9901c08be0a | UCTECHIP/PortComputeLibrary | ComputeLibrary/src/core/NEON/kernels/NEGEMMMatrixMultiplyKernel.cpp | #include "arm_compute/core/NEON/kernels/NEGEMMMatrixMultiplyKernel.h"
#include "arm_compute/core/AccessWindowStatic.h"
#include "arm_compute/core/CPP/Validate.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/IAccessWindow.h"
#include "arm_compute/core/ITensor.h"
#... | ALGO | 0.99229 | 6.066181 |
4c8a4a93-1fc5-4fef-ba9e-43ddf85b8458 | vrandakoolwal/Hacker-earth-Problems | Basics-of-Input-Output/LiftQueries.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a=0, b=7;
int t;
cin >> t;
int n;
for (int i=1; i<=t; i++)
{
cin>>n;
if (abs(a-n)<abs(b-n))
{
cout<<"A \n";
a=n;
}
else if (abs(a-n)>abs(b-n))
{
cout<<"B \n";
b=n;
}
else if (abs(a-n)== abs(b-n))
{
if (a<... | ALGO | 0.999947 | 3.526206 |
dba8f88f-12dd-4d9c-80eb-9b6236221718 | itsprinceraj/LogicHub | Arrays/searchingAlgos/linearSearch/findMax.cpp | #include <iostream>
#include <limits.h>
using namespace std;
// create function for finding max num;
int findMax(int arr[], int size)
{
// without using max and INT_MIN;
// int max = arr[0];
// for (int i = 0; i < size; i++)
// {
// if (max < arr[i])
// {
// max = arr[i];... | ALGO | 0.997112 | 4.248193 |
446e8294-decb-4617-9d9b-955aadf6b9eb | Abdelrhmankaram/PS_temp | main.cpp | #include<bits/stdc++.h>
#ifdef _MSC_VER
#define __builtin_popcount __popcnt
#define __builtin_clz __lzcnt
#endif
#define ll long long
#define all(x) x.begin(), x.end()
#define cin(vector) for(auto& i : vector) cin >> i
#define copy(x) copy(x.begin(), x.end(), ostream_iterator<ll>(cout," "))
#define ll long long
#
#d... | ALGO | 0.999862 | 3.752863 |
f4ec807e-54a7-4800-a7fb-536fd8029e7b | PTD504/DSA_Practice | DSA_Sheet_Love_Babbar/CountInversions.cpp | /*
###########################################
Source: GeeksforGeeks
Problem statement:
Given an array of integers. Find the Inversion Count in the array. Two array elements arr[i] and arr[j] form an inversion if arr[i] > arr[j] and i < j.
Inversion Count: For an array, inversion count indicates how far (or close) t... | ALGO | 0.999924 | 5.889144 |
68af2a08-7075-49c9-a762-a9c3bc1447fb | RafaelChavesPB/CompetitiveProgramming | codeforces_great_graphs.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<long long> arr(n);
vector<long long> diff;
long long ant = 0;
for(auto &it: arr)
cin>>it;
sort(arr.begin(),arr.end());
for(au... | ALGO | 0.999951 | 4.054792 |
73f5510d-06ea-415e-a288-6158d0f96de6 | umaidansari12/CP_Backup | previous_codes/breaking_bricks.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios_base :: sync_with_stdio(false);
//cin.tie(NULL);
//cout.tie(NULL);
int T;
cin >> T;
while (T--)
{
int s, w1, w2, w3;
cin >> s >> w1 >> w2 >> w3;
}
return 0;
} | ALGO | 0.996236 | 3.473917 |
be4dbace-9e9a-4d5f-b574-d09cf9961389 | ishandutta2007/codeforces | cheissmart/normal/952/C.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
bool ok = 1;
for(int i = 0; i + 1 < n; i++){
if(abs(a[i] - a[i+1]) >= 2)
ok = 0;
}
cout << (ok ? "YES" : "NO") << endl;
} | ALGO | 0.999979 | 3.873356 |
26fb1f2a-0d97-4124-92bd-5f67454074bd | MOCAP/MOCAP | Code/Reference_libs/qwt-6.1.0/src/qwt_raster_data.cpp | #include "qwt_raster_data.h"
#include "qwt_point_3d.h"
class QwtRasterData::ContourPlane
{
public:
inline ContourPlane( double z ):
d_z( z )
{
}
inline bool intersect( const QwtPoint3D vertex[3],
QPointF line[2], bool ignoreOnPlane ) const;
inline double z() const { return d_z; }
... | ALGO | 0.918398 | 6.699402 |
fe688661-5642-47a6-affb-72c1ebf2a66d | tanntnny/como | posn2023/graph/ag_runloop.cpp | #include <bits/stdc++.h>
using namespace std;
// D L R U
const int di[] = {1, 0, 0, -1};
const int dj[] = {0, -1, 1, 0};
const char dc[] = "DLRU";
struct NODE{
int x, y, w;
};
queue<NODE> QU;
int A[66][1111][1111];
char C[1111][1111];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
i... | ALGO | 0.999955 | 3.898735 |
291ac98d-ff50-4aae-a59f-888f68759c89 | mmrs/UVA-SOLUTIONS | 673-Parentheses Balance .cpp | #include<stdio.h>
#include<stack>
#include<string.h>
using namespace std;
int main()
{
int i,t,flag,l;
char ar[130];
scanf("%d\n",&t);
while(t--)
{
stack<char>s;
flag=0;
gets(ar);
l=strlen(ar);
for(i=0; i<l; i++)
{
if(ar[i]=='(' || ar[i]=... | ALGO | 0.999666 | 3.410895 |
67ec5dd1-3587-4421-a090-1d841b0b93ce | AshishTiwari1203/Cpp-Coding | Heap/heapsort.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
class heap
{
public:
int arr[100];
int size;
heap()
{
arr[0] = -1;
size = 0;
}
void insert(int val)
{
size += size;
int index = size;
arr[index] = val;
// Now the code for sw... | ALGO | 0.999977 | 4.616822 |
70f8b17a-bce7-4683-84ea-6675ae6f4ef7 | grimmerk/casa | code/air_casawvr/src/tbutils.cpp | /**
\file tbutils.cpp
Bojan Nikolic <<EMAIL>>, <<EMAIL>>
Initial version May 2008
Maintained by ESO since 2013.
*/
#include "tbutils.hpp"
#include "basicphys.hpp"
namespace LibAIR2 {
double PlanckToRJ(double f,
double TPlanck)
{
const double I = BPlanck(f, TPlanck);
const double ... | ALGO | 0.986082 | 4.882834 |
396634f9-3e22-4a2c-b40a-d137fbe65ced | xcel24/ds-algo-c- | Udemy/Graphs/snakes_and_ladders.cpp | #include<bits/stdc++.h>
using namespace std;
class Graph{
int vertices;
unordered_map<int,vector<int>>connections;
public:
Graph(int v){
vertices = v;
}
void addEdge(int x,int y){
connections[x].push_back(y);
return;
... | ALGO | 0.999088 | 4.111174 |
79aa81c3-8168-4d81-8471-fad6605a7ded | vivek14581/Sheet_Solve | Day-3/Series-5.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int even = 1;
int odd = 2;
int sum = 3;
for(int i=2;i<n;i++)
{
if(i % 2 == 0)
{
even *= 3;
sum += even;
}
else
{
odd *= 3;
s... | ALGO | 0.999945 | 3.669679 |
9a4f5873-15db-45da-a8af-11a7ad819ca4 | mahmud006/Codeforces | CF-998A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin >> n;
ll arr[n];
for (ll i = 0; i < n; i++)
{
cin >> arr[i];
}
if (n == 1)
{
cout << -1 << endl;
}
else if (n == 2)
{
if (arr[0] != arr[1])
{
... | ALGO | 0.999949 | 3.729861 |
59fb31b5-b24d-4a77-aaf4-f3199719bfea | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1830_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
bool vis[2][2][N + 10];
int n, m;
long long cnt;
void dfs(int x, int y) {
if (x == 1)
vis[0][0][y] = 1;
else if (x == n)
vis[0][1][y] = 1;
else if (y == 1)
vis[1][0][x] = 1;
else
vis[1][1][x] = 1;
if (y + 1 <= m && x - 1 >= 1... | ALGO | 0.999949 | 3.164116 |
9b7974f0-b617-4ad4-a9c8-9a20231c4daa | oneskovic/CP-Problems | USACO/2018/Gold/milking_order.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> topological_sort(const vector<vector<int>>& graph)
{
int n = graph.size();
priority_queue<int,vector<int>,greater<int>> pq;
vector<int> in_degree(n);
for (int i = 0; i < graph.size(); i++)
for (int neigh... | ALGO | 0.999978 | 4.570349 |
2e6eff43-c5fa-4437-be4b-e4c6e8ff54ca | GoSSIP-SJTU/TripleDoggy | tools/clang/tools/extra/change-namespace/ChangeNamespace.cpp | using namespace clang::ast_matchers;
namespace clang {
namespace change_namespace {
namespace {
inline std::string
joinNamespaces(const llvm::SmallVectorImpl<StringRef> &Namespaces) {
if (Namespaces.empty())
return "";
std::string Result = Namespaces.front();
for (auto I = Namespaces.begin() + 1, E = Names... | TOOL | 0.931388 | 3.920524 |
163c6e56-1904-4684-8baf-e51b0a811a85 | ojhaChandu/Practice-Codes | interviewBit/divTwoInt.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long quotient = 0;
long long dividend;
long long divisor;
cin >> dividend;
cin >> divisor;
int sign = dividend < 0 ^ divisor < 0 ? -1 : 1;
divisor = abs(divisor);
// dividend = abs(dividend);
if(dividend == INT_MI... | ALGO | 0.999948 | 4.058477 |
3d41606e-05e1-4067-a965-87de537c9226 | CodingTestStudy2/Daily_Morning_Coding_Test | 프로그래머스/lv3/김원래/네트워크.cpp | #include <string>
#include <vector>
using namespace std;
int nodes[200];
int visit[200];
int Find(int i)
{
if(nodes[i] == i) return i;
return nodes[i] = Find(nodes[i]);
}
void Union(int i, int j)
{
if(i==j) return;
int iParent = Find(i);
int jParent = Find(j);
if(iParent < jPa... | ALGO | 0.999653 | 4.631893 |
55f3542e-15bb-4b0f-b54b-7c6a3b7908e4 | gongbaochicken/Coding-Practice | C++ Solutions/Dynamic_Programming/MaximalSquare .cpp | //Maximal Square
//Tags: Dynamic Programming
/*
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4.
*/
//Solution:
class Solution {
public:
int maximalSquare(... | ALGO | 0.999904 | 6.938684 |
ef73d3e9-f270-4597-8162-ddadc97973ec | Lewuathe/mlir-hello | thirdparty/llvm-project/clang-tools-extra/clangd/ConfigYAML.cpp | namespace clang {
namespace clangd {
namespace config {
namespace {
using llvm::yaml::BlockScalarNode;
using llvm::yaml::MappingNode;
using llvm::yaml::Node;
using llvm::yaml::ScalarNode;
using llvm::yaml::SequenceNode;
std::optional<llvm::StringRef>
bestGuess(llvm::StringRef Search,
llvm::ArrayRef<llvm::Str... | TOOL | 0.972978 | 5.878152 |
58c70bd7-9334-49f2-9aba-893672b4d370 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/maximize-the-number-of-partitions-after-operations-Solution.maxPartitionsAfterOperations/177799_Overflow.cpp | _XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorImage head;
XcursorImage *image;
int n;
XcursorPixel *p;
if (!file || !fileHeader)
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, ... | TOOL | 0.968818 | 4.260468 |
8541663f-7b3f-4af5-bb84-7a00bc56f957 | aparaschiveiadrian/few-useful-algos | GRAPHS/bfs.cpp | #include <fstream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
ifstream cin("BFS.in");
ofstream cout("BFS.out");
int n, m, x, p, q;
vector <int >v[100002];
int vizitat[100002];
void ascending(int max_nod)
{
for(unsigned int k = 1; k<= max_nod;k++)
{
sort(v[k].begin(), v[... | ALGO | 0.999995 | 4.113636 |
f7491947-d916-4e7d-a8ee-648e238f1f41 | Wisdom-Peng/txp_learning | cpp_base/01-max.cpp | #include <iostream>
using namespace std;
int max(int a,int b){
return a>b?a:b;
}
int main(){
int a,b;
cout<<"Please input two numbers:"<<endl;
cin>>a>>b;
cout<<"The max number is:"<<endl;
cout<<max(a,b)<<endl;
} | ALGO | 0.998811 | 3.750902 |
3922c8a1-8b03-461a-b56f-009910fb176f | Morgan-Co/Netology | advanced_programming_in_c++/under_the_hood_compilation_and_linking/task_1/task_1/task_1.cpp | #include <iostream>
using namespace std;
struct point {
double m_x;
double m_y;
point(double x, double y) {
m_x = x;
m_y = y;
}
};
void print_point(const point& point_object) {
std::cout << "x:" << point_object.m_x << ", y: "
<< point_object.m_y << std::endl;
}
int main()
{
for (int i = 0; i < 5; i++) {
... | TOOL | 0.879627 | 3.848191 |
9a7119a2-d700-499e-9842-365483f765db | spitfire88/lc | Trees/TreeGeneric/genericTreeMethods.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(-1), left(nullptr), right(nullptr) {}
TreeNode(int v) : val(v), left(nullptr), right(nullptr) {}
TreeNode(int v, TreeNode *l, TreeNode *r) : val(v), left(l), right(r) {}
};
c... | ALGO | 0.999982 | 6.460843 |
74049f31-eb78-4f77-86e9-1b422a1f43dd | e1th4nUwU/CodingExercises | C++/isRepeatingCycle.cpp | #include<iostream>
#include<vector>
using namespace std;
bool isRepeatingCycle(vector<int>, int);
int main(){
cout<<endl<<isRepeatingCycle({1,2,3,1,2,3,1},3)<<endl<<isRepeatingCycle({1,2,3,4,2,3,1},4);
return 0;
}
bool isRepeatingCycle(vector<int> arr, int length){
for(int i=0;i<arr.size(); i++){
if(arr[i] !=... | ALGO | 0.99958 | 3.96814 |
3e2cd4e1-f319-446a-b6d9-0f3cfd038ff8 | DCMMC/ParkingLot | ParkingLotEditor/src/tool/splittool.cpp | #include "splittool.h"
#include "../gui/documentview.h"
#include "../core/scene.h"
#include "../core/room.h"
#include "../core/floor.h"
#include <QPoint>
#include <QPolygon>
#include <QGraphicsSceneMouseEvent>
#include <QMessageBox>
#pragma execution_character_set("utf-8")
//------------SplitLine methods-------------... | TOOL | 0.908998 | 4.827202 |
f10f4d6a-f4f1-4ded-bc00-0a6e22474da2 | yongwhan/codeforces | 1011B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n,m,a; cin>>n>>m;
map<int,int> ct;
for (int i=0; i<m; i++)
cin>>a, ct[a]++;
for (int d=100; d>0; d--) {
int cur=0;
for (auto it : ct)
cur+=... | ALGO | 0.999977 | 3.753126 |
fd5d6984-f33b-43b6-bd1b-acd549818283 | Student-FastDev/Problems | InstaKolko/Duże mnożenie.cpp | #include <bits/stdc++.h>
using namespace std;
string multiplyStrings(string num1, string num2) {
int len1 = num1.length();
int len2 = num2.length();
int result[len1 + len2] = {0};
for (int i = len1 - 1; i >= 0; i--) {
for (int j = len2 - 1; j >= 0; j--) {
int product = (num1[i] - '0') * (num2[j] -... | ALGO | 0.999974 | 5.582234 |
4f489c02-98b1-4591-9d98-e9a1698bc70f | trinhminhtriet/leetcode | solutions/3000-3099/3002.maximum-size-of-a-set-after-removals/Solution.cpp | class Solution {
public:
int maximumSetSize(vector<int>& nums1, vector<int>& nums2) {
unordered_set<int> s1(nums1.begin(), nums1.end());
unordered_set<int> s2(nums2.begin(), nums2.end());
int n = nums1.size();
int a = 0, b = 0, c = 0;
for (int x : s1) {
if (!s2.co... | ALGO | 0.999896 | 5.464456 |
72e0544f-e36d-47ec-b412-61a731c88736 | tiqwab/atcoder | abc191/f/main.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <limits.h>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
... | ALGO | 0.999948 | 4.109275 |
b9b55bb6-c815-4767-ba0e-102ad3dbe24e | AndreMaestro/2_semestr | informatica/working_with_trees/cr.cpp | /*Даны числа: 5, 4, 8, 1, 9, 2, 7, 6, 0, 3. Создать дерево бинарного поиска (написать функцию).
Вывести дерево. Написать функцию для обратного обхода и вывести результат*/
#include <iostream>
#include <string>
#include<vector>
using namespace std;
struct tree {
int inf;
tree *left;
tree *right;
tree *... | ALGO | 0.999988 | 4.801373 |
c7dd483b-6e8c-4dfe-a1c4-825a9ebf596b | AakashRanjan001/leetcodebros | 1920-build-array-from-permutation/1920-build-array-from-permutation.cpp | class Solution {
public:
vector<int> buildArray(vector<int>& nums) {
const int n = nums.size();
vector<int> ans(n);
for (int i = 0; i < n; i++)
ans[i] = nums[nums[i]];
return ans;
}
}; | ALGO | 0.999994 | 5.962013 |
01018a40-5b7a-46aa-b463-fcd919fbcf5e | fwdzh/cp_code | XCPC/Nowcoder-Summer-2025/3/J.cpp | /*
第一章 陨落的天才
“斗之力,三段!”
望着测验魔石碑上面闪亮得甚至有些刺眼的五个大字,
少年面无表情,唇角有着一抹自嘲,紧握的手掌,
因为大力,而导致略微尖锐的指甲深深的刺进了掌心之中,带来一阵阵钻心的疼痛…
“萧炎,斗之力,三段!级别:低级!”测验魔石碑之旁,一位中年男子,
看了一眼碑上所显示出来的信息,语气漠然的将之公布了出来…
中年男子话刚刚脱口,便是不出意外的在人头汹涌的广场上带起了一阵嘲讽的骚动。
“三段?嘿嘿,果然不出我所料,这个'天才'这一年又是在原地踏步!”
“哎,这废物真是把家族的脸都给丢光了。”
“要不是族长是他的父亲,这种废物,早就被驱赶出家族,任其自生自灭了,哪还有机会待在家族中白吃白喝。... | ALGO | 0.981587 | 3.53732 |
c8fe9e1b-fab5-4b33-a82c-1ffbc213d741 | 2AiBAIT/SmartHealthPhoneScanner | InstantNGP/dependencies/eigen/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
struct PointPointMinimizer //how to compute squa... | ALGO | 0.9999 | 6.502348 |
6908addf-5295-4181-b908-c7588bc16d1f | ChanJoon/mpcc | qp_solver/qpoases/EXAMPLES/example1.cpp | /**
* \file EXAMPLES/example1.cpp
* \author Hans Joachim Ferreau
* \version 1.3embedded
* \date 2007-2008
*
* Very simple example for testing qpOASES (using QProblem class).
*/
#include <QProblem.hpp>
/** Example for qpOASES main function using the QProblem class. */
int main( )
{
/* Setup data of first QP. *... | ALGO | 0.976645 | 5.426085 |
74c31e68-ab67-4c5a-af86-a05e441c23f4 | djadjaa/AISP22 | ispiti/2 jan1A2021/stepenasti.cpp | #include <bits/stdc++.h>
using namespace std;
void stepenasti(vector<int>& a, int indeks){
if(indeks==a.size()){
for(int i=0; i<a.size(); i++){
cout << a[i] << ' ';
}
cout << endl;
return;
}
a[indeks] = a[indeks-1];
stepenasti(a,indeks+1);
a[indeks] = a[... | ALGO | 0.999788 | 3.892746 |
85fbf290-32fb-46da-b4d3-6f51923b6931 | arafat-hasan/problem-solving | UVa/11239-Open_Source.cpp | /*
* FILE: Open_Source-11239.cpp
*
* @author: Arafat Hasan Jenin <arafathasanjenin[at]gmail[dot]com>
*
* LINK:
*
* DATE CREATED: 24-07-17 03:50:34 (+06)
* LAST MODIFIED: 24-07-17 05:52:56 (+06)
*
* DESCRIPTION:
*
* DEVELOPMENT HISTORY:
* Date Version Description
* -----------------------------... | ALGO | 0.998102 | 4.303409 |
f86b6b56-0f5d-4462-ab64-ff95e154c0b5 | timmyjose-experiments/competitive-programming | lc/coreprep/implementation/practice_iterations/dp_iterations_1/nck_brute.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int next_random(int low, int high) {
random_device rd;
mt19937 engine(rd());
u... | ALGO | 0.999982 | 5.468229 |
769074af-3e7b-4801-a56d-df76888b9d99 | jeong011010/solved.ac | BAEKJOON/17070/17070.cpp | #include<iostream>
using namespace std;
int N, ans=0;
bool arr[18][18];
void input(){
cin>>N;
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
cin>>arr[i][j];
}
void dfs(int x, int y, int form){
if(x==N&&y==N){
ans++;
return;
}
switch (form)
{
case 0:
... | ALGO | 0.999831 | 3.927754 |
3b1f7856-4de8-402b-9345-f7213eac422c | scchan/hcc_perf | create_stream_priority/create_stream_priority.cpp |
#include <cstdio>
#include <string>
#include <thread>
#include <vector>
#ifdef __linux__
#include <unistd.h>
#include <getopt.h>
#endif
#include "hip/hip_runtime.h"
#define CHECK_HIP_ERROR(a) { if ((a) != HIP_SUCCESS) { abort(); } }
__global__ void dummy(int* output, int init_value, int multiplier, int num_iters) ... | TOOL | 0.998312 | 4.201642 |
419662da-746a-4991-9dd9-b91cd9f64f66 | virtualsecureplatform/llvm-rv16k | llvm/lib/CodeGen/PostRASchedulerList.cpp | #include "AggressiveAntiDepBreaker.h"
#include "AntiDepBreaker.h"
#include "CriticalAntiDepBreaker.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include... | ALGO | 0.988234 | 7.188899 |
e1fea5c8-4e1a-4add-8c7e-c698de5598ef | capstone-engine/llvm-capstone | libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
// template<container-compatible-range<T> R>
// constexpr void assign_range(R&& rg); // C++23
#include <vector>
#include "../../insert_range_sequence_containers.h"
#include "asan_testing.h... | TEST | 0.856486 | 7.69393 |
3bd5e8d4-30bb-4f9e-96fa-17c459dec0aa | Tutlegoss/Beginner_Cpp | inc/cppPDF/Examples/Heap.cpp | //Heap.cpp
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
#include <algorithm>
using std::cout; using std::endl;
using std::ifstream; using std::setw;
using std::left; using std::max;
//Function to insert data into MaxHeap.
//Will make MaxHeap larger if needed.
void insertNumber(int* &max... | ALGO | 0.997782 | 4.54515 |
4587aeb0-7af7-49b2-a804-edfb8f43b920 | AnkitaPorel/DSAP_Assignment1 | 2024201043_A1_Q3b.cpp | #include <iostream>
using namespace std;
class Priority_queue{
private:
int* arr;
int si,cap; /* si for size, cap for capacity */
public:
Priority_queue()
{
arr=nullptr;
si=cap=0;
}
int size()
{
return si;
... | ALGO | 0.999904 | 3.518535 |
7af89162-b5b0-492f-9989-3f967d1515fd | arasHi87/OnlineJudgeExercise | poj2528.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
const int maxN=2e5+10;
struct Node {
int x, y;
} s[maxN];
int vis[maxN], seg[maxN<<4], tmp[maxN];
vector<int> v;
inline void pull(int root) {
seg[root<<1]=seg[root<<1|1]=seg[root];
seg[root]=0;
}
inline void bui... | ALGO | 0.99989 | 3.931893 |
80458162-701c-458e-aee4-48c04ebe8d11 | AnshikPatel/90days_placement | day1/reverse string.cpp | class Solution {
public:
void reverseString(vector<char>& s) {
// for(int i=0;i<s.size()/2;i++){
// swap(s[i],s[s.size()-i-1]);
// }
reverse(s.begin(),s.end());
}
};
| ALGO | 0.999406 | 5.870771 |
78b18356-e76a-4f99-9e54-a6d97c2dd309 | archfp/floorplan | Readings/C++/TICPP-2nd-ed-Vol-two/code/C09/Recycle2.cpp | //: C09:Recycle2.cpp
// From "Thinking in C++, 2nd Edition, Volume 2"
// by Bruce Eckel & Chuck Allison, (c) 2001 MindView, Inc.
// Available at www.BruceEckel.com.
// Chapter XX example w/ RTTI
//{L} ../TestSuite/Test
#include "../purge.h"
#include <fstream>
#include <vector>
#include <typeinfo>
#include <cstdlib>
#in... | TOOL | 0.927765 | 6.471571 |
239683e3-7087-4762-b209-615468554c64 | actium/codeforces | 1300/90/1390a.cpp | #include <algorithm>
#include <iostream>
#include <vector>
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(unsigned v)
{
std::cout << v << '\n';
}
void solve(const std::vector<unsigned>& a)
{
con... | ALGO | 0.999938 | 4.415147 |
6f5a9c5c-3d10-4a6c-8219-558589ec36ba | ishandutta2007/codeforces | dancho/normal/204/B.cpp | #include <cstdio>
#include <cstring>
#include <map>
using namespace std;
int n;
map<int,int> cnt;
map<int,int> os;
int main()
{
int i, j, k;
scanf( "%d", &n );
for ( i = 1; i <= n; i++ )
{
scanf( "%d %d", &j, &k );
cnt[j]++;
if ( j != k )
{
os[k]++;
}
if ( cnt[j] >= (n+1)/2 )
{
printf( "0\n... | ALGO | 0.999965 | 3.642488 |
7d8cc5ee-5b4c-406e-9c4c-eb140f3be640 | kamyu104/LeetCode-Solutions | C++/split-the-array.cpp | // Time: O(n)
// Space: O(n)
// freq table
class Solution {
public:
bool isPossibleToSplit(vector<int>& nums) {
unordered_map<int, int> cnt;
for (const auto& x : nums) {
if (++cnt[x] > 2) {
return false;
}
}
return true;
}
};
| ALGO | 0.999751 | 5.882266 |
53e8f2ae-bd3b-4e5a-9754-71ad4e22e208 | abhishekdhar30/CP_Problems | test8.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++)
{
cin>>a[i];
}
map<ll,ll>P;
for(ll i=0;i<n;i++)
{
P[a[i]]++;
}
for(auto i:P)
{
cout<<i.first;
}
} | ALGO | 0.999786 | 3.34063 |
fd0d4174-6c29-405f-a9ca-f6f87efbd109 | hyunJIN7/PRACTICE_CODDINGTEST | BackJoon/C++/BOJ11722.cpp | // https://www.acmicpc.net/problem/11722 ϴ κ
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n, ans = 0,a[1001], dp[1001]={0,};
cin >> n;
for(int i =1 ; i<= n; i++){
cin >> a[i];
dp[i] = 1;
for(int j=i-1 ; j > 0 ;j--){
if( ... | ALGO | 0.999858 | 4.229351 |
0a9d66ec-3561-4d69-add7-7b48f6b13e3d | yyj-me/my-study | PS/BOJ/기본입출력/BOJ-10951.cpp | /*
BOJ 10951
입력 필드 EOF 처리
char -> int
main 함수 return 0; --> 정상 종료
*/
#include <stdio.h>
int a, b;
int main() {
while(scanf("%d %d", &a, &b) != EOF) {
printf("%d\n", a + b);
}
return 0;
} | ALGO | 0.994374 | 4.29387 |
928f43e1-7718-4427-b2d9-d76f31677478 | ElvinMammadov/MafiaGame | 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.998764 | 6.762122 |
52128303-af3e-447c-8759-55860d1b0040 | BadhonAhmad/Codeforces-Solve | F_Selection_of_Personnel.cpp | #include <bits/stdc++.h>
using namespace std;
#define vll vector<int>
#define all(a) a.begin(), a.end()
#define pb(a) push_back(a)
#define e "\n"
#define int long long
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
void solve()
{
int i,j,k,a,b,c,sm=0,ct=0,n,m,f=0,mn=LONG_LONG_MAX,mx=... | ALGO | 0.999929 | 3.263803 |
ce76d1bf-ce76-4e3c-bb45-197689c0a996 | ishandutta2007/codeforces | jjleo_/normal/1405/B.cpp | #include <bits/stdc++.h>
#define maxn 100086
using namespace std;
int t;
int n;
long long a[maxn];
long long ans;
int main(){
scanf("%d", &t);
while(t--){
scanf("%d", &n);
ans = 0;
for(int i = 1;i <= n;i++) scanf("%lld", &a[i]);
for(int i = 1;i <= n;i++){
a[i] += a[i - 1];
if(a[i] < 0) ans -= a[i], a... | ALGO | 0.999706 | 3.830734 |
b775ace4-dc71-4aec-8eae-8df0225a8bc1 | Imanm02/CE462-ES | Assignments/Assignment 6/truetime-2.0/kernel/matlab/ttSetNextSegment.cpp | #define KERNEL_MATLAB
#include "../ttkernel.h"
#include "../setnextsegment.cpp"
#include "getrtsys.cpp"
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
rtsys = getrtsys() ; // Get pointer to rtsys
if (rtsys==NULL) {
return;
}
// Check number and type o... | TOOL | 0.919523 | 4.231922 |
6ff40174-b3cc-462c-8741-1f6bc4f61b2c | senthilnathan01/DSA | Basics/Problems/Binary_Search_Trees/InorderSuccessorInBST.cpp | #include<iostream>
#include<stack>
#include<vector>
using namespace std;
// 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(i... | ALGO | 0.999999 | 6.283136 |
17a7bf56-e4d8-400d-a6d9-54df7d4c2908 | kishan-7077/DSA | Arrays/recursion2.cpp | #include<bits/stdc++.h>
using namespace std;
string keypadarr[]={"","./","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
void reverse(string s){
if(s.length()==0){
return;
}
string restStr = s.substr(1);
reverse(restStr);
cout<<s[0];
}
void replacePi(string s){
if(s.length()==0){... | ALGO | 0.999122 | 3.119159 |
f4e1f7a1-c0c1-4dca-8f8a-0d5ca8a62325 | tranzmatt/opencv-salsa | samples/cpp/intersectExample.cpp | /*
* Author: Steve Nicholson
*
* A program that illustrates intersectConvexConvex in various scenarios
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
using namespace std;
// Create a vector of points describing a rectangle with the given corners
static vector<Point> makeRect... | ALGO | 0.999049 | 6.691697 |
e8a7df0a-dd8e-4587-9e0d-2c02f00b4e17 | zhouhaozzz/Furion_C | src/optical_element/g_cyliner_parabolic_collimation.cpp | #include "g_cyliner_parabolic_collimation.h"
using namespace Furion_NS;
G_Cyliner_Parabolic_Collimation::G_Cyliner_Parabolic_Collimation(G_Beam* beam_in, double ds, double di, double chi, double theta, No_Surfe* surface, double r1, double r2, Grating* grating)
: G_Oe(beam_in, ds, di, chi, theta, surface, grating)... | ALGO | 0.998633 | 4.127069 |
b5275dc5-fbe2-4490-88cb-0173e147a2d0 | nmadev/2D-SPH | simulation/old_code/FLUID_2D_PERIODIC.cpp | ///////////////////////////////////////////////////////////////////////////////
// This is an extensively reworked version of the "solver.c" file
// from Jos Stam's original "Stable Fluids" code:
//
// http://www.dgp.toronto.edu/people/stam/reality/Research/zip/CDROM_GDC03.zip
//
///////////////////////////////////////... | ALGO | 0.999947 | 4.878039 |
eea9ed23-2790-49aa-a1b1-170eb35e72ca | ramenia/sa2asamples | skypecheckers/checkers.cpp | // checkers.cpp
//
#include "stdafx.h"
#include "checkers.h"
#include <cassert>
//class Board
Checkers::Board::Board()
{
for(int i=1;i<size-1;i++)
{
for(int j=1;i+j<size-1;j+=2)
{
cell[i][i+j].available = true;
cell[i+j][i].available = true;
}
}
}
bool Checkers::Board::IsOnBoard(int x, int y)const
{... | TOOL | 0.950921 | 5.331444 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.