text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint linf = 1e18 + 7; const lint inf = 1e9 + 7; const int MOD = 1000000007; void press(vector<long long>& x) { map<int, int> memo; int n = x.size(); for (int i = 0; i < n; ++i) { memo[x[i]] += 1; } int cur ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ROM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ====================================... |
#include <bits/stdc++.h> using namespace std; char s[200001], s1[200001]; int n, m, sum, gang, ans[200001], cnt; int main() { scanf( %s , s1 + 1); m = strlen(s1 + 1); for (int i = 1; i <= m; i++) { if (s1[i] == ( || s1[i] == ) ) s[++n] = s1[i]; if (s1[i] == # ) { s[++n] = ) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1.5e3 + 5; const int T = 1e5 + 5; const int mod = 1e9 + 7; int n, m, a, b, p, t; int fac[T], inv[T], res; int P[N], F[N], SP[N], SPL[N], S[N][N], L[N][N]; namespace _ { inline int mul(int x, int y) { return 1ll * x * y % mod; } inline int d... |
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = RDLU ; long long ln, lk, lm; void etp(bool f = 0) { puts(f ? YES : NO ); exit(0); } void addmod(int &x, int y, int mod = 1000000007) { assert(y >=... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long int M, k, Q, sum = 0, a = 1, W; vector<int> x; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %lld , &W); for (int j = 0; j < W; j++) { x.push_back(i); } } scanf( %lld , &M); ... |
/**
* 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 a[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int n, m, k; int q(int x) { return x * (x + 1) / 2; } int p[200005]; int b[200005]; int u[200005]; int dfs(int v) { u[v] = 1; if (!u[p[v]]) return dfs(p[v]) + 1; else return ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 10; const int mod = 1e9 + 7; int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = (x << 1) + (x << 3) + c - 0 , c ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n; cin >> n; long long int a[n], b[n]; long long int sum_1 = 0, sum_2 = 0, c = 0; for (long long int i = 0; i <= n - 1; i++) { cin >> a[i] >> b[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; int sz; cin >> n; cin >> s; sz = s.size(); int count = 0; bool valid = true; for (int i = 0; i < sz; i++) { if (s[i] == 1 ) { if (i < sz - 1 && s[i + 1] == 1 ) { valid = false; ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; int n; vector<long long> a(200013); bool f(long long m) { long long l = (long long)(a[0] + 2 * m), r = (long long)(a[n - 1] - 2 * m); if (l >= r) { return 1; } if ((r - l) <= 2 * m) { return 1... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
// $Id: udp_reg_master.v 1965 2007-07-18 01:24:21Z grg $
//
// Module: udp_reg_master.v
// Project: NetFPGA
// Description: User data path register master
//
// Note: Set TIMEOUT_RESULT to sp... |
#include <bits/stdc++.h> int main() { int i = 0, z, flag = 0, even = 0; char str[100002], temp; scanf( %s , str); int size = strlen(str); char x = str[size - 1]; for (i = 0; i < size; i++) { if (str[i] % 2 == 0) { even = 1; if (str[i] < x) { flag = 1; ... |
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... |
/*
* 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> int main() { long long t, i, l, k, j, b[23132], s, n; char ch[1000000]; while (gets(ch)) { l = strlen(ch); for (k = 0; k < 124; k++) b[k] = 0; for (k = 0; k < l; k++) { b[ch[k] - 48]++; } s = 0; for (j = 0; j < 124; j++) { if (0 ... |
module top(
input in_clk_12_mhz,
output [7:0] out_leds,
// VGA666
output out_vga_r,
output out_vga_g,
output out_vga_b,
output out_vga_hsync,
output out_vga_vsync,
// Controller 0
output out_controller0_pulse,
output out_controller0_latch,
input in_controller0_data,
// SDRAM
output out_sd... |
#include <bits/stdc++.h> using namespace std; long long ans[200005]; vector<vector<pair<long long, long long> > > G(200005); int main() { long long i, j, n, m, a, b, c; priority_queue<pair<long long, long long> > pq; scanf( %lld %lld , &n, &m); for (i = 0; i < m; i++) { scanf( %lld %lld %l... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/10/2016 04:46:19 PM
// Design Name:
// Module Name: exp_operation
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5.2e3 + 5; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } char s[MAXN]; bool a[MAXN][MAXN]; int main(void) { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %s , s + 1); for (int j = 1; s[j]; ++j) {... |
`timescale 1ns / 1ps
/*******************************************************************************
* Engineer: Robin zhang
* Create Date: 2016.09.10
* Module Name: spi_slave
*******************************************************************************/
module spi_slave_freertos(
clk,sck,mosi,miso,ssel,rst_n,rec... |
/**
* 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; using ll = long long int; using P = pair<int, int>; constexpr int INF = 1 << 30; template <typename Monoid> struct SegmentTree { private: using F = function<Monoid(Monoid, Monoid)>; int N; vector<Monoid> node; F f; Monoid e; public: ... |
/*******************************************************************************
* (c) Copyright 1995 - 2010 Xilinx, Inc. All rights reserved. *
* *
* This file contains confidential and proprietary information ... |
//-----------------------------------------------------
// Design Name : hw2_B
// File Name : hw2_B.v
// Function : This program designs a Stream Filter.
// Coder : hydai
//-----------------------------------------------------
`timescale 1 ns/1 ns
module hw2_B (
input in,
input clk,
input rst_n,
outp... |
#include <bits/stdc++.h> using namespace std; const int N = 1010; int n, m; int fw[N][N], fb[N][N]; int dx[8] = {-2, -2, 2, 2, 1, 1, -1, -1}; int dy[8] = {1, -1, 1, -1, 2, -2, 2, -2}; queue<pair<int, int> > q; void bfs(int x, int y, int f[][N]) { for (int i = 1; i <= n; ++i) for (int j = 1; j ... |
/**
* 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:
// Engineer:
//
// Create Date: 10:11:43 02/19/2014
// Design Name:
// Module Name: WcaCicInterp
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
`timescale 1ns / 1ps
/*
Copyright 2015, Google 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long int, long long int> > arr; bool fun(pair<long long int, long long int> fi, pair<long long int, long long int> se) { if (fi.first < se.first) { return true; } else return false; } void solve() { long long int... |
/*
Copyright (c) 2014-2016 Alex Forencich
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, publish, distri... |
/**
* @module data_to_segment
* @author sabertazimi
* @email
* @brief raw data to segment encoder
* @param DATA_WIDTH data width
* @input data raw decimal data
* @output seg_data bit data for cnodes
*/
module data_to_segment
#(parameter DATA_WIDTH = 32)
(
input [(DATA_WIDTH-1):0] data,
output [(DATA_WI... |
//
// 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 (c) 2015-2016 Alex Forencich
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, publish, distri... |
/*
* 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 long long N = 2005; const long long mod = 1e9 + 7; const long long INF = 1e18 + 1; long long goal, n, m; long long umbrella[N], rain[N], cache[N][N]; pair<long long, long long> a[N], b[N]; long long dp(long long x, long long y) { if (x == goal) ret... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, A = 1e5 + 2; bool v[20][20]; long long dp[20][1 << 20]; int n, m, start = 0; long long solve(int node, int mask) { if (~dp[node][mask]) return dp[node][mask]; long long ret = 0; if (v[node][start] && __builtin_popcount(mask) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, M = 1e6 + 10; struct node { int a, b, w; } e[M]; int fa[N]; bool cmp(node a, node b) { return a.w < b.w; } int find(int x) { if (fa[x] != x) fa[x] = find(fa[x]); return fa[x]; } int du[N]; int main() { int n, m; ... |
/**
* 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 maxn = 1e5 + 10; vector<int> e[maxn], re[maxn], List; int n, m, id[maxn], tt, cnt[maxn], ans; bool vis[maxn]; void input() { scanf( %d%d , &n, &m); for (int u, v, i = 1; i <= m; i++) { scanf( %d%d , &u, &v); e[u].push_back(v); ... |
//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; template <typename T> ostream& operator<<(ostream& s, vector<T> t) { for (int i = 0; i < (int)(t.size()); i++) s << (i ? : ) << t[i]; return s; } template <typename T> istream& operator>>(istream& s, vector<T>& t) { for (int i = 0; i < (int)(t.... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; const int MAXN = 1e6 + 3; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } long long power(long long x, long long y) { long long res = 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { float H, L; cin >> H >> L; float x; x = ((L * L) - (H * H)) / (2 * H); printf( %0.6f , x); return 0; } |
/*
*
* 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 distributed in the ... |
#include <bits/stdc++.h> int const MOD = 998244353; int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); int n, nopt; std::cin >> n >> nopt; std::vector<int> h; h.reserve(n + 1); h.resize(n); for (int& hi : h) std::cin >> hi; h.push_back(h[0]); std::vector<int> f{1}; ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx2 ) using namespace std; const int MX = 1005; int n, a, b; vector<int> adj[2 * MX][2]; int leaf[MX][2]; int pos[2 * MX][2]; int siz[2 * MX][2]; int best[MX][MX][2]; int ans[MX][2]; pair<int, int> rang[2 * MX][2]; voi... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> int min(int a, int b) { return a > b ? b : a; } int max(int a, int b) { return a < b ? b : a; } int main() { int n, a, b, c, d, i, pos; int sum, next; while (~scanf( %d , &n)) { int ans = 0; for (i = 1; i <= 4; i++) { scanf( %d%d%d%d , &a, &b, &c, &d); ... |
#include <bits/stdc++.h> using namespace std; const int Maxs = 300 * 1000 + 5, Maxn = 300 * 1000 + 5; int n, dp[Maxs]; string s, t; long long ans; vector<pair<int, string> > adj[Maxn]; void kmp() { dp[0] = -1; for (int i = 0; i < t.size(); i++) { int pt = i; while (dp[pt] != -1 && t[dp... |
#include <bits/stdc++.h> using namespace std; const long long dx[] = {-2, -1, 1, 2, -2, 1, -1, 2}; const long long dy[] = {-1, -2, 2, 1, 1, -2, 2, -1}; const long long Mod = 1e9 + 7; const long long N = 5e5; const long long inf = 1e9 + 1; const long long N_N = 1e2; long long n, m, x, y, cnt; int main(... |
`timescale 1ns/10ps
module master_pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked,
// interface 'reconfig_to_pll'
input wire [63:0] reconfig_to_pll,
// interf... |
#include <bits/stdc++.h> int f[10005], c, d, n, m, k; inline int min(int x, int y) { return x < y ? x : y; } int main() { scanf( %d %d %d %d %d , &c, &d, &n, &m, &k); if (n * m <= k) { puts( 0 ); return 0; } memset(f, 0x3f, sizeof(f)); f[0] = 0; for (int i = 1; i <= n * m; ++i)... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_txstatem.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> bool is_prime(int n) { if (n < 2) { return false; } for (int d = 2; d * d <= n; d++) { if (n % d == 0) { return false; } } return true; } int main() { int n; std::cin >> n; int m = n, cross = 0; while (!is_prime(m + cross)) { ... |
// 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 : Fri Jan 13 17:31:20 2017
// Host : KLight-PC running 64-bit major release (bu... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int l = s.length(); if ((s[l - 1] - 48) % 2 == 0) { int temp = s[l - 2] * 10 + s[l - 1]; if (temp % 4 == 0) { cout << 4 << endl; } else { cout << 0 << endl; } } else { cou... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/12/2016 06:18:20 PM
// Design Name:
// Module Name: Mux_Array
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// ... |
/*
* Milkymist VJ 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 distri... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_width (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter min_cks = 1;
parameter max_cks ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int p1 = 0, q1 = 0, r1 = 0, s1 = 0; int ans = 1; int a = 0, b = 0, c = 0, d = 0; vector<int> v; int sum = 0; for (int j = 0; j < s.length(); j++) { if (s[j] == R ) { ... |
#include <bits/stdc++.h> using namespace std; const int N = (int)(1e2 + 5); int n, m, k; int grid[N][N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m >> k; for (int(i) = (1); (i) <= (n); (i)++) for (int(j) = (1); (j) <= (m); (j)++) cin >> grid[i][j]; in... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; using namespace std; string s; long long ispalindroma[2005][2005]; long long ispalindrome(long long i, long long j) { if (i > j) return (1); if (i == j) return (1); if (ispalindroma[i][j] != -1) return (ispalindroma[i][... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e17 + 10; const int N = 1e6 + 10; const long long mod = 998244353; map<string, int> ml; long long b[N], vis[N], po[N], num[N], t, n, m, x, y, k, a[N]; long long ex, ey, cnt, ans, sum, flag; long long dist[N]; long long dp[N]; vecto... |
/**
* 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 p[300002], pi; bool tag[300002]; int main() { int n, x; long long cnt; while (scanf( %d , &n) != EOF) { memset(tag, false, sizeof(tag)); pi = 0; for (int i = 0; i < n; i++) { scanf( %d , &x); if (x < 1 || x > n || ta... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long l, r; cin >> l >> r; long long ans = 0; for (long long i = 1; i <= r; i *= 2) { long long cur = i; while (cur <= r) { if (cur >= l) ans++; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, x, t; char card, ha; map<int, pair<int, int> > mh; map<int, pair<int, int> > ma; map<int, pair<int, int> >::iterator it; string h, a; cin >> h >> a; cin >> n; for (i = 0; i < n; i++) { cin >> t >> ha; ... |
#include <bits/stdc++.h> using namespace std; int n, m, x, y; long int v[1001]; long int ans; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { scanf( %ld , &v[i]); } for (int i = 0; i < m; i++) { scanf( %d%d , &x, &y); if (v[x] > v[y]) ans += v[y]; els... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:04:36 05/24/2015
// Design Name:
// Module Name: binary_to_BCD_eight_bit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
#include <bits/stdc++.h> const double eps = 1e-9; const double PI = acos(-1); const long long MOD = 1e9 + 7; using namespace std; vector<string> powers; pair<string, string> solution(string s) { string order; reverse(s.begin(), s.end()); map<char, int> mp; for (char c : s) { if (!mp[c]... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; set<int> s; multiset<int> d; auto Add = [&](int x) { auto ret = s.insert(x); auto it = ret.first; if (next(it) != s.end() && it != s.begin()) { ... |
`timescale 1 ps / 1 ps
// lib IP_Integrator_Lib
module zc702_wrapper
(DDR_addr,
DDR_ba,
DDR_cas_n,
DDR_ck_n,
DDR_ck_p,
DDR_cke,
DDR_cs_n,
DDR_dm,
DDR_dq,
DDR_dqs_n,
DDR_dqs_p,
DDR_odt,
DDR_ras_n,
DDR_reset_n,
DDR_we_n,
FIXED_IO_ddr_vrn,
FIXED_IO_ddr_vrp... |
#include <bits/stdc++.h> #define f(c,a,b) for(int c=a; c<=b; c++) #define N 5000010 #define pii pair<int,int> #define mp make_pair #define fi first #define se second #define sl (u<<1) #define sr ((u<<1)+1) #define pb push_back using namespace std; typedef double db; typedef long long ll; st... |
//======================================================================
//
// tb_mkmif_spi.v
// --------------
// Testbench for the mkmif SPI module.
//
//
// Copyright (c) 2016, Assured AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are permitted 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... |
#include <bits/stdc++.h> using namespace std; long long MOD(long long, long long); void doublesetprecision(double, int); bool isEven(long long); int gcd(int, int); int n, m, o, ans, k; int a[1000000]; void solve() { string s, t; cin >> s >> t; if (s == t) { cout << yes ; return;... |
//move some stuff to minitests/ncy0
`define SEED 32'h12345678
module top(input clk, stb, di, output do);
localparam integer DIN_N = 42;
localparam integer DOUT_N = 79;
reg [DIN_N-1:0] din;
wire [DOUT_N-1:0] dout;
reg [DIN_N-1:0] din_shr;
reg [DOUT_N-1:0] dout_shr;
always @(posedge clk) begin
din_shr <= {d... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_cmos2_term_dn.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 ... |
// DESCRIPTION: Verilator: Verilog example module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ======================================================================
// This is intended to be a c... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int cnt = 1, T[N * 31][2], n; long long t, a[N * 31]; void insert(long long x) { int u = 0; for (int i = 30; i >= 0; i--) { int v = (x >> i) & 1; if (!T[u][v]) { memset(T[cnt], 0, sizeof(T[cnt])); a[cnt] =... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e9 + 7; template <class X, class Y> void minimize(X &x, const Y &y) { if (x > y) x = y; } template <class X, class Y> void maximize(X &x, const Y &y) { if (x < y) x = y; } vector<int> adj[5050]; int nLeaf[5050]; int f[5050... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: FIFO_WRITE.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
#include <bits/stdc++.h> using namespace std; const int N = 450, inf = 1e8; int n1, n2, m, r, b, node, s, t, S, T, a[N], id[N]; char col1[N], col2[N]; int head[N], ce = 1, inq[N], dis[N], maxflow, mincost, need; struct edge { int to, nxt, cap, flow, w; } e[5000]; void lnk(int a, int b, int c, int w)... |
/**
* 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; typedef long long int ll; void solve() { ll n; cin>>n; vector<ll> v; for(int i=0;i<n;i++) { ll x; cin>>x; v.push_back(x); } sort(v.begin(),v.end()); ll cost=0; for(ll i=2; i<n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; vector<int> eum; int w[100005]; int Euler(int num) { int p = 2, ans = 1; while (p * p <= num) { int ct = 1; while (num % p == 0) { ct *= p; num /= p; } if (ct > 1) ct = ct / p * (p - 1); ... |
//deps: fifo.v, uart.v
`timescale 1ns/1ps
module uart_controller(
input rx,
input clk,
input en,
input rst,
input wr_en,
input read,
input baud_wr_en,
input [15:0] data,
output [7:0] data_out,
output reg [7:0] status_out = 0,
... |
#include <bits/stdc++.h> using namespace std; int A[20][6], n, B[4]; bool check(int l) { int a0 = 0, a1 = 0, i, j; for (i = 0; i < 4; i++) for (j = i + 1; j < 4; j++) if (B[i] == B[j]) return 0; for (i = 0; i < 4; i++) { a0 += (int)(B[i] == A[l][i + 2]); for (j = 0; j < 4; j+... |
#include <bits/stdc++.h> using namespace std; long long r(long long a) { long long i = 0; while (a % 2 == 0) { a /= 2; ++i; } return i; } void one_case() { long long a, b; cin >> a >> b; auto ra = r(a); auto rb = r(b); a /= (1ll << ra); b /= (1ll << rb); i... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_arb_rd_4.v
*
* Date : 2012-11
*
* Description : Module that arbitrates between 4 read requests from 4 ports.
*
*****************************************************************************/
module... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); n = (s[n - 2] - 48) * 10 + (s[n - 1] - 48); if (n % 4) cout << 0 ; else cout << 4 ; } |
#include <bits/stdc++.h> #define int long long #define f(i,a,n) for (int i = a; i < n; ++i) #define f1(i,a,n) for(int i=n-1;i>=a;i--) #define ff first #define ss second #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define sortall(x) sort(all(x)) #define fastio ios_base... |
#include <bits/stdc++.h> using namespace std; int i, j, k, l, x, y, z, m, n, ans, dir, s, f, current, p, q; pair<int, int> a; pair<int, pair<int, int> > spies[300000]; int main() { scanf( %d %d %d %d , &n, &m, &s, &f); for (i = 0; i < m; i++) { scanf( %d %d %d , &x, &y, &z); a = make_pair(... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; const int MOD = 1e9 + 7; vector<pair<int, int> > G[maxn]; int vis[maxn]; int dp[maxn]; int dfs(int x, int v) { vis[x] = 1; dp[x] = v; for (pair<int, int> e : G[x]) { int a = e.first; int b = 1 - e.second; ... |
/*
* Milkymist VJ 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 distri... |
#include <bits/stdc++.h> using namespace std; int n, a[4], b[4]; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); sort(a, a + n); if (!n) puts( YES n1 n1 n3 n3 ); else if (n == 1) printf( YES n%d n%d n%d n , a[0] << 1, a[0] << 1, a[0] + (a[0] << 1)); ... |
`timescale 1 ns / 1 ps
`include "n64_cart_cntlr_v1_0_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_BURST_LENGTH 1
`def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.