text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int n, m, i, j, k, l, a[1000009], b[1000009], p[1000009], ans, cn, t, x, y, z, mx, mn, s; char c[1000009], d[1000009], ch; struct point { int num, pos; } pp[1000009]; bool cmp(point a1, point a2) { if (a1.num == a2.num) { return a1.pos < a2.p... |
#include <bits/stdc++.h> using namespace std; const int modulo = 1e9 + 7; const int max_n = 111; const int max_k = max_n * max_n; int bin_pow(int base, long long pw) { if (pw == 0) return 1; if (pw & 1) return (1LL * base * bin_pow(base, pw - 1)) % modulo; return bin_pow((1LL * base * base) % modu... |
/*
* 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_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, i, j; cin >> n; int x[n], y[n]; for (i = 0; i < n; ++i) { cin >> x[i] >> y[i]; } long long int c1 = 0, c2 = 0; std::map<pair<double, double... |
#include <bits/stdc++.h> using namespace std; int cnt[125]; char sa[5005]; int main() { bool ok, whh; int lens, lent; string s, t, my; cin >> s >> t; memset(cnt, 0, sizeof cnt); lens = s.length(); for (int i = 0; i < lens; i++) cnt[s[i]]++; ok = true; whh = false; my = s;... |
#include <bits/stdc++.h> using namespace std; long long POW(long long a, long long b) { if (b == 0) return 1; if (b == 1) return a; if (b & 1) return (a * POW(a, b - 1)) % 1000000007; long long t = POW(a, b / 2); return (t * t) % 1000000007; } long long gcd(long long a, long long b) { return... |
#include <bits/stdc++.h> using namespace std; long long tot, n, q, u, v, z, a, b, c, p, k; long long dep[200005], f[200005][25], fa[200005], va[200005]; struct edge { long long from, head, nxt, val, go; } e[200005 * 4]; long long find(long long x) { long long o = x; while (x != fa[x]) x = fa[x] ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:07:05 10/11/2015
// Design Name:
// Module Name: UART_fifo_interface
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
/*
* Copyright (c) 1998 Purdea Andrei ()
*
* 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 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; vector<pair<int, int> > v; int N, M; long long f(int a, int b) { long long res = 1; for (int i = 1; i <= a; i++) { int ii = i; while (b > 0 && ii % 2 == 0) { ii /= 2; b--; } res = (res * ii) % M; } return res; ... |
#include <bits/stdc++.h> using namespace std; struct edge { int v, next; }; bool islucky[100010]; bool vis[100010]; int A[100010], C[100010]; edge e[2 * 100010]; int beg[100010], f[100010]; int n, m, cnt, tot, ne; void dfs(int x) { if (x >= 100010) return; islucky[x] = true; dfs(x * ... |
//
// Copyright 2011-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 i... |
#include <bits/stdc++.h> using namespace std; int n, flag = 0; int matrix[2505][2505]; int parent[2505]; vector<int> graph[2505]; int vis[2505], num[2505]; struct Edge { int u, v, w; Edge() {} Edge(int u, int v, int w) : u(u), v(v), w(w) {} }; vector<Edge> edge; bool cmp(const Edge &a, c... |
#include <bits/stdc++.h> using namespace std; long long arr[200000 + 10] = {0}; long long dp[200000 + 10] = {0}; int main() { int t; cin >> t; while (t--) { long long n, k, p; cin >> n >> p >> k; for (int i = 1; i <= n; i++) { cin >> arr[i]; } sort(arr + 1, arr ... |
/**
* 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 2018-2022 F4PGA 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... |
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; for (int test_case = 0; test_case < T; test_case++) { int num, round = 1; vector<int> result; cin >> num; while (num > 0) { if (num % 10 != 0) { result.push_back((num % 10) * round); ... |
#include <bits/stdc++.h> using namespace std; const int mod = 51123987; int f[160][53][53][53]; int n, m, ans, a[160][3]; char s[160]; void up(int &a, int b) { a += b; a %= mod; } int main() { scanf( %d n%s , &n, s); a[n][0] = a[n][1] = a[n][2] = n; for (int i = n - 1; i >= 0; i--) {... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 9; const int L = 20; int par[N][L]; int up[N][L]; int h[N]; int to[N]; int s[N], t[N]; pair<int, int> edge[N]; vector<pair<int, int> > al[N]; int find(int v) { if (to[v] == v) return v; return to[v] = find(to[v]); } int ... |
#include <bits/stdc++.h> const long long int MAX = 1e12; using namespace std; const int alpha = 26; void solve() { int n; cin >> n; vector<int> arr(n); for (auto &it : arr) cin >> it; for (int i = 0; i < n; i++) { while (arr[i] % 2 == 0) arr[i] /= 2; while (arr[i] % 3 == 0) arr[i... |
#include <bits/stdc++.h> using namespace std; vector<vector<long long> > matmul(vector<vector<long long> > &a, vector<vector<long long> > &b) { int i, j, k, n = a.size(); vector<vector<long long> > ans(n, vector<long long>(n)); for (i = 0; i < n; i++) for (j = 0... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[100005]; int tr[100005]; int lb(int x) { return x & (-x); } void add(int x, int v) { while (x <= 100000) { tr[x] = max(tr[x], v); x += lb(x); } } int get(int x) { int ans = 0; while (x > 0) { ans = max(ans, t... |
// Verilog netlist generated by Workcraft 3
module CTRL (uv, oc, zc, gp_ack, gp, gn_ack, gn);
input uv, oc, zc, gp_ack, gn_ack;
output gp, gn;
wire charge_ctrl_chrg_ack, cycle_ctrl_chrg_req;
CHARGE_CTRL charge_ctrl (.gp(gp), .gn(gn), .gp_ack(gp_ack), .gn_ack(gn_ack), .chrg_req(cycle_ctrl_chrg_req), .oc... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; struct dsu { vector<int> par, rnk, size; int c; dsu(int n) : par(n + 1), rnk(n + 1, 0), size(n + 1, 1), c(n) { for (int i = 1; i <= n; ++i) par[i] = i; } int find(int i) { return (par[i] == i ? i : (par[i] = find(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 law... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> using namespace std; const int maxn = 4e5 + 7; char s[maxn]; int sa[maxn], str[maxn], _rank[maxn], height[maxn]; int t1[maxn], t2[maxn], c[maxn]; int RMQ[maxn], mm[maxn], best[20][maxn], len; bool cmp(int *r, int a, int b, int l) { return r[a] == r[b] && r[a + l] == r[b + l]; ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 30; int num[MAX], x[MAX]; char s[1000 + 10]; int main() { int n; while (cin >> s >> n) { int m = n; string a; memset(num, 0, sizeof num); int len = strlen(s), sum = 0; for (int i = 0; i < len; ++i) { if... |
#include <bits/stdc++.h> using namespace std; FILE *outt, *inn; const int N = 3e5 + 10; int n, a[N], res[N], ans, c, l, r; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } ans = -1; for (int i = 0; i < n; i++) { l = r = i; while (l > 0 && ... |
// 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 : Thu Feb 02 02:37:11 2017
// Host : TheMosass-PC running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); long long n; cin >> n; string s; cin >> s; vector<long long> pref(n + 1); pref[0] = 0; char c; for (long long i = 1; i <= n; ++i) { c = (int)s[i - 1] - 48... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); long long n, a, b, p, q; cin >> n >> a >> b >> p >> q; long long someGcd = gcd(a, b); long long lcm = ... |
/**
* 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... |
// (C) 2001-2016 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 any of the foregoing (including device programming or simulation
// files), and any associated docum... |
/**
* 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 NumOfStudent; int NumOfTeams; int ones = 0, twos = 0, threes = 0; int i, k, l, j, c, m, n, p; int a[5000]; scanf( %d , &NumOfStudent); for (i = 0; i < NumOfStudent; i++) { scanf( %d , &a[i]); } for (i = 0; i < NumOfStudent; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2005; const int maxz = 16005; int l[maxn], r[maxn], n, l1, l2; int dp[maxn][maxz], q[maxz]; bool lt[maxn][maxz]; char s[maxn]; struct ac_machine { int ch[maxz][10], cnt; int fail[maxz]; int tp[maxz][maxn]; void init() { ... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : user_logic.v
// Version : 0.1
// Author : Vipin.K
//
// Description: A dummy user logic for testing purpose
//--------------------------------------------------------------------------------
... |
/*
* 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... |
//======================================================================
//
// poly1305_mulacc.v
// -----------------
// multiply-accumulate core used to implement the 128 bit
// multiplications in Poly1305.
//
//
// Copyright (c) 2017, Secworks Sweden AB
// Joachim Strömbergson
//
// Redistribution and use in source a... |
#include <bits/stdc++.h> using namespace std; template <class T1> void deb(T1 e) { cout << e << endl; } template <class T1, class T2> void deb(T1 e1, T2 e2) { cout << e1 << << e2 << endl; } template <class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3) { cout << e1 << << e2 ... |
#include <bits/stdc++.h> using namespace std; bool check(string s) { string t = s; reverse(t.begin(), t.end()); return (s == t); } int main() { string s; cin >> s; int l = 0, r = ((int)s.length()) - 1; set<char> all; while (l < r) { all.insert(s[l]); all.insert(s[r]);... |
// (C) 2001-2017 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 any of the foregoing (including device programming or simulation
// files), and any associated docum... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; const int MOD = 998244353; long long fac[MAXN]; struct Edge { int to, next; } edge[MAXN * 2]; int head[MAXN], tot; void AddEdge(int s, int t) { edge[tot].to = t; edge[tot].next = head[s]; head[s] = tot++; edge[to... |
#include <bits/stdc++.h> using namespace std; struct interval { int l, r; bool operator<(const interval &t) const { return r < t.r; } }; set<interval> itree[20]; set<interval>::iterator l, r; long long ans; long long f(int type, int num) { return (1LL << type) * ((num + 1LL) * num) / 2; } ... |
`timescale 1ns / 1ps
/*
* Copyright 2015 Forest Crossman
*
* 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 appl... |
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf( %d , &n); if (n <= 2) { printf( -1 n ); return 0; } printf( %d , n); for (n--; n; n--) printf( %d , n); return 0; } |
module tail_offset (ir, ${ range(16).map(e => 'toff_' + e + '_0').join(', ') });
input [63:0] ir;
output [3:0] ${
range(16)
.map(e => 'toff_' + e + '_0')
.join(', ')
};
reg [3:0] ${ range(16).map(e => 'toff_' + e + '_' + e).join(', ') };
reg [3:0] ${ range(16).map(e => 'ir' + e ).join(', ') };
<% var re... |
module Sec6_SM(
//input [7:0] data,
input clk_i,
input reset_n,
output reg [2:0] sel,
output reg digit
//output [6:0] segments
);
reg [1:0] state;
reg [1:0] state_next;
//reg [3:0] num_int; //Internal number storage
parameter S0 = 2'b00; //Disp Digit 1
parameter S1 = 2'b01; //Disp Digit 2
paramete... |
#include <bits/stdc++.h> using namespace std; const int NN = 1000100; int link[NN], fail[NN], len[NN], dif[NN], nxt[NN][26]; int ed, sz, cur; char s[NN], S[NN], T[NN]; int tp[NN], dp[NN], pre[NN], pr[NN]; void clear(int u, int L = 0) { len[u] = L; } void init() { sz = 2; ed = 1; cur = 0; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; bitset<10000> B; int BIT[100010]; int n; void update(int pos, int x) { for (; pos < n; pos |= pos + 1) BIT[pos] += x; } int qu(int pos) { int ret = 0; for (; pos; pos &= pos - 1) ret += BIT[pos - 1]; return ret; } in... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 100; int cnt[MAXN]; int pre[MAXN]; ll fact[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); fact[0] = 1; for (int i = 1; i < MAXN; i++) { fact[i] = fact[i - 1] * i; }... |
#include <bits/stdc++.h> using namespace std; int len, a, b, c; string s; int main() { cin >> s; len = s.length(); for (int i = 0; i < len; i++) { if (s[i] == a ) a++, c++; else b++; a = max(a, b); b = max(b, c); } cout << a; return 0; } |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time ba... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n <= 30) cout << NO n ; else { cout << YES n ; if (n == 36 || n == 40 || n == 44) cout << 6 10 15 << n - 31 << n ; else ... |
//#############################################################################
//# Function: General Purpose Software Programmable IO #
//# (See README.md for complete documentation) #
//#############################################################################
... |
// ddrOutTest.v
// Copyright (c) 2010 Atomic Rules LLC, ALL RIGHTS RESERVED
// Test Case to debug constraints
// 2010-01-14 ssiegel Creation
// 2010-01-15 ssiegel Specialaized for Slave-Drive role
// 2010-01-18 ssiegel Improved OSERDES Reset Synchronizer
// 2010-01-25 ssiegel Tweaked DCM_ADV parameters after reviewing ... |
// A simple OSD implementation. Can be hooked up between a cores
// VGA output and the physical VGA pins
module osd (
// OSDs pixel clock, should be synchronous to cores pixel clock to
// avoid jitter.
input clk_sys,
// SPI interface
input SPI_SCK,
input SPI_SS3,
input SPI_DI,
// ... |
#include <bits/stdc++.h> using namespace std; bool dif[10]; int p[1005], n, x, y, ans1, ans2; inline void chk(int p) { int i, sz = 0, res; for (i = 1; i <= n; i++) { if (i & (1 << p)) { sz++; } } if (sz == 0) { dif[p] = 0; return; } printf( ? %d , sz); ... |
#include <bits/stdc++.h> using namespace std; map<int, int> mp; long long v[100000]; vector<long long> V[200005]; long long sum[200005] = {0}, l[5005], r[5005], ans[5005]; int main() { long long int n, k, q, i, j, a, b, d, l1, t, sm = 0; cin >> t; for (i = 1; i <= t; i++) { cin >> l[i]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 505, M = 300005; int a[N][N]; int main() { int n, k; scanf( %d%d , &n, &k); int res = n * k - n + 1, rp = n - k + 1; int ans = 0; int k1 = 0; for (int i = (1); i <= (n); i++) { ans += res; for (int j = (1); j <= (k -... |
//------------------------------------------------------------------------------
//
// Copyright 2011, Benjamin Gelb. All Rights Reserved.
// See LICENSE file for copying permission.
//
//------------------------------------------------------------------------------
//
// Author: Ben Gelb ()
//
// Brief Description:
//... |
#include <bits/stdc++.h> using namespace std; inline int sqr(int x) { return x * x; } int main() { int n, m, x, y; map<int, int> targets; vector<int> ans, r; scanf( %d , &n); ans.assign(n, -1); r.assign(n, 0); for (int i = 0; i != n; ++i) { scanf( %d%d , &x, &r[i]); targets... |
/*
* 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_base::sync_with_stdio(false); int k, n, w; cin >> k >> n >> w; long long t = k * (w) * (w + 1) / 2, h = 0; cout << max(h, t - n) << endl; } |
/*
* 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() { long long int a, b, c; cin >> a >> b >> c; cout << a * b + (a + b - 1) * (c - 1); return 0; } |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 9; char s[MAXN]; map<char, char> mp; int main(int argc, char const *argv[]) { int n, m; scanf( %d%d , &n, &m); scanf( %s , s); int present = 0; for (int i = 0; i < n; i++) { present |= (1 << (s[i] - a )); } ... |
// Copyright (C) 2017-2020 The Project X-Ray 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
`default_nettype none
`timescale 1ns / 1ps
`include "../src/message_formatter... |
#include <bits/stdc++.h> using namespace std; int memo[5001][501]; int k; int h[11]; long long distribute(int cards, int players) { if (cards <= 0 or players <= 0) return 0; if (cards >= k * players) return players * h[k]; if (memo[cards][players] != -1) { return memo[cards][players]; } ... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s; bool ok = false; for (int i = 0; i < s.size(); i++) { if (s.size() - i < 26) break; int j = i; vector<int> f(26); int qq = 0; while (j < s.size() && j - i + 1 <= 26) { if (s[j] != ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, i, n; cin >> t; for (i = 1; i <= t; i++) { cin >> n; cout << n / 2 << n ; } return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 1010; int N; long long c[4][maxn][maxn]; void upd(int p, int i, int j, long long x) { int jj = j; while (i <= N) { j = jj; while (j <= N) c[p][i][j] ^= x, j += j & (-j); i += i & (-i); } } long long get(int p, int... |
#include <bits/stdc++.h> using namespace std; static const int maxn = 2e5 + 5; struct Node { bool ok; int val; int pos, rpos; Node(bool ok = 0, int val = 0, int pos = 0, int rpos = 0) : ok(ok), val(val), pos(pos), rpos(rpos) {} bool operator<(const Node &other) const { if (ok and... |
#include <bits/stdc++.h> using namespace std; void lemon() { double R1, R2; int k; scanf( %lf%lf%d , &R1, &R2, &k); k++; double xl = 1 / (R1 * 2), xr = 1 / (R2 * 2); double xc = (xl + xr) / 2, rad = abs(xc - xl); double yc = rad * (k - 1) * 2; double len = sqrt(xc * xc + yc * yc); ... |
`default_nettype none
module nonblocking_gate (clk, ctrl, din, sel, dout);
input wire clk;
input wire [4:0] ctrl;
input wire [1:0] din;
input wire [0:0] sel;
output reg [31:0] dout;
always @(posedge clk)
begin
dout <= (dout)+(1);
case (({(ctrl)*(sel)})+(0))
0:
... |
#include <bits/stdc++.h> using namespace std; int a[1000005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; int n; cin >> n; for (long long(i) = (0); (i) < (n); (i)++) cin >> a[i]; int tmp = n + 1; int ans = 0; for (int i = n; i >= 1; --i) { if (i < tmp) ans++;... |
/**
* 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; void _print(long long t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _print(unsigned long long t)... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:36:05 04/26/2017
// Design Name:
// Module Name: cordic_LUT
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
#include <bits/stdc++.h> using namespace std; int c[1000001]; int b[1000001]; int main() { int n, i, l, r, m, kq = 1, a; scanf( %d , &n); for (i = 1; i <= n; i++) { cin >> a; c[a] = i; b[i] = 0; } cin >> a; b[1] = c[a]; for (i = 2; i <= n; i++) { cin >> a; ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; const int MAXN = 1e4 + 10; const int MOD = 1e9 + 7; const int inf = 1e9; const double pi = acos(-1.0); const double eps = 1e-6; int dx[] = {0, -1, 0, 1}; int dy[] = {1, 0, -1, 0}; long long dp[510][510]; int n; int a[510]; ... |
#include <bits/stdc++.h> using namespace std; int n, d = 2; bool P[100100]; int A[100100]; vector<pair<int, int> > R; void criba() { for (int i = 0; i < 100100; i++) P[i] = 1; P[0] = 0; P[1] = 0; for (int i = 2; i < 100100; i++) { if (P[i]) { for (int j = 2 * i; j < 100100; j +... |
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 27.11.2014 14:15:43
// Design Name:
// Module Name: red_pitaya_iq_fgen_block
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:... |
/*
* 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:
// Engineer:
//
// Create Date: 14:45:26 04/09/2015
// Design Name: GCD
// Module Name: S:/a/asw011/public/PrimeFactorization/test_gcd.v
// Project Name: PrimeFactorization
// Target Device:
// T... |
#include <bits/stdc++.h> using namespace std; vector<long long> res; long long n, a, b; void solve(long long x, long long y) { long long i, k; for (i = 1, k = 0; k < x; i += a, k++) { for (long long j = i + 1; j < i + a; j++) res.push_back(j); res.push_back(i); } for (k = 0; k < y; i... |
#include <bits/stdc++.h> using namespace std; multiset<int> s; multiset<int>::iterator itr; int c[5], tot; int get_ty(int x) { if (c[2] >= x) return 1; else if (c[1] + c[2] >= x) return 2; else if (c[0] + c[1] + c[2] >= x) return 3; else return 4; } int main() { ... |
/*
* AGrises.v
*
* Created on: 09/10/2012
* Author: Lord_Rafa
*/
`timescale 1 ps / 1 ps
module AGrises (
input clk,
input rst,
output [DATA_WIDTH-1:0] data_fifo_out,
output data_valid_fifo_out,
input wire [FIFO_DEPTH_LOG2:0] usedw_fifo_out,
input wire [DATA_WIDTH-1:0] data_fifo_i... |
// zhiyang ong
// andrew mattheisen
`timescale 1ns/10ps
module pipe2tb;
// REGISTERS
reg [0:4] aluop_in;
reg [0:2] ppp_in;
reg [0:1] ww_in;
reg [0:1] memop_in;
reg [0:20] memAddr_in;
reg [0:15] wbyteen_in;
reg regwren_in;
reg [0:4] rwraddrd_in;
reg reginmuxop_in;
reg [0:127] rd1data_in;
reg [0:127] rd2... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia 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.
*
... |
#include <bits/stdc++.h> using namespace std; int n; int f[500000], g[500000], a[500000]; map<long long, int> mp; struct bit1 { int s[500000]; int num; void add(int x, int z) { for (int i = x; i <= num; i += (i & -i)) s[i] = max(s[i], z); } int ask(int x) { int tmp = 0; 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 law... |
// file: Clock50MHz.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int x, y; cin >> x >> y; string s; cin >> s; bool flag = false; int cnt = 0; for (int i = 0; i < n; ++i) { if (s[i] == 0 ) { flag = tr... |
#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]; } for (int i = 0; i < n - 1; i++) { if (arr[i] % 2 != 0) { if (arr[i + 1] > 0) { arr[i + 1] -= 1; if (arr[i + 1] < 0) {... |
// ======================================================================
// TDES encryption/decryption
// algorithm according:FIPS 46-3 specification
// Copyright (C) 2013 Torsten Meissner
//-----------------------------------------------------------------------
// This program is free software; you can redistribute i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.