text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
module hazard_unit( input clk, // isn't needed for now
input rst, // isn't needed for now
input [4:0] ex_dst_reg,
input [4:0] mem_dst_reg,
input [4:0] id_rs,
input [4... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_rxcounters.v ////
//// ////
//// This file is part of the Ether... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_top.v ////
//// ////
//// This file is part of the SPI I... |
/* This file is part of JT12.
JT12 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JT12 is distributed in the hope tha... |
`include "constants.vh"
`default_nettype none
module tag_decoder
(
input wire [`SPECTAG_LEN-1:0] in,
output reg [2:0] out
);
always @ (*) begin
out = 0;
case (in)
5'b00001: out = 0;
5'b00010: out = 1;
5'b00100: out = 2;
5'b01000: out = 3;
5'b10000: out = 4;
default: out = 0;
en... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// SPI hub: arbitrating between AVR and Z80 accesses to SDcard via SPI.
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it un... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////////////
// Company: Digilent Inc.
// Engineer: Andrew Skreen
//
// Create Date: 07/11/2012
// Module Name: master_interface
// Project Name: PmodGYRO_Demo
// Target Devices: Nexys3
// Tool versions: ISE 14.... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:35:11 11/08/2015
// Design Name:
// Module Name: prf_tb
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependen... |
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) using namespace std; const int N = 9; const int C = 840; int n; long long dp[C * N]; long long cnt[N], M; int main() { scanf( %lld , &M); for (int i = 1; i < N; ++i) scanf( %lld , &cnt[i]); m... |
#include <bits/stdc++.h> using namespace std; struct Node { int val; int op; int cl; Node(int x, int y, int z) { val = x; op = y; cl = z; } Node() { Node(0, 0, 0); }; }; string s; vector<Node> ST; Node temp; int n, t, x, y, t1, t2; void update(int root, int l, i... |
#include <bits/stdc++.h> using namespace std; const double v = 1.41421356237; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int t = 1; cin >> t; while (t--) { long long int x1, y1, z1, x2, y2, z2; cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2; long long ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Jie Xu.
// SPDX-License-Identifier: CC0-1.0
// change these two parameters to see the speed differences
`define DATA_WIDTH 8
`define REP_COUNT4 `DATA_WIDTH/4
`define REP_COUNT... |
// ====================================================================
// Radio-86RK FPGA REPLICA
//
// Copyright (C) 2011 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// ------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf( %d , &n); long long int a[n]; set<long long int> x; map<long long int, set<int> > m; for (i = 0; i < n; i++) { scanf( %lld , &a[i]); x.insert(a[i]); m[a[i]].insert(i); } while (!x.empty()) {... |
// lattice ice5lp4k rxadc v2
// 07-17-16 E. Brombaugh
module rxadc_2 #(
parameter isz = 10,
fsz = 26,
dsz = 16
)
(
// SPI slave port
input SPI_CSL,
input SPI_MOSI,
output SPI_MISO,
input SPI_SCLK,
// rxadc board interface
input rxadc_clk,
output rxadc_dfs,
input rxadc_otr,... |
//*****************************************************************************
// (c) Copyright 2009 - 2012 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
/... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; double arr[n]; double temp = 0; for (int i = 0; i < n; i++) { cin >> temp; arr[i] = temp; } long long sum = 0; double fractpart, intpart; int arr2[n]; for (int i = 0; i < n; i++) { 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 la... |
// (C) 1992-2014 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 simulati... |
#include <bits/stdc++.h> using namespace std; int n, m, x, c, a[200001], tin[200001], tout[200001], sz[200001], seg[524288]; string s; bool lazy[524288]; vector<int> G[200001]; void dfs(int i) { tin[i] = ++c; ++sz[i]; for (int j : G[i]) { dfs(j); sz[i] += sz[j]; } tout[i] = c... |
#include <bits/stdc++.h> using namespace std; int main() { int size; cin >> size; while (size--) { int nums; cin >> nums; while (nums--) cout << 1 << ; cout << n ; } return 0; } |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { cin >> n >> m; bool flg = false; int a; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> a; if (a == 1 && (i == 0 || i == n - 1 || j == 0 || j == m - 1)) flg = true; } if (flg) ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1E-9; int cnt; double a, b, m, vx, vy, vz, t, f; double ansx, ansz; int main() { scanf( %lf%lf%lf , &a, &b, &m); scanf( %lf%lf%lf , &vx, &vy, &vz); t = -m / vy; ansx = a / 2 + t * vx; ansz = t * vz; while (ansx < 0) ans... |
/*
* 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( Ofast ) using ll = long long; using ull = unsigned long long; using ld = long double; using namespace std; int n; void solve() { cin >> n; if (n % 2 == 0) { cout << NO ; return; } cout << YES n ; vector<int> v(2 * n + 1); ... |
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops , omit-frame-pointer , inline ) #pragma GCC option( arch=native , tune=native , no-zero-upper ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) #pragma GCC optimize( Ofast ) using namespace std; const ... |
#include <bits/stdc++.h> using namespace std; long long int n; vector<long long int> BIT((int)1e6 + 5, 0); void _update(int x) { while (x <= n) { BIT[x]++; x += x & -x; } } int query(int x) { long long int sum = 0; while (x > 0) { sum += BIT[x]; x -= x & -x; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 2005; const int M = 730; int Head[M * 10], Next[M * 100], vet[M * 100]; int a[N], b[N], d[M * 10], vis[15], p[M][5], dis[M], Dis[M], P[10], len[M], U[M][12], D[M][12]; int n, cnt, edgenum; pair<int, int> c[M]; ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 48 + 10; vector<int> adj[MAX_N]; vector<int> ziro; bool mark[MAX_N]; int ans[MAX_N][3]; int poi = 0; vector<int> dfs(int v) { vector<int> ret; ret.push_back(v); mark[v] = 1; for (auto i : adj[v]) if (!mark[i]) { ... |
// megafunction wizard: %ALTFP_ABS%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: ALTFP_ABS
// ============================================================
// File Name: acl_fp_fabs_double.v
// Megafunction Name(s):
// ALTFP_ABS
//
// Simulation Library Files(s):
//
// ==================================... |
/*
* 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... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: asy_64_1.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
//
// ===========================================... |
#include <bits/stdc++.h> using namespace std; int start[200010], finish[200010], cnt, n, m, a[200010], dis[200010]; long long tree[2][8 * 200010]; vector<int> adj[200010], nodes[2], starts[2]; void update(int v, int vl, int vr, int l, int r, int val, int k) { int mid = (vl + vr) / 2; if (l <= vl && vr... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Mon May 26 11:16:42 2014
// Host : macbook running 64-bit Arch Linux
// ... |
#include <bits/stdc++.h> using namespace std; long long max(long long a, long long b) { if (a > b) return a; else return b; } long long min(long long a, long long b) { if (a < b) return a; else return b; } long long power(long long B, long long P) { if (P == 0) re... |
// File : ../RTL/hostController/hctxportarbiter.v
// Generated : 11/10/06 05:37:22
// From : ../RTL/hostController/hctxportarbiter.asf
// By : FSM2VHDL ver. 5.0.0.9
//////////////////////////////////////////////////////////////////////
//// ... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 200 * 1000 + 10; int n, arr[Maxn], ind[Maxn], ans; int main() { cin >> n; for (int i = 0; i < n; i++) scanf( %d , &arr[i]); int a; for (int i = 0; i < n; i++) { scanf( %d , &a); ind[a] = i; } int prev = 0; for... |
/* This file is part of JT12.
JT12 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 Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JT12 program is distribute... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t, n, k; cin >> t; while (t--) { cin >> n >> k; if (k % 2) { if (n % 2) { n -= k - 1; if (n > 0) { cout << YES n ; for ... |
/**
* 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 = 2005; bool f[N][N]; int x[3005], y[3005]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i]; f[x[i] + 1000][y[i] + 1000] = true; } int ans = 0; for (int i = 1; i <= n; i++) { fo... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: capture_fifo.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
//
// =====================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21.02.2016 19:07:10
// Design Name:
// Module Name: can_qsampler
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimization( unroll-loops ) std::pair<int, int> DR[] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {-1, -1}, {1, 1}, {1, -1}}; using namespace std; template <class c> struct rge { c b, e; }; template ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spiMasterSpmcBI.v ////
//// ////
//// This file is part of the spiMas... |
/**
* 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... |
//-----------------------------------------------------------------------------
//-- ACC1 (Apollo CPU Core 1)
//-----------------------------------------------------------------------------
//-- (C) August 2016. Juan Gonzaelz-Gomez (Obijuan)
//-- Released under the GPL license
//----------------------------------------... |
#include <bits/stdc++.h> using namespace std; class Solution { public: void solve(std::istream& in, std::ostream& out) { string s; in >> s; int n = s.size(); for (size_t i = 0; i < n; i++) { int x = (s[i] - 0 ); if (x % 8 == 0) { out << YES <... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:33554432 ) using namespace std; const double PI = 2 * acos(0.0); const double EPS = 1e-8; const int INF = (1 << 30) - 1; int n; string s; vector<int> p; set<int> ans; void add01(char c1, char c2, int a, int b) { for (int i = 0; i < a; ++i)... |
#include <bits/stdc++.h> using namespace std; int setBit(int n, int pos) { return n | (1 << pos); } int resetBit(int n, int pos) { return n & ~(1 << pos); } bool checkBit(int n, int pos) { return n & (1 << pos); } inline long long bigmod(long long p, long long e, long long M) { long long ret = 1; whil... |
#include <bits/stdc++.h> using namespace std; long long ans = -((long long)1 << 62); int n, u, r; int a[105]; int b[105]; int k[105]; int p[105]; void process(int m, int op) { if (((u - m) & 1) == 0) { long long an = 0; for (int i = 1; i <= n; i++) an += a[i] * k[i]; ans = max(an, ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int p, q, l, r; cin >> p >> q >> l >> r; vector<pair<int, int> > z_timing, x_timing; int start, stop; for (int i = 0; i < p; i++) { cin >> start >> stop; z_ti... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; constexpr int N = 2e5 + 5; int t, a, b, p; string s; void Solve() { cin >> t; while (t--) { cin >> a >> b >> p >> s; s.pop_back(); vector<ll> suf; suf.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 law... |
`timescale 1ns/10ps
module VGA2Sim;
reg clock;
reg reset;
reg [11:0] inst;
reg inst_en;
wire vga_hsync;
wire vga_vsync;
wire vga_r;
wire vga_g;
wire vga_b;
initial begin
#0 $dumpfile(`VCDFILE);
#0 $dumpvars;
#100000 ... |
#include <bits/stdc++.h> using namespace std; int head[(1000 + 10)], to[(1000 + 10) * (1000 + 10)], pre[(1000 + 10) * (1000 + 10)], tot; bool vis[(1000 + 10)], color[(1000 + 10)]; int tag[(1000 + 10)], cc, L[(1000 + 10)], dis[(1000 + 10)]; int n, m; void adde(int u, int v) { to[++tot] = v, pre[tot] = ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { int n, m, k; cin >> n >> m >> k; vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p[i]; vector<int> s(n); for (int i = 0; i < n; ++i) cin >> s[i]; vector<int> c(k); for (int i = 0; i < k; ++i) cin >> c[i]; vector<... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 * 100; int n; pair<int, int> sora[maxn + 100]; int lpos = 0; bool seen[maxn + 100]; bool comp(pair<int, int> a, pair<int, int> b) { if (a.first < b.first) return true; else { if (a.first == b.first) return a.se... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_sstl_dq_bscan.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 605; int nask(vector<int> tmp) { if (!tmp.size() || tmp.size() == 1) return 0; cout << ? << tmp.size() << endl; for (int i = (0), iend = ((int)tmp.size() - 1); i <= iend; i++) cout << tmp[i] << ; cout << endl; cout.flus... |
/*
* 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; cin >> n; string fld; cin >> fld; int l = 1, r = 2 * n; int ans = -1; while (l <= r) { int mid = (l + r) >> 1; int posbl = 1; int back = -1, flag = 0; for (int i = 0; i < n; i++) { if (fld[i... |
#include <bits/stdc++.h> using namespace std; const int MX = 100000 + 10; long long n, arr[MX]; struct node { long long bit_[3]; node() { memset(bit_, 0, sizeof(bit_)); } }; vector<node> tree; void add(long long inode, long long ptr, long long num) { if (ptr < 0) return; long long q = (num... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
// verilator lint_off BLKANDNBLK
// verilator lint_off COMBDLY
// verilator lint_off UNO... |
#include <bits/stdc++.h> using namespace std; const long long MAX = 123456789; const long long inf = 123456789000000000; const double EPS = 1e-10; const double PI = 2 * asin(1.0); const long long mod = 1e9 + 7; inline int cmp(double x, double y = 0, double tol = EPS) { return (x <= y + tol) ? (x + tol... |
module wb_bfm_memory
#(//Wishbone parameters
parameter dw = 32,
parameter aw = 32,
parameter DEBUG = 0,
// Memory parameters
parameter memory_file = "",
parameter mem_size_bytes = 32'h0000_8000, // 32KBytes
parameter rd_min_delay = 0,
parameter rd_max_delay = 4)
(input wb_clk_i,
input ... |
#include <bits/stdc++.h> using namespace std; int main() { long long h, n; cin >> h >> n; long long l = 1, r = (1LL << h), ret = 0, cur = 0, dir = 0; while (cur < h) { long long size = (1LL << (h - cur)), mid = (l + r) / 2; if (dir == 0) { if (n <= mid) ++ret, r = mid, ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; long long ans = 0; f... |
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) const int maxn = 2e5 + 5; struct node { int idx, p; bool operator<(const node &b) const { return p < b.p; } } ver[100005], hor[100005]; int vcnt, hcnt; vector<node> V1[maxn], V2[maxn]; int tempx[100005], tempy[100005];... |
//*****************************************************************************
//(c) Copyright 2009 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
//... |
/**
* 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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int t, n, i; cin >> n; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; long long int ans = 0; long long int pre[n + 1]; memset(pre, 0, sizeof(pre))... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int ans = 0; int score = -1; for (int i = 0; i < n; i++) { int sub, subsc = 0; scanf( %d , &sub); subsc += sub; scanf( %d , &sub); subsc += sub; scanf( %d , &sub); subsc += sub; scanf( %d ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:02:31 02/17/2016
// Design Name:
// Module Name: AR_RXD
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; bool isIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { double t1 = (y3 - y4) * (x1 - x3) + (x4 - x3) * (y1 - y3); double t2 = (x4 - x3) * (y1 - y2) - (x1 - x2) * (y4 - y3); double r1 = t1 / t2; double f1 = (... |
#include <bits/stdc++.h> using namespace std; vector<int> arr[60][60]; int path[60][60][110]; int adj[60][60]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { int x, y; scanf( %d%d , &x, &y); adj[x][y] = 1; int k; scanf( %d , &k); whi... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:49:18 09/03/2013
// Design Name:
// Module Name: timer
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > g(300005); int a[300005], s1[300005], s2[300005]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for (int i(1); i <= n; i++) { cin >> a[i]; } for (int i(0); i < n - 1; i++) { int x, y; cin >... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:16777216 ) const char DEBUG = 0; mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count()); struct pp { int pos, id; }; long long pos[200000]; int type[200000]; int res[100000]; vector<int> arr; in... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) #pragma GCC target( avx,avx2 ) using namespace std; const long double eps = 1e-6; long double inf = 0; const long long mod = 1e9 + 7; long long gcd(long long a, long long b) { ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; map<pair<int, int>, bool> mp; bool check(int x, int y, int z) { if (y < x) swap(x, y); if (z < y) swap(z, y); if (y < x) swap(x, y); if (x + y > z && z > y && mp.count({x, y}) == 0) { mp[{x, y}] = 1; return 1; } else return 0; }... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
//////////////////////////////////////////////////////////////////////
// usbHostSlave_h.v
//////////////////////////////////////////////////////////////////////
`ifdef usbHostSlave_h_vdefined
`else
`define usbHostSlave_h_vdefined
// Version 0.6 - Feb 4th 2005. Fi... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* This 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 Free Software Foundation, version 3 of the License.
*
* This program is distribut... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 400010; int n; int fa[MAXN][21]; int dep[MAXN]; int LCA(int x, int y) { if (dep[x] < dep[y]) swap(x, y); for (int i = 20; i >= 0; i--) { if (dep[x] - (1 << i) >= dep[y]) { x = fa[x][i]; } } if (x == y) return ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n - 1); vector<int> b(n - 1); for (auto &d : a) cin >> d; for (auto &d : b) cin >> d; for (int u = 0; u <= 3; ++u) { vector<int> ans; ans.push_back(u); bool flagg = true; for... |
/*
* 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 arr[1000005]; int n, m, k; int main() { scanf( %d%d%d , &n, &m, &k); memset(arr, 0, sizeof arr); for (int i = 0; i < m; ++i) { int number; scanf( %d , &number); arr[number] = 1; } bool flg = 0; int where = 1; if (arr... |
/**
* 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... |
`ifdef cyclonev
`define LCELL cyclonev_lcell_comb
`define MAC cyclonev_mac
`define MLAB cyclonev_mlab_cell
`define IBUF cyclonev_io_ibuf
`define OBUF cyclonev_io_obuf
`define CLKENA cyclonev_clkena
`endif
`ifdef cyclone10gx
`define LCELL cyclone10gx_lcell_comb
`define MAC cyclone10gx_mac
`define MLAB cyclone10gx_mlab_c... |
module RxUart_tb ();
reg clk; ///< System clock
reg rst; ///< Reset FIFO
reg x16BaudStrobe; ///< Strobe at 16x baud rate
reg read; ///< Read strobe for buffer
reg write; ///< Write strobe
reg [7:0] dataIn; ///< Data to transmit
wire [7:0] dataOut; ///< Data from receive buf... |
/**
* 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 mod = 1e9 + 7; const int N = 1e6 + 10; const long long INF = 1e18; const long double EPS = 1e-12; int a[300005]; map<int, int> mi; int l_, r_; long long pre[300005]; int b[300005]; int main() { int n; scanf( %d , &n); for (int i =... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: multiplier.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ====================================... |
/*
* 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 a[105]; double t[105]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int cnt; for (int d = -1000; d <= 1000; d++) { if (d != 0) { for (int i = 0; i < n; i++) { t[i] = a[i] * 1.0 /... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.