text
stringlengths
59
71.4k
module ereset (/*AUTOARG*/ // Outputs reset, chip_resetb, // Inputs hard_reset, soft_reset ); //inputs input hard_reset; // hardware reset from external block input soft_reset; // soft reset drive by register (level) //outputs output reset; //reset for elink ...
/** * 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...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Mar 12 16:54:19 2017 ///////////////////////////////////////////////////////////// module Approx_adder_W16 ( add_sub, in1, in2, res ); input [15:0] in1...
`ifdef GPU_PIPELINE_ADDER `include "adder_half_precision.v" `endif `ifdef GPU_PIPELINE_MULT `include "mult_half_precision.v" `endif `ifdef GPU_PIPELINE_DIVIDER `include "div_half_precision.v" `endif `ifdef GPU_PIPELINE `include "adder_half_precision.v" `include "mult_half_precision.v" `includ...
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/versclibs/data/simprims/LUT4.v,v 1.10 2007/06/05 00:00:54 yanx Exp $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; int main() { int t, i; string s; cin >> t; while (t--) { cin >> s; int cap = 0, sm = 0, dig = 0; for (i = 0; i < s.size(); i++) { if (s[i] >= 65 && s[i] <= 90) { cap++; } else if (s[i] >= 97 && s[i] <= 122) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; struct P { int t, id; bool operator<(const P &tmp) const { if (t != tmp.t) return t < tmp.t; return id < tmp.id; } } p[N]; priority_queue<int, vector<int>, greater<int> > qu; queue<int> q; set<int> s; long long ...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2005 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (clk); input clk; reg [7:0] crc; wire [61:59] ah = crc[5:3]; wire [61:59] bh = ~crc...
module foo (/*AUTOARG*/ // Outputs d, // Inputs b, a ); /*AUTOINPUT*/ // Beginning of automatic inputs (from unused autoinst inputs) input a; // To foo2 of foo2.v input b; // To foo2 of foo2.v // End of automatics /*AUTOOUTPUT*/ // Beginning of automatic outputs (from unused au...
module top; reg pass = 1'b1; integer delay; reg [3:0] in = 4'h0; reg [7:0] result [1:0]; initial begin result[0] <= #10 8'h00; if ($simtime != 0 || result[0] !== 8'bx) begin $display("Failed #10 blocked at %0t, expected 8'hxx, got %h", $simtime, result[0]); pass = 1'b0; ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const long long INF = 1LL << 60; const long long mod = 1e9 + 7; const long double eps = 1e-8; const long double pi = acos(-1.0); template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; ...
/** * 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 a[100005], s[100005]; int main() { int l, r, q1, q2, i, N, S; scanf( %d%d%d%d%d , &N, &l, &r, &q1, &q2); s[0] = 0; for (i = 1; i <= N; i++) { scanf( %d , &a[i]); s[i] = s[i - 1] + a[i]; } int mx = s[N] * l + q1 * (N - 1); for (i = 0; i <= N; i++) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; const int N = 4e5; vi cnt(N, 0); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int a; cin >> a; string s...
#include <bits/stdc++.h> using namespace std; int n, m, f[2001] = {0}; bool p, a[2001][2001]; string st; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> st; for (int j = 0; j < m; j++) if (st[j] == 1 ) { a[i][j + 1] = true; f[j + 1]++; ...
#include <bits/stdc++.h> using namespace std; int n; long long val[2001000]; int f[2001000], pre[2001000]; void getans(long long F) { for (int i = 1; i <= n + n; i++) f[i] = 0, pre[i] = i; int pl = 1; int ans = 0x7fffffff; for (int i = n + 1; i <= n + n; i++) { while (pl < i && val[i] - ...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long TESTS = 1; while (TESTS--) { long long n, x, y; cin >> n >> x >> y; string s; cin >> s; long long cnt = 0; char c = s[0]; f...
#include <bits/stdc++.h> using namespace std; const int bas = 23333; const long long mod = 9999999999973ll; int N, M, S[26], L[555]; char C[255][255]; long long H[26], W[255][255][255], G[555]; int manacher(int n) { int k = 0, m = 0, res = 0; memset(L, 0, sizeof(L)); for (int i = 1; i <= n; i+...
#include <bits/stdc++.h> using namespace std; const int OO = 1e9; const long long INF = 1e18; const int irand(int lo, int hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo; } const long long lrand(long long lo, long long hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n, m, k; set<int> a[maxn], b[maxn]; set<int, greater<int> > c[maxn], d[maxn]; int main() { scanf( %d%d%d , &n, &m, &k); int x, y, nx, ny, lx = 0, ly = 0, rx = n + 1, ry = m + 1, dir = 1; long long ans = 1; for (int i ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:03:15 02/21/2016 // Design Name: // Module Name: Contador_Ascendente_Descendente // Project Name: // Target Devices: // Tool versions: // Description: //...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; vector<long long> p; int main() { int n, q; cin >> n >> q; string s; cin >> s; p.resize(1e5 + 1); p[0] = 1; for (int i = 1; i <= 1e5; i++) { p[i] = (p[i - 1] * 2) % MOD; } vector<long long> kum...
#include <bits/stdc++.h> int main() { int n, d, t, x, y, z, m; scanf( %d %d %d , &n, &d, &m); z = n - d; while (m--) { scanf( %d %d , &x, &y); if (x > n || y > n) { printf( NO n ); } else { if (y >= abs(x - d) && y <= n - (abs(z - x))) { printf( YES 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> #pragma GCC optimize( O3 ) using namespace std; const int MAX = 2e5 + 5; const long long MAX2 = 11; const long long MOD = 998244353; const long long MOD2 = 1000005329; const long long INF = 2e18; const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; const int dc[] = {0, 1, 0, -1, 1...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> gru; for (int i = 0; i < n; i++) { gru.push_back(i + 1); } long long lead = 1; for (int i = 0; i < k; i++) { long long a; cin >> a; lead += a; lead = lead % gru.s...
#include <bits/stdc++.h> using namespace std; void read_file(bool outToFile = true) {} int main() { read_file(); string a, b; char str[1000000 + 1]; while (scanf( %s , str) != EOF) { a = str; scanf( %s , str); b = str; int n = a.length(), m = b.length(); if (n != m) {...
#include <bits/stdc++.h> long long cmpfunc(const void* a, const void* b) { return (*(long long*)a - *(long long*)b); } int main(void) { long long int test, i, j, n, count, flag = 0, o1 = 0, o2 = 0, b1, x, m, l, max, sum2, min, f, r, o, sum1, sum = 0, y, ...
#include <bits/stdc++.h> #define N 410 #define ll long long #define ull unsigned long long //#define mo (ll)((ll)1e9+7) #define squ(x) ((x)*(x)) #define db double #define all(x) x.begin(),x.end() #define cmax(a,b) a=max(a,b) #define cmin(a,b) a=min(a,b) #define rep(i,l,r) for(register int i=l;i<=r;+...
/* 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...
#include <bits/stdc++.h> using namespace std; int main() { int n, s, len; scanf( %d%d%d , &n, &s, &len); vector<int> a(n); for (int &t : a) scanf( %d , &t); if (len > n) { puts( -1 ); return 0; } multiset<int> ms; vector<int> dp(n + 1, 1 << 20); for (int r = 0; r < le...
/* Project: RECON 2017 Author: Jeff Lieu <> Description: recon_0_top level */ /* Note that the PORT_0_WIDTH doesn't propagate to the NIOS system */ module recon_0_top #(parameter PORT_0_WIDTH = 32) ( input sys_clk, input sys_rstn, inout [ PORT_0_WIDTH-1:0] port_0_io, output ...
/* * 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 n, m, s[7]; long long lin[100005][1 << 7], cov[1 << 7]; char ch[100005], ans[100005]; vector<long long> e[100005]; bool hall(long long x) { for (long long ss = 0; ss <= (1 << 6) - 1; ss++) { long long sum = 0; for (long long i = 1; 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...
/* Copyright 2010 David Fritz, Brian Gordon, Wira Mulia 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. ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:02:35 07/09/2015 // Design Name: // Module Name: VIDEOGEN // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // /...
#include <bits/stdc++.h> int main() { int n; std::cin >> n; int t, c; int max = 0, cur = 0, lt = -1; for (int i = 0; i < n; i++) { std::cin >> t >> c; if (lt != -1) { cur += lt - t; } if (cur < 0) cur = 0; cur += c; if (cur > max) max = cur; lt = t...
module qsys ( clk_clk, reset_reset_n, sdram_clock_areset_conduit_export, sdram_clock_c0_clk, sdram_read_control_fixed_location, sdram_read_control_read_base, sdram_read_control_read_length, sdram_read_control_go, sdram_read_control_done, sdram_read_control_early_done, sdram_read_user_read_buffer, sdram_rea...
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf( %d , &n); if (n == 1) { puts( white ); cout << 1 << << 2 << endl; return 0; } if (n & 1) { puts( black ); return 0; } puts( white ); cout << 1 << << 2 << endl; return 0; ...
/* * 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...
/* This file is part of JT12. JT12 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. JT12 is distributed in the hope tha...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
//Legal Notice: (C)2010 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...
/** * 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 read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f = ch == - ? -1 : f, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return x * f; } const int N = 200050; int sta[3][N], f[3][N], F[3]; 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; const int MOD = 1000000007; long double PI = 4 * atan(1); pair<int, int> p[3]; set<pair<int, int> > second; bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second > p2.second; } int main() { ios::sync_with_stdio(0), cin.tie(0); for (int 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...
// Check behaviour with out-of-range and undefined array indices // on LHS of procedural continuous (reg) assignment. module top; reg [1:0] array1[2:1]; reg [1:0] array2[1:0]; reg [1:0] var1; `ifndef VLOG95 real array3[2:1]; real array4[1:0]; real var2; `endif reg failed; initial begin failed = 0; array1[1] ...
#include <bits/stdc++.h> using namespace std; signed main() { long long n, d; cin >> n >> d; long long k = 0, c = 0, a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; c = 0; for (long long i = 1; i < n; i++) { if (a[i - 1] < a[i]) continue; k = a[i - 1] - a[i] + d; c += ...
#include <bits/stdc++.h> using namespace std; long long t, n; char str[200005]; void solve() { long long i, b = 0, c, s = 1, min = 0; char a; a = str[0]; str[n] = str[0]; for (i = 1; i < n; ++i) { if (str[i] != a) { b = i; break; } else { s++; } ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void solve() { int m, d, w; long long int ans = 0, lim, g, x, y; scanf( %d%d%d , &m, &d, &w); lim = min(m, d); if (d == 1) ans = lim * lim; else { g = gcd(d - 1, w); w /=...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T; cin >> T; for (int t = 1; t <= T; ++t) { int64_t n; cin >> n; if (n == 1) { cout << 0 << n ; continue; } int cou...
/* * land2 - a verilog test for logical and operator && in boolean context * * * Copyright (C) 1999 Stephen G. Tell * Portions inspired by qmark.v by Steven Wilson () * Modified by SDW to self test. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General...
`include "../src/include/abs.v" `include "../src/include/single_step_motor.v" `include "../src/include/block_ram.v" `include "../src/step_motor.v" module test_step_motor(); parameter integer C_STEP_NUMBER_WIDTH = 16; parameter integer C_SPEED_DATA_WIDTH = 16; parameter integer C_SPEED_ADDRESS_WIDTH = 4; parameter int...
// // fixed for 9.1 jan 21 2010 cruben // //`include "timescale.v" `include "i2c_master_defines.v" module i2c_opencores ( wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_dat_o, wb_we_i, wb_stb_i, /*wb_cyc_i,*/ wb_ack_o, wb_inta_o, scl_pad_io, sda_pad_io ); // Common bus signals input wb_clk_i; // WISHBONE cloc...
#include <bits/stdc++.h> using namespace std; const int a1[2][6] = {{1, 3, 4, 5, 2, 6}, {3, 2, 6, 4, 1, 5}}; int i, j, k, n, m; int a[10], f[10]; char p[10]; string s; set<string> yao, laji; void sou(string a, int ty) { if (laji.count(a)) return; int i, j; if (ty) laji.insert(a); for (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...
/* * 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 (c) 1995/2014 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Vers...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(228); const int N = 404; int mod; int fact[N], d0[N], d[N], d2[N][N]; int main() { int qq; cin >> qq >> mod; fact[0] = 1; for (int i = 1; i < N; ++i) fact[i] = (1LL * fact[i - 1] * i) % mod; d[1] = 1; d0[1] = 1; for (int n...
#include <bits/stdc++.h> using namespace std; struct compleks { double x, y; }; compleks operator*(compleks a, compleks b) { compleks c; c.x = a.x * b.x - a.y * b.y; c.y = a.x * b.y + a.y * b.x; return c; } compleks operator-(compleks a, compleks b) { compleks c; c.x = a.x - b.x,...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int n, m, x, y, fail; int G[305][305], v[305], u[305], l[305], z[305]; long long int A, B, C, a[305], b[305], d[305]; int rx[305 * 305 * 2], ry[305 * 305 * 2], rc[305 * 305 * 2], cnt; void dfs(int x) { v[x] = 1; A += a[x]; B += b[x]; for (int i =...
#include <bits/stdc++.h> using namespace std; long long expo(long long x, long long n, long long m) { if (n == 0) return 1; else if (n % 2 == 0) return expo((x * x) % m, n / 2, m); else return (x * expo((x * x) % m, (n - 1) / 2, m)) % m; } string DtoB(int j) { string s = ; ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7, NMAX = 160; int N, M; int DP[NMAX][2][2][NMAX][NMAX], SUM[NMAX][2][2][NMAX][NMAX]; void Mod(int &value) { value -= MOD; if (value < 0) value += MOD; } void ComputeSums(int i) { int j, k, left, right; for (j = 0; j < 2; ...
#include <bits/stdc++.h> #pragma GCC optmize( Ofast ) using namespace std; const int maxn = 20009; const int inf = 1e8; int n, m, K, T; int e[1 << 10][maxn << 1]; int head[maxn], cntedge = 1; int from[maxn], to[maxn], cap[maxn], flow[maxn], nex[maxn]; void Addedge(int x, int y, int z) { nex[++cnte...
#include <bits/stdc++.h> const int N = 100001; using namespace std; long long a[N], sum[N]; int main() { int n; while (scanf( %d , &n) == 1) { for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]); for (int i = 1, j; i < n; i++) { for (j = 0; (1 << j) + i <= n; j++) ; ...
#include <bits/stdc++.h> using namespace std; long long cross(pair<long long, long long> a, pair<long long, long long> b, pair<long long, long long> c) { pair<long long, long long> v1 = make_pair(b.first - a.first, b.second - a.second); pair<long long, long long> v2 = make_...
//Legal Notice: (C)2019 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 = 0x3f3f3f3f; const int maxn = 100005; int a[maxn], lefts[maxn], rights[maxn]; int main() { int n, l, r, q1, q2; cin >> n >> l >> r >> q1 >> q2; memset(lefts, 0, sizeof(lefts)); memset(rights, 0, sizeof(rights)); for (int i = 0; i...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int MaxN = 3e5 + 5; map<int, int> mp; struct node { int x, y; } arr[MaxN], brr[MaxN]; struct qnode { int x, y; bool operator>(const qnode &p) const { return p.y > y; } } st; bool cmp(node b, node c) { if (b...
#include <bits/stdc++.h> using namespace std; const int MAXP = 18; const int MAXN = 1000001; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int n, p; string cad; int freq[MAXP]; int val[1 << MAXP]; int vis[1 << MAXP]; vector<pair<int, int> > lista[1 << MAXP]; bool mat[MAXP][MAXP]; bool ...
#include <bits/stdc++.h> using namespace std; int a[105], c[105]; int findz(int n) { return a[n] == n ? a[n] : a[n] = findz(a[n]); } void un(int x, int y) { a[findz(x)] = findz(y); } int main() { int n, l, f; cin >> n >> l; int count = 0; int wei = 0; memset(c, 0, sizeof(c)); for (int ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1010; int n, k, m; int p10[maxn]; inline void init() { p10[0] = 1; for (register int i = 1; i <= 1000; i++) { p10[i] = (p10[i - 1] * 10) % k; } } long long f[1010][110][2]; long long dfs(long long pos, long long statu, bool...
module message_printer ( input clk, input rst, output [7:0] tx_data, output reg new_tx_data, input tx_busy, input [7:0] rx_data, input new_rx_data ); localparam STATE_SIZE = 1; localparam IDLE = 0, PRINT_MESSAGE = 1; localparam MESSAGE_LEN = 14; reg [STATE_SIZE-1:0] state_d,...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, m, k; cin >> n >> m >> k; long long s = 2 * n * m; if (s % k != 0) { cout << NO ; return 0; } s /= k; long long x2, x3, y2, y3; x2 = n; if (s % n ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007LL; int n, k; string s; long long A[30]; long long ans, aux; int last[30]; int main() { cin >> n >> k >> s; memset(last, -1, sizeof(last)); int m = s.length(); ans = 1LL; for (int i = 0; i < m; i++) { ...
`default_nettype none /*********************************************************************************************************************** * Copyright (C) 2016-2017 Andrew Zonenberg and contributors * * ...
//Legal Notice: (C)2010 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...
/* * 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() { string str, ch[103]; int n; cin >> str >> n; for (int i = 1; i <= n; i++) cin >> ch[i]; sort(ch + 1, ch + 1 + n); for (int i = 1; i <= n; i++) { int len = str.length(); string t = ch[i].substr(0, len); if (t == str)...
#include <bits/stdc++.h> using namespace std; int main() { int tc, cs = 1, n, k, a, b, c, d; while (cin >> n >> k) { cin >> a >> b >> c >> d; if (k < n + 1 || n == 4) { printf( %d n , -1); } else { printf( %d %d , a, c); for (int i = 1; i < n + 1; 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...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.1 (win64) Build Fri Apr 14 18:55:03 MDT 2017 // Date : Mon Aug 14 17:02:30 2017 // Host : ACER-BLUES running 64-bit major release (b...
#include <bits/stdc++.h> using namespace std; long long mod = 0; const int N = 100005; vector<array<int, 2>> v[N]; vector<set<int>> g(N); vector<int> depth(N, 0); vector<vector<int>> p(N, vector<int>(17, 0)); vector<long long> up(N, 0); vector<long long> down(N, 0); vector<int> sz(N, 0); vector<in...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int t, n, cnt = 0, ans = 0, tot = 0, num[maxn] = {}, zz[maxn] = {}, b[maxn] = {}; vector<int> k[maxn]; int powmod(int a, int b) { int ans = 1; for (; b; b >>= 1, a = a * a) if (b & 1) ans = ans * a; return ans...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Inverse_Clarke_Transform.v // Created: 2014-08-25 21:11:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------...
//Legal Notice: (C)2016 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 = 1000000000; const long long INFLL = 1000000000000000000LL; const int h = 300000000; int l, r; int pr[(h >> 6) + 1]; int main() { scanf( %d%d , &l, &r); int res = 0; int r2 = (r - 1) / 2; pr[0] |= 1; for (int i = (1), _b = ((...
// file: timer_tb.v // // (c) Copyright 2008 - 2010 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 l...
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<vector<int> > pre; vector<int> starts; vector<int> coproc; vector<int> cnts; vector<int> nexts; void dfs(int v, int co) { for (int p : pre[v]) { cnts[p]--; if (cnts[p] == 0) { if (coproc[p] == co) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int(_) = 0; (_) < (n); (_)++) { string S, T; cin >> S >> T; S.push_back( A ); T.push_back( A ); vector<pair<char, int> > sl, tl; char ns = S[0]; int cs = 1; for (int i = 1; i ...
// This module is a small fifo which has a bsg_channel_narrow // on its output, that would send out each data in several steps // based on the input and output width. width_p is the FIFO data // width and width_out_p is the output width. els_p is the number // of elements in fifo and lsb_to_msb_p determined the directi...
// ----------------------------------------------------------- // PLI byte transport HDL interface // // @author jyeap, gkwan // ----------------------------------------------------------- `timescale 1 ns / 1 ns module altera_pli_streaming ( clk, reset_n, // source out source_valid, ...