text
stringlengths
59
71.4k
#include <bits/stdc++.h> const bool DEBUG = false; using namespace std; const long long maxn = 1e5 + 2; const long long INF = 4e18; const long long M = 1e9 + 7; const int lg = 21; const int z = 256 * 256; int n, m, a[maxn], t[maxn], dp[maxn]; string s; vector<int> g[2], v[2]; bool f(vector<int>(&v...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int legs[N]; bool hide[N]; vector<vector<int> > adj; void dfs(int v, int par = 0) { if (adj[v].size() <= 2u) { hide[v] = true; for (int i : adj[v]) { if (i != par) { dfs(i, v); } } } } ...
#include <bits/stdc++.h> int main() { char str[100][100] = { January , February , March , April , May , June , July , August , September , October , November , December }; char month[100]; scanf( %[^ n] , month); int n...
#include <bits/stdc++.h> using namespace std; const int maxn = 131072, P = 998244353, inv2 = (P + 1) / 2; int n, m, ans, a[maxn], b[maxn], fact[maxn], finv[maxn]; int lim, l, r[maxn], w[maxn]; vector<int> V; vector<int> f[maxn << 2][2][2]; int qp(int x, int y) { int z = 1; for (; y; y >>= 1, x = 1...
#include <bits/stdc++.h> #define PI 3.141592653589793238462643383279 #define EXP 2.71828182846 #define ll long long using namespace std; double log2(double n) { return log(n)/log(2); } double ln(double n) { return log(n)/log(EXP); } void Heap(signed long long int A[],sig...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: // Design Name: // Module Name: ACA_I_N16_Q4 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); cout << arr[(n - 1) / 2]; return 0; }
#include <bits/stdc++.h> using namespace std; int t, n; long double ang, ca, PI = acos(-1); int main() { ; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> t; while (t--) { cin >> n; ang = 2 * PI / (2 * n); ca = 0.5 / tan(ang / 2); cout << fixed...
(** Extraction : tests of optimizations of pattern matching *) Require Coq.extraction.Extraction. (** First, a few basic tests *) Definition test1 b := match b with | true => true | false => false end. Extraction test1. (** should be seen as the identity *) Definition test2 b := match b with | true => ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); const long long inf = 1e9; long long n; cin >> n; vector<pair<long long, long long> > m(n); for (int i = 0; i < n; i++) cin >> m[i].first >> m[i].second; long long maxy = -inf, miny = inf, maxx = -in...
#include <bits/stdc++.h> using namespace std; vector<int> vec; int main() { int k; cin >> k; string arr; while (k--) { cin >> arr; int n = arr.length(); int maxLen = 0; for (int i = 0; i < n; i++) { int len = 0; while (arr[i] == L ) { len++; ...
#include <bits/stdc++.h> using namespace std; const long long oo = 1000000000000000000; const int N = 100005; int main() { int n, x; scanf( %d , &n); multiset<int> a, b; for (int i = 0; i < int(n); i++) { scanf( %d , &x); a.insert(x); } for (int i = 0; i < int(n - 1); i++) { ...
////////////////////////////////////////////////////////////////////// //// //// //// MP3 demo Xilinx global signals //// //// //// //// This file is part of the MP3 d...
#include <bits/stdc++.h> const int MXN = 100010; bool alive[MXN * 5]; int L[MXN], R[MXN], T[MXN]; struct heap_t { int idx; heap_t(int nidx) : idx(nidx) {} bool operator<(const heap_t& cmp) const { return T[idx] > T[cmp.idx]; } }; struct ele_t { int idx, val; bool operator<(const ele_t& c...
#include <bits/stdc++.h> using namespace std; long long cnk[50][50] = {1}; long long calc(long long mask, long long mx, int cnt, int n) { if (mask > mx) return 0; if (cnt == 0) return 1; if (cnt > n + 1) return 0; if (mask + (1LL << (n + 1)) - 1 <= mx) return cnk[n + 1][cnt]; return calc(mask ...
// DESCRIPTION: Verilator: Verilog Test module for Issue#1609 // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2020 by Julien Margetts. module t (/*AUTOARG*/ reset, a, b, c, en, o1, o2, o3, o4, o5); input reset; input a; input b; input c; input en; output ...
#include <bits/stdc++.h> using namespace std; const double pi = 3.1415926535; const double eps = 1e-6; struct TP { int x, h, id; } P[110000]; bool cmp(TP a, TP b) { return a.x < b.x; } int n, tot, Z[110000], F[110000], num[110000], ans[110000]; int main() { scanf( %d , &n); for (int i = 0; i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:07:12 10/28/2015 // Design Name: // Module Name: UART_uart_module // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencie...
/* * This is a reduced example from comp1001 to demonstrate a problem * in the Icarus Verilog code generator. If the left && argument is * replaced with a single 1'b1 which should be logically equivalent * this will work correctly. It appears that the width of the * expression is being calculated incorrectly. */ ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2007 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; v95 v95 (); v01 v01 (); v05 v05 (); s05 s05 (); s09 s09 (); a23 a23 (); s12 ...
#include <bits/stdc++.h> using namespace std; int n, q; long long m, w[100000]; vector<long long> phiChain; long long modPow(long long a, long long p, long long mod) { return (p ? modPow((a * a) % mod, p / 2, mod) * ((p & 1) ? a : 1) : 1) % mod; } long long phi(long long x) { long long temp = 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...
/* * 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; void doRoutine() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } bool isInside(pair<long long int, long long int> p, pair<long long int, long long int> a[]) { return (p.first >= a[0].first) && (p.second >= a[0].second) ...
/** * 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 tx_sm #( parameter STATE_DEFER = 4'h0, parameter STATE_IFG = 4'h1, parameter STATE_IDLE = 4'h2, parameter STATE_PREAMBLE = 4'h3, parameter STATE_SFD = 4'h4, parameter STATE_DATA = 4'h5, parameter STATE_PAD = 4'h6, parameter STATE_JAM ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k[101], m, mi = 1000000; cin >> n; for (int i = 0; i < n; i++) cin >> k[i]; for (int i = 0; i < n; i++) { int c = 0, s = 0; for (int j = 0; j < k[i]; j++) { cin >> m; s += m * 5; c++; } ...
#include <bits/stdc++.h> using namespace std; int main() { int x = 0, o = 0, h = 0, v = 0, d = 0; char r; char ar[3][3]; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { cin >> ar[i][j]; if (ar[i][j] == X ) x++; else if (ar[i][j] == 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 : Wed Mar 01 09:52:04 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; const int INF = 1e8 + 7; int n; int Min[N][20], Max[N][20]; struct Node { int x, y; bool operator<(const Node& p) const { return x < p.x; } } nod[N]; long long sqr(long long x) { return x * x; } void rmq() { for (int i = ...
`timescale 1ns / 1ps module counter_updown_tb; // Inputs reg clk_in; reg rst_in; reg sync_load_in; reg [11:0] count_in; reg updown_in; // Outputs wire [11:0] count_out; // Instantiate the Unit Under Test (UUT) counter_updown uut ( .clk_in(clk_in), .rst_in(rst_in), .sync...
module fifo(/*AUTOARG*/ // Outputs fifo_full_w, data_valid_r, rdata_r, // Inputs clk, rst_n, enqueue_w, data_in_w, dequeue_w, full_threshold ); input clk; input rst_n; output fifo_full_w;...
// -- (c) Copyright 2010 - 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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; using UL = unsigned int; using ULL = unsigned long long; using LL = long long; int N; int CB[300000]; int CN[300000]; int Bbuf = 0, Nbuf = 0; int F(int cn, int cb) { int ans = 0; for (int i = 0; i < (N); i++) { ans = max(ans, abs(cn - CN[i]))...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; int n, k, a, m, cur; set<int> S; int main() { cin >> n >> k >> a; cin >> m; S.insert(0); S.insert(n + 1); cur = (n + 1) / (a + 1); for (int i = 0; i < m; i++) { int x; cin >> x; auto prv = S.lower_bound(x); auto nxt = ...
/* * PicoSoC - A simple example SoC using PicoRV32 * * Copyright (C) 2017 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
#include <bits/stdc++.h> using namespace std; const int N = 1e5; int n; pair<int, int> Cd[N + 10]; int cop[2 * N + 10], lnk[2 * N + 10]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &Cd[i].first), Cd[i].second = i * 2 - 1; sort(Cd + 1, Cd + 1 + n); int L = 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...
`timescale 1ns/1ps module axi_master_wr #( parameter ID_WIDTH = 2, parameter ADDR_WIDTH = 64, parameter DATA_WIDTH = 512, parameter AWUSER_WIDTH = 8, parameter ARUSER_WIDTH = 8, ...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ * * SVN revision information: * $Rev:: $: * $Author:: ...
#include <bits/stdc++.h> using namespace std; int n, m; long long a[200200]; int f(int x) { return ((x % n) + n) % n; } int main() { scanf( %d%d , &n, &m); m--; for (int i = (0); i < (n); i++) cin >> a[i]; int p = m; for (int i = (1); i <= (n); i++) if (a[p] >= a[f(m + i)]) p = f(m +...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int n; cin >> n; vector<int> m(n), r(n); unsigned long long lcm = 1; for (int i = 0; i < n; ++i) { cin >> m[i]; lcm *= m[i] / gcd(m[i], lcm); } for (int i = 0;...
#include <bits/stdc++.h> using namespace std; int main() { string s, c; int n, t = 0; cin >> n; cin >> s >> c; for (int i = 0; i < n; i++) { int p = s[i], k = c[i]; if (p <= k) t += min(abs(p - k), (p + 1) + (9 - k)); else t += min((9 - p) + (k + 1), abs(p - k))...
#include <bits/stdc++.h> using namespace std; long long int mod = 1e9 + 7; long long int inf = 9 * 1e18; const long long maxn = 2e5 + 100; long long pow(long long a, long long b) { if (b < 0) return 0LL; long long ans = 1; while (b) { if (b & 1) ans = ans * a; a = a * a; b >>= 1;...
#include <bits/stdc++.h> using namespace std; struct ghost { long long vx, vy; long long magic; ghost(long long x, long long y, long long a) : vx(x), vy(y), magic((long long)a * x - y) {} }; bool cmp1(const ghost& x, const ghost& y) { return x.magic < y.magic; } bool cmp2(const ghost& x, c...
#include <bits/stdc++.h> using namespace std; const int modulo = 1000000009; long long A(int events, int days) { if (events < days) return 0; long long result = 1; for (int e = events - 1; e >= days; --e) { result *= e; result %= modulo; } for (int i = 0; i < days; i++) { res...
#include <bits/stdc++.h> using namespace std; int a, b, c, l; long long Ans; int main() { cin >> a >> b >> c >> l; for (int i = 0; i <= l; i++) { long long lim = (a + b + c + i - 1) / 2; if (a <= lim && b <= lim && c <= lim) { Ans += (long long)(i + 2) * (i + 1) / 2; if (a + ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; cout << n / 2520 << endl; }
#include <bits/stdc++.h> using namespace std; const long long inf = 1000ll * 1000ll * 1000ll; const long long inf64 = inf * inf; const double pi = acos(-1.0); long long Abs(long long a) { return (a >= 0 ? a : -a); } template <typename T> inline T Sqr(T a) { return a * a; } vector<int> par, sz; b...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: linebuf.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
#include <bits/stdc++.h> using namespace std; const int P = 1e9 + 7; int n, m; namespace flow { int n, s, t; int head[200306], to[200306 << 1], nex[200306 << 1], wto[200306 << 1], ecn = 1; int ade(int u, int v, int w) { to[++ecn] = v, nex[ecn] = head[u], wto[ecn] = w, head[u] = ecn; to[++ecn] = u,...
/** * 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; template <typename U, typename V> void Min(U &a, const V &b) { if (a > b) a = b; } template <typename U, typename V> void Max(U &a, const V &b) { if (a < b) a = b; } template <typename U, typename V> void add(U &a, const V &b) { a = (a + b) % 1...
#include <bits/stdc++.h> using namespace std; long long int dp[205][205][205]; long long int recur(string &a, string &b, long long int index, long long int k, long long int curr) { if (index == a.size()) { return 0; } if (dp[index][k][curr] != -1) { return dp[index][k...
`timescale 1ns/10ps //----------------------------------------------------------------- // Module //----------------------------------------------------------------- module top_tb ; //----------------------------------------------------------------- // Registers / Wires //---------------------------------------------...
/* ORSoC GFX accelerator core Copyright 2012, ORSoC, Per Lenander, Anton Fosselius. WBM reader Loosely based on the vga lcds wishbone reader (LGPL) in orpsocv2 by Julius Baxter, This file is part of orgfx. orgfx is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General...
/* * 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; long long tree[1000001]; int n; void update(int x, long long val) { for (int i = x; i <= n; i += i & (-i)) { tree[i] += val; } } long long query(int x) { long long sum = 0; while (x > 0) { sum += tree[x]; x -= x & (-x); } ...
#include <bits/stdc++.h> using namespace std; struct point { int x, y; point(int x = 0, int y = 0) : x(x), y(y) {} }; point p[305]; int n; point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); } int cp(point a, point b) { return a.x * b.y - a.y * b.x; } double work() { int ...
////////////////////////////////////////////////////////////////// //// //// //// CRCAHB CORE BLOCK //// //// //// //// This file is part of the APB to I2C project //// //// http://www.opencores.org/cores/apbi2c/ //// //// //// //// Description //// //// Implementation of APB IP core according to //// ...
// megafunction wizard: %Shift register (RAM-based)% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: ALTSHIFT_TAPS // ============================================================ // File Name: Line_Buffer1.v // Megafunction Name(s): // ALTSHIFT_TAPS // // Simulation Library Files(s): // // ===...
#include <bits/stdc++.h> using namespace std; int N, X, ans; int A[100002]; int B[100002]; int main() { scanf( %d%d , &N, &X); for (int i = 1; i <= N; i++) scanf( %d , &A[i]); for (int i = 1; i <= N; i++) scanf( %d , &B[i]); sort(A + 1, A + N + 1); sort(B + 1, B + N + 1); for (int i = ...
#include <bits/stdc++.h> using namespace std; int read() { char c = getchar(); while (!isdigit(c)) c = getchar(); int num = 0; while (isdigit(c)) num = num * 10 + c - 0 , c = getchar(); return num; } void write(int num) { if (num >= 10) write(num / 10); putchar(num % 10 + 0 ); } ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long MAX = 100005; const long double PI = 3.14159265359; const long double G = 9.807; const long long INF = 1e18; const long double EPS = 1e-6; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : ...
#include <bits/stdc++.h> using namespace std; const int lim = 200005; long long int n; vector<vector<long long int> > ans; vector<long long int> ed; void solve(int test) { cin >> n; for (int(i) = 0; (i) < n; (i)++) { long long int v; cin >> v; vector<long long int>::iterator ind = ...
/* * 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 long long getnum() { char c = getchar(); long long num, sign = 1; for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) sign = -1; for (num = 0; c >= 0 && c <= 9 ;) { c -= 0 ; num = num * 10 + c; c = getchar(); } ...
/* * 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 (c) 1995-2011 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
//////////////////////////////////////////////////////////////////////////////// // Original Author: Schuyler Eldridge // Contact Point: Schuyler Eldridge () // button_debounce.v // Created: 10/10/2009 // Modified: 3/20/2012 // // Counter based debounce circuit originally written for EC551 (back // in the day) and then...
#include <bits/stdc++.h> using namespace std; int n; unordered_map<int, int> mask, f; int SG(int s) { if (f.count(s)) return f[s]; bool t[30] = {0}; for (int i = 0; s >> i; i++) { t[SG(s >> (i + 1) | (s & ((1 << i) - 1)))] = 1; } for (int i = 0; i < 30; i++) if (!t[i]) return f[s...
#include <bits/stdc++.h> using namespace std; long long INF = 1e6; long long M = 1e9 + 7; void solve() { long long n; cin >> n; vector<int> a(n), b(n - 1), c(n - 2); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) cin >> b[i]; for (int i = 0; i < n - 2; i++) cin ...
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { for (int i = 2; i < int(sqrt(n) + 1); i++) if (n % i == 0) return 0; return 1; } int main() { int n; cin >> n; if (isPrime(n)) return !(cout << 1 << n ); if (n & 1) { if (isPrime(n - 2)) cout << 2 <...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Wojtek Gumua // // Create Date: 14:00:36 05/19/2015 // Design Name: // Module Name: opening3x3 // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
//================================================================================================== // Filename : ceespu_alu.v // Created On : 2018-07-17 17:47:58 // Last Modified : 2018-07-21 20:57:40 // Revision : // Author : Cees Wolfs // // Description : The alu for the ceespu // // //=...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // 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) an...
#include <bits/stdc++.h> using namespace std; long long t, n, p[200100], c[200100], ans = 100100; bool hamin[200100]; vector<vector<long long> > cycle; bool same_color(long long ind, long long start, long long dist) { long long asdf = (start + dist) % cycle[ind].size(); while (asdf != start) { i...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, n, d, h; cin >> n >> d >> h; if (n >= d + 1 && d >= h + 1 && d <= 2 * h && h + 1 <= n && d >= 2) { for (i = 1; i <= h; i++) { cout << i << << i + 1 << endl; } i++; int f = 0; if (d - h >...
#include <bits/stdc++.h> using namespace std; template <typename T> T expo(T e, T n) { T x = 1, p = e; while (n) { if (n & 1) x = x * p; p = p * p; n >>= 1; } return x; } template <typename T> T power(T e, T n, T m) { T x = 1, p = e; while (n) { if (n & 1) x =...
// synthesis verilog_version verilog_2001 `timescale 1 ps / 1 ps //----------------------------------------------------------------------------- // Title : PCI Express Reference Design Example Application // Project : PCI Express MegaCore function //--------------------------------------------------------...
module wb_rom #(//Wishbone parameters parameter dw = 32, //Memory parameters parameter depth = 256, parameter aw = $clog2(depth), parameter memfile = "") (input wb_clk_i, input wb_rst_i, input [aw-1:0] wb_adr_i, input [dw-1:0] wb_dat_i, input [3:0] wb_...
#include <bits/stdc++.h> const int MX = 1e5 + 23; const long long MOD = 998244353; int read() { char k = getchar(); int x = 0; while (k < 0 || k > 9 ) k = getchar(); while (k >= 0 && k <= 9 ) x = x * 10 + k - 0 , k = getchar(); return x; } struct node { int l, r; int sum, mx...
#include <bits/stdc++.h> using namespace std; int main() { int t, a, i, j, ans, k, n, m; scanf( %d , &t); while (t--) { ans = 0; set<int> a; a.clear(); scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d , &k); if (k % 2 == 0) a.insert(k); } wh...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; vector<int> A(n + 7); for (int i = 1; i <= n; i++) cin >> A[i]; vector<int> B(n); for (int i = 1; i <= n; i++) B[i - 1] = i; sort(B.begin(), B.end(), [&](int a, int b) { return A...
#include <bits/stdc++.h> int main() { int n, h, a, b, t, f; int t1, f1, t2, f2; int sum; while (~scanf( %d%d%d%d%d , &n, &h, &a, &b, &t)) { while (t--) { sum = 0; scanf( %d%d%d%d , &t1, &f1, &t2, &f2); if (t1 > t2) { f = t1; t1 = t2; t2 = f; ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n; while (scanf( %d , &n) != EOF) { if (n & 1) printf( black n ); else printf( white n1 2 n ); } return 0; }
module pipeWrap( input clk, input rst_n, input start, input [31:0] MMIO_PIPE0, input [31:0] MMIO_PIPE1, input [31:0] MMIO_PIPE2, input [31:0] MMIO_PIPE3, input in_valid, output in_ready, input [63:0] in_data, output out_valid, input out_ready, output [63:0] out_d...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, i, j, k, ct; bool swapped = false; cin >> n >> m; if (n < m) { swap(n, m); swapped = true; } vector<vector<int>> ans(n, vector<int>(m, -1)); ct = 0; if (m...
From iris.program_logic Require Export weakestpre hoare. From iris.heap_lang Require Export lang. From iris.proofmode Require Import tactics. From iris.heap_lang Require Import proofmode notation. Section spec. Context `{!heapG Σ}. (* Set up the heap context *) (** * Hoare Triples *) (* Hoare-triple is a classi...
//----------------------------------------------------------------------------- // // (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; template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long double...
`include "macro.v" module ex_mem_buffer( input wire clock, input wire reset, input wire[`SIGNAL_BUS] stall, input wire ex_write_enable, input wire[`REGS_ADDR_BUS] ex_write_addr, input wire[`REGS_...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n); vector<int> ans(n); for (int i = 0; i < n; i++) cin >> v[i]; int flagie = 1; for (int i = 1; i < n; i++) if (v[i] != v[i - 1]) fl...
/* * 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...
/*------------------------------------------------------------------------------ * 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...
#include <bits/stdc++.h> using namespace std; struct zero { int nxt, to; } edge[200000 << 1]; int head[200000], tot = 0; void add_edge(int a, int b) { edge[++tot] = (zero){head[a], b}; head[a] = tot; } int n, m, plk, poi, d1, d2, dep[200000], kl[200000], d[200000], op[200000], h[200000];...
#include <bits/stdc++.h> using namespace std; int gr[1000005]; int was[1000005]; long long GetPow(long long val, int deg) { long long ret = 1; for (int i = 0; i < deg; ++i) { ret *= val; } return ret; } long long arr[100000]; int main() { long long sq4 = 2, sq2 = 2, val4 = 16, va...
//----------------------------------------------------------------------------- // (c) Copyright 2012 - 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 proper...