text
stringlengths
59
71.4k
// 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 : Mon Sep 18 13:00:13 2017 // Host : vldmr-PC running 64-bit Service Pack 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...
//Legal Notice: (C)2010 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...
/* * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_dq_pscan.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 an...
/* * 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; template <class T> void print_array(T a[], int size) { for (int i = 0; i < size; i++) cout << a[i] << ; cout << endl; } template <class T> void print_array_v(T &a) { int size = a.size(); for (int i = 0; i < size; i++) cout << a[i] << ; ...
/** * 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 = 505; int dp[N][N]; int a[N]; int calc(int l, int r) { if (dp[l][r] != -1) return dp[l][r]; if (l > r) { return dp[l][r] = 1; } if (l == r) { return dp[l][r] = 1; } dp[l][r] = N; if (a[l] == a[r]) { dp[l][...
/* This file is part of JT51. JT51 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. JT51 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> arr; int n, a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; arr.push_back(a); } sort(arr.begin(), arr.end()); cout << arr[n - 1] << endl; arr.clear(); return 0; }
#include <bits/stdc++.h> using namespace std; long long t; long long n; long long tmp; long long gcd(long long a, long long b) { long long temp; if (a < b) { temp = a; a = b; b = temp; } while (b != 0) { temp = a % b; a = b; b = temp; } return a; }...
// (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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2004 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; reg [255:0] a; reg [255:0] q; reg [63:0] qq; i...
#include <bits/stdc++.h> using namespace std; int INT_MAX_VAL = (int)0x3F3F3F3F; int INT_MIN_VAL = (int)-0x3F3F3F3F; long long LONG_MAX_VAL = (long long)0x3F3F3F3F3F3F3F3F; long long LONG_MIN_VAL = (long long)-0x3F3F3F3F3F3F3F3F; vector<long long> G[5005]; long long n; int W; int cnt[5005]; int dp[2...
#include <bits/stdc++.h> using namespace std; struct sir { int val, ind; }; sir sv[200005]; int n, m, k, v[200005], part[200005], t = 0; long long sum = 0; bool B[200005]; bool comp(sir X, sir Y) { return X.val > Y.val; } int main() { cin >> n >> m >> k; for (int i = 1; i <= n; ++i) { ...
//--------------------------------------------------------------------------- //-- Copyright 2015 - 2017 Systems Group, ETH Zurich //-- //-- This hardware module 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 ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; int p; cin >> n >> k >> p; long long ndiv2 = n / 2; long long ndiv2minus1 = n / 2 - 1; long long nminusk = n - k; for (int i = 0; i < p; i++) { long long x; scanf( %I64d , &x); printf( %c , ((((x...
module srl_init_tester # ( parameter [255:0] PATTERN = 256'hFE1AB3FE7610D3D205D9A526C103C40F6477E986F53C53FA663A9CE45E851D30, parameter SRL_LENGTH = 32 ) ( input wire clk, input wire rst, input wire ce, output reg srl_sh, output wire [SRL_BITS-1:0] srl_a, output wire srl_d, input wire srl_q, output reg ...
/* * 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 be us...
module uart_ctrl ( clk, reset_, tx, rx, addr, cs, req, rnw, wr_data, rd_data, rdy); input clk; input reset_; output tx; // Transmit to host computer input rx; // Receive from host computer // This circuit provides software cont...
// (c) Copyright 1995-2017 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 license and does not grant ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const int INF = 1000 * 1000 * 1000 + 7; const long long LINF = INF * (long long)INF; const int MAX = 1000 * 100 + 47; long long A[MAX]; long long P[MAX]; long long Q[MAX]; long long R[MAX]; int main() { int n; long lon...
#include <bits/stdc++.h> using namespace std; const int N = 20; const int mod = 1e9 + 7; long double a[N]; int n, k; long double dp[1 << N], out[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> k; int zeros = 0; for (int i = 0; i < n; i++) cin >> a[i], zeros +...
/* * 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...
/* * 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, a[100001], t, l, r; int _gcd[262144][19], _min[262144][19], _num[262144][19]; int gcd(int x, int y) { if (x < y) swap(x, y); if (y == 0) return x; int r = x % y; return gcd(y, r); } int main() { scanf( %d , &n); for (int i = 1; i <...
// megafunction wizard: %LPM_COUNTER% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_COUNTER // ============================================================ // File Name: four_digit_counter_enable.v // Megafunction Name(s): // LPM_COUNTER // // Simulation Library Files(s): // lpm // ==================...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's instruction fetch //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; int main() { int Q; cin >> Q; while (Q--) { long long n, a, b, ans; cin >> n >> a >> b; double x = b / 2.0; if (x > a) { ans = a * n; cout << ans << endl; } else { if (n % 2 == 0) { ans = n / 2 ...
/* -------------------------------------------------------------------------- Pegasus - Copyright (C) 2012 Gregory Matthew James. This file is part of Pegasus. Pegasus is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software ...
#include <bits/stdc++.h> using namespace std; const int N = 1000010; string s; long long ans; long long mem[N][5]; int n; long long dp(int i, int last) { if (i == n) { if (last == 2 || last == 4) return 0; return 1; } if (mem[i][last] != -1) return mem[i][last]; long long p = 0...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ /** * Import the design modules for other design submodules * * Include statements for design modules/files need to be commented * out when I use the Make environment - similar to that in * Assignment/Homework 3. * * Else, the Make/Cadence envi...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int i, n, f = 0; cin >> n; vector<int> v(n); vector<int> use(n + 1, 0); for (i = 0; i < n; i++) { cin >> v[i]; if (v[i] < (i + 1)) { f = 1; } } ...
#include <bits/stdc++.h> const int maxn = 1e5 + 10; using namespace std; long long gcd(long long p, long long q) { return q == 0 ? p : gcd(q, p % q); } long long qpow(long long p, long long q) { long long f = 1; while (q) { if (q & 1) f = f * p; p = p * p; q >>= 1; } return f; ...
`timescale 1ns/10ps module system_acl_iface_acl_kernel_clk_kernel_pll( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked, // interface 'reconfi...
// file: clk_wiz_0.v // // (c) Copyright 2008 - 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 // laws. // // DISCLAIMER // This disclaimer is not a ...
//Legal Notice: (C)2013 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 associate...
/* * These source files contain a hardware description of a network * automatically generated by CONNECT (CONfigurable NEtwork Creation Tool). * * This product includes a hardware design developed by Carnegie Mellon * University. * * Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University * * ...
// 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 : Mon Feb 13 12:43:25 2017 // Host : WK117 running 64-bit major release (build ...
/** * 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() { string s; int good = 0; int bad = 0; cin >> s; for (int i = 0; i < s.length(); i++) { if (s.at(i) == a ) good++; else bad++; } if (good > bad) cout << s.length(); else cout << s.length...
#include <bits/stdc++.h> using namespace std; int PASSED_POINT = 0; void Duxar() {} void read_int(int &value) { int sign = 1; char ch; value = 0; while (!isdigit(ch = getchar())) { (ch == - ) && (sign = -1); } do { value = value * 10 + (ch - 0 ); } while (isdigit(ch = g...
#include <bits/stdc++.h> using namespace std; long long mp[1005][1005]; long long n, a, b; void output() { for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= n; j++) { if (i == j) printf( 0 ); else printf( %lld , a < b ? !mp[i][j] : mp[i][j]); } ...
/* * Author : Tom Stanway-Mayers * Description : RV32I Compressed Instruction Expander * Version: : * License : Apache License Version 2.0, January 2004 * License URL : http://www.apache.org/licenses/ */ `include "riscv_defs.v" module merlin_rv32ic_expander ( input wire [...
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; int max = -1; int min = -1; std::vector<int> l, r; for (int i = 0; i < n; ++i) { int x, y; std::cin >> x >> y; l.push_back(x); r.push_back(y...
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const long long linf = 1LL << 62; const int mod = 1e9 + 7; const int MAX = 510000; const int V = 100005; struct UnionFind { vector<long long> p; vector<long long> rank; vector<long long> cnt; UnionFind(long long n) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> v; string a; while (n--) { cin >> a; v.push_back(a); } int cot = 0; bool p = 1; int ans = 1000000; string c; for (int j = 0; j < v.size(); j++) { c = v[j]; c...
#include <bits/stdc++.h> using namespace std; int n, m, s, t, g; int dl[200009], head, last, q[20009]; int dep[20010]; int h[20010], top = 1; struct edge { int to, net; long long w; } es[200009]; void add(int u, int v, long long w) { top++; es[top].w = w; es[top].net = h[u]; h[u]...
#include <bits/stdc++.h> using namespace std; long long int calculate(long long int p, long long int q) { long long int modx = 998244353, expo; expo = modx - 2; while (expo) { { if (expo & 1) p = (p * q) % modx; } q = (q * q) % modx; expo >>= 1; } return p % modx;...
#include <bits/stdc++.h> using namespace std; int i, j, a; int main() { for (i = 1; i <= 5; i++) { for (j = 1; j <= 5; j++) { cin >> a; if (a == 1) cout << (abs(3 - i) + abs(3 - j)) << 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 law...
// (C) 2001-2013 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...
`timescale 1ns / 1ns // Define this to get the original behaviour of the 74373 on the Mark2 board latching // addresses to keep them stable during refresh rather than forcing a fixed value // during dummy accesses. // `define LATCH_ADR 1 `define ELK_PAGED_ROM_SEL 16'hFE05 `define PAGED_ROM_SEL 16'hFE30 `define BPLUS_...
`include "elink_regmap.v" module erx_arbiter (/*AUTOARG*/ // Outputs rx_rd_wait, rx_wr_wait, edma_wait, ecfg_wait, rxwr_access, rxwr_packet, rxrd_access, rxrd_packet, rxrr_access, rxrr_packet, // Inputs erx_rr_access, erx_packet, emmu_access, emmu_packet, edma_access, edma_packet, ecfg_access, ecfg_pa...
// DeBounce_v.v //////////////////////// Button Debounceer /////////////////////////////////////// //*********************************************************************** // FileName: DeBounce_v.v // FPGA: MachXO2 7000HE // IDE: Diamond 2.0.1 // // HDL IS PROVIDED "AS IS." DIGI-KEY EXPRESSLY DISCLAIMS ANY // WARRA...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long int is_query = LLONG_MIN; struct Line { long long int m, b; mutable function<const Line*()> succ; bool operator<(const Line& rhs) const { if (rhs.b != is_query) return m < rhs.m; const Line* s = succ(); if (!s) return 0; ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; const int SINF = 0x7fffffff; const long long LINF = 0x3fffffffffffffff; const long long SLINF = 0x7fffffffffffffff; const int MAXN = 30007; const int MAXD = 6; const int MOD = 998244353; int n, d; int a[MAXN][MAXD][MAXD]; in...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; /*AUTOWIRE*/ // Beginning of au...
/** * 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...
#include <bits/stdc++.h> using namespace std; int fun(int x, int y, int z) { return x * x + y * y + z * z + x * y + y * z + z * x; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t, n; cin >> t; while (t--) { cin >> n; int a[n]; int f =...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; bool lava[2][n]; for (int i = 0; i < 2; i++) { for (int j = 0; j < n; j++) lava[i][j] = false; } set<int> blocked1; set<int> blocked2; for ...
#include <bits/stdc++.h> using namespace std; void solve() { int a; cin >> a; int b[a]; for (int i = 0; i < a; i++) { cin >> b[i]; } int ind = 0; for (int i = 0; i < a - 1; i++) { if (b[i] > b[i + 1]) { b[0] = b[0] - b[i] + b[i + 1]; if (b[0] < 0) { ...
// Copyright 2020 The XLS 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
#include <bits/stdc++.h> using namespace std; const int maxn = 40 + 2; int n, m, q, dp[maxn][maxn][maxn][maxn], ones[maxn][maxn], a, b, c, d; int main() { ios::sync_with_stdio(false); char ch; cin >> n >> m >> q; for (int _b = (n), i = (1); i <= _b; ++i) for (int _b = (m), j = (1); j <= _b...
#include <bits/stdc++.h> using namespace std; const int MAX = 100009; int n, m, k, a[MAX], b[MAX], pos[MAX]; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; pos[a[i]] = i; } long long ans = 0; for (int i = 1; i <= m; i++) { cin >> b[i]; in...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:21:08 01/31/2017 // Design Name: PWM // Module Name: /home/aaron/Git Repos/CSE311/lab2/PWM_tb.v // Project Name: lab2 // Target Device: // Tool versions: // D...
/** * 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 = 200005; int a[N], f[N]; long long dis[N], pos[N], res[N]; int n; void add(long long *b, int x, long long v) { for (int i = x; i <= n; i += i & -i) b[i] += v; } long long qry(long long *b, int x) { long long ret = 0; for (int i = x; ...
#include <bits/stdc++.h> using namespace std; const int N = 200010; bool good[N], need[N]; int n; void ask(vector<int> &v) { printf( %d , (int)v.size()); for (int i = 0; i < (int)v.size(); i++) { printf( %d , v[i]); good[v[i]] = true; } puts( ); fflush(stdout); int idx; ...
#include <bits/stdc++.h> using namespace std; template <typename TH> void _dbg(const char* sdbg, TH h) { cerr << sdbg << = << h << n ; } template <typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) { while (*sdbg != , ) { cerr << *sdbg++; } cerr << = << h <<...
module top; reg pass; reg [2:0] res [0:7]; reg [2:0] in [0:7]; reg [7:0] dummy [0:6]; time run_time [0:7]; time exp_time [0:7]; integer i; initial begin pass = 1'b1; #1; // Initialize the input array. for (i=0; i<8; i=i+1) begin in[i] = i[2:0]; end #1; for (i=0; i<8; i...
/** * 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::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ((void)0); ((void)0); ((void)0); int T, N, M1, M2, s, e; long long X; for (cin >> T; T--;) { M1 = M2 = 0x7fffffff; s = 0; e = 1e9; for (c...
#include <bits/stdc++.h> using namespace std; bool KT(long long k, long long n) { long long take = 0, cur = n; while (cur > 0) { long long temp = min(k, cur); take += temp; cur -= temp; cur -= cur / 10; } if (take * 2 >= n) return true; return false; } int main() { ...
`include "./simple_fifo.v" `include "./fifo_fwft_adapter.v" module fifo_fwft # ( parameter DATA_WIDTH = 0, parameter DEPTH_WIDTH = 0 ) ( input wire clk, input wire rst, input wire [DATA_WIDTH-1:0] din, input wire wr_en, output wire full, o...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k, l, x = 1; cin >> n >> m >> k >> l; if (k + l > n) cout << -1 ; else if ((k + l) % m == 0 && (k + l) <= n) cout << (k + l) / m; else if ((k + l) % m != 0 && ((k + l) / m + 1) * m <= n) cout << ((k...
#include <bits/stdc++.h> using namespace std; void read(long long &x) { char ch = getchar(); x = 0; while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); } const long long N = 2e5 + 10; long long n, mx, rt, tmp, sum, f[N], fr[N], tot, st[N], fl[N], p[N]...
#include <bits/stdc++.h> using namespace std; map<char, int> mp1; int main() { ios_base::sync_with_stdio(0); string s, p, q; long long int a, b, c, d, i, j, k, u, v, w = 0, x, y, z; cin >> p; for (i = 0; i < p.length(); i++) mp1[p[i]] = 1; cin >> s; cin >> k; while (k--) { w ...
#include <bits/stdc++.h> using namespace std; struct yo { int val; int id; int next, prev; }; vector<yo> a0, a; int n, n0, x; bool operator<(yo a, yo b) { return a.val < b.val; } int main() { cin >> n; n0 = n; if (n <= 2) { cout << 0; return 0; } for (int i = 0;...
#include <bits/stdc++.h> using namespace std; std::mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); inline int sj(int n) { unsigned long long x = rnd(); x = x << 32 | rnd(); return x % n + 1; } const int p = 998244353; inline void inc(int &x, const int y) { if ((x += y) >...
//------------------------------------------------------------------------- // COPYRIGHT (C) 2016 Univ. of Nebraska - Lincoln // // 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 ve...
#include <bits/stdc++.h> using namespace std; int mp[200005]; int a[200005]; int n; int main() { int y, T, n, m, i, t, j, k, x; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &x); mp[x] = i + 1; } for (i = 0; i < n; i++) { scanf( %d , &x); a[i] = mp[x]; ...
#include <bits/stdc++.h> using namespace std; int wyn[1024]; int odp[1024]; int n; int pyt; vector<pair<int, int> > v[2]; void pytaj(vector<int>& skad, vector<int>& gdzie) { if (skad.size() == 0) return; printf( %d n , int(skad.size())); for (int i = 0; i < skad.size(); i++) printf( %d , skad...
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 9; const int Mod = 1000000007; long long n, d, b; long long a[N]; int main() { cin >> n >> d >> b; for (int i = 1; i <= n; i++) { scanf( %I64d , &a[i]); } for (int i = 1; i <= n; i++) a[i] = a[i - 1] + a[i]; long ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:14:43 07/04/2013 // Design Name: // Module Name: serializer // Project Name: // Target Devices: // Tool versions: // Description: // // Depe...
`timescale 1ns / 1ps module tx_tb(); reg reset; reg clock; wire [7:0] tx_data; wire tx_enable; reg fifo_data_start; reg fifo_data_end; reg [7:0] fifo_data; wire fifo_data_read; reg [7:0] packet [0:1518]; reg data_available; integer i; tx_sm U_tx_sm ( ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> #define debug(x) cout << #x << = << x << endl #define REP(i, n) for (Long i = 0; i < (Long)n; i++) using namespace std; typedef long long Long; const int MX = 3e5; vector<Long> adj[MX]; set<pair<Long,Long>> queries[MX]; Long saved[MX]; Long single[MX]; Long cnt[2 *...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a = 1; int b = 2; bool ok = true; int k; for (int i = 0; i < n; i++) { cin >> k; if (k != a && k != b) { ok = false; } else { if (b == 3 && a == 1) { a = min(2, k);...
#include <bits/stdc++.h> using namespace std; struct node { int val, lazy, child; node() { val = child = 0; lazy = 1e9 + 7; } node(int vval, int llazy, int cchild) { val = vval; lazy = llazy; child = cchild; } }; int N, K, Q; int w, x, y, z; int arr[100100];...
/** * 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 dr[]{-1, -1, 0, 1, 1, 1, 0, -1}; const int dc[]{0, 1, 1, 1, 0, -1, -1, -1}; void run() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int sqrtQ = 150; struct suffix_automaton { struct state { int len, link...
#include <bits/stdc++.h> int main() { int a, b, c, d, flag = 0; scanf( %d %d %d %d , &a, &b, &c, &d); if (a + b > c && b + c > a && c + a > b) flag = 1; else if (b + c > d && c + d > b && d + b > c) flag = 1; else if (c + d > a && d + a > c && a + c > d) flag = 1; else if (a ...
////////////////////////////////////////////////////////////////////// //// //// //// fpu_pre_norm_mul //// //// //// //// This file is part of the OpenRISC 120...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int n, x, temp, cntr = 0; cin >> n >> x; while (n--) { cin >> temp; v.push_back(temp); } sort(v.begin(), v.end()); while (v[(v.size() - 1) / 2] != x) { cntr++; v.push_back(x); sort(v.b...
#include <bits/stdc++.h> using namespace std; const int N = 28; vector<int> g[N]; int vis[2000000]; int main() { int k, n; string ss, s; cin >> k >> ss; for (int i = 0; i < k; ++i) s += ss; for (int i = 0; i != s.size(); ++i) g[s[i] - a ].push_back(i); cin >> n; vector<int>::itera...
/* reset...init...save.start_write.stop_write.restore.start_read(compare).stop_read.loop */ module mem_tester( clk, rst_n, // pass/fail counters pass_counter, fail_counter, // DRAM signals DRAM_DQ, DRAM_MA, DRAM_RAS0_N, DRAM_RAS1_N, DRAM_LCAS_N, D...