text
stringlengths
59
71.4k
//Legal Notice: (C)2014 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; const int inf = 0x7fffffff; const double eps = 1e-10; const double pi = acos(-1.0); inline int read() { int x = 0, f = 1; char ch; ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int k = 0, l; int n = s.length(); if (n <= 20) { cout << 1 << << n << endl; cout << s; } else { int m; if (n % 20 == 0) m = n / 20; else m = (n / 20) ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const long long mod = 1e6 + 3; const int INF = 1e9 + 1; const int N = 105; long long H[N], c, h, w; struct Matrix { long long arr[N][N]; Matrix() { memset(arr, 0, sizeof arr); } Matrix(int x) { memset(arr, 0, sizeof ...
`timescale 1ns / 1ps //================================================================================================== // Filename : Tenth_Phase_v2.v // Created On : 2016-09-21 17:42:42 // Last Modified : 2016-09-22 00:16:41 // Revision : // Author : Jorge Sequeira Rojas // Company :...
#include <bits/stdc++.h> using namespace std; const long long INF = numeric_limits<long long>::max() / 4; struct Edge { long long from, to, cap, flow, index; Edge(long long from, long long to, long long cap, long long flow, long long index) : from(from), to(to), cap(cap), flow(flow), inde...
/* * Copyright (c) 2015, Arch Laboratory * All rights reserved. * * 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 condi...
/* * 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> #pragma GCC optimize( -O2 ) using namespace std; const int LIM = 2e5 + 5, MOD = 1e9 + 7; int t, n, m, k, x, y; template <typename... T> void read(T &...args) { ((cin >> args), ...); } template <typename... T> void print(T &&...args) { ((cout << args << ), ...); } ...
// -------------------------------------------------------------------- // Copyright (c) 2008 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Ter...
#include <bits/stdc++.h> using namespace std; int sum[501000 << 2], sum2[501000 << 2]; void pushUp(int rt) { sum[rt] = max(sum[rt * 2], sum[rt * 2 + 1]); } void updata(int l, int r, int rt, int q, int val) { if (l == q && r == q) { sum[rt] = val; return; } int m = (l + r) / 2; if (q ...
/** * 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 la...
//************************************************************************* // > ÎļþÃû: regfile_display.v // > ÃèÊö £º¼Ä´æÆ÷¶ÑÏÔʾģ¿é£¬µ÷ÓÃFPGA°åÉϵÄIO½Ó¿ÚºÍ´¥ÃþÆÁ // > ×÷Õß : LOONGSON // > ÈÕÆÚ : 2016-04-14 //************************************************************************* module regfile_display(...
/* * VGA 800x480 screen * * 3 bit colour - 1 red, 1 green, 1 blue * * The screen I'm using * http://www.amazon.co.uk/gp/product/B00IR5VRS4?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s01 */ module vga_driver ( RESET, VGA_CLOCK, PIXEL, PIXEL_H, PIXEL_V, VGA_RED, VGA_GREEN, VG...
#include <bits/stdc++.h> using namespace std; int dp[105][200005]; int main() { int n, k; cin >> n >> k; int a[n + 1], b[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; int off = 1000 * n; for (int i = 0; i < 105; i++) for (int j = 0; j...
#include <bits/stdc++.h> using namespace std; int t, n; string s; int main(void) { cin >> t; while (t--) { map<pair<int, int>, int> m; int start = 0, end = 2147483647, x = 0, y = 0; cin >> n >> s; s.insert(s.begin(), 0 ); m.insert({make_pair(0, 0), 0}); for (int i = ...
#include <bits/stdc++.h> const long long INF = LLONG_MAX; const long long NINF = LLONG_MIN; const long long MAX = 1e6 + 5; const long long MOD = 1e9 + 7; using namespace std; inline long long gcd(long long a, long long b) { long long t; if (a < b) { t = a; a = b; b = t; } w...
/******************************************************************************* * Function: ENOC Command Decoder * Author: Andreas Olofsson * License: MIT (see LICENSE file in OH! repository) * * see ./enoc_pack.v * *****************************************...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * 200000; const int MAXM = 199999 * 2 * 2 + 200000 * 2; int n, m, a, b; string s[2]; int dsu[MAXN]; int to[MAXM], head[MAXN], nxt[MAXM], E; int p[MAXN][19]; int d[MAXN]; int tin[MAXN], tout[MAXN], timer; inline int root(int x) { retu...
#include <bits/stdc++.h> using namespace std; int main() { int n; int w, h; cin >> w >> h >> n; multiset<int> cuth, cutw, maxh, maxw; cuth.insert(0); cuth.insert(h); cutw.insert(0); cutw.insert(w); maxh.insert(h); maxw.insert(w); int len; for (int i = 0; i < n; i++) {...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; vector<long long> v; void lucky(long long x) { queue<long long> q; q.push(x); while (x < 1e9) { x = q.front(); q.pop(); x *= 10; q.push(x + 4); q.push(x + 7); v.push_back(x + 4); v.push...
/* * 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; long long a[100005], n, s, ans; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; while (n--) { long long x; cin >> x; s += x; a[x]++; } if (s == 1 or s == 2 or s == 5) return cout << ...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: rom.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
/* * 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; inline char gc() { static char now[1 << 16], *S, *T; if (T == S) { T = (S = now) + fread(now, 1, 1 << 16, stdin); if (T == S) return EOF; } return *S++; } inline long long read() { register long long x = 0, f = 1; char ch = gc(); ...
#include <bits/stdc++.h> using namespace std; const int MX = 3005; int n, a[MX], mem[MX][MX], ind[MX]; vector<int> pos[MX]; int dp(int i, int j) { if (i > j) return 0; int &res = mem[i][j]; if (res != -1) return res; res = dp(i, j - 1); for (int k = ind[j] - 1, x; k >= 0 && (x = pos[a[j]][...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2017 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk, d0, d1 ); input clk; input [7:0] d0, d1; logic [7:0] inia [1:0][3:0] = '{ '{ '0, '1, 8'hfe, 8'hed }, ...
#include <bits/stdc++.h> using namespace std; const int intmax = 0x3f3f3f3f; const long long lldmax = 0x3f3f3f3f3f3f3f3fll; double eps = 1e-8; template <class T> inline void checkmin(T &a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T &a, T b) { if (b > a) a = b; } t...
#include <bits/stdc++.h> using namespace std; int n, q; int tim[10000]; int main() { while (~scanf( %d%d , &n, &q)) { memset(tim, -1, sizeof(tim)); while (q--) { int ti, ni, di; scanf( %d%d%d , &ti, &ni, &di); int cnt = 0; for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, e, tp, f, g, h, p[100], pi, q[100], qi, pas; map<pair<long long, long long>, long long> m; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> a; for (b = 1; b <= a; b++) { cin >> tp; if (tp ==...
#include <bits/stdc++.h> using namespace std; struct hehe { unsigned long long l, r; mutable bool z; inline bool operator<(hehe y) const { return l < y.l; } }; set<hehe> s; inline set<hehe>::iterator split(unsigned long long pos) { hehe qaq; qaq.l = pos; qaq.r = 0; qaq.z = 0; 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; template <typename T> istream& operator>>(istream& is, vector<T>& v) { for (T& x : v) is >> x; return is; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i] << (i ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; bool prev = false; for (int i...
#include <bits/stdc++.h> using namespace std; const int N = 1005; char g[N][N]; int l[N][N], r[N][N], up[N][N], dn[N][N]; int jx[N][N], jy[N][N]; struct Node { int x, y, len; }; vector<Node> p; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %s , g[i] ...
#include <bits/stdc++.h> using namespace std; int n, k; int a[200005]; int cnt[400005]; int cv[400005]; int main() { int t; scanf( %d , &t); while (t--) { memset(cnt, 0, sizeof(cnt)); memset(cv, 0, sizeof(cv)); scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d...
/** * 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 init() {} string lines[1001]; int main() { string s; int n = 0; int mx = 0; while (getline(cin, lines[n])) { mx = std::max<int>(mx, lines[n].length()); n++; } cout << string(mx + 2, * ) << endl; int sw = 0; fo...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 02/13/2016 09:05:28 PM // Design Name: // Module Name: FullAdderExtended // 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; bool dp[105][55][210][2]; char com[105], n; int chg, off = 105; int dir(int d) { return d ? 1 : -1; } int main() { cin >> com + 1; n = strlen(com + 1); cin >> chg; memset(dp, false, sizeof(dp)); dp[0][0][off][1] = true; for (int i = 0; i ...
#include <bits/stdc++.h> int x[200010], check[200010]; long long int ans[200010]; long long int size[200010]; int next[200010]; int find(int k) { if (next[k] == k) return k; else return next[k] = find(next[k]); } std::vector<int> V[200010]; int height[200010]; long long int func(in...
#include <bits/stdc++.h> using namespace std; char s[1000100]; int n; int d[1000100]; int dp(int x) { if (d[x] != -1) return d[x]; int ret = 0; int ind = x + 1; while (s[ind] == M ) { ret += 1; ind++; } int w = 0; while (s[ind] == F && ind < n) ind++, w++; if (in...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // Methods defined by IEEE: // class semaphore; // function new(int keyCount = 0); // function vo...
#include <bits/stdc++.h> using namespace std; class DFS { int N_, R_; vector<vector<int> > G_; vector<int> par_, dep_, dep_sub_; void DFS_internal(int v) { dep_sub_[v] = 0; for (auto u : G_[v]) if (par_[u] == -1) { par_[u] = v; dep_[u] = dep_[v] + 1; ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1000 * 100 + 1; const long long INF = 1e12; const int MOD = 1000 * 1000 * 1000 + 7; const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0}; const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; const int MAXN = 2 * 1000 * 100 + 1; struct edge { int to, w...
#include <bits/stdc++.h> using namespace std; int main() { iostream::sync_with_stdio(0); int a, b, c, d; cin >> a >> b >> c >> d; for (int i = a; i <= 200; i++) { for (int j = b; j <= 200; j++) { for (int k = 1; k <= 200; k++) { if (a * 2 >= i && b * 2 >= j && c <= k && c * 2...
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> s; s += b ; n = s.size(); for (int i = 0; i < n - 1; i++) { if (s[i] != s[i + 1]) cout << 1 << ; else cout << 0 << ; } }
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353LL, INV2 = (MOD + 1) / 2; const int MAXN = 500; long long DP[MAXN + 1][MAXN + 1]; int main() { ios::sync_with_stdio(0); cin.tie(0); int N, K; cin >> N >> K; for (int k = 1; k <= min(N, K); ++k) { DP[k][0] = ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); ; cin.tie(0); cout.tie(0); int n, a, b, i; string s; cin >> n >> a >> b >> s; int tot = a + b, p = 0; for (i = 0; i < n; i++) { if (s[i] == * ) { p = 0; continue; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13.07.2017 17:44:01 // Design Name: // Module Name: t_WB // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> questions(k); vector<int> previsited(n + 1, 0); vector<int> posvisited(n + 1, 0); vector<int> vis; int tot_non = n; for (int i = 0; i < k; i++) { cin >> questions[i]; if (!prev...
module cclk_detector #( parameter CLK_RATE = 50000000 )( input clk, input rst, input cclk, output ready ); parameter CTR_SIZE = $clog2(CLK_RATE/50000); reg [CTR_SIZE-1:0] ctr_d, ctr_q; reg ready_d, ready_q; assign ready = ready_q; // ready should only go high once cclk ha...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, col[N], maxx, cnt[N], p[N], eid, Son, mx[N], sz[N]; long long sum, ans[N]; struct edge { int v, nxt; } e[N << 1]; inline void addedge(int u, int v) { e[++eid] = (edge){v, p[u]}, p[u] = eid; } inline void dfs0(int u, int fa) ...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n, k; scanf( %d %d , &n, &k); int div = n / k; int mod = n % k; for (int i = 0; i < k; i++) { for (int j = 1; j <= div; j++) { printf( %c , ( a + i)); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100100 * 3; const int INF = 1E9; const int base = 1E9 + 7; void no() { cout << no n ; exit(0); } int a[maxn]; pair<int, int> b[maxn]; char ans[3030][3030]; int n, m; void validate() { vector<int> draws; n = m; for ...
#include <bits/stdc++.h> using namespace std; void _print(long long int 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 lon...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, lamps[2002], sol = 0, cs; memset(lamps, 0, sizeof(lamps)); cin >> n >> m; string s[2002]; for (int i = 0; i < n; i++) { cin >> s[i]; } for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (s[i]...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 20; const long long mod = 1e9 + 7; int w[(maxn * 4) << 2], n; vector<pair<int, int> > col[(maxn * 4) << 2]; int query(int L, int R, int l, int r, int rt); void pushup(int rt) { w[rt] = w[rt << 1] + w[rt << 1 | 1]; } void pushdown(int r...
#include <bits/stdc++.h> using namespace std; const int maxn = 100009; long long n, a[maxn], b[maxn], c[maxn], in[maxn], color[maxn]; void read(long long a[]) { for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); } void over() { cout << -1; exit(0); } vector<int> vec[maxn]; void dfs(int now...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long M = 1e9 + 7; const long long inf = 1e18 + 5; vector<int> pre_fn(string &s) { int n = s.size(); vector<int> pre(n); int pos = 0; pre[0] = 0; for (int i = 1; i < n; i++) { while (pos and s[pos] != s[i]...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long int sum = 0; cin >> n; int a, b; int max = INT_MIN; for (int i = 0; i < n; i++) { cin >> a >> b; sum = sum - a + b; if (max < sum) max = sum; } cout << max; return 0; }
// outputs H for one clock period once edge detected module edge_detector( clk, reset_n, in, // detector input out, // detector output edge_detect // spcifies whether rising or falling edge it to detect ); `include "parameters_global.v" input clk; input reset_n; input...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> p; vector<pair<long long, long long>> adj[101]; long long visited[101]; long long parent[101]; long long maxi = 0; set<long long, greater<long long>> set1; vector<long long> arr; long long ans[101]; void dfs(long long v, long l...
#include <bits/stdc++.h> using namespace std; const int N = 200000; int n; bool p[N]; int tot, ans[N][2]; int tmp[N], tmptot; int rem[N], remtot; int main() { scanf( %d , &n); for (int i = 3; i <= n / 2; ++i) if (!p[i] && i % 2) { tmptot = 0; p[i * 2] = 1; for (int ...
#include <bits/stdc++.h> using namespace std; int test = 0; const int MAXN = 300009; const long long MOD = 119 << 23 | 1; class { public: vector<int> V[MAXN]; int fa[MAXN * 2], cnt[MAXN * 2]; int n, m; int curset[MAXN * 2], ans; int findfa(int x) { if (fa[x] == x) return 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 a, b, c, n, t, f, ans; vector<int> v; queue<int> q; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> n >> a >> b >> c >> t; for (int i = 0; i < n; i++) { cin >> f; v.push_back(f); } sort(v.begin...
#include <bits/stdc++.h> using namespace std; bool check(int x, pair<int, int> a) { return a.first <= x && x <= a.second; } signed main() { int n; scanf( %d , &n); vector<pair<int, pair<int, int>>> vert; vector<pair<int, pair<int, int>>> hor; while (n--) { int x1, y1, x2, y2; scanf...
#include <bits/stdc++.h> using namespace std; const long long maxn = 5e5 + 10; const long long mod = 998244353; const long long base = 1e9; mt19937_64 rnd; struct Hashing { vector<vector<vector<long long>>> f; vector<long long> mod; vector<vector<long long>> mu; vector<long long> chr; lo...
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5; const int MAXQ = 3e5 + 5; const int inf = 0x3f3f3f3f; struct Query { int id, l, r; Query(void) {} Query(int _id, int _l, int _r) : id(_id), l(_l), r(_r) {} }; long long res[MAXQ]; struct Solver { vector<int> a, b; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; const int mod = 1e9 + 7; const int P = 257; int H[MAXN]; char s[MAXN]; char t[MAXN]; int iP[MAXN]; int add(int a, int b) { return (a + b) % mod; } int mul(long long a, long long b) { return (a * b) % mod; } int range(int l, 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 law...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 10, M = N, INF = 0x3f3f3f3f, mod = 1e9 + 7, base = 131; long long n, t, ans; long long a[N], s[N]; long long phi(long long n) { long long res, a; res = a = n; for (long long i = 2; i <= a / i; i++) { if...
#include <bits/stdc++.h> using namespace std; int n; bool r[100], c[100]; int main() { cin >> n; vector<int> ans; for (int i = 1; i <= n * n; i++) { int x, y; cin >> x >> y; if (!r[x] && !c[y]) { ans.push_back(i); r[x] = true; c[y] = true; } } ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // vga_driver.v -- basic video driver // // Author: W. Freund, UTFSM, Valparaiso, Chile // (based on vga_main.vhd from Barron Barnett, Digilent, Inc.) // 03/05/06, 14/06/12 //Modifier: Mauricio Soli...
/** * 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 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...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); ; long long t; cin >> t; while (t--) { long long n; cin >> n; vector<set<long long>> lol(n - 1); long long cnt = 0; long long x; for (...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long maxn = 3e6; const long long mod = 1e9 + 7; const long double PI = acos((long double)-1); long long pw(long long a, long long b, long long md = mod) { long long res = 1; ...
/* Distributed under the MIT license. Copyright (c) 2011 Dave McCoy () 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, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; map<int, vector<pair<int, int> > > mapa; for (int i = 0; i < n; i++) { int suma = 0; for (int j = i; j < n; j++) { suma += v[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 law...
#include <bits/stdc++.h> using namespace std; int n, L, a; void read() { int x = 0, y = 0, lx = 0, ly = 0, ans = 0; scanf( %d %d %d , &n, &L, &a); for (int i = 0; i < n; i++) { scanf( %d %d , &x, &y); ans += (x - (lx + ly)) / a; lx = x; ly = y; } ans += (L - (x + y)) / ...
/** * 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 a1, a2, a3, sum = 0, a12, a23, a31; int main() { cin >> a1 >> a2 >> a3; sum = a1 + a2 + a3; if (sum % 2) { cout << Impossible ; return 0; } sum /= 2; a12 = sum - a3; a23 = sum - a1; a31 = sum - a2; if (a12 < 0...
module tag_checker import bsg_cache_non_blocking_pkg::*; #(parameter `BSG_INV_PARAM(id_width_p) , parameter `BSG_INV_PARAM(data_width_p) , parameter `BSG_INV_PARAM(addr_width_p) , parameter `BSG_INV_PARAM(cache_pkt_width_lp) , parameter `BSG_INV_PARAM(ways_p) , parameter `BSG_INV_PARAM(sets_p) ...
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); int n; double m, mm; cin >> n >> mm; m = mm; double *a = new double[n]; double *b = new double[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] == 1) { cout << -1; ...
#include <bits/stdc++.h> using namespace std; const int SIZE = 1 << 17; char buffer[SIZE]; int pointer = SIZE; char Advance() { if (pointer == SIZE) { fread(buffer, 1, SIZE, stdin); pointer = 0; } return buffer[pointer++]; } int Read() { int answer = 0; char ch = Advance();...
#include <bits/stdc++.h> using namespace std; char ch[100001]; int per[100001]; bool is[100001]; bool vis[100001]; bool mem[100001]; bool have[100001]; vector<int> V; int main() { int i, j; int a, b; int n, m; cin >> n >> m; for (i = 0; i < m; i++) { cin >> ch[i] >> per[i]; ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_pcx_rptr_3.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 it ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf( %d , &n); printf( %d n , n + n / 2); for (i = 2; n >= i; i = i + 2) { printf( %d , i); } for (i = 1; n >= i; i = i + 2) { printf( %d , i); } for (i = 2; n >= i; i = i + 2) { printf( %d , ...
#include <bits/stdc++.h> using namespace std; char _; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long fpow(long long b, long long exp, long long mod) { if (exp == 0) return 1; long long t = fpow(b, exp / 2, mod); if (exp & 1) return t * t % mod * b % mod; ...
/** * 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 clkgen_xil7series ( IO_CLK, io_clk_bufg, clk_sys ); input IO_CLK; output clk_sys; output io_clk_bufg; wire locked_pll; wire clk_50_buf; wire clk_50_unbuf; wire clk_fb_buf; wire clk_fb_unbuf; wire clk_pll_fb; PLLE2_ADV #( .BANDWIDTH("OPTIMIZED"), .COMPENSATION("ZHOLD"), .STARTUP_WAIT("FALSE"...
/** * 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...
//----------------------------------------------------------------------------- // // piwi, Feb 2019 //----------------------------------------------------------------------------- module hi_get_trace( ck_1356megb, adc_d, trace_enable, major_mode, ssp_frame, ssp_din, ssp_clk ); input ck_1356me...