text stringlengths 59 71.4k |
|---|
//*****************************************************************************
// (c) Copyright 2008-2009 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
// ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline bool cmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int N = 444444; int fa[N], ch[N][26], l[N], f[N], a[N], c[N], pos[N], top[N]; char s[N]; int last = 1, cnt = 1, n, ans = 1; void ins(int c, int k) { int p ... |
#include <bits/stdc++.h> using namespace std; int main() { map<int, int> pos1; map<int, int> pos2; int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; pos1[a[i]] = i; } for (int i = 0; i < n; i++) { cin >> b[i]; pos2[b[i]] = i; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; struct Point { int x, y; void read() { int a, b; scanf( %d%d , &a, &b); x = a + b; y = a - b; } bool operator<(const Point p) const { return x != p.x ? x < p.x : y < p.y; } } p[N]; int n; int pre_min[... |
#include <bits/stdc++.h> using namespace std; int dirx[] = {1, -1, 0, 0, 1, 1, -1, -1}, diry[] = {0, 0, 1, -1, 1, -1, 1, -1}; bool Set(int n, int pos) { return bool(n & (1 << pos)); } int32_t main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; string a, b; cin >> a >> 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... |
#include <bits/stdc++.h> using namespace std; typedef struct node_t { int l, r, k, id; friend bool operator<(const node_t& a, const node_t& b) { if (a.r == b.r) return a.l > b.l; return a.r < b.r; } void print() { printf( l = %d, r = %d, k = %d, id = %d n , l, r, k, id); } } node_t; ... |
//------------------------------------------------------------------------------
//
// Copyright 2011, Benjamin Gelb. All Rights Reserved.
// See LICENSE file for copying permission.
//
//------------------------------------------------------------------------------
//
// Author: Ben Gelb ()
//
// Brief Description:
//... |
/**
* 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... |
/*
Copyright (c) 2015 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, distribute,... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
#include <bits/stdc++.h> using namespace std; const int maxn = 6e5 + 10; int n, k, l[maxn][2]; int fa[maxn], sz[maxn]; string s; int get_fa(int x) { if (x == fa[x]) return x; return fa[x] = get_fa(fa[x]); } int calc(int x) { int y; if (x <= k) y = x + k; else y = x - k; ... |
#include <bits/stdc++.h> using namespace std; bool compare(pair<pair<long long int, long long int>, long long int> p1, pair<pair<long long int, long long int>, long long int> p2) { return p1.first.first < p2.first.first; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); ... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////////////
// Company: Digilent Inc.
// Engineer: Andrew Skreen
//
// Create Date: 07/11/2012
// Module Name: data_select
// Project Name: PmodGYRO_Demo
// Target Devices: Nexys3
// Tool versions: ISE 14.1
// ... |
`define ADDER_WIDTH 017
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ee_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!... |
/*
* 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; template <typename A> ostream &operator<<(ostream &cout, vector<A> const &v); template <typename A, typename B> ostream &operator<<(ostream &cout, pair<A, B> const &p) { return cout << ( << p.first << , << p.second << ) ; } template <typename A> os... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int i, j, n, ans = 0, k1, k2; cin >> n; long long int arr[n]; vector<vector<long long int> > vec(26); for (i = 0; i < n; i++) { cin >> arr[i]; vec[a... |
`include "../../../rtl/verilog/gfx/gfx_clip.v"
`include "../../../rtl/verilog/gfx/gfx_color.v"
module clip_bench();
parameter point_width = 16;
reg clk_i;
reg rst_i;
reg clipping_enable_i;
reg zbuffer_enable_i;
reg [31:2] zbuffer_bas... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int x, long long int y) { return y == 0 ? x : gcd(y, x % y); } int main() { long long int a; cin >> a; if (a > 2) { if (a * a % 2) cout << (a * a - 1) / 2 << << (a * a + 1) / 2; else cout <<... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const long long LINF = 4000000000000000000LL; const double eps = 1e-9; void prepare() {} int a, n; int day[10000008]; void read() { scanf( %d%d , &a, &n); } void solve() { read(); for (int i = 1; i * i < a + 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 la... |
#include <bits/stdc++.h> static const int N = 1 << 17; struct Fenwick { int n; int t[N * 4]; void set(int n) { this->n = n; } void add(int x, int v) { for (int i = x; i <= n; i += (i & -i)) t[i] += v; } void clear(int x) { for (int i = x; i <= n; i += (i & -i)) t[i] = 0; } ... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=4e2+2,p=998244353; vector<int> lj[N]; int dis[N][N],dl[N],ans[N][N],rd[N][N],cnt[N],pre[N][N],lb[N*3][2]; int n,m,s,t,i,j,tou,wei,x,y,r; bool ed[N]; int main() { scanf( %d%d ,&n,&m); for (i=1;i<=m;i++) scanf( %d%d ,&... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
/* Acceptable answer 1
created tag with scope = top.t.tag
created tag with scope = top.t.b.gen[0].tag
created tag with scope = top.t.b.gen[1].tag
mod a has scop... |
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1); long long powm(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = (res * a) % 1000000007; a = (a * a) % 1000000007; b >>= 1; } return res; } long long gcd(long long a, long... |
module SPW_ULIGHT_FIFO(
input FPGA_CLK1_50,
input [1:0] KEY,
input din_a,
input sin_a,
//input din_b,
//input sin_b,
output dout_a,
output sout_a,
//output dout_b,
//output sout_b,
//////////// LED //////////... |
//////////////////////////////////////////////////////////////////////
//// ////
//// ROM ////
//// ////
//// Author(s): ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, k; cin >> n >> k; vector<long long int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<long long int> pks; for (int i = 1; i < n - 1; i++) { ... |
// DESCRIPTION: Verilator: Verilog Test 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
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer _mode; initial _mode = 0;
//... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); return x * f; } int n, m; vector<int> G[20], G2... |
#include <bits/stdc++.h> using namespace std; int main() { int length; bool true_false; char S[100], aux, digits[4] = 123 ; cin >> S; length = strlen(S); for (int i = 0, x = 0, j; i < length; i += 2) { true_false = false; if (S[i] != digits[x]) { for (j = i + 2; j < leng... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 9; const int mod = 1e9 + 7; int32_t main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (n % m == 0) cout << YES n ; else cout << NO n ; } return 0; } |
#include <bits/stdc++.h> using namespace std; int n, m, h; int bb[109][109][109]; int a[109], b[109], c[109][109]; int main() { scanf( %d%d%d , &n, &m, &h); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= h; k++) { bb[i][j][k] = 1; } ... |
///////////////////////////////////////////////////////////////////////////////
// $Id: small_fifo.v 4761 2008-12-27 01:11:00Z jnaous $
//
// Module: small_fifo.v
// Project: UNET
// Description: small fifo with no fallthrough i.e. data valid after rd is high
//
// Change history:
// 7/20/07 -- Set nearly full to 2^M... |
#include <bits/stdc++.h> using namespace std; const int N = 300010; int a[N], f[N][21], la[21]; int main() { int n, q; scanf( %d%d , &n, &q); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); for (int j = 0; j <= 18; j++) if (!(a[i] & (1 << j))) for (int k = 0; k <= 18... |
#include <bits/stdc++.h> using namespace std; template <typename... T> inline void inp(T &...args) { ((cin >> args), ...); } template <typename T> inline istream &operator>>(istream &in, vector<T> &a) { for (auto &x : a) in >> x; return in; } template <typename T, typename U> inline istrea... |
`timescale 1ps / 1ps
module main;
reg clk = 0;
always #200 clk = !clk;
reg [2:0] in = "111";
reg [1:0] out;
reg out_golden;
reg out_del;
integer seed = 1234;
integer rvec_file;
integer ret;
integer soe0 = 0;
initial begin
$sdf_annotate("myde... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << , ; err(++it, args...); } namespace fastIO { bool IOerror = 0; ... |
#include <bits/stdc++.h> char str1[200], str2[200]; char lenstr1, lenstr2; int dp1[200]; int dp2[200]; int got[200] = {0}; int twice; int twicep; int countc; int calel(int st) { int ite = st; int len = 1; for (int i = 0; i < lenstr2; i++) { int flag = 0; while (str1[st] != str2... |
#include <bits/stdc++.h> using namespace std; const int N = 5e3 + 10, mod = 1e9 + 7; int fact[N], invfact[N]; inline int add(int x, int y) { x += y; if (x >= mod) x -= mod; return x; } inline int sub(int x, int y) { x -= y; if (x < 0) x += mod; return x; } inline int mul(int x, i... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; int n, m, k, x[100039], y[100039], z, now, cur, flag[100039]; long long d[100039], ans = 1e15; struct yyy { int to; long long w; int z; } tmps; struct ljb { int head, h[100039]; yyy f[600039]; inline void add(int x, int y, long long z) { ... |
#include <bits/stdc++.h> using namespace std; template <typename T> int size(T &a) { return (int)a.size(); } template <typename T> T sqr(T a) { return a * a; } const int INF = int(1e9); struct pt { int cnt; long long sumr; long long suml; long long f; int pr; int x; ... |
#include <bits/stdc++.h> using namespace std; long n; vector<long> prec; int main() { ios_base::sync_with_stdio(0); prec.push_back(2); prec.push_back(7); prec.push_back(2); prec.push_back(3); prec.push_back(3); prec.push_back(4); prec.push_back(2); prec.push_back(5); prec... |
#include <bits/stdc++.h> #define ALL(x) x.begin(), x.end() #define pb push_back #define db1(x) cout << #x << = << x << endl #define db2(x, y) cout << #x << = << x << , << #y << = << y << endl using namespace std; void localFileInput() { #ifndef ONLINE_JUDGE freopen( input.txt , r ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, inf = 0x3f3f3f3f; int main() { int a, b, h1, h2; while (cin >> h1 >> h2) { cin >> a >> b; int add = a * 12, de = b * 12, first = 8 * a; if (a <= b) { if (h1 + first >= h2) puts( 0 ); else ... |
/**
* 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> const int MAXN = 1001; using namespace std; char s[MAXN + 1], heidi[MAXN + 1]; int main() { int n, i, poz; scanf( %s , &s); n = strlen(s); i = 0; poz = 0; heidi[0] = h ; heidi[1] = e ; heidi[2] = i ; heidi[3] = d ; heidi[4] = i ; while (i... |
#include <bits/stdc++.h> using namespace std; long long ar[500005]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %lld , &ar[i]); } string s; cin >> s; long long gain = 0; long long loss = 0; long long bob = 0; for (int i = 0; i < s.length(... |
#include <bits/stdc++.h> using namespace std; char s1[5010], s2[5010]; int dp[5010][5010]; int main() { int i, j, ind, n, m, ans; cin >> n >> m; cin >> s1; cin >> s2; for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) { dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) - 1; i... |
#include <bits/stdc++.h> using namespace std; int N, M; int p[1010]; long long X[1010]; int A[1010]; long long B[1010]; int U[2020]; int V[2020]; int up[1010]; bool chk[2020]; bool vst[1010]; bool chkv[1010]; long long mn[2020]; vector<int> adj[1010]; priority_queue<pair<long long, int>, v... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int j = 0; j < q; j++) { int n; long long int k; cin >> n >> k; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); long long int mi, ma; ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000009; const int MAXN = 128; const int MAXK = 4; struct TrieNode { int next[MAXK], fail; int danger; void init() { fail = -1; danger = 0; for (int i = 0; i < MAXK; ++i) next[i] = -1; } } T[MAXN]; int root,... |
//
// rom.v -- parallel flash ROM interface
//
module rom(clk, reset,
en, wr, size, addr,
data_out, wt,
ce_n, oe_n, we_n, rst_n, byte_n, a, d);
// internal interface signals
input clk;
input reset;
input en;
input wr;
input [1:0] size;
input [20:0] addr;
... |
#include <bits/stdc++.h> using namespace std; const long long N = 1005; const long long mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; cout << (n + 1) / 2 - 1; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int &i : a) { cin >> i; } vector<vector<bool> > match(n + 1, vector<bool>(n + 1, false)); for (int i = 0, x, y; i < m; i++) { cin >> x >> y; x--; y--; ... |
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1000000007; const long double PI = 3.14159265; long long int powerWithMod(long long int base, long long int exponent, long long int MODulus = LLONG_MAX) { long long int ansult = 1; base %= MODulus; w... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/30 20:05:27
// Design Name:
// Module Name: Mealy_FSM
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
#include <bits/stdc++.h> using namespace std; int a[2010], b[2010]; bool vis[2010]; char *p1, *p2, buf[100000]; int rd() { int x = 0, f = 1; char c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++); while (c < 48) { if ... |
// spw_babasu_hps_0.v
// This file was auto-generated from altera_hps_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 593
`timescale 1 ps / 1 ps
module spw_babasu_hps_0 #(
parameter F2S_Width = 0,
parameter S2F_Width = 1
) (
output wire h2f_rst_n, ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 998244353; vector<long long int> prime; long long int n = 1000001; vector<bool> vis(n, true); void sieve() { vis[0] = vis[1] = false; for (long long int i = 2; i * i <= n; i++) if (vis[i]) for (long long int j = i ... |
module reg_wo_4burst(
input wire clk,
input wire [15:0] bus_ad, // raw mux data
input wire [18:0] my_a,
input wire [2:0] bus_a, // high address bits
input wire adv, // active high, so connect to !EIM_LBA
input wire rw, // low = write, high = read, so connect to EIM_RW
... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int m, n, a[100009], b[100009]; long long sa, sb; long long proca() { long long ans = 0; ans += sa; for (int(x) = (1); (x) < (n); ++(x)) { ans += min(sa, (long long)b[x]); } return ans; } long long procb() ... |
/*
* 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 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; long long a[200005]; unordered_map<long long, long long> f, done; vector<long long> v; int main() { std::ios_base::sync_with_stdio(0); cin.tie(0); long long n; long long ans = 0; cin >> n; for (long long i = 1; i <= n; i++) { cin >> a... |
/**
* 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 = 100 * 1000 + 1000; int arr[MAXN]; vector<int> pt[MAXN]; int mrk[MAXN]; int32_t main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> arr[i]; for (int i = 0; i < n; i++) pt[arr[i]].push_back(i); int cnt = n; int cnt... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long... |
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 5; int n; int fa[N], r[N]; int rt[N], ls[N * 30], rs[N * 30], siz[N * 30], tot; long long sum[N * 30], ans; void update(int &rt, int l, int r, int p) { if (!rt) rt = ++tot; if (l == r) { siz[rt] = 1, sum[rt] = p; return;... |
/*
* 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... |
/************************************************
The Verilog HDL code example is from the book
Computer Principles and Design in Verilog HDL
by Yamin Li, published by A JOHN WILEY & SONS
************************************************/
module CPU (clk,reset,pc,inst,Addr,Data_I,Data_O,WE,ACK,STB,debug_next_... |
module test;
// Test declaring the enum as a 3-bit logic.
enum reg [2:0] { rstate[8] } reg_enum;
enum bit [2:0] { bstate[8] } bit_enum;
enum logic [2:0] { lstate[8] } log_enum;
initial begin
if ($bits(reg_enum) != 3) begin
$display("FAILED -- $bits(reg_enum) == %0d", $bits(reg_enum));
$fi... |
/**
* 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; double f[100]; int k[100]; double cpw[100]; int N; double calc(int i) { return (1 - cpw[i] * f[i]) / (1 - cpw[i]); } int main() { cin >> N; int c; int highInc = 0; double P = 1; for (int i = 0; i < N; i++) { cin >> c; cpw[i] = f... |
/**
* 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 chan_fifo_reader
(reset, tx_clock, tx_strobe, adc_time, samples_format,
fifodata, pkt_waiting, rdreq, skip, tx_q, tx_i,
underrun, tx_empty, debug, rssi, threshhold, rssi_wait) ;
input wire reset ;
input wire tx_clock ;
input wire ... |
//////////////////////////////////////////////////////////
// Filename : cpu_tb.v
// Description : Troy Wide Word Processor Testbench
// Author : Dr. Rashed Z. Bhatti
// Created On : Thu Nov 29 02:35:07 2007
// Last Modified By: .
// Last Modified On: .
// Update Count : 0
//////////////////... |
//`include "../../firmware/include/fpga_regs_common.v"
//`include "../../firmware/include/fpga_regs_standard.v"
module rx_buffer_inband
( input usbclk,
input bus_reset,
input reset, // DSP side reset (used here), do not reset registers
input reset_regs, //Only reset registers
output [15:0] usb... |
#include <bits/stdc++.h> using namespace std; int i, j, k, s, t; int read() { int x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) ch = getchar(); while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x; } int n1, n2, n3, p1, p2, p3, m1, m... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, f = 0, d = 0; cin >> a >> b; for (int i = 1; i <= 6; i++) { int d1 = abs(a - i), d2 = abs(b - i); if (d1 < d2) f++; else if (d1 == d2) d++; } cout << f << << d << << 6 - f - d << endl; ... |
#include <bits/stdc++.h> using namespace std; int a[30010], n; bool vis[30010]; void print(vector<int> v) { for (int i = 0; i < v.size(); i++) printf( %d , v[i]); printf( n ); } bool check(vector<int> v) { if (!v.size()) return false; if (v.size() == 1 || v.size() == 2) return true; in... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; string s; cin >> s; n = s.size(); int z = 0, o = 0; for (int i = 0; i < n; i++) { if (s[i] == 1 ) o++; else z++; } if (min(o, z) & 1) { cout << DA n ; } else { cout << N... |
/**
* 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... |
/*
* Titor - System - Stuff I made because I was really frustrated with the debounce circuitry
* Copyright (C) 2012 Sean Ryan Moore
*
* 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 Foundat... |
/**
* 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 main(int argc, char **argv) { long count = 0; std::cin >> count; long sum = 0; long tmp; long size; do { sum += (tmp = count); size = (count / 2) + 1; int offset = (count % 2) ? 2 : 1; int start = (count % 2) ? 3 : 2; for (long i = sta... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.