text stringlengths 59 71.4k |
|---|
/*
* 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 int read() { int x = 0; char ch = getchar(); bool positive = 1; for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) positive = 0; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 0 ; return positive ? x : -x;... |
#include <bits/stdc++.h> using namespace std; int di[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dj[] = {1, -1, 0, 0, -1, 1, 1, -1}; const double PI = 3.14159265359, EPS = 1e-9; const int N = 1000006, M = 1000006, Mod = 1000000007; vector<int> adj[N]; pair<int, int> tree[4 * N]; int n; string str; void bui... |
#include <bits/stdc++.h> using namespace std; int main() { int x, y, z; cin >> x >> y >> z; if (z == 0) { if (x > y) cout << + ; else if (x < y) cout << - ; else cout << 0 ; } else { if (x > y + z) cout << + ; else if (y > x + z) ... |
`timescale 1ns/1ps
module tb;
`include "useful_tasks.v" // some helper tasks
reg rst_async_n; // asynchronous reset
wire r1,r2;
wire a1,a2;
wire r,a;
two_phase_event_gen U_PORT1_EVENT_GEN (
.run(rst_async_n),
.req(r... |
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <cmath> #include <bitset> #include <iomanip> #include <queue> #include <stack> #include <map> #include <unordered_map> #include <unordered_set> #include <chrono> #include <random> #includ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; int a[] = {1, 2, 3, 4, 6, 12}; int b[] = {12, 6, 4, 3, 2, 1}; cin >> t; while (t--) { string s; cin >> s; int ans[20]; int count = 0, n = 0, no; for (int i = 0; i < 6; i++) { for (int j = 0; j... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Wed Sep 27 15:52:46 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int N = 10; int n, k; int a[1005]; int main() { ios_base::sync_with_stdio(false); cin >> n >> k; int nn = n; for (int i = 0; i < k; i++) { cin >> a[i]; while (a[i] >= 4 && nn > 0) { a[i] -= 4;... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; int n, m, q, u, v, w, l, r, ans, par[N], col[N], mark[N]; vector<pair<int, pair<int, int> > > yal, edge[N * N]; vector<int> cmp[N]; void add(int x) { for (int i = 0; i < edge[x].size(); i++) yal.push_back(edge[x][i]); } int Get_par(in... |
#include <bits/stdc++.h> using namespace std; int n, q, j, x[300000 + 10], a, b, sum, t, o[300000 + 10], p[300000 + 10], h = 1; int main() { cin >> n >> q; for (int i = 0; i < q; i++) { cin >> a >> b; if (a == 1) { j++; x[j] = b; o[b]++; p[b]++; su... |
//愿你和你重要的人能够重逢! #include<bits/stdc++.h> using namespace std; template<typename T>inline void read(T &x) { x=0;char c=getchar(),f=0; for(;c<48||c>57;c=getchar()) if(!(c^45)) f=1; for(;c>=48&&c<=57;c=getchar()) x=(x<<1)+(x<<3)+(c^48); f?x=-x:0; } long long l,r,st,t,x,y;set<long long>s; int main(... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> t; while (t--) { cin >> n; vector<int> a(n); int mx = 0; for (auto &it : a) { cin >> it; mx = max(mx, it); } int r = n - 1; int ind = -1; for (int l = 0; l < n; l++... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 4e3 + 5; const int mod = 1e9 + 7; const double eps = 1e-8; const double pi = asin(1.0) * 2; const double e = 2.718281828459; bool Finish_read; template <class T> inline void read(T &x) { Finish_read = 0; ... |
#include <bits/stdc++.h> using namespace std; long long n, k, x; long long eval(long long x) { long long ret = 0; if (x % 4 == 0) { return x / 4; } else { if (x % 4 == 3) { x -= 15; ret++; ret++; } else if (x % 4 == 2) { x -= 6; ret++; } ... |
#include <bits/stdc++.h> using namespace std; int n; int a[200001]; vector<int> G[200001]; int res[200001]; vector<int> divisor; vector<int> now; int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } void dfs(int v, int p) { for (int i = 0; i < G[v].size(); i++) { i... |
// wasca_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module wasca_nios2_gen2_0 (
input wire clk, // cl... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200001; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; string s; cin >> s; int ans = 2e9; vector<int> can; vector<string> cand; for (int i = 0; i < 10; i++) { priority_queue... |
/**
* 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... |
// LCD video synchronizer, generates X/Y coordinates, validity of
// current pixel RGB value.
// Copyright (c) 2013 Jared Boone, ShareBrained Technology, Inc.
//
// This file is part of the Medusa project.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Gener... |
#include <bits/stdc++.h> namespace FASTIO { char buf[1 << 21]; char *p1, *p2; template <typename T> inline void wt(T x, char c = n ) { if (x < 0) { x = -x; putchar( - ); } static char sta[sizeof(T) * 8]; T top = 0; do { sta[top++] = x % 10; x /= 10; } while (x... |
#include <bits/stdc++.h> using namespace std; inline int read() { char c; int x = 0; int b = 1; do { c = getchar(); if (c == 45) b = -1; } while (c > 57 || c < 48); do x = x * 10 + c - 48, c = getchar(); while (c <= 57 && c >= 48); x *= b; return x; } int n, m, t;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> a(n); vector<int> b(n); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; vector<int> c(n); for (int zsuv = 0; zsuv < l; ++zsuv) { for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; int n, m; inline int read() { int t = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) f = (ch == - ) ? -1 : f, ch = getchar(); while (ch >= 0 && ch <= 9 ) t = t * 10 + ch - 0 , ch = getchar(); return t * f; } struct orz { c... |
#include <bits/stdc++.h> using namespace std; inline long long in() { long long x = 0; int n = 1; char c = getchar(); while (!isdigit(c)) { n = (c == - ) ? -1 : 1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } return x * n; } ... |
////////////////////////////////////////////////////////
// RS-232 RX and TX module
// (c) fpga4fun.com & KNJN LLC - 2003 to 2013
// The RS-232 settings are fixed
// TX: 8-bit data, 1 stop, no-parity
// RX: 8-bit data, 1 stop, no-parity (the receiver can accept more stop bits of course)
//`define SIMULATION ... |
#include <bits/stdc++.h> using namespace std; long long N, x, y, awal, centre, nb, a; bool visited[100005]; vector<long long> adj[100005]; vector<int> ans; void dfs(int x) { int s = adj[x].size(); visited[x] = 1; bool cek = 1; for (int i = 0; i < s; i++) { nb = adj[x][i]; if (!vi... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module pulse_gen_core #(
parameter ABUSWIDTH = 16
... |
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T > 0) { T--; string a, b; int d; cin >> a >> b; for (int i = 0; i < b.length(); i++) if (b[b.size() - i - 1] == 1 ) { d = i; break; } for (int i = ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using str = string; using srt = short; const int INF = (int)1e9 + 4; const int MOD = (int)1e9 + 7; const int N = 1005; const ll inf = (ll)4e18; const ll mod = 998244353; bool us[N][N]; set<pair<in... |
#include <bits/stdc++.h> using namespace std; const long long MAX = 150004; const long long mod = 998244353; struct edge { long long next, to; } h[MAX << 1]; long long head[MAX], cnt, cnt_dfsn; long long n, q, ans, inv; inline void add(long long x, long long y) { h[++cnt] = edge{head[x], y}; ... |
#include <bits/stdc++.h> using namespace std; int read() { char c = getchar(); int t = 0, f = 1; while (c > 9 || c < 0 ) f = (c == - ) ? -1 : 1, c = getchar(); while (c >= 0 && c <= 9 ) t = t * 10 + c - 0 , c = getchar(); return t * f; } struct node { int L, R, po, id; bool o... |
#include <bits/stdc++.h> using namespace std; struct E { int a, b, c; }; struct unionfind { vector<int> p, s; int c; unionfind(int n) : p(n, -1), s(n, 1), c(n) {} int find(int a) { return p[a] == -1 ? a : find(p[a]); } vector<pair<int *, int>> buf; void save(int &a) { buf.emplace_bac... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e6 + 7, Inf = 1e9 + 7; int n, m, k = Inf, x, l, r, f, a[inf], b[inf], c[inf], d[inf]; map<int, int> p[inf]; vector<int> v; string s; int main() { cin >> n >> s; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i < n; ++i) ... |
#include <bits/stdc++.h> using namespace std; const int N = 200 + 5; const int LEN = 1e6 + 10; int n, m, q; int a[N]; int b[N]; int f[N][N]; char ch[LEN]; int g[LEN], l; int xt[N * N], yt[N * N]; int dp[N][N]; int cnt, cir[N * N][10]; int lc[N * N]; int c0[N][N]; int bel[N][N]; int nx[N]... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[301]; int l[301], r[301]; void INPUT() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> l[i] >> r[i]; } void SOLVE() { int res = 0; int ans[301], tam[301]; int sl = 0; in... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)1e6 + 5; const int INF = (int)1e9 + 7; int main() { ios_base ::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int a, b, c, d; cin >> a >> b >> c >> d; if (a + b == c + d or a + c == b + d or a + d == c + b or... |
#include <bits/stdc++.h> using namespace std; long long t, n; int main() { cin >> t; vector<int> a; for (int i = 1; i <= 10000; i++) { n = i; vector<int> v; while (n > 0) { v.push_back(n % 10); n = n / 10; } reverse(v.begin(), v.end()); for (int j = ... |
// Hazard checking unit
module hazard_unit
(
input wire[4:0] rs1_ex_mem_hz_i,
input wire[4:0] rs2_ex_mem_hz_i,
input wire[4:0] rd_mem_wb_hz_i,
input wire[4:0] rd_wb_ret_hz_i,
input wire[1:0] op2sel_ex_mem_hz_i,
input wire rf_en_mem_wb_hz... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int find_first_num_index(long long &k, long long n) { if (n == 1) { return 0; } n--; int first_num_index; long long n_partial_fact = n; while (k >= n_partial_fact && n > 1) { n_partial_fact *= (n - 1);... |
// DEFINES
`define BITS 2 // Bit width of the operands
module bm_if_common(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
out0,
out2,
out1);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS-1:0] a_in;
input [`BITS-1:0] b_in;
input c_in;
input d_in;
output [`BITS-1:0] out0;
out... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:23:50 04/19/2016
// Design Name:
// Module Name: clock
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
module OSERDESE2 ( /*AUTOARG*/
// Outputs
OFB, OQ, SHIFTOUT1, SHIFTOUT2, TBYTEOUT, TFB, TQ,
// Inputs
CLK, CLKDIV, D1, D2, D3, D4, D5, D6, D7, D8, OCE, RST, SHIFTIN1,
SHIFTIN2, T1, T2, T3, T4, TBYTEIN, TCE
);
parameter DATA_RATE_OQ=0;
parameter DATA_RATE_TQ=0;
parameter DATA_WIDTH=0;
para... |
/**
* 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() { int t; cin >> t; string s; for (int j = 0; j < t; j++) { cin >> s; int n = s.size(); cout << s[0]; for (int i = 1; i < n - 1; i++) { if (s[i] == s[i + 1]) { cout << s[i]; i += 1; } ... |
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`endif
module top;
reg pass;
reg [7:0] in;
reg [3:0] out;
initial begin
pass = 1'b1;
in = 8'b10100101;
`ifdef SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
out = in[7:'dx];
`else
out = 4'bxxxx;
`endif
if (out !== 4'bxxxx) begin
... |
//--------------------------------------------------------------------------------
// Logic_Sniffer.vhd
//
// Copyright (C) 2006 Michael Poppitz
//
// 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 Founda... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 Xilinx, Inc.
//
// 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
//
//... |
/**
* 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... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu_triangle.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided th... |
#include <bits/stdc++.h> using namespace std; long long tree[4 * 1000005]; void update(int v, int l, int r, int ind) { if (l > r || l > ind || ind > r) return; if (l == r) { tree[v] = 1; return; } int mid = (l + r) / 2; update(2 * v, l, mid, ind); update(2 * v + 1, mid + 1, r, ... |
#include <bits/stdc++.h> using namespace std; using lli = long long int; lli mod = 1000000007.0; int main(void) { long long t; cin >> t; lli x; lli n; while (t--) { cin >> n; x = 1; for (lli i = 2 * n; i >= 3; i--) { x *= i; x = x % mod; } cout <... |
/*
* 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 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2006 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc = 0;
reg [6... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const double eps = 1e-6; const int N = 1 << 17; char S[N], T[N]; int AS[N], AT[N], BS[N], BT[N]; int main() { cin >> (S + 1) >> (T + 1); int n = strlen(S + 1), m = strlen(T + 1); for (int i = 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 la... |
#include <bits/stdc++.h> using namespace std; int n, k, m; int a[100000]; int base = int(1e9 + 7); int lucky[2000]; long long co[2000]; long long f[2000][2000]; long long unlucky; long long frac[100001]; long long c[100001]; int size = 1100; int r1, r2; int getBit(int, int); void create(); ... |
#include <bits/stdc++.h> using namespace std; int n, m, a[111], ans = 1e9; set<int> s[111]; int main() { ios_base ::sync_with_stdio(false); cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 0, x, y; i < m; ++i) { cin >> x >> y; s[x].insert(y); ... |
#include <bits/stdc++.h> using namespace std; int n; vector<long long> S; vector<int> N, L, R; vector<bool> E; pair<long long, pair<int, int>> merge(int l, int r, int mid, pair<long long, pair<int, int>> L, pair<long long, pair<... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, k, a[N]; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + 1 + n); int p = n / 2 + 1, t = n / 2 + 1; for (int i = n / 2 + 2; i <= n; i++) if (1ll * (a[i] - a[i... |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; template <class T> using vec = std::vector<T>; bool __hack = std::ios::sync_with_stdio(false); auto __hack1 = cin.tie(nullptr); struct Input { Input(istr... |
#include <bits/stdc++.h> using namespace std; int head[100005]; struct edge { int vet, next; } E[200005]; int i, j, k, n, m, s, t, tot, L; int top[100005]; int fa[100005]; int dep[100005]; int a[100005]; int dist[3005][3005]; double ans; int X, Y, all; int cyc[100005]; int getf(int x) { ... |
/*
* 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; struct atom { long long f, w, where; void scan() { scanf( %I64d%I64d , &f, &w); } } x[310000]; priority_queue<long long> A, B; int compare(atom k1, atom k2) { return k1.f > k2.f || (k1.f == k2.f && k1.where < k2.where); } int n, pre, ans, where; ... |
module mac (input clock, input reset, input enable, input clear,
input signed [15:0] x, input signed [15:0] y,
input [7:0] shift, output [15:0] z );
reg signed [30:0] product;
reg signed [39:0] z_int;
reg signed [15:0] z_shift;
reg enable_d1;
always @(posedge clock)
enable_d1 <= #1 ena... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora Module Generator version 2.2
//
// Date: $Date: 2004/11/08 16:19:22 $
// Tag: $Name: i+H-38+78751 $
// File: $RCSfile: aurora_lane_4byte.ejava,v $
// Rev: $Revision: 1.1.6.2 ... |
#include <bits/stdc++.h> using namespace std; template <class T> void printArray(const T* a, int n, ostream& out = cerr); template <class T> void printArray(const vector<T>& arr, ostream& out = cerr); const long long mod = 1e9 + 7; const double PI = acos(-1); int n, i, j, k, t; int m; int a[200002];... |
module ramprog(input [11:0] adr, input we,
inout [31:0] data);
reg [31:0]ram[4095:0];
integer i = 0;
//Op Codes
parameter NOP = 4'b0000;
parameter LOAD = 4'b0001;
parameter STORE = 4'b0010;
parameter BRANCH = 4'b0011;
parameter XOR = 4'b0100;
parameter ADD = 4'b0101;
param... |
#include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long int ll; typedef pair<int, int> pi; typedef pair<long long, long long> pll; #define endl n #define ff first #define ss second #define pb push_back #define int long long #define sz(v) (int)v.size() #def... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; bool chk(string s) { int l = s.size(); for (int i = 0, j = l - 1; i <= j; i++, j--) { if (s[i] != s[j]) return false; } return true; } int main() { int t; cin >> t; while (t--) { string s; cin >... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Wed May 31 03:26:46 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:251700000 ) using namespace std; const int INF = 2e9; const double eps = 1e-6; const int M = 1e5 + 5; int n; string s[M]; bool us[M]; char SS[M]; string get_s() { scanf( %s , &SS); return string(SS); } int main() { scanf( %d ,... |
//Legal Notice: (C)2011 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... |
`timescale 1 ns / 1 ps
//////////////////////////////////////////////////////////////////////////////////
// Company: AGH UST
// Engineer: Wojciech Gredel, Hubert Górowski
//
// Create Date:
// Design Name:
// Module Name: Board
// Project Name: DOS_Mario
// Target Devices: Basys3
//... |
//*****************************************************************************
// (c) Copyright 2009 - 2011 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 prope... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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, ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { x = 0; char c = getchar(), f = 0; for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) f = 1; for (; c >= 0 && c <= 9 ; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); if (f) x = -... |
#include <bits/stdc++.h> using namespace std; int n, m, cnt, ans, tot; unordered_map<long long, int> id; int op[400010], d[400010], fa[400010], rk[400010], lg[400010], hs[400010]; struct node { int u, v; long long h; void bb() { if (u > v) swap(u, v); h = (long long)u << 30 | v; } ... |
//
// Copyright 2011 Ettus Research LLC
//
// 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, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
`timescale 1ns / 1ns
`define HALT 10'b00_0000_0000
`define EXEC 3'b100
module opc6tb();
reg [15:0] mem [ 65535:0 ], iomem[65535:0];
reg clk, reset_b, interrupt_b, int_clk, m1, clken;
wire [15:0] addr, data1;
wire rnw, vda, vpa, vio;
wire ceb = 1'b0;
wire oeb = !rnw;
reg ... |
// This is the Avalon slave for the IMU
//
// Registers 0-7 store ADC outputs
module imu_controller(
input chipselect,
input [3:0]addr,
input read,
output reg [31:0] readdata,
input spi_clk,
input sys_clk,
input ADC_SDAT,
output ADC_CS_N,
output ADC_SADDR,
output ADC_SCLK
);
wire [8*32-... |
#include <bits/stdc++.h> using namespace std; int n, m, ed, x, y; int l[200005], qd[200005], qn[200005], p[200005]; void bd(int x, int y) { qd[++ed] = y, qn[ed] = l[x], l[x] = ed; } int notinE(int x, int y) { for (int i = (l[x]); i; i = qn[i]) if (qd[i] == y) return 0; return 1; } int main()... |
#include <bits/stdc++.h> using namespace std; int n, m; long long k; int res[1000]; long long dp[205][205]; int p[105][105]; pair<int, int> a[10005]; long long calc(int i, int j) { if (j < 0) return 0; if (i == n + m - 1) { return (j == 0); } if (dp[i][j] != -1) return dp[i][j]; ... |
/*
* 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... |
/* -------------------- | LOSER | | ~NOOBOSS~ | -------------------- */ #include <bits/stdc++.h> using namespace std; #define mxx 1e18 #define mnn -1e18 #define Y() cout<< YES <<endl #define N(... |
`timescale 1ns/1ps
module tb_cocotb #(
parameter DATA_WIDTH = 32,
parameter FIFO_WIDTH = 8
)(
input rst,
input [31:0] test_id,
//write side
input WR_CLK,
output WR_RDY,
input ... |
// (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... |
// Single rail, 2-phase arbitrer
// From
// The Design and Implementation of an Asynchronous Microprocessor.
// PhD Thesis by Nigel Charles Paver
// From figure 3.16, page 42
// http://apt.cs.manchester.ac.uk/publications/thesis/paver94_phd.php
// Modified to get acknowledge signals on the input ports
module arbitre... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); long long int a, b; cin >> a >> b; vector<long long int> m; vector<long long int> n; set<long long int> s; m.push_back(1); n.push_back(1); if (a == 1) s.insert(1);... |
#include <bits/stdc++.h> using namespace std; int n, m, x, y, ans, f[200005]; char s[11]; int find(int k) { if (k == f[k]) return k; return f[k] = find(f[k]); } void add(int x, int y) { if (find(x) != find(y)) f[find(x)] = find(y); } int main() { scanf( %d%d , &n, &m); for (int i = 1... |
// (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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 15:16:08 09/12/2015
// Design Name: Gate-level implementation of 4:3 encoder.
// Module Name: encoder43gates
////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n; vector<int> v, lm, rm; class SegmentTreeMax { public: int n; vector<long long> vect; SegmentTreeMax(int _n) : n(_n) { vect.resize(2 * n); fill(vect.begin(), vect.end(), 0); } void modify(int p, lon... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; const int MAXN = 1e6 + 10; const long long MOD = 1e9 + 7; const long long MOD2 = 998244353; const long long INF = 8e18; const int LOG = 22; long long pw(long long a, long long b, long long mod) { return (!b ? 1 :... |
#include <bits/stdc++.h> using namespace std; long long int v[300001], sol[300001], S; int cnt = 0, marked[300001], dp[300001][2]; vector<int> g[300001]; long long int dfs(int node, int p) { sol[node] = v[node]; long long int res = sol[node]; for (auto it : g[node]) if (it != p) { re... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( fast-math ) using namespace std; template <class T> ostream &operator<<(ostream &str, vector<T>... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// 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... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.