text
stringlengths
59
71.4k
/* * Copyright (c) 2015-2017 The Ultiparc Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list...
module test( input rst, input clk, input a0, input wr_n, input [ 7:0] din, output signed [15:0] xleft, output signed [15:0] xright, output sample, output [ 7:0] dout ); wire wr_n,...
// ---------------------------------------------------------------------- // Copyright (c) 2016, 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 N = 2e5 + 7; struct Graph { int head[N], v[N << 1], w[N << 1], next[N << 1], e; void clear() { e = 0; memset(head, -1, sizeof(head)); } void add(int u, int v, int w) { this->v[e] = v; this->w[e] = w; next[e] = he...
#include <bits/stdc++.h> using namespace std; long long modulo(long long base, long long exp, long long m); int main() { int x; cin >> x; if (x <= 1) cout << -1 ; else { cout << x << << x; } return 0; } long long modulo(long long base, long long exp, long long m) { ...
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; cout << a[0]; for (int e = 1; e < a.size(); e++) if (a[e] < b[0]) cout << a[e]; else break; cout << b[0] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; int n; int data[maxn]; int f[25][maxn]; bool mark[(1 << 25)], tt; int res = 0, p; int tmp; int tm, tp; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> data[i]; memset(mark, 0, sizeof(mark)); for (i...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
//Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 //Date : Sat Sep 23 22:44:16 2017 //Host : DarkCube running 64-bit major release (build 92...
#include <bits/stdc++.h> using namespace std; long long n, h, ok; long long cal(long long dep, long long pos, int tag) { if (ok) return 0; if (dep == 0) { ok = 1; return 0; } long long tmp; if (!tag) { if (pos > (1LL << (dep - 1))) tmp = (1LL << dep) + cal(dep - 1, po...
#include <bits/stdc++.h> int main() { int n, i, ans = 0, a[200001] = {0}; scanf( %d , &n); for (i = 0; i < n; i++) { int x; scanf( %d , &x); if (a[100000 + x] == 0 && x != 0) { ans++; a[100000 + x] = 1; } } printf( %d n , ans); 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 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...
#include <bits/stdc++.h> using namespace std; void File_input() { freopen( in.txt , r , stdin); freopen( out.txt , w , stdout); } void FastInputOutput() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); } vector<char> geno[ z + 1]; int t, n; string str; bool vis[ z + 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...
/* * 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 temp = 0, r, l, w, k = 0, m1, e, p, q, ans = 0, k1 = 0, k2 = 0, d = 0, a = 0, b = 0, s = 0, x, y, min1 = 1000000010, max1 = 0, m, c = 0, t = 0, i, n, c1 = 0, tot = 0, t1, k4 = 0, c2 = 0, j = 0, k3 = 0; char ch, ch1, ch2; string s1, ...
module ALU( output reg [31:0] alu_out, output flag_z, flag_v, flag_n, input [31:0] in0, in1, //in0 is rs, in1 can be rt or sign/unsign-extended immediate value input [4:0] shamt, input [15:0] perf_cnt, //input from performance counter input alu_ctrl0, alu_ctrl1, alu_ctrl2, alu_ctrl3 ); loca...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; long long x, q, b; for (int i = k - 1; i >= 1; i--) { x = n / i * k + i; q = x % k; b = x / k; if (q * b == n) return cout << x, 0; } }
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; const int MAXK = 17; int X[MAXN]; long long Y[MAXN]; int N, M; int par[MAXN][MAXK]; int dpth[MAXN]; int Q[MAXN]; int ql = 0, qr = 0; int main() { ios_base::sync_with_stdio(0); cin >> N; for (int i = 1; i <= N; ++i) ...
#include <bits/stdc++.h> using namespace std; char s[1100]; int main() { scanf( %s , s); for (int i = 0; s[i]; i++) printf( %c , s[i]); for (int i = strlen(s) - 1; i >= 0; i--) printf( %c , s[i]); return 0; }
//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 associate...
#include <bits/stdc++.h> using namespace std; long long mi = 2e9; long long ma = -2 * 1e9; const int N = 1e5 + 5; int main() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); long long na, nb, ka, kb; cin >> na >> nb >> ka >> kb; long long a[na], b[nb]; for (int i...
// “Alhamdulillah for Everything” #include<bits/stdc++.h> using namespace std; #define pai acos(-1) #define ff first #define ss second #define ll long long #define pb push_back #define mp ...
// Data RAM module data_mem ( input wire clk, input wire[31:0] addr_dmem_ram_i, input wire[31:0] wr_data_dmem_ram_i, input wire[0:3] wr_strb_dmem_ram_i, input wire wr_en_dmem_ram_i, output wire[31:0] read_data_dmem_ram_o ); para...
(** * Extraction: Extracting ML from Coq *) (* ################################################################# *) (** * Basic Extraction *) (** In its simplest form, extracting an efficient program from one written in Coq is completely straightforward. First we say what language we want to extract into. O...
`timescale 1ns/10ps `include "defines.v" module pc_trace ( `ifdef DEBUG output reg [ 2:0] old_zet_st, output reg [19:0] dat, output reg new_pc, output reg st, output reg stb, output ack, output [ 4:0] pack, output addr_st, `endif // PAD...
#include <bits/stdc++.h> using namespace std; auto clk = clock(); mt19937_64 rang( chrono::high_resolution_clock::now().time_since_epoch().count()); void test_case() { long long int n; cin >> n; long long int a[n + 1]; long long int t = -1, b = -1, c = -1; for (long long int i = 1; i <...
#include <bits/stdc++.h> using namespace std; const int N = 6010; vector<int> a[N]; int L[N], cnt, r[N], n, res = 0; void Refresh() { L[0] = cnt = 0; for (int i = 1; i <= n + 1; i++) L[i] = 10000000; } void DFS(int u, int p) { int Oldval, Oldid, Oldcnt = cnt; if (cnt == 0 || r[u] > L[cnt])...
#include <bits/stdc++.h> #pragma GCC optimize( O2,unroll-loops ) using namespace std; const int inf = 1000000010; const long long INF = 1000000000000001000LL; const int mod = 1000000007; const int MAXN = 100200, SQ = 320, NSQ = MAXN / SQ + 1; int n, m, w, u, v, x, y, t, a, b, maxb; int A[MAXN], B[MAXN],...
/* ######################################################################## ######################################################################## */ module ecfg_if (/*AUTOARG*/ // Outputs mi_mmu_en, mi_dma_en, mi_cfg_en, mi_we, mi_addr, mi_din, access_out, packet_out, // Inputs clk, access_in, p...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps / 1ps `include "utils/bus_to_ip.v" `include "gpio/gpio_core.v" `include "gpio/g...
// file: Test_AXI_Master_simple_v1_0_hw_1_clk_wiz_0.v // // (c) Copyright 2008 - 2013 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. // // DISCLA...
/** * 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 top; reg passed; // These should be OK enum {zdef1_[0:1]} zdef1; enum {zdef2_[1:0]} zdef2; enum {zdefb_[0:0]} zdef3; enum {zvalb_[0:0] = 1} zval1; initial begin passed = 1'b1; if (zdef1_0 !== 0) begin $display("FAILED: expected zdef1_0 to be 0, got %0d", zdef1_0); passed = 1'b...
#include <bits/stdc++.h> using namespace std; int n; int changed; int answer1, answer2 = 1023; int main() { cin >> n; int i; for (i = 0; i < n; i++) { char tp; cin >> tp; if (tp == | ) { int number; cin >> number; answer1 |= number; answer2 |= num...
#include <bits/stdc++.h> using namespace std; int lcp[25][25]; int b[25]; string s[25]; int ans = 0; void BT(int now, int n, int k) { if (now == n) { int have = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if (b[i] && b[j]) have += lcp[i][j]; ans = m...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2009 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 300005; const long long INF = 0x3f3f3f3f3f3f3f3f; long long n; long long Read() { long long x = 0, f = 1; char c = getchar(); while (c > 9 || c < 0 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 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 la...
#include <bits/stdc++.h> using namespace std; int n, m, sum; int s[200010]; vector<pair<int, int> > G[200010]; int fa[200010]; int vis[200010]; int ans[200010]; void dfs(int x, int fa, int id) { vis[x] = 1; for (int i = 0; i < G[x].size(); i++) { int to = G[x][i].first; int id = G[x]...
#include <bits/stdc++.h> using namespace std; stack<int> s; priority_queue<int> pq; long long maxm = numeric_limits<long long>::max(); const int maxn = 10005; struct node { int l, r; } q[1001]; bool cmp(node a, node b) { return a.l < b.l; } int main() { int n, sum = 0; scanf( %d , &n); ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, s; cin >> a >> b >> s; if (a < 0) a *= (-1); if (b < 0) b *= (-1); (s >= (a + b) && (s - a - b) % 2 == 0) ? cout << YES : cout << NO ; return 0; }
`include "defines.v" ////////////////////////////////////////////////////////////////////////////////// // Company: WSIZ Copernicus // Engineer: Rafa³ B., Szymon S., Darek B. // // Create Date: 27.04.2017 18:45:34 // Design Name: // Module Name: modul_monet // Project Name: // Target Devices: // Tool Versions: //...
#include <bits/stdc++.h> using namespace std; int squ(vector<long long> &v) { for (int i = 0; i + 3 < v.size(); i++) { if (v[i] == v[i + 1] && v[i] == v[i + 2] && v[i] == v[i + 3]) return v[i]; } return -1; } vector<long long> pa(vector<long long> &v) { vector<long long> q; for (int i ...
#include <bits/stdc++.h> using namespace std; int n, m, a, b; set<pair<int, int> > s; set<int> sc; vector<int> ans; int main() { cin >> n >> m; for (int i = 1; i <= m; ++i) { cin >> a >> b; s.insert(make_pair(min(a, b), max(a, b))); } for (int i = 1; i <= n; ++i) { sc.inser...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long a[n + 1], b[n + 1]; for (long long i = 1; i <= n; i++) { long long x; cin >> x; a[x] = i; } for (long long i = 1; i <= n; i++) { long long x; cin >> x; b[x] = i; ...
//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...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ns/1ns module aes_tb; reg rst; reg clk; reg [7:0] key_in; reg [7:0] d_in; wire [7:0] d_out; wire d_vld; parameter CP = 20; //Two test vectors //Simple example //CT = 0x69c4e0d86a7b0430d8cdb78070b4c55a parameter kin = 128'h000102030405060708090a0b0c...
module bsg_link_osdr_phy #(parameter `BSG_INV_PARAM(width_p ) ,parameter strength_p = 0) (input clk_i ,input reset_i ,input [width_p-1:0] data_i ,output clk_o ,output [width_p-1:0] data_o ); `define BSG_LINK_OSDR_PHY_CKBUF_INST_MACRO(streng...
// (C) 1992-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 simulati...
//====================================================================== // // sha1_w_mem_reg.v // ----------------- // The SHA-1 W memory. This memory includes functionality to // expand the block into 80 words. // // // Copyright (c) 2013 Secworks Sweden AB // All rights reserved. // // Redistribution and use in sour...
/* * 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 double PI = acos(-1); const double eps = 1e-9; template <typename T> T sqr(T x) { return x * x; } double sind(double x) { return sin(x * PI / 180); } double cosd(double x) { return cos(x * PI / 180); } double tand(double x) { return tan(x * PI / ...
//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 associate...
/** \file "channel-source-sink-b.v" Chain a source and sink in prsim to verilog. $Id: channel-source-sink.v,v 1.4 2010/04/06 00:08:26 fang Exp $ */ `timescale 1ns/1ps `include "standard.v" `define inv_delay 0.020 module timeunit; initial $timeformat(-9,1," ns",9); endmodule module TOP; reg l0, l1, re; wire...
#include <bits/stdc++.h> using namespace std; int a[1000000 + 5]; int b[1000000 + 5]; int main() { ios_base::sync_with_stdio(false); int i, j, n, k; queue<pair<int, int> > q; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= n; i++) cin >> b[i]; for (i = 1; i <= n; 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...
`default_nettype none `define CLKFBOUT_MULT 2 // ============================================================================ module top ( input wire clk, input wire rst, input wire [1:0] sw, output wire [9:0] led, ); // ==========================================================================...
#include <bits/stdc++.h> using namespace std; int x[110], s[110]; int main() { int n, m; cin >> n >> m; for (int i = (1); i < (n + 1); i++) cin >> x[i]; for (int i = (1); i < (n + 1); i++) s[i] = s[i - 1] + x[i]; int v = 0; while (m--) { int l, r; cin >> l >> r; if (s[r] ...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: phd_new.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ============================...
//----------------------------------------------------------------------------- // The FPGA is responsible for interfacing between the A/D, the coil drivers, // and the ARM. In the low-frequency modes it passes the data straight // through, so that the ARM gets raw A/D samples over the SSP. In the high- // frequency mo...
#include <bits/stdc++.h> using namespace std; int n; int keep[201]; int tt[201]; int first[201]; int main() { while (cin >> n) { n *= 2; int sum = 0, n1 = 0, n2 = 0, s1 = 0, s2 = 0; memset(keep, 0, sizeof(keep)); memset(first, 0, sizeof(first)); for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; long long pwr(long long a, long long b, long long mod) { a %= mod; if (a < 0) a += mod; long long ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; a = (a * a) % mod; b /= 2; } return ans; } long long pwr(long long a, l...
#include <bits/stdc++.h> int btf(int n) { static int num[10]; memset(num, 0, sizeof(num)); for (int i = 0; i < 4; i++) { num[n % 10]++; n /= 10; } for (int i = 0; i < 10; i++) if (num[i] > 1) return 0; return 1; } void solve(int n) { for (int i = n + 1; 1; i++) ...
////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03.07.2016 12:04:13 // Design Name: // Module Name: pm0 // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: /...
#include <bits/stdc++.h> using namespace std; const int N = 5e4 + 100; int n, k; struct node { int sz; int mn[15], mx[15]; void init(int a) { sz = 0; for (int i = 1; i <= k; i++) { mx[i] = mn[i] = a; } } void unit(node a) { sz += a.sz; for (int i = 1; i ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: ddr2um_valid_fifo.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // =========================...
#include <bits/stdc++.h> using namespace std; long long n, m, k, d[1010][101][2], ans, nf, p[1010]; int main() { cin >> n >> k >> m; p[0] = 1; for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 10 % k; d[0][0][0] = 1; for (int i = 1; i <= n; i++) { for (int x = (i == n); x < 10; x++) ...
#include <bits/stdc++.h> struct node { int v; node *next; } edge[400000 * 2 + 10], *adj[200000 + 10], *ecnt = &edge[0]; struct Edge { int u, v; Edge() {} Edge(int u, int v) : u(u), v(v) {} } e[400000 + 10], ans[400000 + 10]; int n, m, s, t, ds, dt, col[200000 + 10], cntcol, cnta, fa[200000...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; if (n < 3) { cout << -1; } else { long long a[n][n]; long long offset = n * n - 9; a[0][0] = 9 + offset; a[0][1] = 5 + offset; ...
#include <bits/stdc++.h> using namespace std; vector<long long> tri(100005); void solve() { long long n; cin >> n; for (long long i = 1; i < 100005; i++) { tri[i] = (i * (i + 1)) / 2LL; } for (int i = 1; i <= 100000; i++) { long long x = n - tri[i]; if (x <= 0) { cout...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v...
//====================================================================== // // tb_mkmif_core.v // --------------- // Testbench for the mkmif core module. // // // Copyright (c) 2016, Assured AB // All rights reserved. // // Redistribution and use in source and binary forms, with or // without modification, are permitte...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long int> s(n); for (int i = 0; i < n; ++i) cin >> s[i]; int q; cin >> q; sort(s.begin(), s.end()); int slope0 = 1; for (int i = 1; i < n; ++i) if (s[i] != s[i - 1]) ++slope0; map<lo...
#include <bits/stdc++.h> #pragma GCC optimize( ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long INF = 1e9; long long b[N]; long long ans[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= ...
// // Testbench // // by // David M. Koltak 05/30/2017 // // The MIT License (MIT) // // Copyright (c) 2017 David M. Koltak // // 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 re...
/* File: fifo_empty_block.v This file is part of the Parallella FPGA Reference Design. Copyright (C) 2013 Adapteva, Inc. Contributed by Roman Trogan <> 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 Sof...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; struct data { int points; string name; data(int p, string n) { points = p; name = n; } data() { points = -1; name = ; } }; inline bool cmp(data d1, data d2) { return (d1.points > d2.poin...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int c = 0, h = 0; while (n > c + h) { h++; c += h; n -= c; } cout << h << endl; }
// 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 22:30:37 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; inline int read() { int ans = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) ans = (ans << 3) + (ans << 1) + (c ^ 48), c = getchar(); return ans; } int fa[5005], cnt[5005], sum[5005], dep[5005], bad[5005]; int main...
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; const double oula = 0.57721566490153286060651209; using namespace std; map<long long, string> mp; int main() { std::ios::sync_with_stdio(false); long long n; cin >> n; long long nn = sqrt(n); string tmp; f...
#include <bits/stdc++.h> using namespace std; const long long maxx = 1e5 + 20, sqr = 150, mod = 1e9 + 7; long long len, n, dp[maxx][sqr][2], q, pw25[maxx], pw26[maxx], pwmod[maxx], fac[maxx], tmp[maxx]; string s; long long pw(long long a, long long b) { if (!b) return 1ll; long long x = pw(a, b ...
#include <bits/stdc++.h> using namespace std; int n, m, k, i, x, y, z, suma; pair<int, pair<int, int> > r1, r2, tr0, v[35]; map<pair<int, pair<int, int> >, pair<int, pair<int, int> > > mp; pair<int, pair<int, int> > make_triplet(int x, int y, int z) { return make_pair(x, make_pair(y, z)); } int getSum...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_schmitt.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 and...
/* * 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...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora Module Generator version 2.2 // // Date: $Date: 2004/11/08 16:19:28 $ // Tag: $Name: i+H-38+78751 $ // File: $RCSfile: phase_align.ejava,v $ // Rev: $Revision: 1.1.6.2 $ // /...
`ifndef _iq_ `define _iq_ // instruction queue module iq( input clk, input rst, input inst1_in_valid, input [31:0] inst1_in, input inst2_in_valid, input [31:0] inst2_in, input [31:0] inst1_in_pc4, input [31:0] inst2_in_pc4, input ...
#include <bits/stdc++.h> using namespace std; vector<int> arr, hgt, res; int n; int func(int i, int j) {} int main() { int a, b, c, d, e, f, g; cin >> a; while (a--) { cin >> b; vector<int> num; for (int i = 0; i < b; i++) { cin >> c; num.push_back(c); } ...
#include <bits/stdc++.h> using namespace std; int n; int h[1000010], f[1000010][2]; void Work() { int ans = 0; for (int i = 1; i <= n; i++) { int l, r; l = min(h[i - 1], h[i]); r = min(h[i], h[i + 1]); if (l <= r) f[i][1] = 1LL * f[i - 1][1] * l % 1000000007; else {...
`timescale 1ns/1ps module top; lower dut(); endmodule module lower; parameter bad_name = "this_is_a_bad_name"; reg [15:0] def = "OK"; reg pass = 1'b1; reg [1023:0] result; real rl_res; initial begin #1; /* Display the version and other information. */ $display("Testing with Icarus Verilog...
//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...
/** * 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...
`timescale 1ns / 1ps module rinse_mode #(parameter WIDTH = 32, CLK_CH = 25, TIME_SCORE = 2) ( input rinse_start, input start, input power, input [31:0]clk, input [2:0]weight, output reg rinse_end_sign, //light output reg water_in_light, output reg rinsing_light,output reg water_out_light, output [...
// file: clk_wiz_v3_3_tb.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is ...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; const int N6 = 1e6 + 6; const int N9 = 1e9 + 7; const long long INFLL = (long long)1e18 + 100; const int INF = 1e9 + 100; const long long mod = 1e9 + 9; const long long P = 31; int n, k, cur, ans; std::vector<in...