text
stringlengths
59
71.4k
/********************************************************************* * SYNOPSYS CONFIDENTIAL * * * * This is an unpublished, proprietary work of Synopsys, Inc., and * * is fully protected under copyrigh...
module mu80( input wire clock_100, /* 4 x LED */ output wire [3:0] led, /* VGA PINOUTS */ output wire [4:0] r, output wire [5:0] g, output wire [4:0] b, output wire hs, output wire vs ); assign led = {cpu_led, locked, clock_cpu}; // Îáú...
#include <bits/stdc++.h> using namespace std; int k, s, luu; int F[100000]; int a[100000]; int res; int main() { cin >> s >> k; F[0] = 1; F[1] = 1; for (int i = 2; i <= 10000; i++) { F[i] = 2 * F[i - 1]; if (i >= k + 1) F[i] -= F[i - k - 1]; if (F[i] > 1000000000) { ...
/** * 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...
// BF2HW // Copyright (C) 2017 Christian Fibich // // 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. // // IP for th...
#include <bits/stdc++.h> using namespace std; const int M = 4005; int read() { int x = 0, f = 1; char c; while ((c = getchar()) < 0 || c > 9 ) { if (c == - ) f = -1; } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); } return x * f...
#include <bits/stdc++.h> using namespace std; int tree[1000000 + 5], a[1000000 + 5], data[1000000 + 5], rear, sum; int lowbit(int x) { return (x & -x); } void modify(int x, int value) { for (int i = x; i <= 1000000; i += lowbit(i)) tree[i] += value; return; } int query(int x) { int sum = 0; ...
// 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 : Sun Apr 09 08:27:08 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; long long n, q, sum, x; int main(void) { scanf( %lld%lld , &n, &q); while (q--) { scanf( %lld , &x); while (x % 2 == 0) { sum = (x + 1) / 2 + 1, sum = n - sum, x += sum + 1; } printf( %lld n , x / 2 + 1); } return 0; }...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using pii = pair<int, int>; using pll = pair<ll, ll>; ll power[40]; void dfs(int id, vi& v, vi& s) { if (id < v.size()) { s....
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: rep_jbi_sc2_2.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 it and...
/** * 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 maxn = 5e5 + 10; int n, m, x, y, w, cnt, col[maxn], dis[maxn], vis[maxn], d[maxn], head[maxn]; struct node { int nxt, to, val; } e[maxn << 1]; void add(int x, int y, int w) { e[++cnt].to = y; e[cnt].nxt = head[x]; head[x] = cnt; e[c...
#include <bits/stdc++.h> using namespace std; const int N = 2005, M = 998244353; int read(int x = 0, int f = 1, char c = getchar()) { for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) f = -1; for (; c >= 0 && c <= 9 ; c = getchar()) x = x * 10 + c - 0 ; return x * f; } int n, a[N][...
#include <bits/stdc++.h> using namespace std; int main() { long long i = -1, k, l; cin >> k >> l; while (l % k == 0) { l /= k; i++; } if (i >= 0 && l == 1) cout << YES << endl << i << endl; else cout << NO << endl; }
//***************************************************************************** // (c) Copyright 2009 - 2010 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; void RI() {} template <typename... T> void RI(int& head, T&... tail) { scanf( %d , &head); RI(tail...); } void RLL() {} template <typename... T> void RLL(long long& head, T&... tail) { scanf( %lld , &head); RLL(tail...); } void print() { ...
// (C) 2001-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 doc...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long mas[n]; long long sum = 0; for (int i = 0; i < n; i++) { cin >> mas[i]; sum += mas[i]; } sort(mas, mas + n); int k; cin >> k; int c; while (k > 0) { cin >> c; cou...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, flag = 0; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } sort(v.begin(), v.end()); if (v[0] == 0) { vector<int> v1(n); ...
module lut_n(clk,n_clk, state); /* This module contains the framework for an eighty-state look-up table. It takes a seed value followed by an arbitrary list of 79 corner values in ascending order and uses if-else conditionals, selecting if(val<val0), state0, if(val<val1), state1, ..., else state_80. State changes are m...
/** * 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 M = 1000000007; int n; int dp[1000010]; int main() { while (~scanf( %d , &n)) { int a = 0; for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); if (x == 1) a++; } dp[0] = dp[1] = 1; for (int i =...
/////////////////////////////////////////////////////////////////////////////// // // Module: small_fifo.v // Project: UNET // Description: small fifo with no fallthrough i.e. data valid after rd is high // /////////////////////////////////////////////////////////////////////////////// module small_fifo #...
#include <bits/stdc++.h> using namespace std; long long int k; long long int ways(long long int n) { long long int calc, ways = 0; for (int k = 2; k <= 10000000; k++) { calc = n / (1ll * k * k * k); ways += calc; if (calc == 0) { break; } } return ways; } long l...
/** * 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 station { int p, x, dir; station() {} station(int pp, int xx, int dirr) { p = pp; x = xx; dir = dirr; } }; bool cmp(station a, station b) { if (a.x != b.x) return a.x < b.x; return a.dir == 1; } int d, n, m; int...
#include <bits/stdc++.h> using namespace std; const int N = (int)2e5 + 100; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } long long int modexp(long long int x, long long int n, long long int mod) { long long int result = 1; while (n > 0) { ...
#include <bits/stdc++.h> using namespace std; int bv[7][9] = {{}, {4}, {2, 6}, {2, 4, 6}, {0, 2, 6, 8}, {0, 2, 4, 6, 8}, {0, 2, 3, 5, 6, 8}}; int bh[7][9] = {{}, {4}, {0,...
`include "defines.v" `timescale 1ns/1ps module tb( ); wire injrd, injack; reg clk, rst; reg `control_w flit0c; reg `data_w flit0d; reg `control_w flit1c; reg `data_w flit1d; wire `control_w port0_co, port1_co, port2_co, port3_co, port4_co; wire `data_w port0_do, port1_do, port2_do, port3_do, p...
#include <bits/stdc++.h> using namespace std; inline int read() { int neg = 1, num = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) neg = -1; for (; isdigit(c); c = getchar()) num = (num << 1) + (num << 3) + c - 0 ; return neg * num; } struct node { int x,...
/* * 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 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will...
#include <bits/stdc++.h> using namespace std; int a[300001], d[300001]; long long b[300001], c[300001]; map<int, int> mp; int main() { int n, i, l, r, j, k; long long s, _s; for (scanf( %d , &n), i = 1; i <= n; i++) { scanf( %d , &a[i]); b[i] = b[i - 1] + a[i]; c[i] = c[i - 1] + ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << yes << endl; cout << 1 1 n ; return 0; } vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int l = 0, r = 0; while (l + 1 < n && a[l] < a[l + 1]) l++; r...
#include <bits/stdc++.h> using namespace std; template <class T, class S> ostream& operator<<(ostream& os, const pair<T, S>& v) { return os << ( << v.first << , << v.second << ) ; } template <class T> ostream& operator<<(ostream& os, const vector<T>& v) { os << [ ; for (int i = int(0); i ...
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(0); cout.sync_with_stdio(0); int n, a, c, d, k = 0; cin >> n >> a; c = floorl(n * a / 180.l); if (c > n - 2) c = n - 2; if (c < 1) c = 1; d = ceill(n * a / 180.l); if (d > n - 2) d = n - 2; if (d <...
// 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 : Sun Apr 09 07:02:45 2017 // Host : GILAMONSTER running 64-bit major release (...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
// Copyright (c) 2000-2011 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int x, y, a, b; cin >> x >> y >> a >> b; if ((y - x) % (a + b) != 0) { cout << -1 << endl; } else { cout << (y - x) / (a + b) << endl; } } }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sum = 0; cin >> n >> m; sum = n + (n - 1) / (m - 1); cout << sum << endl; return 0; }
`ifndef REGISTER_FILE_V `define REGISTER_FILE_V `define EAX 5'd0 `define EBX 5'd1 `define ECX 5'd2 `define EDX 5'd3 `define ESI 5'd4 `define EDI 5'd5 `define EBP 5'd6 `define ESP 5'd7 `define CS 5'd8 `define DS 5'd9 `define SS 5'd10 `define ES 5'd11 `define FS 5'd12 `define GS 5'd13 `define REG_CTRL 5'd14 `define IN...
#include <bits/stdc++.h> using namespace std; string scan(); const int mod = 1000000007; const int MAXN = 10010; int sta[MAXN], stb[MAXN]; long long s, x; long long memo[MAXN][2]; long long bt(int i, int rem) { if (i > 52 && rem == 0) return 1; if (i == 60) return 0; long long &ret = memo[i]...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 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 distributed ...
module top; reg a; reg q, d; reg clk; event foo; real rl; int ar []; int start = 0; int stop = 1; int step = 1; int done = 0; task a_task; real trl; event tevt; reg tvr; $display("user task"); endtask always_ff @(posedge clk) begin: blk_name event int1, int2; real in...
#include <bits/stdc++.h> using namespace std; const int maxn = 300010; multiset<int> val[maxn]; struct Trie { int next[maxn][26], fail[maxn], end[maxn]; int last[maxn]; int root, L; int newnode() { for (int i = 0; i < 26; i++) next[L][i] = -1; fail[L] = last[L] = end[L] = 0; re...
#include <bits/stdc++.h> using namespace std; long long f[20][55][2600], c[20]; long long l[5005], tot = 0; void Turn(long long k) { memset(c, 0, sizeof(c)); while (k) c[++c[0]] = k % 10, k /= 10; return; } int gcd(int x, int y) { return x % y ? gcd(y, x % y) : y; } long long Search(int x, int...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: i2c_cpx_cnt.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 it and/o...
/********************************************************************* * SAED_EDK90nm_SRAM : SRAM2RW128x8 Verilog description * * --------------------------------------------------------------- * * Filename : SRAM2RW128x8.v * * SRAM name : SRAM2RW128x...
/* * 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 n, m; int main() { int i, j; scanf( %d%d , &n, &m); for (i = 1; i <= n / 2; i++) { for (j = 1; j <= m; j++) { printf( %d %d n , i, j); printf( %d %d n , n - i + 1, m + 1 - j); } } if (n % 2 == 1) { for (j = 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; const int N = 12005, inf = 2e9; int n, q, a, b, k, m; double x[N], y[N], ans[N], p[N], t, s; int main() { scanf( %d%d%d%d , &n, &q, &a, &b); for (int i = 1; i <= n; i++) scanf( %lf , &p[i]); x[m] = 1, y[m] = 2.0 * (1 - p[1]), m++; x[m] = inf, y[m] ...
#include <bits/stdc++.h> const int MAX_N = 20; int n, k, t; int e[MAX_N + 1][MAX_N + 1]; int choosen[MAX_N + 1]; int mid; int cnt; void dfs(int x, int now_cost_sum) { if (now_cost_sum > mid) return; if (cnt >= t) return; if (x > n) { cnt++; return; } dfs(x + 1, now_cost_sum...
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 7, M = 1e6 + 7; int row[N], col[N]; long long dpc[M], dpr[M]; int main() { priority_queue<int> pqc, pqr; int n, m, k, p; scanf( %d %d %d %d , &n, &m, &k, &p); for (int i = 0; i < n; i++) { for (int j = 0; j < m; 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 la...
//-------------------------------------------------------------------------------- // Project : SWITCH // File : enet_ddr_ctrl.v // Version : 0.3 // Author : Shreejith S, Vipin K // // Description: Ethernet DDR Interface Controller // //-------------------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; const int oo = maxn; int n; int a[maxn], b[maxn], c[maxn], it[maxn * 8], itmin[maxn * 8]; int findit(int u, int v, int l, int r, int i) { if (r < u || v < l) return oo; if (u <= l && r <= v) { return (itmin[i]); } ...
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a; b = a; for (string::reverse_iterator itr = a.rbegin(); itr != a.rend(); itr++) b += *itr; cout << b << endl; return 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 la...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; const int MOD = 1e9 + 7; void solve() { int n, m; cin >> n >> m; cout << (n % m ? NO n : YES n ); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int t = 1; cin >> ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k; int n; cin >> n; long arr[n][2]; for (i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1]; long long minx, miny, maxx, maxy; minx = arr[0][0]; miny = arr[0][1]; maxx = arr[0][0]; maxy = arr[0][1]; for (i...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4 ) using namespace std; const int inf = (int)2e9 + 99999, mod = (int)1e9 + 7; const long long linf = (long long)2e18 + 99999; int kob(int x, int y) { return ((long...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,unroll-loops ) #pragma GCC target( avx,avx2,fma ) using namespace std; const long long sz = 3e3 + 10, mod = 998244353; char s[sz], t[sz]; long long dp[sz][sz]; long long solve(long long l, long long r) { if (l > r) return 1; long long &ret = dp[...
// Testbench for ltcminer_icarus.v `timescale 1ns/1ps `ifdef SIM // Avoids wrong top selected if included in ISE/PlanAhead sources module test_ltcminer (); reg clk = 1'b0; reg [31:0] cycle = 32'd0; initial begin clk = 0; while(1) begin #5 clk = 1; #5 clk = 0; end end always @ (posedge clk) ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 100; const long long INF = 1e18; struct node { long long d, f, t, c; } a[N]; long long b[N]; long long dp[1000006], dp1[1000005]; bool cmp(node p, node q) { return p.d < q.d; } int main() { int n, m, k; long long x = 1000000...
#include <bits/stdc++.h> using namespace std; vector<int> prime; int y; int checker(int n) { for (int i = 0; i < y && i < n; i++) { if (prime[i] + prime[i + 1] + 1 == n) return 1; if (prime[i] + prime[i + 1] + 1 > n) return 0; } } int isprime(int n) { int x = sqrt(n); for (int i ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, sx, sy; cin >> n >> sx >> sy; vector<pair<long long, long long>> vec(n); for (int i = 0; i < n; i++) { cin >> vec[i].first >> vec[i].second; } long long ans1 = 0, an...
////////////////////////////////////////////////////////////////////// //// //// //// eth_txcounters.v //// //// //// //// This file is part of the Ether...
/* * 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...
module ads62p44_spi( output reg sdio, output reg csb, input rst, input clk, output reg spi_ok, input [2:0] adcmode ); wire [6:0] lut_index=7'd12;//spi register 0~lut_index //////////////////////////////////////////// function [15:0] lut_data; input [5:0] addr; begin case(addr)////I7~I0,D7~D0 6'd0 :lut_data = {8'...
// BF2HW // Copyright (C) 2017 Christian Fibich // // 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. // // IP for th...
#include <bits/stdc++.h> using namespace std; int a[100010]; int b[100010]; long long dp[100010][2]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= n; ++i) { cin >> b[i]; } dp[1][0] = a[1]; dp[1][1] = b[1]; long ...
#include <bits/stdc++.h> using namespace std; int n, m, k, x, y, H[300005], d, ant[300005]; vector<int> v[300005], st, L; void dfs(int nod) { int ok = 0; st.push_back(nod); H[nod] = st.size(); if (H[nod] >= d) { cout << PATH n ; cout << st.size() << n ; for (auto it : st) co...
`include "hglobal.v" `default_nettype none module hnull_sink #(parameter MY_LOCAL_ADDR=0, PRB_SRC_ADDR=0, ASZ=`NS_ADDRESS_SIZE, DSZ=`NS_DATA_SIZE, RSZ=`NS_REDUN_SIZE )( `NS_DECLARE_GLB_CHNL(gch), `NS_DECLARE_IN_CHNL(rcv0), `NS_DECLARE_ERR_CHNL(err0) ); parameter RCV_REQ_CKS = `NS_REQ_CKS; `NS_DEBOU...
module Example(outA, outB, outC, outD); parameter OUTPUT = "FOO"; output wire [23:0] outA; output wire [23:0] outB; output reg outC, outD; function automatic [23:0] flip; input [23:0] inp; flip = ~inp; endfunction generate if (flip(OUTPUT) == flip("BAR")) ...
`timescale 1ns / 1ps module t_counter; // Inputs reg [3:0] iSW; reg iCLK_50; reg [1:0] iBTN; // Outputs wire [7:0] oLED; defparam uut.led.cN = 2; // Instantiate the Unit Under Test (UUT) counter uut ( .oLED(oLED), .iSW(iSW), .iCLK_50(iCLK_50), .iBTN(iBTN) ); initial begin // Initialize Input...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Tue Mar 8 16:35:05 2016 //Host : lubuntu running 64-bit Ubuntu 15.04 //Command ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_exu_eclcomp7.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 i...
#include <bits/stdc++.h> using namespace std; int round_up(int i) { while (i & (i - 1)) { i = ((i - 1) | i) + 1; } return i; } class seg_t { public: vector<int> seg, ar; int n; seg_t(vector<int>& a) { n = a.size(); ar = a; int si = round_up(n); seg.resize...
#include <bits/stdc++.h> using namespace std; vector<int> g[200005]; int sz[200005]; void init(int node) { sz[node] = 1; for (auto it : g[node]) { init(it); sz[node] = sz[node] + sz[it]; } } void dfs(int node) { for (auto it : g[node]) { if (!(sz[it] & 1)) dfs(it); } ...
// (C) 2001-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 doc...
#include <bits/stdc++.h> using namespace std; namespace Elaina { template <class T> inline T Max(const T x, const T y) { return x < y ? y : x; } template <class T> inline T Min(const T x, const T y) { return x < y ? x : y; } template <class T> inline T fab(const T x) { return x < 0 ? -x ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n + 1]; int c; for (int i = 0; i <= n; i++) a[i] = i; if (k == n) cout << -1; else { for (int i = 1; i < (n - k); i++) { c = a[i]; a[i] = a[i + 1]; a[i + 1] = c; ...
#include <bits/stdc++.h> using namespace std; long long ppow(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = (res * a) % 998244353; a = (a * a) % 998244353; b >>= 1; } return res; } struct st { long long c, x, y; }; long long sum[2000000]; ...
#include <bits/stdc++.h> using namespace std; int N, M, lb[300010], ind[300010]; vector<int> g[300010], g2[300010]; int val[300010]; bool viz[300010]; int dfs(int nod, int v) { val[nod] = v; viz[nod] = 1; for (int nxt : g2[nod]) { if (viz[nxt]) continue; return dfs(nxt, v + 1); }...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2012 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
#include <bits/stdc++.h> using namespace std; template <class S, class T> ostream& operator<<(ostream& o, const pair<S, T>& p) { return o << ( << p.first << , << p.second << ) ; } template <class T> ostream& operator<<(ostream& o, const vector<T>& vc) { o << sz = << vc.size() << endl << [ ;...
/** * 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 cnt[200001], n, par; vector<int> adj[200001]; vector<pair<int, int> > v; void count(int h, int p) { cnt[h]++; for (auto it : adj[h]) if (it ^ p) { count(it, h); cnt[h] += cnt[it]; } } int ct(int h, int p) { for (auto...
/* * Copyright (c) 2001 Uwe Bonnes * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any la...
#include <bits/stdc++.h> using namespace std; pair<int, int> v[100005]; int a[100008]; int b[100005]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &v[i].first); v[i].second = i; } sort(v, v + n); int val = 0; int qt = (n + 2) / 3; i...
/**************************************************************************** Fetch Unit op 0 Conditional PC write 1 UnConditional PC write ****************************************************************************/ module ifetch(clk,resetn, en, squashn, we, op, ...
////////////////////////////////////////////////////////////////////////////////// // SCFIFO_80x64_withCount for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosmos OpenSSD is free soft...
/******************************************************************************* * 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 with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; const int maxn = 500000 + 10; int n; vector<int> li; struct node { int x, y; } p[maxn]; bool cmp1(node a, node b) { return a.x < b.x; } bool cmp2(node a, node b) { return a.y < b.y; } long long vis[maxn], ans; int main() { scanf( %d , &n); fo...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
// // 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...