text stringlengths 59 71.4k |
|---|
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: Sdram_WR_FIFO.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
//
// ============... |
#include <bits/stdc++.h> using namespace std; const int mo = 10007; char S[205]; int n, m, M, f[205][205][205], ans; struct O { long long a[330][330]; void clear() { memset(a, 0, sizeof a); } } A, B, C; O operator*(const O &A, const O &B) { for (int i = 0; i <= M; ++i) for (int j = i; j ... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
#include <bits/stdc++.h> using namespace std; int main() { int n, r, s1, s2, d; cin >> n; r = ceil(double(sqrt(n))); s1 = r * r; s2 = (r - 1) * (r - 1); d = s1 - s2; d = d / 2; d = s1 - d; if (n < d) { cout << (r * 2) - 1; } else { cout << r * 2; } } |
module hdmi_video_reconfig(
input clock,
input [7:0] data_in,
output r2v_f,
output HDMIVideoConfig hdmiVideoConfig
);
`ifdef std
`include "config/std/hdmi_config.v"
`elsif hq2x
`include "config/hq2x/hdmi_config.v"
`endif
`include "config/hdmi_config.v"
reg [7:0] data_in_reg = 0;
HDMI... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; char s[maxn], t[maxn]; int p[maxn], q[maxn], r[maxn]; int main() { int n, m, k, d; scanf( %s%d , s, &m); n = strlen(s); while (m--) { scanf( %d%d , &k, &d); for (int i = 0; i < n; i++) p[i] = q[i] = i; in... |
/**
* 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 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; int a[52][52] = {0}; int b[52]; bool c[52] = {0}; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { scanf( %d , &a[i][j]); if (c[a[i][j]] == 0) c[a[i][j]] = 1; els... |
#include <bits/stdc++.h> using namespace std; inline int L(int i) { return i << 1; } inline int R(int i) { return (i << 1) | 1; } inline long long max(long long a, long long b) { return a < b ? b : a; } inline long long min(long long a, long long b) { return a < b ? a : b; } inline int abs(int x) { return x... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long power(long long base, long long exp); void solve() { long long n, m, k; cin >> n >> m >> k; vector<vec... |
#include <bits/stdc++.h> using namespace std; long long n; long long p[16]; long long Count(long long n, int i) { long long ret = (i + 1LL) * (n / p[i]); n %= p[i]; if (n == 0) return ret; return ret + min(Count(n, i - 1), i + 1 + Count(p[i] - n, i - 1)); } int main() { p[0] = 1; for... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:59:08 03/29/2016
// Design Name:
// Module Name: top_module
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; inline void Boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int NMax = 1e5 + 50; struct Event { int d, w, t; bool operator<(const Event &e) const { if (w != e.w) return w > e.w; return d > e.d; } ... |
#include <bits/stdc++.h> using namespace std; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator<<(ostream& out, vector<T> const& v) { int l = v.size();... |
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Projekt : FGLT TU Darmstadt
// Dateiname : dcf77_validy_checker.v
// Autor : Stefan Klir
// Modul : dcf77_validy_checker
//
// Beschreibung : DCF77 ist ein Hardwaremodul welches das DCF77 Funksignal
// decodi... |
#include <bits/stdc++.h> using namespace std; int n, k, a, b, q; int Size; int getMid(int s, int e) { return s + (e - s) / 2; } int getSumUtil(int *st, int ss, int se, int qs, int qe, int si) { if (qs <= ss && qe >= se) return st[si]; if (se < qs || ss > qe) return 0; int mid = getMid(ss, se); ... |
`timescale 1 ns / 1 ps
`include "Speck_Block_Cipher_Multirate_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... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void rd(T &x) { char ch; x = 0; bool fl = false; while (!isdigit(ch = getchar())) (ch == - ) && (fl = true); for (x = (ch ^ 0 ); isdigit(ch = getchar()); x = x * 10 + (ch ^ 0 )) ; (fl == true) && (x = -x); }... |
/**
* 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 b, ans; int main(void) { cin >> b; for (long long i = 1; i * i <= b; i++) { if (b % i == 0) { ans = ans + 2; } if (i * i == b) ans--; } cout << ans << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; vector<int> e[100500]; bool visited[100500]; int main() { int n, m; scanf( %d%d , &n, &m); if (m != n - 1) { cout << no << endl; return 0; } for (int i = 0; i < m; i++) { int u, v; scanf( %d%d , &u, &v); u--; ... |
`include "elink_regmap.v"
module etx_protocol (/*AUTOARG*/
// Outputs
etx_rd_wait, etx_wr_wait, tx_packet, tx_access, tx_burst,
// Inputs
reset, clk, etx_access, etx_packet, tx_enable, gpio_data,
gpio_enable, tx_io_wait, tx_rd_wait, tx_wr_wait
);
parameter PW = 104;
parameter AW = 32;
pa... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:38:17 04/11/2015
// Design Name:
// Module Name: Output_Voter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
// megafunction wizard: %LPM_CONSTANT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_constant
// ============================================================
// File Name: lpm_constant3.v
// Megafunction Name(s):
// lpm_constant
//
// Simulation Library Files(s):
// lpm
// =======================... |
/*
* 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 int N = 1e5 + 5, MOD = 1e9 + 7; const double EPS = 1e-9; double PI = acos(-1); double square(long long x) { double ret = double(x) * double(x); return ret; } vector<pair<double, int> > V; double deg(double x) { return (x * 180) / PI; } double... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9 + 7; const long long INF = (long long)1e18 + 7; const int N = 200007; bool c; int chkp(string x) { int ans = 0; if ((int)x.size() % 2) c = 1; for (int i = 0, j = (int)x.size() - 1; i < j; i++, j--) { if (x[i] == x[j]) c... |
#include <bits/stdc++.h> template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long l... |
#include <bits/stdc++.h> using namespace std; const int N = 51; const long long mod = 1e9 + 7; int n, k, n1 = 0, n2 = 0; long long dp[202][N][N][2], C[N][N]; int main() { int x; scanf( %d%d , &n, &k); k /= 50; for (int i = 1; i <= n; i++) { scanf( %d , &x); if (x == 50) n... |
#include <bits/stdc++.h> using namespace std; const int MAX = 4e5 + 10; int n, a[MAX]; int f(int x) { vector<int> v(n); for (int i = 0; i < n; ++i) { v[i] = (a[i] == -1 ? x : a[i]); } int ret = 0; for (int i = 0; i < n - 1; ++i) { ret = max(ret, abs(v[i] - v[i + 1])); } r... |
/**
* 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 N = 3e5 + 5, inf = 1e9; int n, kk, s, x, k[N][2]; char ch[N]; int fa[N << 1], val[N << 1]; int find(int u) { return fa[u] ? fa[u] = find(fa[u]) : u; } void uni(int a, int b) { if (find(a) == find(b)) return; val[find(b)] += val[find(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 inft = 1000000009; const int MAXN = 1000006; int n, T[MAXN], A[MAXN], B[MAXN]; int main() { scanf( %d , &n); for (int i = 0; i < (n); ++i) scanf( %d , &T[i]); A[0] = 1; for (int i = 1; i < n; ++i) A[i] = min(A[i - 1] + 1, T[i]); B[n -... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: input2output_128_139.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ======================... |
#include <bits/stdc++.h> using namespace std; struct info { double val; string a; }; vector<info> t; int n, x, y, hcnt, sumh; double aa; long long res = 0; bool cmp(const info &u, const info &v) { return u.val > v.val; } int main() { string a; cin >> n; for (int i = 0; i < n; i++) ... |
#include <bits/stdc++.h> const int V = 1e6, M = 1e9 + 7; struct edge { int v, c, nxt; } g[V]; int n, m, k, t, dep[V], q[V], l, r, d[7], head[V], dis[V], a1[V], a2[V], a3[V]; std::vector<int> h[V]; inline void Insert(int u, int v, int c) { g[++k] = (edge){v, c, head[u]}; head[u] = k; } bool C... |
#include <bits/stdc++.h> using namespace std; constexpr long long int mod = 1e9 + 7; constexpr long long int MAXN = 1e6 + 3; constexpr long long int inf = 1ll << 32; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> vx(n + 2); int med = 0; for (int ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); map<int, int> cur; set<pair<int, int>> st; for (int i = 0; i < n; i++) { cin >> a... |
#include <bits/stdc++.h> const int N = 18; const int INF = -1e9; int dp[N][1 << N][2][2]; int a[1 << N]; void solve() { int n, k; scanf( %d %d , &n, &k); for (int i = 0; i <= n; ++i) { int groups = (1 << n) / (1 << i); for (int j = 0; j < groups; ++j) { for (int u = 0; u < 2; +... |
#include <bits/stdc++.h> int main() { int a; scanf( %d , &a); if (a == 5) printf( 1 n ); else printf( %d n , a % 3 + 1); return 0; } |
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 100; const long long maxN = 6e6; const long long oo = 1e18; const long long mod = 998244353; long long n, m; long long a[N], b[N], cost[N], equalpos[N]; long long IT[20 * N], lazy[20 * N]; map<long long, long long> mp; void updm... |
#include <bits/stdc++.h> using namespace std; int m, n, cn, nw, res, ans; int used[533]; int x[1020], y[1020]; int a[1020][1020]; int asjkjas[1020]; bool kuhn(int x) { if (used[x] == nw) return false; used[x] = nw; for (int i = (0); i < (n); ++i) if (a[x][i] && i != cn && (asjkjas[i] == ... |
#include <bits/stdc++.h> using namespace std; vector<long long> v[201]; long long arr[201]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, i, j, c, max1, min1, temp, temp1, n1; cin >> n; for (i = 0; i < 2 * n; i++) { cin >> arr[i]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2000210; inline int scan() { char c = getchar(); int x = 0; while (c < 0 || c > 9 ) { c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 1) + (x << 3) + c - 0 ; c = getchar(); } return x; } lon... |
#include <bits/stdc++.h> using namespace std; long long sqr(long long x) { return (long long)(x * x); } long long my_abs(long long x) { if (x < 0) return -x; return x; } const int MN = 1000 * 1000 * 10; int main() { long long ans = 0; long long n, m; cin >> n >> m; for (long long b =... |
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n; scanf( %d , &n); char s[n + 1]; scanf( %s , s + 1); int a[100] = {0}, b[100] = {0}; int aa = 0, bb = 0; for (int i = 1; i <= n; i++) { if (s[i] == a ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; int main() { ios::sync_with_stdio(false); cin.tie(0); int ans = 0, a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; if (e < f) { int now = min(d, min(b, c... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
/**
* Import the design modules for other design submodules
*
* Include statements for design modules/files need to be commented
* out when I use the Make environment - similar to that in
* Assignment/Homework 3.
*
* Else, the Make/Cadence env... |
// Copyright 2018 Google LLC
//
// 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 w... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } pair<int, int> rev[1000005]; int h[1000005]; int d[1000005]; vector<int> g[1000005]; int N, K; void pre_d... |
#include <bits/stdc++.h> using namespace std; int p, numb, hh, i, j, l, n, m, a; char k; bool flag; int h[200000], check[500000], check1[500000], prime[500000], dp[500000]; int main() { for (i = 2; i <= 100000; i++) if (check[i] == 0) { for (j = 2 * i; j <= 100000; j += i) check[j] = 1; ... |
#include <bits/stdc++.h> #pragma GCC optimize( -O3 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; const long long MAXN = 1123456; const long long N = 2e6; const long long inf = 3e18; const long long mod = 998244353; const long long MOD = mod * (mod - 2); mt... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:40:46 12/20/2010
// Design Name:
// Module Name: clk_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
/*
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; long long ans = 0; int a[200005], n, len = 1 << 18; int mx1[1 << 18], mx2[1 << 18], fa[200005], w1[200005], w2[200005]; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } void add(int x, int w) { if (find(w) != find(mx1[x]) && a[w] > a[mx1[x]])... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: fifo_181x128a.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =====================================... |
#include <bits/stdc++.h> using namespace std; int main() { int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, ... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e6, mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, sum = 0; cin >> n; long long x; long long nm = 0; for (long long i = 0; i < n; i++) { cin >> x; nm =... |
module PhaseDelaySerialInMain(clk, progIn, sigIn, sigOut);
/***
This module is the master control for a phase delay board. Its operation is as follows:
1. Read sigIn every clock cycle
a. create a period counter which counts one period.
2. sigOut is a delayed version of sigIn - state changes are delayed by an amount c... |
#include <bits/stdc++.h> using namespace std; long long a[(200020)], b[(200020)], close[100][2]; set<pair<long long, long long> > vis; signed main() { long long n; cin >> n; for (long long i = 1; i <= n; i++) scanf( %lld , &a[i]); for (long long i = 1; i <= n; i++) b[i] = b[i - 1] + a[i]; lo... |
/*
* 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 n, m, q, l, r; double d, s, t, x, y; int tree[2000010 * 4], pl[2000010 * 4], pr[2000010 * 4], cnt = 1; bool flag[2000010 * 4]; void change(int l, int r, int id, int l1, int r1) { if (l >= l1 && r <= r1) { tree[id] = r - l + 1; flag[id] = 1; ... |
#include <bits/stdc++.h> using namespace std; int n, k, t, cur; void solve() { scanf( %d %d , &n, &k); t = n - k; for (int i = 1; i <= t; i++) printf( %d , i); for (int i = k, j = 1; i >= 1; i--, j *= -1) { t += i * j; printf( %d , t); } } int main(void) { solve(); re... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; char s[105]; int main() { int n, nr = 0; gets(s); n = strlen(s); int x = 0; for (int i = 0; i < n; i++) x = (x * 2 + s[i] - 0 ) % mod; for (int i = 1; i < n; i++) x = (x * 2) % mod; printf( %d n , x); retu... |
#include <bits/stdc++.h> using namespace std; long long r, m, n, x, y, a[5000005], b[5000005]; long long fb(long long i, long long j, long long p) { if (p < b[i]) return i - 1; if (p >= b[j]) return j; long long mid = (i + j) / 2; if (b[mid] >= p && b[mid + 1] < p) return mid; if (b[mid] > p) ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int connected; int par[N], sz[N]; struct DSU { void init(int n) { for (int i = 1; i <= n; i++) { par[i] = i; sz[i] = 1; } connected = n; } int getPar(int k) { while (k != par[k]) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 202020, P = 1e9 + 7; int n; int a[N], par[N], cnt[2][N], c[2][N]; long long ans; vector<int> g[N]; void upd(long long &a, long long b) { if (b < 0) b += P; a += b; if (a >= P) a -= P; } void dfs(int u, int fa) { cnt[0][u] = 1;... |
// part of NewGS project (c) 2007 NedoPC
//
// ramtest
module main(
clk_fpga, // clocks
clk_24mhz, //
clksel0, // clock selection
clksel1, //
warmres_n, // warm reset
d, // Z80 data bus
a, // Z80 address bus
iorq_n, // Z80 control signals
mreq_n, //
rd_n, //
wr_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 law... |
#include <bits/stdc++.h> using namespace std; struct answer { int b, c; bool operator==(answer other) const { return b == other.b && c == other.c; } bool operator!=(answer other) const { return !(*this == other); } }; answer eval(string secret, string query) { string left_s, left_q; answer a... |
//
// Copyright 2011 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 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 = 2010; int a[maxn], b[maxn], tot, n, m; pair<int, int> ans1, ans21, ans22; pair<long long, pair<int, int> > two[maxn * maxn]; int main(void) { long long s = 0, s2 = 1e18, s3 = 1e18; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf(... |
/*------------------------------------------------------------------------------
* 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... |
module mainmem(clk, hit,hit2, address, address2,miss,miss2, re, writetag, writeback, readdatamemory, readmisswritetomemory, readmisswritetocache, dirty);
input clk, miss,miss2, hit,hit2, re, dirty;
input [31:0] address,address2;
input [127:0] writeback;
input [19:0] writetag;
input [127:0] readmisswritet... |
/*
_______________________________________________________________________________
Copyright (c) 2012 TU Dresden, Chair for Embedded Systems
(http://www.mr.inf.tu-dresden.de) All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the follo... |
#include <bits/stdc++.h> using namespace std; int n, a[300010], cnt, fa[300010], siz[300010], ans; bool tag[300010]; inline int find(int x) { while (x ^ fa[x]) x = fa[x] = fa[fa[x]]; return x; } inline void merge(int x, int y) { x = find(x), y = find(y); if (x ^ y) fa[x] = y, siz[y] += siz[x... |
/*
* 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 n, m; char x[1001][1001]; int check(int i, int j) { if (x[i][j] == . ) { for (int a = -1; a <= 1; a++) { for (int k = -1; k <= 1; k++) { if (i + a >= 0 && i + a < n && j + k >= 0 && j + k < m && x[i + a][j + k] == * ) ... |
// synthesis translate_off
`timescale 1ns / 1ps
// synthesis translate_on
// synthesis verilog_input_version verilog_2001
// turn off superfluous verilog processor warnings
// altera message_level Level1
// altera message_off 10034 10035 10036 10037 10230 10240 10030
//--------------------------------------------------... |
//Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2015.2.1 (lin64) Build Wed Aug 5 13:06:02 MDT 2015
//Date : Fri Sep 18 10:18:30 2015
//Host : VB running 64-bit Ubuntu 14.04.3 LTS
//Command... |
module alu (ALUop, a, b, result, clk);
input [3:0] ALUop;
input [31:0] a, b;
input clk;
output reg [31:0] result;
reg [63:0] tem64;
reg [31:0] HI, LO;
initial begin
HI <= 32'h0000_0000;
LO <= 32'h0000_0000;
end
always @ ( ALUop or a or b ) begin
case (ALUop)
4'b0000: result <= a + b;// add|... |
`timescale 1 ns / 1 ps
module psd_counter_tb();
parameter integer PERIOD = 64;
parameter integer PERIOD_WIDTH = 6;
parameter integer N_CYCLES = 8;
parameter integer N_CYCLES_WIDTH = 3;
reg clk;
reg s_axis_tvalid;
reg [32-1:0] s_axis_tdata;
wire m_axis_tvalid;
wire [32-1:0] m_axis_tdata;
wire [PER... |
//----------------------------------------------------------------------------
//-- Ejemplo de uso del transmisor serie
//-- Envio de la cadena "Hola!..." de forma continuada cuando se activa la
//-- señal de DTR
//----------------------------------------------------------------------------
//-- (C) BQ. September 2015... |
#include <bits/stdc++.h> using namespace std; int it[1000100 * 5], a[1000100]; char s[1000100]; void incIT(int node, int l, int r, int pos, int k) { if (pos < l || pos > r) return; if (l == r) { it[node] += k; return; } incIT(node * 2, l, (l + r) / 2, pos, k); incIT(node * 2 + 1,... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 300000; int sub[2 * MAXN + 5][2]; int par[2 * MAXN + 5]; int getRoot(int a) { while (par[a] > 0) { a = par[a]; } return a; } long long int ans = 0; void dsu(int a, int b) { int x0 = sub[a][0] + sub[b][0]; int x1 = s... |
/**
* 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 main() { int n, a, b, arr[25], ans = 0, c[3]; bool r1 = 1; cin >> n >> a >> b; c[0] = a, c[1] = b; for (int i = 0; i < n; i++) { cin >> arr[i]; } int mid = n / 2; if (2 * mid < n) mid++; for (int i = 0; i < mid; i++) { ... |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ *********... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, cnt = 0, pz = 0, mx = 0; string s; cin >> a >> b; for (int i = 0; i < a; i++) { for (int j = 0; j < b; j++) { s += j + 97; } } for (int i = 0; i < a; i++) cout << s[i]; } |
/*
Copyright (c) 2015, Steven F. Hoover
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer... |
/*
Copyright (c) 2014-2018 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... |
//This module controls all I2C master communication
module master(
input wire reset_n,
input wire clk,
input wire en,
input wire start,
input wire stop,
input wire mode,
input wire [6:0] address,
input wire [7:0] registor,
inout reg sda,
inout reg scl,
output reg [7:0]data_out
);
reg [3:0] m... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; float square = sqrt(n); float csquare = ceil(square); if ((csquare == square) || (csquare - square <= 0.5)) { cout << 4 * csquare; } else if (csquare - square > 0.5) { cout << 2 * (csquare + (csquare - 1)... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } long long sum[30]; char fir[210000], sec[210000]; int main() { int len, i; double ans, cnt; ... |
/**
* 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.