text
stringlengths
59
71.4k
//Legal Notice: (C)2015 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...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; struct Node { int pos, id; Node(int p = 0, int i = 0) : pos(p), id(i) {} bool operator<(const Node& rhs) const { return pos < rhs.pos; } } a[MAXN], b[MAXN]; int m, n; long long c[3 * MAXN]; int ans[MAXN]; void add(int x, ...
module testbench; localparam wide_width_lp = 16; localparam narrow_width_lp = 4; localparam els_lp = wide_width_lp / narrow_width_lp; logic clk; bsg_nonsynth_clock_gen #(.cycle_time_p(1000)) clock_gen (.o(clk)); logic reset; bsg_nonsynth_reset_gen #(.num_clocks_p(1) ,.reset_cycles_lo...
// $Id: c_wf_alloc_rep.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, 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: Redistributio...
#include <bits/stdc++.h> using namespace std; int main() { int t, n, ans, i, j, k; cin >> t; for (i = 0; i < t; i++) { cin >> n; int x[2 * n]; for (j = 0; j < 2 * n; j++) cin >> x[j]; sort(x, x + 2 * n); ans = x[n] - x[n - 1]; cout << ans << endl; } return 0; ...
#include <bits/stdc++.h> using namespace std; const int N = 2005, MOD = 1e9 + 7; int d, n, a[N], dp[N], rt; vector<int> g[N]; void dfs(int v, int pr = -1) { dp[v] = 1; for (int to : g[v]) { if (to == pr) { continue; } if (a[to] < a[rt] || a[to] > a[rt] + d) { continue...
#include <bits/stdc++.h> using namespace std; const long long INF = 4e18; const long long MAX = 2e5 + 5; const long long MOD = 1e9 + 7; int n, m; void exgcd(int a, int b, long long &c, long long &d) { if (a == 0) { c = 0; d = 1; return; } exgcd(b % a, a, d, c); c -= b / a *...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_181x128a.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // =========================================...
/** * 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...
/** * 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 udp_reg_path_decode ( input reg_req, input reg_rd_wr_L, input [31:0] reg_addr, input [31:0] reg_wr_data, output reg reg_ack, output reg [31:0] reg_rd_data, // interface to core registers output reg core_reg_req, ...
#include <bits/stdc++.h> long long gi() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == - , ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f ? x : -x; } std::mt19937 rnd(time(NULL)); template <class T> void cxk(T& a, T b) {...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Engineer: Ryan // // Create Date: 06/07/2017 // Module Name: ClkDiv_20Hz // Project Name: Joystick_Controller // Target Devices: ICEStick // Tool versions: iCEcube2 // Description: Converts input 12 MHz...
#include <bits/stdc++.h> using namespace std; int ans, n, a[10005], cnt, f, i, j, vis[10005]; int main() { scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &a[i]); } ans = 0; f = 0; cnt = 0; memset(vis, 0, sizeof vis); for (i = 0; i < n; i++) { if (!f) { f...
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e8; int n, m; char s[22][22]; int x[22][22], dp[1 << 20], state[30], sum[30], maxN[30]; vector<int> sta[22]; vector<int> cost[22]; int bit[1 << 20]; void initialIt() { for (int i = 0; i < 20; i++) { bit[1 << i] = i; } ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:05:40 09/06/2015 // Design Name: // Module Name: Deco_Round_Mult // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e5 + 5; template <typename T> void chkmax(T& x, T y) { if (y > x) x = y; } template <typename T> void chkmin(T& x, T y) { if (y < x) x = y; } int N, c[MAXN]; long long ans; int main() { scanf( %d , &N); for (int i = 1;...
#include <bits/stdc++.h> int main() { int a, b; scanf( %d%d , &a, &b); int c = 0; while (b) { c *= 10; c += b % 10; b /= 10; } printf( %d n , c + 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...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int c, m, x; cin >> c >> m >> x; long long int y = c + m + x; y = y / 3; long long int ans = 0; if (c >= 1 && m >= 1) { long long int v = min(c, m); ...
module register16(clk, out, in, write, reset); // Negedge-triggered flipflop register with active-low write signal and reset output reg [15:0] out; input [15:0] in; input clk, write, reset; always@(posedge clk) begin if(reset==0) begin out = 16'b0; end else if(write == 1'b0) begin out = ...
#include <bits/stdc++.h> using namespace std; struct kmp { vector<int> lps; string pattern; void compute_lps() { int lptr = 0, rptr = 1; lps[0] = 0; while (rptr < lps.size()) { while (lptr != 0 && pattern[lptr] != pattern[rptr]) lptr = lps[lptr - 1]; if (pattern[lptr] =...
#include <bits/stdc++.h> int main() { int n, i, a[100001]; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); for (i = 1; i <= n; i++) while (a[i] % 2 == 0) a[i] /= 2; for (i = 1; i <= n; i++) while (a[i] % 3 == 0) a[i] /= 3; for (i = 1; i <= n - 1; i++) if (a[i] !...
#include <bits/stdc++.h> using namespace std; int mx[4] = {1, 0, -1, 0}; int my[4] = {0, 1, 0, -1}; void dfs(int x, int y, vector<vector<char> > &b, vector<vector<int> > &val, int &c, int &v) { v++; val[x][y] = c; for (int i = 0; i < 4; i++) { int xt = x + mx[i]; int yt = y + ...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2009 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. module t (); sub a (.inst(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 law...
#include <bits/stdc++.h> using namespace std; const int N = 200514; vector<int> a3[N], a4[N], mn, mx; set<int> s; int p3[N], p4[N]; int n, m, M, a[N], ct[N], l1 = 1, l2 = 1; int j, p1, p2, k1, k2; int main() { scanf( %d%d , &n, &m); p3[n + 1] = p4[n + 1] = n + 1; for (int i = (1); i <= (n); ...
// This is a component of pluto_step_spi, a stepper driver for linuxcnc over SPI. // based on the main.v from Jeff Epler <> // Copyright 2013 by Matsche <> // // 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 //...
#include <bits/stdc++.h> #define ln n #define all(dat) dat.begin(), dat.end() #define loop(i, to) for (int i = 0; i < to; ++i) #define cont(i, to) for (int i = 1; i <= to; ++i) #define circ(i, fm, to) for (int i = fm; i <= to; ++i) #define foreach(i, dat) ...
//----------------------------------------------------------------- // AltOR32 // Alternative Lightweight OpenRisc // V2.1 // Ultra-Embedded.com // Copyright 2011 - 2014 // // Email: // // ...
#include <bits/stdc++.h> using namespace std; int p[201], bag[201]; int n, l, k; double mem[202][202][202]; double solve(int r, int bagwon, int prizewon) { if (mem[r][bagwon][prizewon] >= -.5) return mem[r][bagwon][prizewon]; if (r == n) return mem[r][bagwon][prizewon] = bagwon ...
#include <bits/stdc++.h> using namespace std; const long long Max = 1e5 + 10; int T; long long n, m; long long number[Max]; int main() { cin >> T; while (T--) { cin >> n >> m; long long ans = 1; int k = 1; for (int i = 1;; i *= 2) { number[k] = number[k - 1] + i; ...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. `include "std_ovl_defines.h" `module ovl_one_hot (clock, reset, enable, test_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width = 32; parameter property_ty...
#include <bits/stdc++.h> using namespace std; template <class T> ostream& operator<<(ostream& os, vector<T> V) { os << [ ; for (auto v : V) os << v << ; return os << ] ; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> P) { return os << ( << P.first << , <<...
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ppi = pair<pii, int>; char s[200100]; int rk[200100], sa[200100], ht[200100]; int mn[200100][22]; namespace SA { int head[200100 * 2]; ppi pos[200100 * 2], buf[200100 << 1], tbuf[200100 << 1]; int nxt[200100 * 2]; void...
/** * 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 double PI = 4.0 * atan(1.0); void EnchomSolve() { int l; long double L; long double ans = 0.0; long double area; long double height; long double help, help2; scanf( %d , &l); L = (long double)l; help = L / sqrt(3.0); ...
#include <bits/stdc++.h> using namespace std; const long long d = 20; long long n, m, dsu[80], cc[80], al[40], dp[1ll << d]; long long fd(long long x) { if (dsu[x] != x) { dsu[x] = fd(dsu[x]); } return dsu[x]; } int main() { long long i, ii, k, l, mk, mk2, z[4] = {1, 1, 1, 0}; scan...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b = 0, c = 0, n, t; cin >> t; for (int o = 1; o <= t; o++) { b = 0; c = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a != 1) { c = 1; } else { if (c ==...
// Copyright (C) 1991-2014 Altera Corporation // 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 from any of the foregoing // (including device programming or simulation files), and any // associated docume...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int count = 0; int len = s.size(); bool small = false; for (int i = 0; i < len; i++) { if (s[i] < a ) { count++; } if (s[0] >= a ) { small = true; } } if (count ==...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n; for (int k = 0; k < n; k++) { cin >> m; for (int i = 0; i < m / 2; i++) { int fir, sec; cin >> fir >> sec; if (fir > 0 && sec > 0) { cout << sec << << -fir << ; } e...
/** * 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; double work(int x) { if (x == 0) return 1; double n = 1.000000011; double ans = 1; while (x > 0) { if ((x & 1) == 1) ans *= n; n *= n; x /= 2; } return ans; } int main() { int n, t; cin >> n >> t; printf( %0.20lf...
#include <bits/stdc++.h> using namespace std; const int N = 61; int a[N], n; long long dp[N][2][2], k; long long Dfs(int pos, int x, int y) { if (pos < n - pos + 1) return 1; if (dp[pos][x][y] != -1) return dp[pos][x][y]; long long ans = 0; for (int i = 0; i < 2; i++) if (a[pos] == -1 ||...
#include <bits/stdc++.h> using namespace std; const int S = (int)1e6; int dp[S]; string txt, pat; vector<int> ans; void kmp() { int i = 0, j = -1, n = ((int)(txt.size())), m = ((int)(pat.size())); dp[0] = -1; while (i < m) { while (j >= 0 and pat[i] != pat[j]) j = dp[j]; i++, j++; ...
/* * Copyright (c) 2015, Arch Laboratory * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of con...
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long res = 1; a %= 998244353; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % 998244353 % 998244353; a = a * a % 998244353; } return res; } long long gcd(long long a...
#include <bits/stdc++.h> int cnt[111], ans, b, d, pr[111], v[111]; int main() { scanf( %d%d , &b, &d); int k = b; for (int i = 2; k > 1; i++) { if (k % i) continue; while (k % i == 0) cnt[i]++, k /= i; } bool flag = true; k = d; for (int i = 2; k > 1; i++) { if (k % i) ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; const long long mod = 998244353; long long a[N]; long long n, m, k; long long pw(long long n, long long k) { if (!k) return 1; long long res = pw(n, k >> 1); res = res * res % mod; if (k & 1) return res * n % mod; ...
/* * * Copyright (c) 2011 * * * * 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 distribu...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int res = 0, cur = 0, tmp; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> tmp; res = (cur + tmp) / m; cur = (cur + tmp) % m; cout << res << ; } }
#include <bits/stdc++.h> using namespace std; long long tab[12], pr[12]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int q; cin >> q; long long n, m, w, x; for (int z = 0; z < q; z++) { cin >> n >> m; x = 1; for (long long i = 1; i <= 11; i++) ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } void solve() { long long p, q; cin >> p >> q; long long g = p; long long t = q; map<long long, long long> f, l; for (long long i = 2; i * i <= t; i++) { if (t % i =...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; const long long inf = (long long)1e9; double PI = 3.14159265; double eps = 1e-9; long long t = 0; long long pow(long long a, long long b) { if (b == 0) return 1; if (b % 2 == 1) { return (pow(a, b - 1) * a); } if ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [2:0] in; wire a,y,y_fixed; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) cin >> a[i]; b[n - 1] = a[n - 1]; for (int j = 0; j < n - 1; j++) b[j] = a[j] + a[j + 1]; for (int k = 0; k < n; k++) cout << b[k] << ; return 0; }
//---------------------------------------------------------------------------- // Copyright (C) 2015 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: city.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, m; map<string, int> h; string name[N], str[N], re[N]; bool f[N][N]; int g[N][N]; void print(int x, int y) { if (x == 0) { return; } print(x - 1, g[x][y]); cout << name[y] << re[x - 1] << endl; } void work()...
#include <bits/stdc++.h> using namespace std; const int MaxN = int(2e5) + 256; const int INF = int(1e9); const int mod = (int)(1e9) + 7; const double pi = 3.1415926535897932384626433832795; long long n, m, ans, A[MaxN], k, a, b, q; long long t[MaxN * 8], t1[MaxN * 8]; void upd(int v, int l, int r, int p...
///////////////////////////////////////////////////////////////////// //// //// //// JPEG Run-Length Encoder, remove zero sequences //// //// //// //// - Detect (15,0) (0,0) seqence ...
#include <bits/stdc++.h> using namespace std; int m, n, a[2000100], b[2000100], d[2000100], ans = 1, pos[2000100]; int between(int x, int y, int z) { if (z < y) return x < z || x > y; return x > y && x < z; } int main() { memset(d, -1, sizeof(d)); cin >> m >> n; for (int i = 0; i < m; i++)...
#include <bits/stdc++.h> using namespace std; const long long MAX_N = 200 * 1000 + 24, INF = (1 << 30); int n; int a[MAX_N], cnt[MAX_N], mark[MAX_N]; vector<int> G[MAX_N], vec, avb; int main() { cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin ...
module avr_interface( input clk, input rst, input cclk, output spi_miso, input spi_mosi, input spi_sck, input spi_ss, output [3:0] spi_channel, output tx, input rx, input [3:0] channel, output new_sample, output [9:0] sample, output [3:0] sample_channel, input [7:0] tx_data, ...
////////////////////////////////////////////////////////////////// //// //// //// 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 //// ...
#include <bits/stdc++.h> using namespace std; int main() { char c[100005]; scanf( %s , c); vector<char> v; int count[26]; int instk[26]; memset(count, 0, sizeof(count)); memset(instk, 0, sizeof(instk)); int find = 0; for (int i = 0; c[i] != 0; i++) count[c[i] - a ]++; while ...
// // 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 (c) 2008 Xilinx, Inc. All rights reserved. // // XILINX CONFIDENTIAL PROPERTY // This document contains proprietary information which is // protected by copyright. All rights are reserved. This notice ...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long PRIME = 999727999; long long PRIME2 = 999999937; long long INF = LLONG_MAX / 4; template <class F1, class F2> ostream& operator<<(ostream& os, const pair<F1, F2>& p) { return os << p.first << << p.second; } templa...
/* * 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 law...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long ts, tf, t; cin >> ts >> tf >> t; int n; cin >> n; map<long long, int> T; for (int i = 0; i < n; ++i) { long long t; cin >> t; ++T[t]; } long long bt = 0...
// 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 ...
#include <bits/stdc++.h> using namespace std; struct $ { $() { ios_base::sync_with_stdio(false); cin.tie(NULL); } } $; const int Maxn = 202005; class BIT { int *tree, sz; public: BIT() { sz = 202005; tree = new int[sz + 1]; } BIT(int N) { sz = N; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, m, i, x, p = 0, kk = 100000000000000000, sum = 0; cin >> n >> k >> m; string me[n]; map<string, long long> fahim; for (i = 0; i < n; i++) { cin >> me[i]; } for (i = 0; i < n; i++) { cin >> fahim[me[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...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; const long long INFLL = 1000000000000000007; const long long MOD = 998244353; bool comp(long long a, long long b) { return a > b; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n, k; ...
#include <bits/stdc++.h> using namespace std; using ui32 = unsigned int; using i64 = long long; using f64 = long double; using ui64 = unsigned long long; void read(int& x) { scanf( %d , &x); } void read(int n, vector<int>& a) { for (int i = 0; i < n; i++) read(a[i]); } void read(int n, int* a) { ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; vector<vector<int> > col; vector<vector<int> > adj; int color[N]; void dfs(int v, int p) { set<int> st; int toapply = 1; for (int i = 0; i < col[v].size(); i++) { int c = col[v][i]; if (color[c] != -1) st.insert(col...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; const long double pi = acos(-1); const long long int mod = 1e9 + 7; bool debug = false; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long lo...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; map<long long, long long> m; map<long long, long long>::iterator it; long long ans[200500]; int main() { long long n, i, x, y, pr = -1, cur = 0; cin >> n; for (i = 0; i < n; i++) { cin >> x >> y; m[x]++; m[y + 1]--; } for (it ...
#include <bits/stdc++.h> using namespace std; map<string, int> M; int eval(string s) { int c1 = 0, c2 = 0; string t; int indl = 0; while (indl < s.size() && s[indl] == & ) ++indl, ++c1; int ind2 = s.size() - 1; while (ind2 >= 0 && s[ind2] == * ) --ind2, ++c2; t = s.substr(indl, ind2 ...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
module join_fadd( input clk, input reset, input [7:0] inp_a, input inp_aValid, output inp_aRetry, input [7:0] inp_b, input inp_bValid, output inp_bRetry, output [7:0] sum, output sumValid, input sumRetry ); logic [7:0] sum_next; always_comb b...
/* * 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...
/* * Super Simple Priority Interrupt Controller * Copyright (C) 2010 Zeus Gomez Marmolejo <> * Copyright (C) 2010 Donna Polehn <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public License as ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3 + 10; int n, m, c = 0, ans = 0; vector<int> adj[maxn], bkadj[maxn], components, nodes[maxn], sink; bool mark[maxn]; int cmp[maxn], d[maxn], o[maxn]; stack<int> st; queue<int> q; void input() { cin >> n >> m; for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; pair<pair<int, int>, int> a[100010]; vector<pair<long long, int> > pre[100010]; long long maxx = 0; int maxi, maxj; int c = 0; long long s = 0; long long val1, val2; void eval(int i, int j, int k, bool f) { val2 = pre[j][k].first; if (val1 + val2 >...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2) cout << contest ; else cout << home ; 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; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) f = ch == - ? -1 : 1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 48, ch = getchar(); return x * f; } const int maxn = 205; int tot; ...
#include <bits/stdc++.h> using namespace std; const int M = 200005; int n, m, tot, ans; struct Node { int u, v, w; } node[M]; int vis[M], match[M]; int sum1[M], sum2[M]; int head[M], Nxt[M], ver[M]; bool v[M], flag = 0; vector<int> e[M]; inline bool dfs(long long x) { for (int i = 0; i < e...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003-2007 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=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...