text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; void solve(int* arr, int n) { int max_sum = 0; int answer = 0; for (int i = 1; i <= 30; i++) { int current = 0; max_sum = 0; for (int j = 0; j < n; j++) { if (arr[j] > i) { current = 0; continue; } ...
#include <bits/stdc++.h> using namespace std; using ll = long long; struct Rect { int right, left, top, bottom; int height() { return top - bottom; } int width() { return right - left; } int area() { return (top - bottom) * (right - left); } }; void solve() { int w, h; cin >> w >> h; ...
#include <bits/stdc++.h> using namespace std; list<int> l[100005]; list<int> son[100005]; int n, dad[100005], x, y, val[100005], res; void f(int a) { for (list<int>::iterator it = l[a].begin(); it != l[a].end(); it++) if ((*it) != dad[a]) { dad[*it] = a; f(*it); son[a].push_b...
#include <bits/stdc++.h> using namespace std; int main() { int n; string str; cin >> n >> str; int sum = 0; bool flag = false; for (int i = 0; i < n - 1; i++) { sum += str[i] - 48; int ts = 0, ti = i + 1; while (ti < n && ts <= sum) { if (ts == sum && str[ti] != 48)...
// (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 N = 1e5 + 5; int n, a[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); if (a[n] >= a[n - 1] + a[n - 2]) cout << NO ; else { cout << YES n ; cout << a[n] << ; for (...
// Copyright 2007 Altera Corporation. All rights reserved. // Altera products are protected under numerous U.S. and foreign patents, // maskwork rights, copyrights and other intellectual property laws. // // This reference design file, and your use thereof, is subject to and governed // by the terms and condi...
#include <bits/stdc++.h> using namespace std; inline long long sqr(long long x) { return x * x; } mt19937 Random((int)time(0)); inline long long rnd(long long x) { return Random() % x; } const long long INF = (long long)1e9 + 2018; const long long MOD = (long long)1e9 + 7; const long double PI = acos(-1.0...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000005; struct node { int l, r, sum, id; } tr[200010 * 4]; void build(int l, int r, int x) { tr[x].l = l, tr[x].r = r; if (l == r) { tr[x].sum = 0; tr[x].id = l; return; } int mid = (l + r) >> 1; build(...
#include <bits/stdc++.h> using namespace std; int n, m, u, v, num_col = 1; vector<int> adjList[5001]; vector<int> edges[5001]; bitset<5001> vis; bitset<5001> act; bitset<5001> col; void dfs(int nd) { vis[nd] = 1; act[nd] = 1; for (int k = 0; k < adjList[nd].size(); k++) { int nd_b = ad...
// 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] ...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (win64) Build Tue Nov 18 18:29:27 MST 2014 // Date : Tue Jun 30 15:19:47 2015 // Host : Vangelis-PC running 64-bit major release (...
/* * 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...
//***************************************************************************** // (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 /...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long mod = 1000000007; const double e = 2.718281828459; long long gcd(long long a, long long b) { if (!b) return a; return gcd(b, a % b); } long long gcd1(int a, int b) { if (!b) return a; return gcd(b, a ...
#include <bits/stdc++.h> const long long oo = 1e16; using namespace std; const int N = 1000005; long long n, dp[N]; long long num(long long n) { if (n == 0) return 0; if (dp[n] != -1) return dp[n]; string s = to_string(n); long long res = oo; for (int i = 0; i < s.size(); i++) if (s[...
// // iverilog -DNO_DEBUG tb_top.v ... // // `timescale 1ns/1ns module tb_top; reg clk, rst; wire [31:0] addr; wire write_en; wire [31:0] wdata; wire [31:0] rdata; initial begin clk <= 0; rst <= 1; #105 rst <= 0; #1000 $finish; end always begin #10 clk =...
#include <bits/stdc++.h> using namespace std; const int X = 100000 + 5; long long C[1005][1005]; long long n, m; long long iis, ii, jjs, jj, cc; void calc() { for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cc += C[i][j]; } } for (int i = 0; i < n; i++) { fo...
/* // Verilog syntax highlighting test file. * Ryan Dalzell, 19th October 2005 * License: as-is * NOTE This whole comment section should fold * Testing the alerts: * FIXME HACK NOTE NOTICE TASK TODO ### */ `timescale 1ns/1ns // comment in a directive. `define ns 1 // typical Verilog syntax. module test (clock, ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, a[N], d[N], b[21][N], a2[25], ans[N]; void dg(int x) { if (x > 20) { if (d[0] < ans[0]) for (int i = 0; i <= d[0]; i++) ans[i] = d[i]; return; } int pos = 0; for (int i = 1; i <= n; i++) pos |= a[i] &...
#include <bits/stdc++.h> using namespace std; long long n, l, r, k, c, i; string s; int main() { ios_base::sync_with_stdio(0); cin >> n; if (n == 0) { cout << a << n ; return 0; } while (n > 0) { l = 1; r = 100000; k++; while (l < 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...
/* * 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 int maxn = 1 << 18; const int MOD = 2013265921, MAX = MOD / 2; const int gen = 440564289; long long power(long long x, int n) { if (n <= 1) return n ? x : 1LL; long long t = power(x, n / 2); if (n & 1) return (t * t % MOD) * x % MOD; el...
#include <bits/stdc++.h> int main(void) { int a, b, m, n, count = 0; scanf( %d %d , &n, &m); for (a = 0; a <= m; a++) { for (b = 0; b <= n; b++) { if (n - b != a * a) continue; if (m - a != b * b) continue; count++; break; } } printf( %d n , count); ...
#include <bits/stdc++.h> using namespace std; bool sushu(long long n) { long long t = sqrt(n); for (long long i = 2; i <= t; i++) { if (n % i == 0) return false; } return true; } long long ret(long long n) { long long ne = 0; while (n != 0) { ne = ne * 10 + n % 10; 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...
/* ------------------------------------------------------------------------------- * (C)2012 Korotkyi Ievgen * National Technical University of Ukraine "Kiev Polytechnic Institute" * ------------------------------------------------------------------------------- * * *** NOT FOR SYNTHESIS *** * */ module LAG_...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int q = 30; if (n == 1 || n == 3 || n == 5 || n == 7 || n == 8 || n == 10 || n == 12) q++; if (n == 2) q = 28; q = q - 8 + m; if (q % 7 == 0) cout << (q / 7) + 1; else cout << (q / 7) + 2;...
#include <bits/stdc++.h> using namespace std; char str[40], ans[2][40], p[40]; int pre[40], sum[40]; int main() { scanf( %s , str); int L = 0, R = 0; bool mark = true; memset(pre, -1, sizeof(pre)); for (int i = 0; i < 27; i++) { int a = str[i] - A ; sum[a]++; if (pre[a] ==...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2004 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; reg [41:...
#include <bits/stdc++.h> using namespace std; long long N, M; struct MATRIX { int dim; long long MAT[100][100]; MATRIX(int N, int x = -1) { dim = N; for (int i = 0; i < dim; i++) for (int j = 0; j < dim; j++) { if (x != -1 && i == j) MAT[i][j] = x; e...
/** * pc_system.v - Microcoded Accumulator CPU * Copyright (C) 2015 Orlando Arias, David Mascenik * * 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, o...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; string str; cin >> n; cin >> str; int len = n - 11; int coun = 0, cou = 0; for (int j = 0; j < len + 1; j++) { if (str[j] == 8 ) coun = 1, cou++; ; } if (cou > len / 2) cout << YES ; ...
/* * 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) 2012 by Terasic Technologies Inc. // ============================================================================ // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for...
#include <bits/stdc++.h> using namespace std; int N, M; char A[2020][2020]; int B[2020][2020]; int D[2020][2020]; queue<int> qx; queue<int> qy; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; long long ans; int main() { scanf( %d%d , &N, &M); for (int i = 1; i <= N; i++) { scan...
////////////////////////////////////////////////////////////////////////////////// // Module Name: PWM_gen // Description: This IP expects 100 MHz input clock and generates the desired output // at PWM output with the configurable frequency (in Hz) and duty cycle. // // The configurable frequency should be ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-7; const int MX = 1111 * 1111 * 2; int n, m; const double pi = acos(-1.0); int len, res[MX], mx; struct Complex { double r, i; Complex(double r = 0, double i = 0) : r(r), i(i){}; Complex operator+(const Complex &rhs) { r...
#include <bits/stdc++.h> using namespace std; inline int getint() { static char c; while ((c = getchar()) < 0 || c > 9 ) ; int res = c - 0 ; while ((c = getchar()) >= 0 && c <= 9 ) res = res * 10 + c - 0 ; return res; } const int MaxN = 200000; int n; int col[MaxN + 1]; s...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; const long long int inf = 2e9 + 5; double PI = 3.14159265358979323846; void solve() { int n; cin >> n; int x = (int)sqrt(n); int best = inf; for (int i = max(1, x - 2); i <= x + 2; i++) { for (int j = ma...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Inverse_Park_Transform.v // Created: 2014-08-25 21:11:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // --------------------------------------------...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation 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 ...
/** * 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> bool canWin(long long b, long long e) { if (e % 2 == 1) { return b % 2 == 0; } else if (e < 2 * b) { return b % 2 == 1; } else if (e < 4 * b) { return 1; } else { return canWin(b, e / 4); } } bool canLose(long long b, long long e) { if (e < ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int l, r; int p = 0, j = 0, i = 0, len = 0, cnt = 0; while (j < n) { if (a[j] == 0) { cnt++; } while (cnt > k) { if (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 law...
// ---------------------------------------------------------------------- // 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; const int modd = 998244353; const int maxn = 2000 + 10; int n, k; long long dp[maxn][maxn][4]; void solve() { dp[1][1][0] = dp[1][1][3] = 1; dp[1][2][1] = dp[1][2][2] = 1; for (int i = 2; i <= n; i++) { dp[i][1][0] = dp[i][1][3] = 1; dp[i...
/* Karmanye vadhikaraste Ma Phaleshu Kadachana | Ma Karmaphalaheturbhurma Te Sangostvakarmani ||*/ //----------------------------------------------------------------------------------------------------------------// /* this is begining have to survive more and go through long journey*/ ////////////////////...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and apply to test...
#include <bits/stdc++.h> using namespace std; const int N = 100002; int n, m, ok[N], a, b, c, l[N], nr[N]; vector<pair<int, int>> G[N]; int p[20][N]; void parentDFS(int x, int par) { p[0][x] = par; l[x] = l[par] + 1; for (auto it : G[x]) if (it.first != par) parentDFS(it.first, x); } i...
#include <bits/stdc++.h> using namespace std; long long f[105], g[105][2], q[105], t, n; int main() { f[1] = 1; f[2] = 2; for (int i = 3; i <= 86; ++i) f[i] = f[i - 1] + f[i - 2]; int cases; for (scanf( %d , &cases); cases--;) { scanf( %I64d , &n); t = 0; for (int i = 86; i; ...
/* * Copyright 2017 Google Inc. * * 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...
/* * 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...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-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 ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; bool t = false; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) t = true, ch = getchar(); while (ch <= 9 && ch >= 0 ) x = x * 10 + ch - 48, ch = getchar(); retu...
#include <bits/stdc++.h> using namespace std; vector<pair<int, string> > vc[100010]; vector<string> vc1[100010]; bool comp(pair<int, string> a, pair<int, string> b) { return a.first > b.first; } int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { string s; int a, ...
module ball_control( input clock, reset, load, enable, floor, input [5:0] radius, input [9:0] load_x, load_y, input [3:0] s_x, s_y, input [5:0] seed, input bd_p, bd_bl, input [1:0] bd_di, output reg [9:0] x, y, output dead ); `include "def.v" wire rstx, rsty; wire [UBIT-1:0] cntx, cnty; wire [31:0] rnum; reg...
`include "bsg_defines.v" `include "config_defs.v" module config_node_bind #(parameter // node specific parameters id_p = -1, // unique ID of this node data_bits_p = -1) // number of bits of configurable register associated with this node (input clk, // this reflects the destini...
/* ----------------------------------------------------------------------- * * Copyright 2008 Tommy Thorn - All Rights Reserved * * 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, In...
`timescale 1ns/1ps module VGA_Controlador( input wire _clk_, input wire _reset_, output reg hsync, output reg vsync, output reg [10:0] PixelX, output reg [10:0] PixelY, output reg video_encendido ); parameter TotalHorizontalPixels = 11'd800; parameter HorizontalSyncWidth = 11'd96; parameter VerticalSyncWidth = ...
/** * 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 comment(linker, /STACK:16777216 ) using namespace std; template <class T> inline void checkmin(T &a, T b) { if (a > b) a = b; } template <class T> inline void checkmax(T &a, T b) { if (a < b) a = b; } const int oo = 1 << 30; const double eps = 1e-7; const ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long int t, temp, i, ans = 0, n, m, index, j; cin >> n >> m; vector<pair<long long int, long long int> > pa; vector<long long int> v(n), finger(m); for (i = 0; i < n; i++) { cin >> v[i]; ...
#include <bits/stdc++.h> using namespace ::std; const long long maxn = 5e5 + 500; long long seg[4 * maxn]; long long dp[maxn]; long long q[maxn]; long long houp[maxn]; long long a[maxn]; map<long long, long long> last; map<long long, vector<long long> > las; void bild() { fill(seg, seg + 4 * maxn, -...
//========================================== // Function : Code Gray counter. // Coder : Alex Claros F. // Date : 15/May/2005. //======================================= `timescale 1ns/1ps module GrayCounter #(parameter COUNTER_WIDTH = 4) (output reg [COUNTER_WIDTH-1:0] gray_count_out, //'Gray...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1500 + 10; const int INF = 1e9; int ans[MAX_N][26]; int main() { ios::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; for (int it = 0; it < 26; ++it) { char c = char(it + a ); for (int i = 0; i < n; +...
#include <bits/stdc++.h> using namespace std; int n; vector<int> g[100005]; int c[100005]; double r[100005]; void dfs(int x) { c[x] = 1; for (int i = 0; i < g[x].size(); ++i) { int y = g[x][i]; dfs(y); c[x] += c[y]; } } void calc(int x) { for (int i = 0; i < g[x].size()...
#include <bits/stdc++.h> using namespace std; int n; map<int, int> mpp; map<int, int> tmp; multiset<int> adj[200005]; multiset<pair<int, int> > pairs; int cnt[200005]; int arra[100005]; int arrb[100005]; list<int> ans; void addpair(int u, int v) { pairs.insert(make_pair(u, v)); pairs.inser...
reg reset; wire [WIDTH-1:0] data_in_sig; reg data_in_clock; wire data_in_enable; wire data_in_start_sig; wire data_in_end_sig; wire [WIDTH-1:0] data_out_sig; wire data_out_start_sig; wire data_out_end...
#include <bits/stdc++.h> using namespace std; char x[15]; int main() { scanf( %s , x); int lenx = strlen(x); for (int i = lenx - 1; i >= 0; i--) { int dig = x[i] - 0 ; if (dig == 0) printf( O-|-OOOO n ); else if (dig == 1) printf( O-|O-OOO n ); else if (dig == ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, a, b, c, d; scanf( %d%d%d%d%d%d , &n, &k, &a, &b, &c, &d); if (n <= 4 || k < n + 1) { puts( -1 ); return 0; } printf( %d %d , a, c); for (int i = 1; i <= n; i++) { if (i != a && i != b && i != c && i != d)...
#include <bits/stdc++.h> using namespace std; const long double pi = 3.1415926535897932384626433832795; long long int inp() { long long int n = 0, s = 1; char c; for (c = getchar(); c < 48 || c > 58; c = getchar()) if (c == - ) s = -1; for (; c > 47 && c < 59; c = getchar()) n = n * 10 + c ...
// system1_mm_interconnect_0_avalon_st_adapter.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 16.1 196 `timescale 1 ps / 1 ps module system1_mm_interconnect_0_avalon_st_adapter #( parameter inBit...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015 // Date : Fri May 27 23:50:21 2016 // Host : Dries007-Arch running 64-bit unknown // Com...
//====================================================================== // // Module Name: WHIRLPOOL_WCIPHER_MU_INVERSE // Description: Mu-inverse function of Whirlpool W-Cipher // // Language: Verilog-2001 // // Module Dependencies: none // // Developer: Saied H. Khayat // URL: https://github....
#include <bits/stdc++.h> using namespace std; int main(void) { int n; scanf( %d , &n); long a[n]; long long s = 0, ss = 0; for (int i = 0; i < n; i++) { scanf( %ld , &a[i]); s += a[i]; } if (s % 3 != 0) { printf( 0 n ); return 0; } s = s / 3; vector<in...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 2e5 + 4; int main() { int n; scanf( %d , &n); long long b[n], c[n], sum = 0; for (int i = 0; i < n; i++) scanf( %lld , &b[i]), sum += b[i]; for (int i = 0; i < n; i++) scanf( %lld , &c[i]), sum += c[i]...
// 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 : Fri Jan 13 17:33:49 2017 // Host : KLight-PC running 64-bit major release (bu...
/* * 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...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: cyclone3_pmem.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==========================...
//Defines an integer pipeline that can attempt to do internal dependency resolution. //By shifting execution to individual components, the revision B core //should be easier to debug. module intpipe(op, clk, rst, opWt, regWt, aSel, bSel, cSel, aDat, bDat, flgIn, FLGWRI, COUT, CWRI, AS, BS, CS, FLGOUT); input [3:0] op...
/** * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Tue May 30 20:23:12 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int m1[4] = {1, 1, 1, 1}; int m2[4] = {1, 2, 4, 3}; int m3[4] = {1, 3, 4, 2}; int m4[4] = {1, 4, 1, 4}; int main() { string s; cin >> s; int b = s[s.size() - 1] - 0 ; int a; if (s.size() > 1) a = s[s.size() - 2] - 0 ; else a...
#include <bits/stdc++.h> using namespace std; const int Maxn = 100000; struct Node { int t; int id; }; bool cmp(Node lhs, Node rhs) { return lhs.t == rhs.t ? lhs.id < rhs.id : lhs.t < rhs.t; } int N, P; Node A[Maxn + 5]; queue<int> q1; priority_queue<int, vector<int>, greater<int> > q2; ...
#include <bits/stdc++.h> using namespace std; const long long int Maxn = 2e5 + 5, N = 4e5 + 5, Mod = 1e9 + 7, Inf = 1e18, Log = 22; int n, h[Maxn], r, mx; vector<int> adj[Maxn]; bool mrk[Maxn]; bool flg[2]; void Dfs(int v, int p) { for (int i = 0; i < adj[v].size(); i++) { ...
#include <bits/stdc++.h> using namespace std; long long N = 1e5 + 10; vector<vector<long long> > v1(N, vector<long long>(2)); vector<vector<long long> > v; long long dfs(long long s, long long n, vector<long long>& level) { long long val = 0; for (auto u : v[s]) { if (level[u] == 0) { va...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2010 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [89:0] in; ...
//wb_host_interface_tester.v /* Distributed under the MIT license. Copyright (c) 2015 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 limitatio...
#include <bits/stdc++.h> std::vector<int> G[200006]; int check, a, i, x, y, D, o[200006], z[200006], par[200006], d[200006]; void dfs(int p) { d[p] = D; for (int k = 0; k < G[p].size(); k++) { if (d[G[p][k]] == 0) { D++; dfs(G[p][k]); D--; } else par[p] = G[p][k...
#include <bits/stdc++.h> long long n, i, k, j, t, b; char a[2500]; bool s; using namespace std; int main() { k = 0; cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == H ) k++; } b = n - k; for (i = n + 1; i <= 2 * n; i++) a[i] = a[i - n]; for (i = 1; i <= 2 ...
#include <bits/stdc++.h> using namespace std; template <class T> istream& operator>>(istream& is, vector<T>& v) { for (T& x : v) is >> x; return is; } ostream& operator<<(ostream& os, const pair<int, int>& unit) { return os << y = << unit.first << x + << unit.second; } template <class T>...
#include <bits/stdc++.h> using namespace std; int n, h; int main() { cin >> n >> h; for (int i = 1; i < n; i++) { double h1 = h * sqrt(1.0 * i / n); printf( %.12llf , h1); } return 0; }
#include <bits/stdc++.h> using namespace std; const long long N = 4e6 + 5; long long n, a[N], b[N], sum[N], I, lim = 1, mx = -1, Ans; long long read() { long long x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: FIFO_DETECTION_YN.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // // ==============================================...
module nios_solo ( clk_clk, io_ack, io_rdata, io_read, io_wdata, io_write, io_address, io_irq, io_u2p_ack, io_u2p_rdata, io_u2p_read, io_u2p_wdata, io_u2p_write, io_u2p_address, io_u2p_irq, mem_mem_req_address, mem_mem_req_byte_en, mem_mem_req_read_writen, mem_mem_req_request, mem_mem_req_tag, mem...
#include <bits/stdc++.h> using namespace std; int main() { int n, j, t, k, x, y; scanf( %d , &t); int a[10] = {0}, b[10] = {0}; for (j = 0; j < t; j++) { scanf( %d%d%d , &k, &x, &y); if (k == 1) { a[0] = a[0] + x; a[1] = a[1] + y; } else { b[0] = b[0] + x; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin >> n; cout << 0 << << 0 << << n; return 0; }