text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { pair<long long, long long> a[1001]; a[0].second = 1; for (long long i = 1; i < 1001; i++) { a[i].first = i; if (i < 10) a[i].second = 1; else if (i < 100) a[i].second = 2; else if (i < 1000) a[i].s...
#include <bits/stdc++.h> using namespace std; struct Act { int l, r; int mx; double pb; vector<Act *> son; static int dp_size; double dp[5005]; bool operator<(const Act &act) const { if (l < act.l) { return true; } else if (l > act.l) { return false; } e...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int t, h, g; cin >> t; while (t--) { scanf( %d %d , &h, &g); int n = (1 << h) - 1, m = (1 << g) - 1; std::vector<pair<int, int> > a(1 << h); for (int i = 0; i < n; i++) { scanf( %d , &a[i]....
#include <bits/stdc++.h> const int mxn = 1e5; int cost[mxn][3], go[mxn][2], deg[mxn], path[mxn]; int color[mxn]; long long cc[3][3]; int main() { int n, u, a, b, c = 0; scanf( %d , &n); for (int j = 0; j < 3; ++j) for (int i = 1; i <= n; ++i) scanf( %d , &cost[i][j]); for (int i = 1; i <...
// (C) 2001-2013 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 doc...
#include <bits/stdc++.h> using namespace std; int n, m; int a[200010], b[200010]; int nxt[200010]; void make_next() { int i = 0, j = -1; nxt[0] = -1; while (i < m) { if (j == -1 || b[i] == b[j]) { i++; j++; if (b[i] == b[j]) nxt[i] = nxt[j]; else ...
#include <bits/stdc++.h> using namespace std; using bigint = long long int; using vi = vector<int>; using vll = vector<long long int>; int cnt[200001]; int main() { int N, A; cin >> N >> A; for (int i = 0; i < N; i++) { int x; cin >> x; cnt[x]++; } int ans = 0; if (...
#include <bits/stdc++.h> using namespace std; int ans, cnt; struct Node { Node *Left = NULL, *Right = NULL; int value, fix, sz = 1; long long sum[5] = {}; }; typedef Node *PNode; PNode root = NULL; inline int gts(PNode &cur) { if (cur == NULL) return 0; return cur->sz; } Node nodes...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int x, n, m, temp = 0; cin >> x >> n >> m; for (int i = 0; i <= n; i++) { if (x <= 10 * m) { temp = 1; break; } else x = x / 2 + 10; } if ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; set<pair<long long, long long> > S; set<pair<long long, long long> >::iterator it; set<pair<long long, long long> >::iterator it2; pair<long long, long long> temp; void intersect_yes(long long s, long long e) { if (S.empty()) return; for (it = S.begin();...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char a[2 * n - 1][2 * n - 1]; int v = 0, k = n; for (int i = 0; i < n; i++, k--, v++) { for (int j = 0; j < k; j++) printf( ); for (int j = 0; j < v; j++) printf( %d , j); printf( %d , v); for...
/* Generated by Yosys 0.3.0+ (git sha1 3b52121) */ (* src = "../../verilog/addsubcmp.v:1" *) module AddSubCmp(AddOrSub_i, A_i, B_i, D_o, Carry_i, Carry_o, Zero_o, Sign_o, Overflow_o); (* src = "../../verilog/addsubcmp.v:33" *) wire [16:0] \$add$../../verilog/addsubcmp.v:33$7_Y ; (* src = "../../verilog/addsubcmp...
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; vector<int> used(1000000, 0); vector<int> len(1000000, 5); queue<int> q; q.push(x); used[x] = 1; len[x] = 0; while (!q.empty()) { int v = q.front(), v1 = v; q.pop(); vector<int> res(6); ...
#include <bits/stdc++.h> using namespace std; long long ans, cr[40002], ar[40005], br[40005], nd[40005]; void build(int id, int l, int r) { if (l == r) { nd[id] = cr[l]; return; } int md = (l + r) >> 1; build(id * 2, l, md); build(id * 2 + 1, md + 1, r); nd[id] = min(nd[2 * id]...
#include <bits/stdc++.h> using namespace std; long long n, m, k; long long read() { long long s = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { s = s * 10 + ch - 0 ; ch = getchar(...
module ultrasonic #( parameter N = 16 , CONSTANT = 20'd588 ) ( input clk, input signal, input rst_n, output reg [N-1:0] value , output reg done ); reg [1:0] state ; reg [N-1:0] count_1 ; // El modulo tiene 3 estados, el primero mantiene los valores en cero y se llega a el por me...
#include <bits/stdc++.h> using namespace std; const int maxn = 1010; int c1, c2; char str[maxn]; int main() { scanf( %s , str); int len = int(strlen(str)); for (int i = 0; i < len; i++) { int t = str[i] - 0 ; if (t == 0) { if (!c1) { puts( 1 1 ); } else ...
`timescale 1ns/1ns module hct74245( input dir, input nOE, inout [7:0] A, inout [7:0] B, output [7:0] C // Added to demonstrate that a straight dependency timing works correctly ); // HCT typical @ 5v according to https://assets.nexperia.com/documents/data-sheet/74HC_HCT245.pdf specify (A *> C) = 10...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000 + 20; int xor_n[maxn]; int p[maxn]; int n; int q; void init() { xor_n[0] = 0; for (int i = 1; i < maxn; i++) { xor_n[i] = i ^ xor_n[i - 1]; } } int main() { init(); while (~scanf( %d , &n)) { q = 0; ...
/* * Copyright (C) 2015 Harmon Instruments, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This progr...
#include <bits/stdc++.h> using namespace std; int main() { long long b, d, s, x, y, z, m, t; x = y = z = 0; cin >> b >> d >> s; long long a[3] = {b, d, s}; sort(a, a + 3); if (a[0] == a[2]) { cout << 0; } else if (a[1] == a[2]) { cout << a[2] - a[0] - 1; } else { co...
#include <bits/stdc++.h> using namespace std; vector<int> g[100100]; int a[100100], b[100100], s[100100]; int n, sa, sb; double ans; void dfs(int v, int p) { s[v] = 1; for (int i = 0; i < g[v].size(); i++) { int u = g[v][i]; if (u == p) continue; dfs(u, v); s[v] += s[u]; ...
module nios_system ( alu_a_export, alu_b_export, alu_carry_out_export, alu_control_export, alu_negative_export, alu_out_export, alu_overflow_export, alu_zero_export, clk_clk, hex_0_export, hex_1_export, hex_2_export, hex_3_export, hex_4_export, hex_5_export, leds_export, regfile_data_export, regfile_...
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, vector<T> &vec) { os << { ; for (int i = (0), __i = (((int)(vec).size())); i < __i; i++) { os << vec[i]; if (i + 1 != ((int)(vec).size())) os << , ; } os << } ; return os; } tem...
/* * 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; vector<int> V[1005]; int dis[1005], rdis[1005], G[1005][1005]; void spfa(int s, int e) { queue<int> Q; memset(dis, 0x3f, sizeof(dis)); memset(rdis, 0x3f, sizeof(rdis)); Q.push(s); dis[s] = 0; while (!Q.empty()) { int f = Q.front(); ...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int MAX = 400005; const int MAX1 = 2007; const int MAX2 = 4007; const int LEN = 21; const int BASE = 1000000000; const double EPS = 1e-7; const int MOD = 1234567891; vector<pair<char, int> > vec; int main(void) { i...
#include <bits/stdc++.h> using namespace std; bool can(int x, int y, int a, int b) { cout << ? << x << << y << << a << << b << endl; string ans; cin >> ans; if (ans == BAD ) exit(0); return ans == YES ; } int main() { ios::sync_with_stdio(false); cin.tie(0); int ...
/* * 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[55], b[55]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = 1; i <= m; i++) scanf( %d , b + i); long long ans = 1ll << 62; for (int x = 1; x <= n; x++) { long long maxv = -...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: asy_256_139.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // // ========================================...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int s, x1, x2, t1, t2, p, d; cin >> s >> x1 >> x2 >> t1 >> t2 >> p >> d; int cnt = 0, initial_position = p; while (initial_position != x1) { if (initial_position == s) d = -1; if (initial_position == 0) d = 1; initial_posit...
// 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 : Thu May 25 21:01:02 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; cin >> m; int a[m]; for (int i = 0; i < m; i++) { a[i] = 0; } cin >> n; int p = 0, q = 0, r = 0; for (int i = 0; i < n; i++) { cin >> p; cin >> q; cin >> r; a[p - 1] -= r; a[q - 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 "hrfp_defs.vh" module hrfp_mult_round_final( input wire clk, input wire expdiff, input wire sign5, input wire rounding_overflowed,answer_is_zero, res_is_inf, res_is_nan, input wire [53:0] rounded_mantissa_expdiff0, rounded_mantissa_expdiff1, input wire...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long MOD = 1e9 + 7; long long dp[4000][4000]; long long mn[4000][4000]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const long long MOD1 = 2286661337; const long long MOD2 = 998244353; const int INF = (int)1e9 + 7; const double EPS = 1e-7; const int N = (int)2e5; int n; long long a[N], b[N]; bool is_same_() { for (int i = ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
/* * 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; void solve() { long long n, m; cin >> n >> m; set<long long> s; vector<long long> ar(n + 1, 0); for (long long i = 0; i < n; i++) { s.insert(i + 1); } for (long long i = 1; i <= m; i++) { long long li, ri, xi; vector<long lo...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:52:54 10/17/2015 // Design Name: // Module Name: tx // 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 law...
#pragma GCC optimize( Ofast ) #include<bits/stdc++.h> using namespace std; #define int long long int #define double long double #define all(x) begin(x), end(x) #define Done(x) cout<<x<<endl; return; #define endl n void solve(){ int q; cin>>q; for(int i=0;i<q;i++){ int u; cin>>u; ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.4 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
#include <bits/stdc++.h> using namespace std; vector<long long> arr; pair<int, long long> doit(long long n) { if (n <= 7) return make_pair(n, n); vector<long long>::iterator ite = upper_bound(arr.begin(), arr.end(), n); int ind = (ite - arr.begin()); ind--; pair<int, long long> te1 = doit(n - ...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; template <typename T> void DEBUG(string label, T value) { cerr << [ << label << = << value << ] n ; } const int oo = 1 << 30; void solve() { int n; ...
/***************************************************************************** * File : processing_system7_bfm_v2_0_arb_rd.v * * Date : 2012-11 * * Description : Module that arbitrates between 2 read requests from 2 ports. * *****************************************************************************/ module p...
/** * 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
#include <bits/stdc++.h> using namespace std; using ll = long long int; ll ara[300005], ans_ara[300005]; set<ll> st; vector<pair<ll, ll> > vv; int main() { ll n, k, i, j, ans = 0; scanf( %I64d %I64d , &n, &k); for (i = 1; i <= n; i++) { scanf( %I64d , &ara[i]); ans -= (ara[i] * i); ...
#include <bits/stdc++.h> using namespace std; const int nax = 505; int n; char grid[nax][nax]; int cc[nax][nax]; int cc_size[nax * nax]; int when_added[nax * nax]; const int dx[4] = {-1, 1, 0, 0}; const int dy[4] = {0, 0, -1, 1}; const char EMPTY = . ; bool inside(int x, int y) { return 0 <= min(...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: Adam LLC // Engineer: Adam Michael // // Create Date: 15:51:43 09/10/2015 // Design Name: SN74LS195Agates and SN74LS195Abehavior // Module Name: C:/Users/adam/Documents/GitHub/Lab1SN74LS195A/SN74LS19...
#include <bits/stdc++.h> using namespace std; int n; int pos[100005]; pair<int, long long> ai[4 * 100005]; void update_ai(int node, int l, int r, int pos, pair<int, long long> val) { if (l == r) { ai[node] = val; return; } int mid = (l + r) >> 1; if (pos <= mid) update_ai(2 *...
// megafunction wizard: %ALTPLL% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altpll // ============================================================ // File Name: VgaPll.v // Megafunction Name(s): // altpll // ============================================================ // ***********************...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y; cin >> n >> m >> x >> y; vector<vector<int>> chessboard(n, vector<int>(m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) chessboard[i][j] = 0; cout << x << << y << endl; chessboard[x - 1][y - 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 law...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n = 1000 + 1000 + 1; printf( %d n , n); for (int i = (int)(1); i <= (int)(1000); ++i) printf( %d %d %d %d n , i, 1, i, 2); puts( 1 1 1 2 ); for (int i = (int)(1); i <= (int)(1000); ++i) printf( %d %d %d %d n , i, 1, i, 2)...
#include <bits/stdc++.h> using namespace std; const double pi = acos((double)(-1)); const int maxn = 100010; const int mod = 1e9 + 7; int moven2[10][5] = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}; int moven1[10][5] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; ...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference ...
#include <bits/stdc++.h> using namespace std; const int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1}; const int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; long long dp[1005][1005][2]; string s; int k; int ar[1026]; long long Dance_of_Death(int x, int rem, int f) { if (x == s.size()) { if (ar[rem] + 1...
#include <bits/stdc++.h> using namespace std; #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) const int tam = 100010; const int MOD = 1000000007; const int MOD1 = 998244353; const double DINF = 1e100; const double EPS = 1e-9; const double PI = acos(...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long R = 1, n, q, arr[N]; vector<long long> a[N]; long long h[N], p[N][20]; long long cnt = 0, st[N], en[N], pos[2 * N]; long long it[8 * N], lz[8 * N]; void dfs(long long u) { st[u] = ++cnt; pos[cnt] = arr[u]; f...
/** * 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 ds8dac1(clk, PWM_in, PWM_out); input clk; input [7:0] PWM_in; output reg PWM_out; reg [8:0] PWM_accumulator; reg [7:0] PWM_add; initial begin PWM_accumulator <= 0; PWM_add <=0; end always @(posedge clk) begin PWM_accumulator <= PWM_accumulator[7:0] + PWM_add; PWM_add <= PWM_in; end always @(negedge clk) ...
//----------------------------------------------------------------------------- //-- Secuenciador de notas //-- Se tocan por el mismo canal las notas DO, RE, MI, (silencio) repetidamente //----------------------------------------------------------------------------- //-- (C) BQ. August 2015. Written by Juan Gonzalez //...
#include <bits/stdc++.h> using namespace std; const int N = 2010, mod = 998244353; int sm[2][N], n, f[N][N], a[N][N], ans; void add(int x, int y, int z) { for (; x <= n; x += x & -x) sm[z][x] += y; } int query(int x, int z) { int ret = 0; for (; x; x -= x & -x) ret += sm[z][x]; return ret; ...
/** * 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; int main() { int n, i, j; string s1, s2; cin >> n >> s1 >> s2; if (s2 == week ) { if (n == 5 || n == 6) { cout << 53 << endl; } else { cout << 52 << endl; } } else { if (n <= 29) { cout << 12 << ...
#include <bits/stdc++.h> const long long int M = 1e9 + 7; using namespace std; bool visit[100000]; vector<int> G[100000]; void dfs1(int v, stack<int> &s) { visit[v] = true; for (int i = 0; i < G[v].size(); i++) { int c = G[v][i]; if (!visit[c]) dfs1(c, s); } s.push(v); } void d...
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE...
#include <bits/stdc++.h> using namespace std; long long n, k, s[30][105], cnt[105]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; string t; cin >> t; s[t[0] - a ][1] = 1; for (int i = 1; i < t.size(); i++) { int u = t[i] - a ; for (int j = i + 1; j ...
#include <bits/stdc++.h> using namespace std; long long int pwr(long long int a, long long int n, long long int m) { long long int p = 1; while (n > 0) { if (n % 2 == 1) p = (p * a) % m; a = (a * a) % m; n = n / 2; } return p; } char str[1000000]; int main() { ios::sync_w...
/** * 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...
`timescale 1 ns / 1 ns ////////////////////////////////////////////////////////////////////////////////// // Company: Rehkopf // Engineer: Rehkopf // // Create Date: 01:13:46 05/09/2009 // Design Name: // Module Name: address // Project Name: // Target Devices: // Tool versions: // Description: Address logic w/ S...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:10:36 04/11/2015 // Design Name: // Module Name: MEMWB_Voter // Project Name: // Target Devices: // Tool versions: // Description: // // Dep...
/** * 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...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2016.2 // Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps ...
#include <bits/stdc++.h> using namespace std; void __print(unsigned x) { cerr << x; } void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(float x) { cerr << x; } void __print(double x) { cerr << x; } void __print(long long x) {...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 0; while (c =...
#include <bits/stdc++.h> using namespace std; int a[101], k, i, n, check[101][101], j = 0, kil1, kil2, ans; int main() { cin >> n >> k; for (i = 1; i <= n; i++) { cin >> a[i]; } for (i = 1; i <= k; i++) { kil1 = 0; kil2 = 0; for (j = i; j <= n; j += k) { if (a[j] ==...
module register_file_testbench; reg[1:0] read_register_port_0; reg[1:0] read_register_port_1; reg[1:0] write_register; reg[31:0] write_data; reg write_enable; wire[31:0] read_data_port_0; wire[31:0] read_data_port_1; register_file rf(read_register_port_0, read_register_po...
module top; typedef reg [4:0] T1; typedef T1 [7:0] T2; T2 q_tst [$:2]; T2 q_tmp [$]; bit passed; task automatic check_size(integer size, string fname, integer lineno); if (q_tst.size !== size) begin $display("%s:%0d: Failed: queue size != %...
/* * 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...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `ifdef OVL_XCHECK_OFF //Do nothing `else `ifdef OVL_IMPLICIT_XCHECK_OFF //Do nothing `else wire valid_start_event; wire valid_test_expr; assign valid_start_event = ~(start_event ^ st...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long l; cin >> n >> l; long long *lanterns = new long long[n]; for (long long i = 0; i < n; i++) cin >> lanterns[i]; double maxDistance = 0; sort(lanterns, lanterns + n); for (long long i = 0; i < n - 1; i++) ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int trie[5000005][2]; int n, cnt; inline int read() { int t = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { ch = getchar(); } while (ch >= 0 && ch <= 9 ) { t = (t << 3) + (t << 1) + (ch ^ 4...
///////////////////////////////////////////////////////////////////// //// //// //// FFT/IFFT 256 points transform //// //// //// //// Authors: Anatoliy Sergienko, V...
#include <bits/stdc++.h> const double eps = 1e-7, PI = 3.1415926; const int N = 2e5 + 10; using namespace std; int n, q, m, k, x, y, a[N], mx = -1, mn = 1e9, sum, t; char c[N]; string s, s1, s2; map<pair<int, char>, int> mp; vector<int> vec; int main() { cin >> q; while (q--) { cin >> n;...
#include <bits/stdc++.h> using namespace std; int col[501]; int tcol[501]; int edge[501][501]; void docol(int v, int c) { col[v] = c; for (int i = 1; i <= v; ++i) { if (edge[v][i] && col[i] == -1) { docol(i, c); } } } int main(void) { ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1100100; long long N, l, r; long long L[MAX], R[MAX], d, sol; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N; for (int I = 0; I < N; I++) { cin >> L[I] >> R[I]; l += L[I]; r += R[I]; } d = ...
#include <bits/stdc++.h> using namespace std; int n, m, p, q, c, x, y, mod, lo[100000], z[3005][3005]; long long ans; struct segment_tree { int a[3005][13]; void update(int x, int y) { a[x][0] = y; } void build(int n) { for (int i = 1; i <= lo[n]; i++) for (int j = 1; j + (1 << i) - 1 ...