text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; struct Node { int data; Node* next; }; Node* head = NULL; void insert_ll(int data) { Node* temp = new (Node); temp->data = data; temp->next = NULL; if (head == NULL) { head = temp; return; } else { Node* temp2 = head; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, l, r, m, ans = 1e9; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> l >> r; ans = min(ans, r - l + 1); } cout << ans << n ; for (int i = 0; i < n; i++) cout << i % ans << ;... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; inline bool cmp(const pair<int, int> &a, const pair<int, int> &b) { if (a.first != b.first) return a.first > b.first; return a.second < b.second; } int a[1000005], b[1000005]; char s[1000005], r[1000005]; int test; int main() { int t, n, m, k, l, x... |
module MemoryHierarchy(clk, rst_n, i_acc, d_rd_acc, d_wr_acc, i_addr, d_addr, d_wrt_data, stall, instr, data);
input clk, rst_n, i_acc, d_rd_acc, d_wr_acc; // Instruction accesses are assumed read
input [15:0] i_addr, d_addr, d_wrt_data;
output stall;
output [15:0] instr, data;
wire rd, wr;
wire [15:0] addr... |
`timescale 1ns / 1ps
module cpu_ctl(op,func,equal_result,JR,J,JAL,LW,WREG,WMEM,RDorRT,SE,SA,IorR,BJ,Aluc
);
input wire [5:0] op, func;
input wire equal_result;
output wire JR,J,JAL,LW,WREG,WMEM,RDorRT,SE,SA,IorR,BJ;
output wire [4:0] Aluc;
wire r_type, i_jr, i_sll, i_srl, i_sra; //i_mfhi,i_mflo,i_m... |
// *****************************************************************************
// Cadence C-to-Silicon Compiler
// Version 14.10-p100 (32 bit), build 50398 Tue, 27 May 2014
//
// File created on Sat Oct 11 22:28:08 2014
//
// The code contained herein is generated for Cadences cust... |
#include <bits/stdc++.h> using namespace std; template <typename Tp> inline void rd(Tp &x) { x = 0; int fh = 1; char ch = 1; while (ch != - && (ch < 0 || ch > 9 )) ch = getchar(); if (ch == - ) fh = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getcha... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 9; const long long mod = 998244353; long long dp[N][1 << 7]; int s[N][1 << 7], st[N], Log[1 << 7]; struct node { int v, id; } a[N]; bool cmp(node a, node b) { return a.v > b.v; } void upd(long long &a, long long b) { if (a < b) ... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-10; const double PI = acos(-1.0); template <class T> T gcd(T a, T b) { for (T c; b; c = a, a = b, b = c % b) ; return a; } template <class T> void out(const vector<T> &a) { for (int i = 0; i < ((int)(a).size()); ++i) c... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int arr[maxn]; int cum[maxn], n, m, k; int dp[2020]; map<int, int> offer; int range(int l, int r) { return (cum[r] - cum[l]); } int solve(int i) { if (i == k) return 0; int &ret = dp[i]; if (ret != -1) return ret; ... |
#include <bits/stdc++.h> using namespace std; const int M = 1000000007; int n, k; vector<vector<long long> > mul(vector<vector<long long> > &A, vector<vector<long long> > &B) { vector<vector<long long> > C(1, vector<long long>(n)); for (int i = 0; i < n; ++i) { for... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; ++i) { int n; cin >> n; set<int> st; for (int j = 0; j < n; ++j) { int x; cin >> x; st.insert(x); } int ans = 0; int mx = *st.rbegin(); ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE SD Card Controller IP Core ////
//// ////
//// monostable_domain_cross.v ... |
#include <bits/stdc++.h> using namespace std; bool mark[10][10][10][10]; int n, ans; int main() { memset(mark, false, sizeof(mark)); scanf( %d , &n); while (n--) { string x, y, z; if (n == 0) { cin >> x; cin >> y; } else { cin >> x; cin >> y; ... |
#include <bits/stdc++.h> using namespace std; vector<int> g[100005]; int par[18][100005]; int depth[100005]; void dfs(int u, int p = 0, int d = 0) { par[0][u] = p; depth[u] = d; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; if (v == p) continue; dfs(v, u, d + 1); }... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 50; const long long oo = 1e18; const long long mod = 1e9 + 7; int a[N], sum[2 * N]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; int cur = n; long long ans = 0; sum[cur] = 1; long ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 50; vector<int> e[N]; int dp[N], res, deg[N]; void dfs(int u, int pre) { dp[u] = deg[u]; for (int v : e[u]) { if (v == pre) continue; dfs(v, u); res = max(res, dp[u] + dp[v]); dp[u] = max(dp[u], dp[v] + deg[u] - ... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 9; const long long maxn = 3e2 + 9; long long a[maxn][maxn]; pair<long long, long long> q[N]; long long front, rear; long long dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; bool vis[maxn][maxn]; void solve() { memset(vis, 0, ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; struct node { int v, next; } p[200005 << 1]; int head[200005], n, k; long long dp[200005][10], size[200005], ans; void dfs(int x, int fa, int depth) { size[x] = dp[x][depth % k] = 1; for (int i = head[x]; ~i; i = p[i].next)... |
//#############################################################################
//# Function: GPIO Pads #
//# Copyright: OH Project Authors. ALl rights Reserved. #
//# License: MIT (see LICENSE file in OH repository) # ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, sg, m, k; cin >> n >> sg >> m >> k; vector<int> a(n), starts(n, n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < sg; i++) { int l, r; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; struct _2DLL { _2DLL *R, *D; int val; _2DLL() { R = D = NULL; val = 0; } }; int n, m, q; _2DLL *grid[1005][1005]; int main() { scanf( %d%d%d , &n, &m, &q); for (int i = 0; i <= n; i++) for (int j = 0; j <= m; j++) grid[i... |
#include <bits/stdc++.h> const char en = n ; using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; vector<long long> V(n + 47, 0); long long ma2 = 0; long long ma3 = 0; vector<long long> X; for (int i = 0; i < n; i++) { cin >> V[i]; long long... |
#include <bits/stdc++.h> using namespace std; int n; struct node { int pos, len; friend bool operator<(node a, node b) { return a.len > b.len; } } f[100005]; vector<int> po; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { int x = i * 2 - 1; f[i].pos = x; scanf(... |
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) using namespace std; inline int read() { int x = 0, neg = 1; char op = getchar(); while (!isdigit(op)) { if (op == - ) neg = -1; op = getchar(); } while (isdigit(op)) { x = 10 * x + op - 0 ; op... |
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
// for whatever reason, strength 1 has very bad setup and hold times
`define bsg_dff_reset_en_macro(bits) \
if (harden_p && width_p==bits) \
begin: macro \
bsg_rp_tsmc_250_dff_nre... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #define debug(a) cout << #a << : << a << n #define debugLine() cout << ============== n #define tick() cout << Tick n ; #define testCases() int t; cin >> t; while(t--) #define all(a) a.begin(), a.end() #define fillWith(a, b) memset(a, b, sizeof(a)) #define INF_32 1e9 #d... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: upd77c25_datrom.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); ; int precision = numeric_limits<double>::digits10; ; int n, a, b; cin >> n >> a >> b; cout << (a + b - 1 + 100 * n) % n + 1; } |
#include <bits/stdc++.h> using namespace std; int main() { long long b, c, d, e, f, g, h, i, j = 0, k = 2, l, o = 0, m = 0, n = 0, q = 1, r = 1, s, t, u, v, x = 1, y = 1, z = 1111111; string a; cin >> a; b = a.size(); fo... |
#include <bits/stdc++.h> const long long oo = 0x7f7f7f7f7f7f7f7f; using namespace std; const long long maxn = 1e6 + 999; long long n, m, k, visa[maxn], visb[maxn], b[maxn], tota, totb, totc, totd; struct goods { long long val, id; friend bool operator<(goods x, goods y) { return x.val < y.val; } } a... |
#include <bits/stdc++.h> using namespace std; int n, pd[4][10100], x, y, gox[4] = {1, 0, -1, 0}, goy[4] = {0, 1, 0, -1}, w[16], dp[10100][8], mo = 1000000007; char getin() { char ch = getchar(); while (ch != . && ch != X && ch != O ) ch = getchar(); return ch; } i... |
#include <bits/stdc++.h> using namespace std; inline int gi() { char tmp = getchar(); int ans = 0, flag = 1; while (!isdigit(tmp)) { if (tmp == - ) flag = -1; tmp = getchar(); } while (isdigit(tmp)) { ans = ans * 10 + tmp - 0 ; tmp = getchar(); } return ans * fl... |
//
// Paul Gao 08/2019
//
//
`timescale 1ps/1ps
`include "bsg_noc_links.vh"
module bsg_fifo_1r1w_small_hardened_tester
#(
parameter width_p = 64
,parameter els_p = 16
,parameter channel_width_p = 8
)
();
`declare_bsg_ready_and_link_sif_s(width_p, bsg_ready_and_link_sif_s... |
#include <bits/stdc++.h> using namespace std; const int maxi = 1e6 + 10; const long long mo = 1e9 + 7; long long a[maxi]; long long m, l, r, k; string s; vector<int> v[maxi]; long long mat[53][3][3]; void mul_mat(int idx1, int idx2, int idx) { for (int i = 1; i <= 2; i++) for (int j = 1; j <... |
/*
# ZUMA Open FPGA Overlay
# Alex Brant
# Email:
# 2012
# LUTRAM wrapper
*/
`include "define.v"
`include "def_generated.v"
module elut_custom #(
parameter used = 0,
parameter LUT_MASK={2**K{1'b0}}
) (
a,
d,
dpra,
clk,
we,
dpo,
qdpo_clk,
qdpo_rst,
qdpo);
input [5 : 0] a;
input [0 : 0] d;
input [5 : 0] d... |
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; constexpr int maxn = 1e5 + 10; vector<int> topo; vector<vector<pii>> pilha; int ans[maxn]; int main() { int n; scanf( %d , &n); vector<int> a(n); for (auto& it : a) scanf( %d , &it); for (int i = 0; i < n; i++) {... |
#include <bits/stdc++.h> using namespace std; int main() { int ans, n, m; cin >> n >> m; ans = (n * m) / 2; cout << ans; return 0; } |
// Issue 559 - nested ifdef with generate indentation bug
module m;
`ifndef DDR_PT_GATE_SIM
generate
/***************** Assertions for DP HM signals ***************************************************************/
for (dp_id=0; dp_id <PDDR_NUM_DP; dp_id++) begin: DPConnectGen
if (PDDR_DP_HV[dp_id]) begin: VGen
`ifdef... |
// Jai Shree Ram #include<bits/stdc++.h> typedef long long int ll; #define pb push_back #define max2(a,b) (a>b)?a:b #define mi2(a,b) (a<=b)?a:b #define fori(i,n) for(ll i=0;i<(ll)n;i++) #define ford(i,n) for(ll i=n;i>=0;i--) #define pll pair<ll,ll> #define mod 1000000007 #define ff first #defin... |
// DESCRIPTION: Verilator: Verilog Test for generate IF constants
//
// The given generate loop should have a constant expression as argument. This
// test checks it really does evaluate as constant.
// This file ONLY is placed into the Public Domain, for any use, without
// warranty, 2012 by Jeremy Bennett.
// SPDX-L... |
//----------------------------------------------------------------------------
// Copyright (C) 2001 Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { ios_base::sync_with_stdio(false); cin.tie(0); ; int n; cin >> n; vector<int> indeg(n); queue<int> deg1; vector<int> xorV(n); for (int i = 0; i < n; i++) { cin >> indeg[i] >> xorV[i]; if (i... |
// MBT 7/7/2016
//
// 1 read-port, 1 write-port ram
//
// reads are synchronous
`include "bsg_defines.v"
module bsg_mem_1r1w_sync_mask_write_bit #(parameter `BSG_INV_PARAM(width_p)
, parameter `BSG_INV_PARAM(els_p)
// semantics of "1" are... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2013 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
typedef struct packed {
logic [1:0] b1;
logic [1:0] b2;
logic [1:0] b3;
logic [1:0] b4;
} t__a... |
//W4P3R /* ---------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; inline void FAST_IO() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { FAST_IO(); int n, m; cin >> n >> m; pair<int, int> ac{0, 0}, bc{0, 0}; for (int i = 0; i < n; ++i) { int a; cin >> a; if (a % 2... |
#include <stdio.h> #include <iostream> #include <vector> #include <unordered_set> #include <math.h> #include <time.h> #include <algorithm> #include <string.h> #include <string> #include <deque> #include <ctype.h> #include <limits.h> #include <map> #include <set> #include <unordered_map> #i... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long inf = 1LL << 62; const long long mx = 100005; const double eps = 1e-10; long long dx[10] = {1, 0, -1, 0}; long long dy[10] = {0, -1, 0, 1}; long long power(long long a, long long b) { if (b == 0) return 1... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> bool Max(T1& a, T2 b) { return a < b ? a = b, 1 : 0; } template <typename T1, typename T2> bool Min(T1& a, T2 b) { return a > b ? a = b, 1 : 0; } const int N = 200002, inf = 1e9 + 1; int s[N], g[N], ans[N]; boo... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; long double p[N], k[N]; int par[N]; vector<int> v[N]; bool vstd[N]; void dfs(int node) { if (vstd[node]) return; vstd[node] = true; for (auto u : v[node]) { if (u != par[node]) { k[node] += p[u]; par[u] ... |
//Circuit which generates Fibonacci numbers
module fibonacci (
clk, //clock
reset, //reset the Multiplier
n, //Fibonacci number to calculate
result, //result of fibonacci calculation
ready //signals if the result is ready
);
parameter inBits = 8; //No of bits for n
parameter outBits = 16; //No of bits of Fib number... |
#include <bits/stdc++.h> using namespace std; const int NMAX = 1e5 + 7; long long n, a[NMAX], b[NMAX]; long long dp[NMAX]; struct linija { long long a, b; }; linija c[NMAX]; int sz, cur; double prijesek_x(int i, int j) { return (double)(c[i].b - c[j].b) / (c[j].a - c[i].a); } void dodaj(li... |
#include <bits/stdc++.h> using namespace std; long long dp[1001][1001 + 2][2][2]; int n, k, hv = 1002; char s[1001 + 5], l[1001 + 5], r[1001 + 5]; long long go(int pos, int pv, int ch, int f) { if (pos == -1) return (long long)f; long long &ret = dp[pos][pv][ch][f]; if (ch && ret != -1) return ret... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793238; int main() { int t, a, b; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; int ct = 0, ct1 = 0, ct2 = 0; sort(a, a + n); ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`timescale 1ns / 1ps
module ROM(input clk,
input wire [8:0] addr,
output reg [7:0] data);
reg [7:0] rom [0:127];
always @(negedge clk) begin
data <= rom[addr];
end
initial begin
rom[0] = 8'h0;
rom[1] = 8'h1;
rom[2] = 8'h2;
rom[3] ... |
#include <map> #include <queue> #include <cmath> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #define itt map<int,int>::iterator #define ll long long #define ull unsigned long long #define dd double using namespace std; const int maxn=5000,N1=maxn+5; const int in... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; const int maxn = 5e5 + 10; int N, M; struct edge { int v, u, l, r; edge() {} edge(int v_, int u_, int l_, int r_) : v(v_), u(u_), l(l_), r(r_) {} bool operator>(const edge& rhs) const { return l > rhs.l; } }; priority_... |
#include <bits/stdc++.h> char s[5][110], ss[5][5]; int main() { int t, n, i, j; scanf( %d , &n); memset(s, 0x00, sizeof(s)); if (n == 1) { s[0][0] = a ; s[1][0] = a ; s[2][0] = b ; s[3][0] = b ; } else if (n & 1) { s[2][0] = f ; s[3][0] = f ; s[0][... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b[100], c, xd = 0, lol; cin >> a; for (int i = 0; i < a; i++) { cin >> b[i]; } sort(b, b + a); for (int i = 0; i < a; i++) { if (i == a - 1) { c = b[i]; } } for (int i = 0; i < a; i++) { ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000000, inv2 = (MOD + 1) / 2; long double eps = 1e-6; int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1}; long double pi = acos(-1.0L); struct node { int x, y, z, op, id; } a[1000000 + 10], c[1000000 + 10]; bool cmp(node a, ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; bool a[m + 1]; memset(a, 0, sizeof(a)); for (int i = 1; i <= n; i++) { int l, r; cin >> l >> r; for (int j = l; j <= r; j++) a[j] = 1; } vector<int> v; int res = 0; for (int i = ... |
#include <bits/stdc++.h> using namespace std; int Get() { char c; while (c = getchar(), c < 0 || c > 9 ) ; int X = 0; while (c >= 0 && c <= 9 ) { X = X * 10 + c - 48; c = getchar(); } return X; } const int inf = 1000000000; int GCD(int a, int b) { return b ? GCD... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ram30x4.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
#include <bits/stdc++.h> const unsigned long long M1 = 1e8 + 7; const unsigned long long M2 = 1e9 + 7; const unsigned long long M3 = 998244353; const int N = 2e5 + 5; int n, m, k, U[N], V[N], h[10], ans; unsigned long long k1[N], k2[N], k3[N], f1[10][10], f2[10][10], f3[10][10], g[10][10]; unsigned ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LL_INF = 0x3f3f3f3f3f3f3f3f; const int xx[4] = {1, -1, 0, 0}; const int yy[4] = {0, 0, 1, -1}; int inline in() { int x = 0, c; for (; (unsigned)((c = getchar()) - 0 ) >= 10;) { if (c == - ) return -in()... |
#include <bits/stdc++.h> const int ms = 200200; const int eps = z - a + 1; void print(int x) { for (int i = 0; i < eps; i++) { std::cout << ((x & (1 << i)) ? 1 : 0); } std::cout << n ; } char t[200200]; std::string str[200200]; int main() { int n; std::cin >> n; int isn... |
#include <bits/stdc++.h> using namespace std; int n, x, y; int a, b; int diff; void ask(int mask) { int sz = 0; for (int i = 0; i < n; ++i) { if ((i & mask) > 0) { ++sz; } } if (sz == 0) { return; } printf( ? %d , sz); for (int i = 0; i < n; ++i) { i... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; map<int, int> mx, my; vector<int> v; long long cal() { long long ans = 0; int sz = v.size(); sort(v.begin(), v.end()); int l = 0, r; while (l < sz) { r = l; while (r < sz - 1 && v[r + 1] == v[l]) r++; a... |
#include <bits/stdc++.h> using namespace std; const long long int N = 3e5 + 5, inf = 1e9 + 7; long long int bigmod(long long int b, long long int p, long long int m) { long long int rt = 1; while (p) { if (p & 1) rt = (rt * b) % m; b = (b * b) % m; p >>= 1; } return rt; } int... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e7; const long long maxm = 1e7; const long long INF = 0x3f3f3f3f; const long long mod = 1e9 + 7; long long uu[maxn]; int main() { long long n, a, b; cin >> n >> a >> b; for (long long i = 0; i < n; i++) scanf( %lld , &uu[i])... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 2; unsigned long long h[N]; int p[N]; bool ed[N], flg[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count()); unordered_map<unsigned long long, int> mp; ... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 14; const int Q = 101; int n, m, q; long long dp[N][1 << N]; bool edge[N][N]; int a[Q], b[Q], c[Q]; int lowbit(int x) { return x & (-x); } int in(int i, int S) { return ((S >> i) & 1); } bool check(int u, int k) { for (int i = 0; i < n;... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = LLONG_MAX; void solve() { long long k; cin >> k; string s; cin >> s; long long test[10] = {0}; long long sum = 0; for (long long i = 0; i < s.size(); i++) { int digit = s[i] - 0 ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; template <class T> T gcd(T a, T b) { return ((b == 0) ? a : gcd(b, a % b)); } int m[1005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.