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 la...
#include <bits/stdc++.h> int a, n; int main() { scanf( %d %d , &n, &a); int res = 0; if (a % 2 == 1) printf( %d n , a / 2 + a % 2); else printf( %d n , n / 2 - a / 2 + 1); return 0; }
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; unsigned seed = chrono::system_clock::now().time_since_epoch().count(); mt19937 eng(seed); long long random2() { return (1ll << 31ll) * eng() + eng(); } long long n, m, k, q, T; const long long big = 1000000007; const long long big...
#include <bits/stdc++.h> template <class T> void read(T &a) { a = 0; char x = getchar(); bool f = 0; for (; x < 0 || x > 9 ; x = getchar()) f |= x == - ; for (; x >= 0 && x <= 9 ; x = getchar()) a = (a << 3) + (a << 1) + x - 0 ; if (f) a = -a; } template <class T, class... Args> ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e4; bitset<maxn * 25> f[50][25]; int n; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; vector<int> a(n * 2); for (int i = 1; i <= n * 2; i++) cin >> a[i - 1]; sort(a.begin(), a.end()); vector...
// vim: ts=4 sw=4 noexpandtab /* * SPI bus slave * * Copyright (c) 2019 Michael Buesch <> * * 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 ...
/* * 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 edge { long long a, b, cost; edge(long long x, long long y, long long z) : a(x), b(y), cost(z){}; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, k, p; cin >> n >> k >> p; vector<long long> v(n), a(k);...
// Copyright (c) 2000-2012 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, pub...
(** * Maps: Total and Partial Maps *) (** Maps (or dictionaries) are ubiquitous data structures both generally and in the theory of programming languages in particular; we're going to need them in many places in the coming chapters. They also make a nice case study using ideas we've seen in previous c...
#include <bits/stdc++.h> using std::abs; using std::bitset; using std::cerr; using std::cin; using std::cout; using std::deque; using std::map; using std::max; using std::min; using std::pair; using std::queue; using std::set; using std::sort; using std::string; using std::swap; using st...
/* * Copyright (c) 2000 Stephen Williams () * * 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) * ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; cout << min(a + a + b + b, min(a + b + c, min(a + a + c + c, b + b + c + c))) << endl; return 0; }
#include <bits/stdc++.h> int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int main() { int n, a; scanf( %d , &n); for (int i = 1; i <= n / 2; i++) { if (gcd(i, n - i) == 1) a = i; } printf( %d %d , a, n - a); }
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize( Ofast ) #pragma GCC optimize( inline ) #pragma GCC optimize( -fgcse ) #pragma GCC optimize( -fgcse-lm ) #pragma GCC optimize( -fipa-sra ) #pragma GCC optimize( -ftree-pre ) #pragma GCC optimize( -ftree-vrp )...
/*########################################################################### # Function: Dual port memory wrapper (one read/ one write port) # To run without hardware platform dependancy, `define: # "TARGET_CLEAN" ############################################################################ */...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module gpac_adc_rx_core #( parameter ABUSWIDTH ...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
#include <bits/stdc++.h> #pragma GCC optimize(3, Ofast , inline ) using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const long long maxn = (long long)1e6 + 5; const long long mod = 998244353; const long long inf = 0x3f3f3f3f; long long T = 1; vector<lon...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); long long n, R = 0, L = 0; cin >> n; long long l[n], r[n]; for (int x = 0; x < n; x++) { cin >> l[x] >> r[x]; L += l[x]; R += r[x]; } int val = abs(R - L); int ans = 0; for (int ...
#include <bits/stdc++.h> using namespace std; long long n, h, m, data[55]; int main() { cin >> n >> h >> m; for (int i = 1; i <= n; i++) { data[i] = h; } for (int i = 1; i <= m; i++) { long long l, r, x; cin >> l >> r >> x; for (int j = l; j <= r; j++) { data[j] = m...
/* Copyright 2010 David Fritz, Brian Gordon, Wira Mulia 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. ...
/** * 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 ////////////////////////////////////////////////////////////////////////////////// // Company: Xilinx, Inc // Engineer: Parimal Patel // Create Date: 04/17/2017 12:44:43 PM // Modified Date: 08/19/2017 to support PYNQ-Z2 board's Raspberry Pi and // and Arduino interfaces // Module Name: input_m...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's register file inside CPU //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; long long second; long long a1[1231], a2[2131]; long long b[1231]; long long sum[1231]; int main() { int n; cin >> n; for (int i = 2; i <= n; i++) cin >> a1[i]; for (int i = 1; i <= n - 1; i++) cin >> a2[i]; for (int i = 1; i <= n; i++) { ...
////////////////////////////////////////////////////////////////////// //// //// //// uart_log.v //// //// //// //// This file is part of the "uart...
#include <bits/stdc++.h> using namespace std; int main() { int d[100008] = {0}; int n = 0, f = 0; cin >> n; for (f = 0; f < n; f++) cin >> d[f]; sort(d, d + n); if (d[n - 1] >= d[n - 2] + d[n - 3]) cout << NO ; else { cout << YES n ; for (f = n - 1; f >= 0; f -= 2) co...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-11; template <class T> inline void checkmin(T& a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T& a, T b) { if (b > a) a = b; } template <class T> inline T sqr(T x) { ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { char c; bool nega = 0; while ((!isdigit(c = getchar())) && (c != - )) ; if (c == - ) { nega = 1; c = getchar(); } x = c - 48; while (isdigit(c = getchar())) x = x * 10 + c -...
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; int inp[100005]; int main() { int n, a, b; cin >> n; int flag = 0; string str; for (int i = 0; i < n; i++) { cin >> str; int a, b; cin >> a >> b; if (a >= 2...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 50; char s[N], t[N]; int n, a[N], b[N], c[N]; int main(void) { scanf( %d , &n); scanf( %s , s); scanf( %s , t); for (int i = 0; i < n; i++) { a[i] = s[i] - a ; b[i] = t[i] - a ; } for (int i = 0; i < n; 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 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...
/** * 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 matrix { int a[25][25]; }; struct matrix g, b, e; int l, r, mod = 1000000007; int ans; void init() { int i, j; g.a[7][2] = 1; g.a[10][3] = 1; g.a[11][3] = 1; g.a[8][5] = 1; g.a[10][6] = 1; g.a[11][6] = 1; g.a[2][7] = ...
/* * Milkymist 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 in ...
#include<bits/stdc++.h> using namespace std; #define int long long #define fast_io ios_base::sync_with_stdio(0);cin.tie(0) #define mod 1e9 + 7 #define pb push_back #define vi vector<int> int32_t main(){ fast_io; int t;cin>>t; while(t--){ int n;cin>>n; set<int> s; ...
#include <bits/stdc++.h> using namespace std; bool arr[3001]; int main() { int n, i, input; cin >> n; for (i = 1; i <= n; i++) { cin >> input; arr[input] = true; } for (i = 1; i <= 3000; i++) { if (!arr[i]) { cout << i << endl; return 0; } } cout...
/* ctrl_rst.v */ `ifdef SOC_SIM `define RST_CNT 16'h00ff // reset counter length used in simulations `else `define RST_CNT 16'hffff // reset counter length `endif module ctrl_rst ( // system input wire clk, // PLL lock input input wire pll_lock, // external reset input in...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int main() { long long int n, m, i, j, x, y, l = INF, u = 0; cin >> n >> m; if (m == 0) cout << n - 1 << endl; else { for (i = 0; i < m; i++) { cin >> x >> y; if (y < x) swap(x, y); u = max(u, x)...
#include <bits/stdc++.h> using namespace std; int n, m; int dp[303030][30]; int u, v; int in[303030]; vector<int> adj[303030]; char s[303030]; int main() { scanf( %d %d , &n, &m); scanf( %s , s); for (int i = 0; i < m; ++i) { scanf( %d %d , &u, &v); --u; --v; adj[u].p...
#include <bits/stdc++.h> using namespace std; int arr[1000005]; int main() { int n, q, a, b, x = 0, xPar = 0; scanf( %d %d , &n, &q); while (q--) { scanf( %d , &a); if (a == 1) { scanf( %d , &b); x += b; if (x >= n) { x = x % n; } else if (x < 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 law...
module testbench_CLA(); parameter bits = 8; reg [bits-1:0] operand1; reg [bits-1:0] operand2; reg carryIn; wire [bits-1:0] result; wire carryOut; wire p; wire g; integer i; integer j; integer k; reg errorFlag = 0; reg expectG; reg expectP; reg expectCOut; reg [bits-1:0] expectResult; initial begin carryIn = 0...
#include <bits/stdc++.h> using namespace std; double r[1000]; double p = atan(1.) * 4.; int main() { double rez = 0; int n; cin >> n; for (int i = 0; i < n; i++) cin >> r[i]; sort(r, r + n); bool t = true; for (int i = n - 1; i >= 0; i--) { if (t) rez += r[i] * r[i] * p...
#include <bits/stdc++.h> using namespace std; long long T, n, s, sum; inline int read() { char ch = getchar(); int x = 0, f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while ( 0 <= ch && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(...
module etx_fifo(/*AUTOARG*/ // Outputs txrd_wait, txwr_wait, txrr_wait, txrd_fifo_access, txrd_fifo_packet, txrr_fifo_access, txrr_fifo_packet, txwr_fifo_access, txwr_fifo_packet, // Inputs sys_nreset, sys_clk, tx_lclk_div4, txrd_access, txrd_packet, txwr_access, txwr_packet, txrr_access, txrr_pack...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > a(n); for (int i = (0); i < ((n)); ++i) cin >> a[i].first >> a[i].second; sort(a.begin(), a.end()); long long best = -1; vector<long long> dp(n, 0); for (int i = n - 1; i >= 0; --i) { ...
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(false); cin.tie(nullptr); long long int n; cin >> n; bool prime = true; for (long long int i = 2; i < n && i < 101010; ++i) { if (n % i == 0) { prime = false; } } if (prime) { cou...
#include <bits/stdc++.h> using namespace std; const int MAXN = 500; const int MAXM = (int)1e5; vector<int> g[MAXN + 1]; int x[MAXM + 1], y[MAXM + 1]; int ok[MAXN + 1]; bool flag; vector<int> edge; void dfs(int nod) { ok[nod] = 1; edge.push_back(nod); for (auto it : g[nod]) { if (flag...
////////////////////////////////////////////////////////////////////// //// //// //// spi_top.v //// //// //// //// This file is part of the SPI I...
`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, ...
//==================================================================== // bsg_imul_iterative.v // 11/15/2016, //==================================================================== // // An 32bit integer iterative multiplier, capable of signed & unsigned division // a3 a2 a1 a0 ...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Wilson Snyder. `include "verilated.v" module t; // Note $sscanf already tested elsewhere reg [3:0] n; reg [63:0] q; reg [16*8:1] wide; reg [8:1] char; r...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ctu_revision.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/...
//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 associated do...
//==================================================== // This is FSM demo program using single always // for both seq and combo logic // Design Name : fsm_using_single_always // File Name : fsm_using_single_always.v //===================================================== module fsm_using_single_always ( clock ,...
/** * 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...
/* ring32b_bidir.v Philip Watts 6th April 2010 Chip-to-chip module for the BEE3 based on the microsoft DDR2 code This version hides the clock inversion control from the top level Transmission is DDR => 64 bits over 32 wires */ `timescale 1ns / 1ps module ring32b_bidir( // Clocks and resets input CLK,...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2017 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 // /...
////////////////////////////////////////////////////////////////////// //// //// //// File name "ge_1000baseX_test.v" //// //// //// //// This file is part of the : ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; int n, k, x, y; set<pair<int, int> > s; vector<pair<int, int> > a[MAXN]; vector<int> ans; inline void start() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d%d , &x, &y); a[x].push_back({y, 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 N, M; int Candidates[100]; int main() { cin >> N >> M; for (int i = 0; i < M; i++) { int MaxVotesNum = -1; int idx = -1; for (int j = 0; j < N; j++) { int Temp; cin >> Temp; if (MaxVotesNum < Temp) { Ma...
module rgb_led ( pclk, nreset, bus_write_en, bus_read_en, bus_addr, bus_write_data, bus_read_data, pwm_r, pwm_g, pwm_b ); `define HZ_PER_COLOR_DIVISION 16'd3921 // 100Hz pwm `define PWM_PERIOD 32'd1000000 // bus lines input pclk, nreset, bus_write_en, bus_read_en; input [7:0] bus_addr; input [31:0] bu...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; bool impr = false; bool taken[n + 1]; for (int i = 0; i <= n; i++) { taken[i] = false; } int notTaken = -1; for (int i = 0; i < n; i++) { ...
//############################################################################# //# Function: 4:1 one hot mux # //############################################################################# //# Author: Andreas Olofsson # ...
#include <bits/stdc++.h> using namespace std; int n, k; char playLog[1111]; char posLet[3] = { W , D , L }; int delta[3] = {1, 0, -1}; int val[256]; char dp[1111][2222]; void clearArray() { for (int i = 0; i <= n + 1; i++) { for (int j = -k; j <= k; j++) dp[i][j + k] = X ; } } void ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; const int inf = -INF; const int mod = 1e9 + 7; const double pi = acos(-1.0); string s; int pre[N]; int dp[N][2]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int T; cin >> T; ...
#include <bits/stdc++.h> using namespace std; int arr[3500]; int main(void) { int c; scanf( %d n , &c); for (int t = 0; t < c; t++) { int n, m, k; scanf( %d %d %d n , &n, &m, &k); for (int i = 0; i < n; i++) { scanf( %d , &arr[i]); } scanf( n ); vector<int...
#include <bits/stdc++.h> using namespace std; char str[1000]; int main() { int n, k; while (scanf( %d %d , &n, &k) == 2) { scanf( %s , str + 1); int left = k - 1; int right = n - k; int di; if (right >= left) { di = 1; for (int i = k; i > 1; i--) printf( LEFT ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int a, b, c, d; scanf( %d%d%d%d , &a, &b, &c, &d); if (a < b) { if (c < d) { if (d * a > b * c) printf( %d/%d n , (a * d - b * c) / gcd(a *...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n + 2]; vector<int> s; s.push_back(n); for (int i = 2; i < n + 1; i++) cin >> arr[i]; arr[1] = 0; int k = n; while (k > 0) { s.push_back(arr[k]); k = arr[k]; } for (int i = s.s...
#include <bits/stdc++.h> struct { inline operator int() { int x; return scanf( %d , &x), x; } inline operator long long() { long long x; return scanf( %lld , &x), x; } template <class T> inline void operator()(T &x) { x = *this; } template <class T, class....
/* * 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; const long long INF = 2e18 + 9; const long long MAXN = 1e6 + 7; const long long MAXN1 = 5e2 + 7; const long long MOD = 1e9 + 7; const long long ST = 157; const long long ST1 = 199; const long double EPS = 1e-9; const long long BLOCK = 138; void solve(); ...
// -- (c) Copyright 2010 - 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 property // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; int main() { string ss[100]; int n, ans = 0, cur; cin >> n; for (int i = 0; i < n; i++) cin >> ss[i]; for (char a = a ; a <= z ; a++) for (char b = a ; b <= z ; b++) { cur = 0; for (int i = 0; i < n; i++) { int l =...
// *************************************************************************** // *************************************************************************** // Copyright 2014(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
#include <bits/stdc++.h> const int maxn = 400000 + 5; int f[maxn]; int n, m, q; int ans; inline int Read() { register int ret; register char r; register bool f = false; while (r = getchar(), r < 0 || r > 9 ) if (r == - ) f = true; ret = r - 48; while (r = getchar(), r >= 0 ...
module top; parameter seeq1 = 6'sb111000 === 4'sb1000; parameter seeqx = 6'sbxxx000 === 4'sbx000; parameter seeqz = 6'sbzzz000 === 4'sbz000; parameter seq1 = 6'sb111000 == 4'sb1000; parameter seqx = 6'sbxxx000 == 4'sbx000; parameter seqz = 6'sbzzz000 == 4'sbz000; reg pass; initial begin pass = 1'b1...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 7; int clr[MAX] = {0}, vis[MAX] = {0}, res = 0; vector<int> adj[MAX]; void dfs(int u, int p, int clr_p) { int f = 0; if (!vis[clr[u]]) { f = 1; vis[clr[u]] = 1; res++; } else if (p != -1 && clr_p != clr[u]) ...
//***************************************************************************** // (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 /...
// Single-Port BRAM with Byte-wide Write Enable // Read-First mode // Single-process description // Compact description of the write with a generate-for // statement // Column width and number of columns easily configurable // // bytewrite_ram_32bits.v // // `timescale 1ns/1ps module bytewrite_ram_32bits (clk, we, a...
//----------------------------------------------------------------- // FPGA Audio Project SoC IP // V0.1 // Ultra-Embedded.com // Copyright 2011 - 2012 // // Email: // // License: LGPL // // If you wo...
#include <bits/stdc++.h> inline long long MAX2(long long a, long long int b) { return (a) > (b) ? (a) : (b); } inline long long MAX3(long long a, long long b, long long c) { return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)); } inline long long MIN2(long long a, long long b) { re...
`timescale 1ns/1ps module test_spi; reg clk; reg spi_rd_slave_rst_b2b; reg ss_rd_sck_b2b; reg ss_rd_mosi_b2b; wire ss_rd_miso_b2b; reg ss_rd_ssel_b2b; wire recived_status; integer i; spi_slave_b2b_reduced spi_slave_b2b_instance_reduced( .clk(clk), .sck(ss_rd_sck_b2b), .m...
#include <bits/stdc++.h> using namespace std; int a[200010]; int base; int n, tmp; int main() { cin >> n; cin >> base; a[100000]++; for (int i = 1; i <= n - 1; i++) { cin >> tmp; int offset = tmp - base; if (abs(offset) > 100000) { cout << NO << endl; return...
// $Id: c_mat_mult.v 1854 2010-03-24 03:12:03Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of sou...
#include <bits/stdc++.h> using namespace std; const int MXN = 2000010; int N, M; int A[MXN], B[MXN], T[32] = {}; void init() { scanf( %d%d , &N, &M); for (int i = 1; i <= N; i++) scanf( %d , A + i); for (int i = 1; i <= M; i++) scanf( %d , B + i), T[B[i]]++; } namespace solve { long long ans...
/* * 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 ...
#include <bits/stdc++.h> using namespace std; int x[6]; int m[6]; int w[6]; int h, uh; int main() { x[0] = 500; for (int i = 0; i < 5; i++) { cin >> m[i]; if (i) x[i] = x[i - 1] + 500; } for (int i = 0; i < 5; i++) cin >> w[i]; cin >> h >> uh; int score = 0; for (int ...
#include <iostream> #include <cmath> using namespace std; int t, n, a[105]; int main(){ cin>>t; while(t--){ cin>>n; int suc = 0; for(int i=0; i<n; i++) cin>>a[i]; for(int i=0; i<n; i++){ int k = (int)sqrt((double)a[i]); if(k*k != a[i]){ suc = 1; break; } ...
`timescale 1ns / 1ps /**************************************************************/ /* _____ _ _ */ /* | ____|_ __ ___ _ __ __ _ _ _| | __ _| |__ ___ */ /* | _| | '_ \ / _ \ '__/ _` | | | | | / _` | '_ \/ __| */ /* | |___| | | | __/ | | (_| |...
// // Copyright 2012 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...
/* * 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 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015 // Date : Wed Apr 13 17:20:49 2016 // Host : Dries007-Arch running 64-bit unknown // Com...
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int x, i = 1; while (i <= n) { scanf( %d , &x); printf( n%d %d , 1, x - 1); i++; } }