text stringlengths 59 71.4k |
|---|
module difficult_multi (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, valid);
input A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z;
output valid;
wire [8:0] min_value = 9'd180;
wire [8:0] max_weight = 9'd100;
wire [8:0] max_volume = 9'd... |
#include <bits/stdc++.h> using namespace std; void fun(long long int a, long long int b, long long int u, vector<long long int> &t) { long long int i, j, k, n; for (i = 1; i < b; i++) { if (u) t[i]++; } u = 1 - u; i = b; while (i < 1000) { for (j = 0; j < a; j++) { ... |
/* 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; const long long mod = 1000000007LL; const int lmt = 1005; const long long inf = 1LL << 62; long long dp[lmt][lmt], a[lmt], req[lmt]; int n; long long solve(int idx, int left) { if (idx > n) return 0; if (dp[idx][left] != -1) return dp[idx][left]; l... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int w, h; cin >> w >> h; int ans = 1; for (int i = 0; i < w + h; i++) { ans = (ans * 2) % 998244353; } cout << ans % 998244353 << n ; return 0; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17.06.2017 00:00:41
// Design Name:
// Module Name: Lab_6_prev_1
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> int N, K; std::string S; int main() { std::cin >> N >> K; std::cin >> S; std::string t = S; std::string s = ; for (int l = 1; l < N; ++l) { if (S.substr(0, l) == S.substr(N - l, l)) { t = S.substr(0, N - l); s = S.substr(N - l, l); } }... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module mux2 (
S,
A,
B,
Y
);
input S;
input A, B;
output reg Y... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:29:24 05/22/2014
// Design Name:
// Module Name: control_unit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; long long c[100005], a[100005], b[100005], cur[100005]; int n, m; void update(int x, long long y) { while (x <= m) { c[x] += y; if (c[x] >= 1000000007) c[x] -= 1000000007; x += x & (-x); } } long long query(int x) { long long sum = ... |
#include <bits/stdc++.h> using namespace std; int a[3005]; int main() { int n; int cnt = 0; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (a[i] > a[j]) cnt++; } } if ... |
#include <bits/stdc++.h> using namespace std; int cups[1001]; int main() { int size; cin >> size; int sum = 0; int avg; for (int i = 1; i <= size; ++i) { cin >> cups[i]; sum += cups[i]; } avg = sum / size; if (size * avg != sum) { cout << Unrecoverable configurat... |
#include <bits/stdc++.h> using namespace std; inline int read() { int n = 0, f = 1; char c; for (c = getchar(); c != - && (c < 0 || c > 9 ); c = getchar()) ; if (c == - ) c = getchar(), f = -1; for (; c >= 0 && c <= 9 ; c = getchar()) n = n * 10 + c - 48; return n * f; } s... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:18:06 06/19/2016
// Design Name:
// Module Name: logarithmic
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dep... |
/*
=========================================================================================================================
| Verilog module for driving a half-bridge (HB) conveter topology in digital current mode control. |
| |
| Theory of operation: This module is very similar to a duty cycle mode... |
#include <bits/stdc++.h> using namespace std; long long n, m, a[100010], l[100010], r[100010], LS[100010], T; int G[100010][10]; struct MAT { int data[10][10]; MAT() { memset(data, 0, sizeof(data)); } MAT operator*(const MAT& ma) const { MAT ret; for (int i = 1; i <= 3; ++i) for ... |
(** * Extraction: Extracting ML from Coq *)
(** * Basic Extraction *)
(** In its simplest form, program extraction from Coq is completely straightforward. *)
(** First we say what language we want to extract into. Options are OCaml (the
most mature), Haskell (which mostly works), and Scheme (a bit out
of ... |
module \$__ECP5_DP16KD (CLK2, CLK3, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN);
parameter CFG_ABITS = 10;
parameter CFG_DBITS = 18;
parameter CFG_ENABLE_A = 2;
parameter CLKPOL2 = 1;
parameter CLKPOL3 = 1;
parameter [18431:0] INIT = 18432'bx;
parameter TRANSP2 = 0;
input CLK2;
input CLK3;
input [CFG_ABITS... |
/**
* 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 n, k, a, b; int ask(int x, int y) { if (x == n) return 1; fflush(stdout); printf( 1 %d %d n , x, y); fflush(stdout); char s[5]; scanf( %s , s); fflush(stdout); return s[0] == T ; } int xxx(int l, int r) { int mid, res = 0; while (l <= r) { ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e6 + 5; long long mod = 1e9 + 7, bas = 31; long long h[2][N], pw[N], cnt[N]; char c[N]; long long n, q; long long query(long long l, long long r, long long op) { return ((h[op][r] - h[op][l - 1] * pw[cnt[r] - cnt[l - 1]]) % mod + mod) ... |
#include <bits/stdc++.h> using namespace std; int check(string s) { int d = 0; for (int i = 0; i < s.length(); i++) if (s[i] == a || s[i] == e || s[i] == o || s[i] == u || s[i] == i ) d++; return d; } int main() { string s1, s2, s3; getline(cin, s1); getline(cin, s... |
`timescale 1ns/1ps
module dv_top();
//static variables
parameter TIMEOUT = 100;
parameter N = 1;
parameter IDW = 12;
parameter AW = 32;
parameter PW = 2*AW+40;
//local variables
integer r;
wire [IDW-1:0] dv_coreid;
wire [N*N-1:0] vdd;
wire vss;
wire clkou... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module gpio
#(
parameter BASEADDR = 0,
parame... |
#include <bits/stdc++.h> using namespace std; const int maxx = (int)1e7; long long SOD(long long n) { long long ans = 0; while (n) { ans += (n % 10); n /= 10; } return ans; } int main() { int T; cin >> T; while (T--) { vector<int> num; long long n, s, nnn; ... |
/**
* 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; long long inf = 1e9; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; long long noemer = 0; for (long long i = 1; i <= n; i++) { noemer += (n + 1 - i) * (n + 1 - i); } string s1, s2; cin >> s1; cin >> s2; do... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if ((i + j) % 2) cout << W ; else cout << B ; } cout << endl; } } |
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; template <typename T> void chkmax(T &x, T y) { if (x < y) x = y; } template <typename T> void chkmin(T &x, T y) { if (x > y) x = y; } inline int read() { int x = 0; char c = getchar(); bool f = 0; while (c < ... |
#include <bits/stdc++.h> using namespace std; stack<int> S; int n, m, q, x, y; struct rs_tree { int hed[200005], ver[600005], nxt[600005], tot, cnt; int dep[200005], fa[200005], top[200005], siz[200005], son[200005]; void push(int x, int y) { ver[++tot] = y; nxt[tot] = hed[x]; hed[... |
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long n; cin >> n; long long ans = 0; for (long long i = 1; i < n; i++) { if (n % i == 0) { ans++; } } cout << ans << n ; } ... |
#include <bits/stdc++.h> using namespace std; long long n; map<pair<long long, long long>, pair<long long, long long> > mp; pair<long long, long long> count(long long x, long long y) { if (mp.find(make_pair(x, y)) != mp.end()) return mp[make_pair(x, y)]; long long temp = 1; while (x / 10 >= temp) te... |
#include <bits/stdc++.h> int main() { unsigned int m = 0, n = 0, s; scanf( %d%d , &m, &n); s = (m * n) / 2; printf( %d , s); return 0; } |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9 + 10; const int MOD = 1e9 + 7; const int N = 1e3 + 10; int n, k; int a[N]; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; if ((a[1] & 1) && (a[... |
//*****************************************************************************
// (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
/... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by John Stevenson.
// SPDX-License-Identifier: CC0-1.0
typedef logic [63:0] uid_t;
typedef logic [31:0] value_t;
interface the_intf #(parameter M = 5);
logic valid;
... |
// (C) 2001-2018 Intel Corporation. All rights reserved.
// Your use of Intel 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 ... |
#include <bits/stdc++.h> using namespace std; unsigned long long X, Y, sum, exor, l, m; int main() { cin >> sum >> exor; if (sum < exor || sum % 2 != exor % 2) { cout << -1 << endl; return 0; } X = (sum - exor) / 2; Y = sum - X; cout << X << endl << Y << endl; } |
#include <bits/stdc++.h> using namespace std; typedef int STDD[1010]; struct lst { int po; int num; lst* nxt; }; lst* hd[1001]; int n, m, sx, sy, ans = 2E9 + 1, a1, a2; STDD seq, tseq, fa, clr, far; int x[30010], y[30010], z[30010]; bool vis[1001]; int getfa(int x) { return (fa[x] != x) ... |
#include <bits/stdc++.h> using namespace std; int a[505][505]; int b[505][505]; priority_queue<int> aq[1005]; priority_queue<int> bq[1005]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { scanf( %d , &a[i][j]); aq[i + ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_div_32eql.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 ... |
#include <bits/stdc++.h> using namespace std; long long mult(long long a, long long b, long long p = 1000000007) { long long ans = a; ans *= b; return ((ans >= p) ? ans % p : ans); } long long add(long long a, long long b, long long p = 1000000007) { long long ans = a + b; return ((ans >= p)... |
/**
* 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... |
/*/ Author: Aniruddh Lawande /*/ #include<bits/stdc++.h> using namespace std; /*/---------------------------Defines----------------------/*/ #define ll long long #define F first #define S second #define pb push_back #define endl n #define all(v) (v).begin(),(v).end() typedef pair<ll,ll>... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2012-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
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Wilson Snyder
`define STRINGIFY(x) `"x`"
module t;
initial begin
`ifdef D1A
if (`STRINGIFY(`D4B) !== "") $stop;
`else
$write("%%Error: Missing define\n"); $sto... |
//Legal Notice: (C)2016 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... |
#include <bits/stdc++.h> using namespace std; const int N = 120; int a[N][N], n, k; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; if (k > n * n) { cout << -1 n ; } else { for (int i = 0; i < n && k > 0; i++) { a[i][i] = 1, k--; for ... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-9; const long long INF = 100000000000000000; const int MAXN = 3 * 100000; struct T { int left, right, diff; bool operator>(const T& other) { if (diff != other.diff) return diff < other.diff; ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
module top(
input REFERENCECLK,
output [1:0] PLLOUTCORE,
output [1:0] PLLOUTGLOBAL,
input EXTFEEDBACK,
input [7:0] DYNAMICDELAY,
output LOCK,
input BYPASS,
input RESETB,
input LATCHINPUTVALUE,
//Test Pins
output SDO,
input SDI,
input SCLK
);
SB_PLL40_2F_CORE #(
.FEEDBACK_PATH("DELAY... |
#include <bits/stdc++.h> const long long N = 1000000; using namespace std; long long n, k, l, i = 0, j, mn, mx = N, ans = 0, als, r1, r2, r3, t, q, v, m, ii, r4; string d1, d3, d2, s; char kl, km, mk, lk; double fg; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL);... |
#include <bits/stdc++.h> using namespace std; long long i, n, now, ans, hh, m, p = 1000000009; int main() { scanf( %lld , &n); if (n == 2) { puts( 10 ); return 0; } m = n / 2; now = 4; hh = 1; for (i = 3; i <= m; i++) { now = now * 2 % p; hh = hh * (now - 3) % p... |
#include <bits/stdc++.h> int main() { int a, b, c, d, e, i; scanf( %d %d %d %d %d , &a, &b, &c, &d, &e); int arr[e]; if (a == 1 || b == 1 || c == 1 || d == 1) printf( %d n , e); else { for (i = 1; i <= e; i++) { if (i % a == 0) arr[i - 1] = 1; else if (i % 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 la... |
//
// 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)
// ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<string> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int c = 0; ... |
#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); int ans = n; if (arr[0] == 0) { ans--; } for (int i = 1; i < n; i++) { if (arr[i] == 0) { ans--... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_be_i
//
// Generated
// by: wig
// on: Sat Mar 3 11:02:57 2007
// cmd: /cygdrive/c/Documents and Settings/wig/My Documents/work/MIX/mix_0.pl -nodelta ../../udc.xls
//
// !!! Do not edit this f... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// generates vertical blank, sync and window.
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
... |
#include <bits/stdc++.h> using namespace std; const int MXN = 1e2 * 2; const int TMXN = 1048576; const long long INF = 1e9 + 7; const long long INFL = 1e18; struct query { int l, r, id; }; int n; int a[TMXN]; long long ans[TMXN]; long long res; int cnt[TMXN]; int m, k; query q[TMXN]; b... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:04:14 06/30/2012
// Design Name:
// Module Name: MIO_BUS
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; template <class T> T __trace(string s, T x) { cerr << s << x << endl; return x; } template <class T> ostream& operator<<(ostream& os, const vector<T>& v) { for (T x : v) os << x << ; return os; } template <class T> istream& operator>>(is... |
#include <bits/stdc++.h> using namespace std; const int N = 110000; int len, k, n; long long a[N]; long long resolve() { int pK = k; set<pair<long long, int>> av; set<pair<long long, int>> changed; long long sumP = 0; for (int i = 0; i < len; i++) { av.insert({a[i], i}); sumP +... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9 * 2; int n, m, ind; long long L[55], M[55], R[55], A[55], ans = -inf, un; bool all = 1; vector<int> a[55]; void calc() { for (int i = 0; i < n; i++) { R[i] = M[i] = L[i] = -inf; for (int j = 0; j < a[i].size(); j++) { ... |
#include <bits/stdc++.h> using namespace std; void checkDefine(); long long int a, b, c, d; int main() { cin >> a >> b >> c >> d; long long int t1 = max(3 * a / 10, a - (a * c) / 250); long long int t2 = max(3 * b / 10, b - (b * d) / 250); if (t1 > t2) { cout << Misha ; } else if (t1 ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 10007; int n, m, d, p[maxn], k[maxn], c[maxn], ans[maxn], vis[maxn], match[maxn]; vector<int> adj[maxn]; bool dfs(int u) { for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i]; if (!vis[v]) { vis[v] = 1; if (... |
#include <bits/stdc++.h> using namespace std; int main() { long long num, tmp, sum, mx, l, r, mid; cin >> num; mx = sum = 0; for (int i = 0; i < num; i++) { cin >> tmp; sum += tmp; mx = max(mx, tmp); } l = mx; r = sum; while (l < r) { mid = (l + r) / 2; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; queue<int> r, d; char c; for (int i = 0; i < n; i++) { cin >> c; if (c == D ) d.push(i); else r.push(i); } while (r.size() != 0 && d.size() != 0... |
#include <bits/stdc++.h> using namespace std; const int N = 1.12e5; const int LEN = 6.4 * N; int len; int c[N], sz[N]; int s[LEN], sa[LEN], *rk, ht[LEN], v[2][LEN], ct[LEN]; long long co[LEN]; void build_sa(int n, int m) { int *x = v[0], *y = v[1]; fill_n(ct, m, 0); for (int i = (0); i != (n... |
//*****************************************************************************
// (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
/... |
module vga( input pxl_clk,
input reset_n,
output reg [9:0] hcount,
output reg [9:0] vcount,
output reg vsync,
output reg hsync );
always @ (posedge pxl_clk or negedge reset_n)
begin : hcounter
if (!reset_n) hcount <= 0;
else ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200200; const int INF = 1000000007; struct Ramp { int i, x, d, t, p; bool operator<(int o) const { return x < o; } bool operator<(const Ramp& o) const { return x < o.x; } } r[MAXN], rr; struct Edge { int a, b, c, t; Edge(int ... |
// -----------------------------------------------------------------------------
// FILE NAME : Wu_Manber_shifter.v
// DEPARTMENT : Computer Engineering
// AUTHOR : Ashik Poojari
// -----------------------------------------------------------------------------
// RELEASE HISTORY
// VERSION DATE ... |
module rca_top(
output reg [15:0] final_output,
output reg carry_output,
input [15:0]input1, input2
);
reg carry_in; // initial carry in
task CRAFA_module(
output reg sum,carry,
input in1,in2,carry_in
);
reg intermediate, gen, propagate;
begin
propagate = in1 ^ in2;
sum = propagate ^ ca... |
`include "hglobal.v"
`default_nettype none
module nd_1to2
#(parameter
OPER_1=`NS_GT_OP,
REF_VAL_1=0,
IS_RANGE=`NS_FALSE,
OPER_2=`NS_GT_OP,
REF_VAL_2=0,
FSZ=`NS_1to2_FSZ,
ASZ=`NS_ADDRESS_SIZE,
DSZ=`NS_DATA_SIZE,
RSZ=`NS_REDUN_SIZE
)(
`NS_DECLARE_GLB_CHNL(gch),
`NS_DECLARE_OUT_CHNL(snd0),
`NS_DE... |
//----------------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTR... |
//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 associate... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 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.
*
* T... |
#include <bits/stdc++.h> using namespace std; bool cmp(pair<long long int, char> p1, pair<long long int, char> p2) { return p1.first > p2.first; } vector<vector<long long int> > graph; vector<bool> vis; vector<vector<long long int> > level; vector<long long int> d, childp; void dfs(long long int nod... |
#include <bits/stdc++.h> using namespace std; long long int x, y, a[3000], n, m, sum; int main() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { cin >> x >> y; sum += min(a[--x], a[--y]); } cout << sum; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { string c; cin >> c; string ans = regex_replace(c, regex( (/)+ ), / ); if (ans[ans.size() - 1] == / and ans.size() > 1) { ans[ans.size() - 1] = ; } cout << ans << endl; ; } |
#include <bits/stdc++.h> using namespace std; int M[1010][1010] = {}, C[1010][1010] = {}; int main() { int n, m; cin >> n >> m; memset(M, 0, sizeof(M)); memset(C, 0, sizeof(C)); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; M[y][x]++; } for (int i = 0; i < m;... |
#include <bits/stdc++.h> using namespace std; const long long INF = 3e18 + 100; const int MOD = 1e9 + 7; const int N = 100; int32_t main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n; cin >> n; set<int> s, tot; vector<int> a(n + 5, 0), cnt(n + 5, 0), la... |
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; string ans = ; int cnt(0); for (int i = 0; i < s.size(); i++) { if (s[i] == 0 && cnt == 0) { cnt++; } else ans += s[i]; } if (cnt == 0) { for (int i = 0; i < ans.size() ... |
//----------------------------------------------------------------------------
//-- Asynchronous serial transmitter Unit
//------------------------------------------
//-- (C) BQ. December 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010; int ar[MAXN][MAXN], star[MAXN][MAXN]; int main() { int n, m, t; char a; cin >> n >> m >> t; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { scanf( %c , &a); ar[i][j] = a - 0 ; } for... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; const long long INFL = (long long)9e18; const int MAXINT = ((~0) ^ (1 << 31)); const long long MAXLL = ((~0) ^ ((long long)1 << 63)); template <class T> inline T pow2(T a) { return a * a; } template <class T> inline bool min... |
//Legal Notice: (C)2017 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; int main() { int tst,i,m,n; cin>>tst; while(tst--) { int ar[4]; cin>>ar[0]>>ar[1]>>ar[2]>>ar[3]; n=max(ar[2],ar[3]);m=max(ar[0],ar[1]); sort(ar,ar+4); ((n==ar[3]||n==ar[2])&&(m==ar[3] || m==ar[2]... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000000 ) using namespace std; const double EPS = 1e-9; const int INF = (int)(2e9 + 0.5); const int MAXN = 201000; int n, k, a; vector<int> mass; set<int> minima; map<int, int> bad; int main() { scanf( %d%d , &n, &k); for (int i = ... |
module top
(
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
parameter SRL_COUNT = 4;
parameter PRESCALER = 4; //100000;
// UART loopback
assign tx = rx;
// ============================================================================
// Re... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_ddrc.v
*
* Date : 2012-11
*
* Description : Module that acts as controller for sparse memory (DDR).
*
*****************************************************************************/
module processi... |
#include <bits/stdc++.h> using namespace std; const int N = 100001; int h, t; set<int> G[N]; vector<int> g[N]; bool check(int gr, int ji) { int sw = 0; int com = 0; if (((int)g[gr].size()) > ((int)g[ji].size())) swap(gr, ji), sw = 1; for (int i = 0; i < ((int)g[gr].size()); i++) com += G[ji]... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; const ll MOD = 998244353; const ll INF = 1e15 + 373; template <typename T> using vector2 = vector<vector<T>>; template <typename T> vector2<T> init_vector2(size_t n0, size_t n1, T e = T()) { return vector2<T>(n0, vector<T>(n1, e... |
#include <bits/stdc++.h> using namespace std; int n, i, a[3][30], half; long long ans, ans1, ans2; struct node { long long x, y, z; bool operator<(const node& T) const { if (x != T.x) return x < T.x; else if (y != T.y) return y < T.y; else return z < T.z; } ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.