text
stringlengths
59
71.4k
/* * 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...
//============================================================ // // Hsiang-Yi Chung // March 2016 // // This is the top level of the radar dsp module // //============================================================ module Radar_top( input clk, input reset_n, input [11:0] adc_in, output [11:0] mag_out1, outpu...
/* * 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 N = (int)(1e6); char S[N + 1], T[N + 1]; vector<int> multiply(vector<int> a, vector<int> b) { int n = (int)a.size(); vector<int> ret; for (int i = 0; i < n; i++) ret.push_back(a[b[i]]); return ret; } vector<int> pow(vector<int> a, int b...
/*+-------------------------------------------------------------------------- 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 ...
#include <bits/stdc++.h> using namespace std; long long n, k; long long get(long long x, long long y) { if (x <= y * 2) return 0; long long s1 = 1, s2 = 0, p1 = x, p2 = x - 1, ans = 0; while (p2 >= y * 2) { if (p2 == y * 2) return s1 + ans; ans += s1 + s2; if (p1 & 1) s1 = s1...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; long long bigmod(long long b, long long p, long long md) { if (p == 0) return 1; if (p % 2 == 1) { return ((b % md) * bigmod(b, p - 1, md)) % md; } else { long long y = bigmod(b, p / 2, md); return (y * y) % md; } } int cnt[70]; c...
#include <bits/stdc++.h> #pragma GCC optimize( O3,unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; mt19937 rnd(time(nullptr)); const int N = 1e5 + 5; unordered_set<int> g[N]; bool check(int v) { for (auto i : g[v]) for (auto j : g[...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long dot(complex<long long> c1, complex<long long> c2) { return imag(c1 * conj(c2)); } double dot(complex<double> c1, complex<double> c2) { return imag(c...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
/** * 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() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; if (n == 5) { cout << YES n ; cout << 3 - 1 = 2 << n ; cout << 2 + 2 = 4 << n ; cout << 4 * 5 = 20 << n ; cout << ...
/** * 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; using ll = long long; using ld = long double; using vl = vector<ll>; using pll = pair<ll, ll>; using vll = vector<pll>; using MAP = map<ll, ll>; using sl = set<ll>; using sll = set<pll>; using MAPs = map<ll, sl>; using MAPv = map<ll, vl>; const ll in...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, 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 Found...
#include <bits/stdc++.h> using namespace std; const int sz = 2e5 + 10; int pr[sz], si[sz], ar[sz][3]; bool us[sz]; bool comp(int a, int b) { return ar[a][2] > ar[b][2]; } int find_se(int v) { if (pr[v] == v) return v; else { pr[v] = find_se(pr[v]); return pr[v]; } } void un...
//Author: AnandRaj uux #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef pair<ll,ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typed...
#include <bits/stdc++.h> using namespace std; long long save[100005]; long long aa[100005]; int hihi[100005]; int main() { int n; scanf( %d , &n); memset(aa, 0, sizeof(aa)); memset(aa, 0, sizeof(aa)); int first = 0, second = 0, sum = 1; long long a; scanf( %I64d , &a); if (a !=...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, 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...
`timescale 1ns/10ps `include "pipeconnect.h" `define TARGET_LOG 0 `define READER_LOG 1 `define WRITER_LOG 1 /* Notation: _ low, 0 ~ high, 1 / posedge \ negedge . unknown,undetermined,unimportant # valid data (held stable) < changing > -- */ /* Fasttarget presents the request address as the result...
#include <bits/stdc++.h> using namespace std; bool check(int left, int right, int m) { left ^= right; if (left > m) return false; else return true; } void solve() { int n, m; cin >> n >> m; if (n > m) { cout << 0 << n ; return; } int ans = 0; for (in...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:24:41 04/15/2016 // Design Name: Alejandro Morales // Module Name: control_digitos // Project Name: // Target Devices: // Tool versions: // Description:...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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...
/** * 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 (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:...
`timescale 1ns / 100ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:41:52 05/03/2020 // Design Name: tipi_top // Module Name: C:/Users/jgpar/Documents/TI99/TIPI/VS-TIPI-CPLD/vs-tipi-top-tb.v // Project Name: vs-tipi //...
// $Revision: #70 $$Date: 2002/10/19 $$Author: wsnyder $ -*- Verilog -*- //==================================================================== module CmpEng (/*AUTOARG*/); input clk; input reset_l; // **************************************************************** /*AUTOREG*/ /*AUTOWIRE*/ // **...
/** * 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, b, one, two; string a; one = 0; two = 0; cin >> n >> a; for (b = 0; b < n; b++) { if (a[b] == 1 ) { one++; } else { two++; } } if (one > two) { cout << one - two; } else { ...
`timescale 1ns/1ns // TB specific - UNUSED module ser_video( input nRESET, input CLK_SERVID, input CLK_6MB, input [6:0] VIDEO_R, input [6:0] VIDEO_G, input [6:0] VIDEO_B, output VIDEO_R_SER, output VIDEO_G_SER, output VIDEO_B_SER, output VIDEO_CLK_SER, output VIDEO_LAT_SER ); reg [6:0] R...
#include <bits/stdc++.h> using namespace std; int main() { float a1, b1, c1, a2, b2, c2; cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2; if (!b1 && !b2) { if ((!a1 && c1) || (!a1 && c2)) { cout << 0 << endl; return 0; } if ((!c1 && !c2) || (!a1 && !a2) || c1 / a1 == c2 / a2) {...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> using namespace std; const int maxx = 5e5 + 7; long long a[maxx], prime[maxx], cnt[maxx], sum, tedad; bool mark[maxx]; int main() { int n, q; cin >> n >> q; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 2; i < maxx; i++) { if (prime[i] == 0) for (...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int res[101] = {0}; for (int i = 0; i < n; i++) { res[arr[i]]++; } i...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 1010; int dp[N][N][2]; int bits[N]; int t, k; long long dfs(int len, int pos, int num, bool mark) { int maxx; long long sum; if (!len) { if (num == 1) { return true; } else { return...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64777216 ) using namespace std; const long long maxn = 100001; const long long maxk = 200001; const long long maxx = 10001; const long long secret_number = 87468267; const long long inf = 1e18; const int iinf = 2147483647 / 2; const double pi = ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.length(); for (int i = 1; i < n - 1; i++) if (s[i] == s[i - 1] && s[i] == s[i + 1]) { if (s[i] == a ) s[i] = b ; else s[i] = a ; } for (int i = 1; i < n; i+...
/* Copyright (c) 2019 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, distribute,...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: fbfifo.v // Megafunction Name(s): // altsyncram // =========================================================...
module vcache_blocking import bsg_cache_pkg::*; #(parameter `BSG_INV_PARAM(id_p) , parameter `BSG_INV_PARAM(addr_width_p) , parameter `BSG_INV_PARAM(data_width_p) , parameter `BSG_INV_PARAM(block_size_in_words_p) , parameter `BSG_INV_PARAM(sets_p) , parameter `BSG_INV_PARAM(ways_p) , paramet...
#include <bits/stdc++.h> using namespace std; const int MX = 1e5 + 69; const int inf = 1e9 + 5; const long long mod = 1e9 + 7; const long double eps = 1e-10; vector<int> v[MX]; int par[24][MX]; int depth[MX]; void dfs(int x, int p) { for (auto g : v[x]) { if (g == p) { continue; ...
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018 // Date : Mon Sep 16 04:56:41 2019 // Host : varun-laptop running 64-bit Service Pac...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, l, d; cin >> n >> d >> m >> l; long long x = 0; long long L = -m; long long R = -m + l; for (int i = 0; i < n; i++) { L += m; R += m; if (x + d < L) break; long long o = (R - x) / d; x = x + d ...
//----------------------------------------------------------------- // RISC-V Top // V0.6 // Ultra-Embedded.com // Copyright 2014-2019 // // // // License: BSD //--------------------------...
/* Copyright (c) 2013-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; const int N = 102, M = 102 * 102; int n, m; vector<pair<int, int> > g[N]; char ans[N][N]; char dp[N][N][28] = {0}; void input() { cin >> n >> m; for (int i = (0); i < (m); ++i) { int u, v; char ch; cin >> u >> v >> ch; u--, v--;...
#include <bits/stdc++.h> using namespace std; long long a[501][501]; bool visited[501]; int main() { long long n; cin >> n; for (long long i = 0; i < n; i++) { visited[i] = false; for (long long j = 0; j < n; j++) { cin >> a[i][j]; } } vector<long long> order(n); ...
#include <bits/stdc++.h> using namespace std; int a, b; int x; int main() { scanf( %d%d%d , &a, &b, &x); if (a >= b) for (int i = 0; i <= x - 2; i++) { printf( %d , i & 1); a -= !(i & 1); b -= (i & 1); } else { for (int i = 1; i <= x - 1; i++) { prin...
#include <bits/stdc++.h> using namespace std; int a[3000010], v[2 * 1000010 + 5]; int main() { int n, k, i, mn, ans, j; scanf( %d%d , &n, &k); for (i = 0; i < n; i++) scanf( %d , &a[i]); mn = a[0]; for (i = 1; i < n; i++) mn = min(mn, a[i]); if (mn <= k + 1) { cout << mn; retur...
// File: mm_vgasys.v // Generated by MyHDL 0.9dev // Date: Sat Mar 22 22:03:29 2014 `timescale 1ns/1ns module mm_vgasys ( clock, reset, vselect, hsync, vsync, red, green, blue, pxlen, active ); input clock; input reset; input vselect; output hsync; reg hsync; output vsync; r...
//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...
/* -- ============================================================================ -- FILE NAME : bus_addr_dec.v -- DESCRIPTION : ƒAƒhƒŒƒXƒfƒR[ƒ_ -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito V‹Kì¬ -- ===...
// *************************************************************************** // *************************************************************************** // 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; int main() { int N; cin >> N; if (N % 2 == 0) cout << -1 << endl; else { for (int i = 0; i < N; i++) cout << i << (i == N - 1 ? n : ); for (int i = 0; i < N; i++) cout << ((long long)(N - 2) * i) % N << (i == N - 1 ? n ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100030; const long long MODD = 1000000009; int ctr[128]; void do_case() { int n, k; cin >> n >> k; string s; cin >> s; for (int i = 0; i < s.size(); i++) ctr[s[i]]++; sort(ctr, ctr + 128); reverse(ctr, ctr + 128); ...
#include <bits/stdc++.h> using namespace std; bool check(string& a, string& b) { if (a.size() != b.size()) return false; int ind1 = -1, ind2 = -1; bool check = false; bool buck[26] = {0}; int count = 0; for (int i = 0; i < a.size(); i++) { if (a[i] != b[i]) { count++; i...
#include <bits/stdc++.h> using namespace std; const int NMAX = 100005; int n, k; char s[NMAX]; int sum[NMAX]; int get(int l, int r) { l = max(1, l); r = min(r, n); return sum[r] - sum[l - 1]; } int main() { cin.sync_with_stdio(false); cin >> n >> k; cin >> (s + 1); for (int i...
#include <bits/stdc++.h> using namespace std; const int N = 520; long long gi() { long long x = 0, o = 1; char ch = getchar(); while (!isdigit(ch) && ch != - ) ch = getchar(); if (ch == - ) o = -1, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return x * o; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; int x = a; while ((a / x + b / x) < n) x--; if (a < x) cout << a; else if (b < x) cout << b; else cout << x; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:58:59 04/05/2017 // Design Name: // Module Name: Timing // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; int a[MAXN], deg[MAXN]; set<pair<int, int> > s; int main() { int n, sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> deg[i] >> a[i]; if (deg[i]) s.insert(make_pair(deg[i], i)); sum += deg[i]; } ...
#include <bits/stdc++.h> using namespace std; vector<long long> num; void solve() { int n; cin >> n; char arr[2][n]; for (int i = 0; i < 2; i++) { for (int j = 0; j < n; j++) { cin >> arr[i][j]; } } int row = 0, col = 0; int visited[2][n]; memset(visited, false,...
#include <bits/stdc++.h> const int oo = 0x3f3f3f3f; template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } template <typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; } template <typename T> T read(T &first) { int f = 1; ...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int MOD = 1e9 + 7; const int N = 2e2 + 10, M = 1e6 + 10; const int alp = 10; vector<pair<int, int> > pos; pair<int, int> s[M]; int n, m, q, a[N][N], f[N][N], h[N][N], len[N][N], dx[10], dy[10], deg[N][N], g[M]; string str; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n; cin >> n; long long int s = 0; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; s += x; } if (s % n == 0) ...
Require Import ExtLib.Structures.Applicative. Require Import Temporal.DiscreteLogic. Require Import ChargeCore.Tactics.Tactics. Set Implicit Arguments. Set Strict Implicit. Definition lift1 {T U : Type} {F : Type -> Type} {Ap : Applicative.Applicative F} (f : T -> U) (x : F T) : F U := Applicative.ap (Ap...
/** * 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 MAXN = 2e5 + 5; const long long MOD = 1e9 + 7; const long long INF = 1e18; signed main() { int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } multiset<long long> kek; long long ans = 0;...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; struct edge { int v, next; } e[200010]; int ecnt = 0, head[100010]; int n; int d[100010]; int leg[100010]; void addedge(int a, int b) { e[++ecnt].v = b; e[ecnt].next = head[a]; head[a]...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> ostream &operator<<(ostream &os, pair<T1, T2> &p); template <class T> ostream &operator<<(ostream &os, vector<T> &v); template <class T> ostream &operator<<(ostream &os, set<T> &v); template <class T1, class T2> ostream &opera...
/** * 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-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
#include <bits/stdc++.h> using namespace std; int main() { int n = 6, m = 8; vector<string> a(n); vector<vector<int>> u; vector<int> loc(m); loc = {3, 3, -1, 4, 4, -1, 3, 3}; u.push_back(loc); u.push_back(loc); loc = {2, 2, -1, 3, 3, -1, 2, 2}; u.push_back(loc); u.push_back(l...
#include <bits/stdc++.h> using namespace std; vector<int> v[30]; string s[100010]; char aver[300010]; long long f(int p, int ch, int si) { int mi = 99999999; if (v[ch].size() == 0) return s[si].size(); for (int i = 0; i < v[ch].size(); i++) mi = min(mi, abs(p - v[ch][i])); return mi; } 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; void solve() { long long n, m; cin >> n >> m; vector<vector<long long> > a(m, vector<long long>(n)); for (long long i = 0; i <= n - 1; i++) { for (long long j = 0; j <= m - 1; j++) { cin >> a[j][i]; a[j][i]--; } } long...
module quantum( input clk, input rst, input hwrite, input [31:0] hwdata, input [31:0] haddr, input hsel, output reg[31:0] hrdata, output[127:0] data, input [127:0] ro_data ); reg[15:0] dataA[7:0]; assign data =...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, q; cin >> n >> m; if (m) q = min(m, n - m); else q = 1; cout << q << endl; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. // bug749 module t (/*AUTOARG*/ // Inputs clk ); input clk; genvar g; for (g=1; g<3; ++g) begin : gblk sub2 #(.IN(g)) u (); //su...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 100, MOD = 1e9 + 9, INF = 1e15, SQ = 370, LOG = 30; int n, m, x, y, x2, y2, z, t, now, l, r; int ans, dp[4][4 * N]; bool lazy[4 * N]; string s; void bld(int b, int e, int pos) { if (b == e - 1) { if (s[b] == 7 ) { d...
//wbs_spi.v ////////////////////////////////////////////////////////////////////// //// //// //// spi_top.v //// //// //// //// This file is part...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 6; vector<int> adj[MAX]; bool visited[MAX]; void dfs(int source, int &nodes, int &total) { total += adj[source].size(); visited[source] = true; nodes++; for (auto &each : adj[source]) { if (!visited[each]) { dfs(...
// -*- verilog -*- // Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) module qa_contents #( parameter WIDTH = 32, parameter MWIDTH = 1 ) ( input wire clk, input wire rst_n, input wire [WIDTH-1:0] in_data, input wi...
#include <bits/stdc++.h> using namespace std; /*DEBUGGER*/ #define deb(x) cout << #x << = << x << endl #define deb2(x, y) cout << #x << = << x << , << #y << = << y << endl typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typede...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> using namespace std; int record[300000]; int main() { map<pair<int, int>, int> m; memset(record, 0, sizeof(record)); int n, p; scanf( %d%d , &n, &p); map<pair<int, int>, int>::iterator iter; for (int i = 0; i < n; i++) { int a, b; scanf( %d%d , &a, &b);...
#include <bits/stdc++.h> namespace std { long long abs(long long x) { return x < 0 ? -x : x; } } // namespace std using namespace std; void dprintf(char* format, ...) { fprintf(stderr, DEBUG: ); va_list argp; va_start(argp, format); vfprintf(stderr, format, argp); va_end(argp); fpri...
/** * 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 x, y, n; scanf( %d%d%d , &x, &y, &n); for (int i = 0; i < n; i++) y += x ^= y ^= x ^= y; printf( %d n , x); }
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Freeze logic //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n, m; cin >> n >> m; long long a[n][m], f1 = 0; for (long long i = 0; i < n; i++) { for (long long j = 0; j < m; j++) { cin >> a[i][j]; if (a[i][j] > 4)...
#include <bits/stdc++.h> using namespace std; using namespace std; const int maxn = 3e5 + 5; int level[maxn * 2], num[maxn * 2], par[maxn * 2]; char s[maxn * 2]; stack<int> stk; int main() { int n, cnt = 0; scanf( %d , &n); scanf( %s , s + 1); for (int i = 1; i <= n; i++) { if (stk.e...
#include <iostream> #include <iomanip> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #inclu...
#include <bits/stdc++.h> using namespace std; long long powmod(long long base, long long exp) { base %= ((int)1e9 + 7); long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % ((int)1e9 + 7); base = (base * base) % ((int)1e9 + 7); exp >>= 1; } return res...
/** * 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( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) #pragma GCC target( avx,tune=native ) using namespace std; class CodeHash { public: string precise(double number, int prec) { stringstream ss; ss << fixed ...
// Copyright (c) 2000-2009 Bluespec, Inc. // 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, pub...
// // Copyright 2015 Ettus Research // module noc_block_exmodrec #( parameter NOC_ID = 64'hABCD080D2EC00000, parameter STR_SINK_FIFOSIZE = 11) ( input bus_clk, input bus_rst, input ce_clk, input ce_rst, input [63:0] i_tdata, input i_tlast, input i_tvalid, output i_tready, output [63:0] o_tdata, output o_...