text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, tot, u, v; int c[N], head[N], last[N * 2], ver[N * 2]; void add(int x, int y) { ver[++tot] = y; last[tot] = head[x]; head[x] = tot; } void dfs(int x, int fa) { cout << x << ; for (int i = head[x]; i; i = la...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; pair<int, int> ar[k]; for (long long i = 0; i < k; i++) { cin >> ar[i].first >> ar[i].second; } set<long long> X, Y; long long atk, safe; for (int i = 0; i < k; i++) { X.insert(ar[i]...
/*+-------------------------------------------------------------------------- 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 ...
// DESCRIPTION: Verilator: Verilog Test module // // Use this file as a template for submitting bugs, etc. // This module takes a single clock input, and should either // $write("*-* All Finished *-*\n"); // $finish; // on success, or $stop. // // The code as shown applies a random vector to the Test // modul...
#include <bits/stdc++.h> using namespace std; void karem() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { karem(); int n, s = 0, res = 0; cin >> n; vector<int> v(12); for (int i = int(0); i < 12; i++) cin >> v[i]; sort(v.b...
#include <bits/stdc++.h> using namespace std; long long a[10]; int main() { int n; while (scanf( %d , &n) != EOF) { memset(a, 0, sizeof(a)); for (int i = 1; i <= n; ++i) a[i % 9]++; long long ans = 0; for (int i = 0; i < 9; ++i) for (int j = 0; j < 9; ++j) ans += a[i] * a[j...
#include <bits/stdc++.h> using namespace std; int INF = 2147483647; int inf = -2147483648; const double PI = acos(-1.0); const double pi = 2 * asin(1.0); int vis[1000009]; int vi[1000009]; int main() { ios::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; for (int i = 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 main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int c[1005] = {0}; int u[1005] = {0}, t = 0; for (int i = 0; i < n; i++) { if (c[a...
#include <bits/stdc++.h> int main() { long long k, l, c = 0; scanf( %I64d , &k); scanf( %I64d , &l); while (l % k == 0) { l /= k; c++; } if (c >= 0 && l == 1) printf( YES n%I64d , c - 1); else printf( NO ); }
module Sec6_Top( input [7:0] ADCData, input reset_n, output [2:0] sel, output [6:0] segments, output digit, output CS_n, output RD_n, output WR_n ); wire clk; wire clk_slow; wire [3:0] dispNum; wire [8:0] voltage; //This is an instance of a special, built in module that accesses our chip's oscillato...
module hps_fpga ( clk_clk, cpu_0_rx_0_external_connection_export, cpu_0_rx_1_external_connection_export, cpu_0_rx_2_external_connection_export, cpu_0_rx_3_external_connection_export, cpu_0_rx_4_external_connection_export, cpu_0_rx_5_external_connection_export, cpu_0_rx_6_external_connection_export, cpu_0_rx_7...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, s, vis[100005], cy; long long t; int nex(int x, int y) { if (x < m) return (x + y) % n; else return (x - y + n) % n; } int main() { scanf( %d %d , &n, &m); scanf( %d %lld , &s, &t); --s; while...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (clk); input clk; reg [31:0] r32; wire [3:0] w4; wire [4:0] w5; assign w4 =...
`timescale 1ns/1ps module tb_multiplier (); /* this is automatically generated */ // clock initial begin clk = 0; forever #5 clk = ~clk; end // (*NOTE*) replace reset, clock reg [SW-1:0] a; reg [SW-1:0] b; // wire [2*SW-2:0] BinaryRES; // wire [2*SW-1:0] FKOARES; // wire [2*SW-1:0] RKOARES...
#include <bits/stdc++.h> using namespace std; string st, t; vector<string> a; int p; int main() { ios_base ::sync_with_stdio(false); cin >> st; for (auto i : st) { t += i; if (i == > ) { a.push_back(t); t = ; } } for (auto i : a) { if (i[1] == / ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long t; cin >> t; while (t--) { long long d, m; cin >> d >> m; long long j = 1, ans = 1, sum = 0; while (sum + j <= d) { ans = ans * (j + 1) % m; ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1000001; long long n, l[MAXN], r[MAXN], id[MAXN], K; bool cmp(long long i, long long j) { return (l[i] / K == l[j] / K) ? ((l[i] / K & 1) ? (r[i] < r[j]) : (r[i] > r[j])) : (l[i] < l[j]); } int main() { ...
#include <bits/stdc++.h> using namespace std; long long a, b, c; int vis[12]; bool ok(long long mid, int x) { long long m = mid % 7; int day = x; long long res[5]; res[1] = mid / 7; res[2] = mid / 7; res[3] = mid / 7; res[1] *= 3; res[2] *= 2; res[3] *= 2; while (m--) { ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Fri Oct 27 10:20:39 2017 // Host : Juice-Laptop running 64-bit major relea...
module fifo # (parameter abits = 3800, dbits = 1)( input reset, clock, input rd, wr, input [dbits-1:0] din, output [dbits-1:0] dout, output empty, output full //output reg ledres ); wire db_wr, db_rd; //reg dffw1, dffw2, dffr1, dffr2; reg [dbits-1:0] out; //initial ledres = 0; //a...
// // Generated by Bluespec Compiler, version 2018.10.beta1 (build e1df8052c, 2018-10-17) // // // // // Ports: // Name I/O size props // mv_read O 64 // mav_write O 64 // CLK I 1 clock // RST_N ...
// RFID Reader for testing epc class 1 gen 2 tags. // rigidly assume clock = 7.812mhz. (this makes our divide ratios work out nicely) // for an 8mhz crystal, we are off by about 2% `timescale 1ns/1ns module rfid_reader ( // basic setup connections reset, clk, tag_backscatter...
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int lcm(int x, int y) { return x * y / gcd(x, y); } long long int gcd(long long int x, long long int y) { if (y == 0) return x; return gcd(y, x % y); } long long int lcm(long...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable 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; const int N = 3e5 + 7; int ans[N]; int he[N]; int res[N]; vector<int> g[N]; vector<int> a[N]; vector<int> lul[N]; void dfs(int v, int pr, int h) { he[v] = h; for (auto to : g[v]) { if (to != pr) { dfs(to, v, h + 1); } } } ...
#include <bits/stdc++.h> using namespace std; const int N = 2000500; int P[N]; int D[N]; multiset<int> S[N]; inline bool recalc(int x) { if (x == 1) { D[x] = *S[x].rbegin() + 1; return false; } else { int nd; if (S[x].size() == 1) nd = *S[x].rbegin(); else ...
#include <bits/stdc++.h> using namespace std; inline void rd(int &x) { x = 0; char o, f = 1; while (o = getchar(), o < 48) if (o == 45) f = -f; do x = (x << 3) + (x << 1) + (o ^ 48); while (o = getchar(), o > 47); x *= f; } int head[100005], to[100005 << 1], nxt[100005 << 1], tot; ...
#include <bits/stdc++.h> using namespace std; int binarySearch(long long int arr[], long long int l, long long int r, long long int x) { if (r >= l) { long long int mid = l + (r - l) / 2; if (arr[mid] == x) return mid; if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x...
/** * 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...
// ---------------------------- // This module impelements a linear feedback shift register (lfsr). // // Note: // - Syntax works and compiles with Verilog2LPN compiler // - async. design follows dual rail encoding that maps // input to output and output to internal states // // author: Tramy Nguyen // --------------...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long solve(long long l, long long r, long long x) { long long res = 0; for (int i = 1; i <= 62; i++) { long long p = (1LL << i) - 1; long long val = (x ^ p); if (l <= p && p <= r) { res = max(res, v...
/* * 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...
//////////////////////////////////////////////////////////////////////////////////////////////////// // 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 2 // of the License, or (at...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:11:09 08/01/2014 // Design Name: // Module Name: pwm_controller // Project Name: // Target Devices: // Tool versions: // Description: // // ...
#include <bits/stdc++.h> using namespace std; vector<int> ans; void solve() { long long int i, a, b, c, d, n; cin >> a >> b >> c >> d; n = a + b + c + d; string s = ; while (a > 0) { s += 0 ; a--; } while (c > 0) { s += 2 ; c--; } i = 0; while (b...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
// file: 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. // // DISCLAIMER // This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; double areaa(int x1, int x2, int x3, int y1, int y2, int y3); int gcd(int x, int y); int lcm(int x, int y); int egcd(int a, int b, int& x, int& y); vector<int> prime_possible_factors(int n); vector<int> primes_included(int n, int m); map<int, int> factor(int...
#include <bits/stdc++.h> using namespace std; const int MAX = 5 + 2e5; int in[MAX], k = 1; long long s[MAX], sorted[MAX], tos[MAX << 1], BIT[MAX << 1]; map<long long, int> mp; void add(int i, int val) { while (i > 0) { BIT[i] += val; i -= (i & (-i)); } } long long at_index(int i) { ...
#include <bits/stdc++.h> using namespace std; void cal(long long number, long long x, long long s) { long long d = number ^ x; long long temp = 2 * number - (s + d); if (temp % 2 == 0) { cout << 3 << endl; cout << d << << temp / 2 << << temp / 2 << endl; } if (temp % 2 == 1) ...
//Copyright 2011 Andreas Lindh //This file is part of genMem. //genMem is free software: you can redistribute it and/or modify //it under the terms of the GNU Lesser General Public License as published by //the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. // //genM...
`timescale 1ns / 1ps // Decodes the bit-pairs received by the rx_DS_SE module // into N-chars and L-chars. // // At present, parity is ignored. However, it will eventually // be covered by this module as well. // The only way to recover from a parity error is through // resetting the module. module rx_DS_char_tb(); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (clk); input clk; // verilator lint_off WIDTH `define INT_RANGE 31:0 `define INT_RANG...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; map<int, int> m; bool f = true; vector<int> v; while (n--) { int a; cin >> a; v.push_back(a)...
/********************************************************************* * SYNOPSYS CONFIDENTIAL * * * * This is an unpublished, proprietary work of Synopsys, Inc., and * * is fully protected under copyrigh...
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; for (int i = 0; i < s.length() - 1; i++) { if (s[i] > s[i + 1]) { cout << YES << endl << i + 1 << << i + 2; return 0; } } cout << NO ; return 0; }
////////////////////////////////////////////////////////////////////////////////// // AXI4LiteSlaveInterface for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosmos OpenSSD is free soft...
/** * 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 ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:43:39 06/14/2016 // Design Name: // Module Name: tausworthe // Project Name: // Target Devices: // Tool versions: // Description: // // Depe...
#include <bits/stdc++.h> int read() { int r = 0, t = 1, c = getchar(); while (c < 0 || c > 9 ) { t = c == - ? -1 : 1; c = getchar(); } while (c >= 0 && c <= 9 ) { r = (r << 3) + (r << 1) + (c ^ 48); c = getchar(); } return r * t; } const int N = 200010; in...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int x; cin >> x; int a[s.length()]; for (int i = 0; i < s.length(); i++) { a[i] = 1; } for (int i = 0; i < s.length(); i++) { if (...
#include <bits/stdc++.h> using namespace std; const int Z = (int)3e3 + 228; const int N = (int)1e6 + 228; const int INF = (int)1e9 + 228; const int MOD = (int)1e9 + 7; int n, d; long long a[N], delta[N], k; bool can(long long mid) { fill(delta + 1, delta + 1 + n, 0LL); for (int i = 1; i <= n; i+...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, i, cnt = 0, sum = 0, ans = 0, x, j; string s; vector<string> v; cin >> n >> m; int a[m]; for (i = 0; i < n; i++) { cin >> s; v.push_back(s...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; long long n, num; long long a[maxn]; long long vis[maxn]; priority_queue<long long> pq; void fnd(long long x) { if (vis[a[x]] == 0) { vis[a[x]] = 1; num++; fnd(a[x]); } else return; } int main() { ...
/* _/_/_/_/_/_/ _/_/_/_/_/ _/_/_/_/_/ _/_/_/_/_/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/_/_/_/_/ _/_/_/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/_/ _...
#include <bits/stdc++.h> using namespace std; void rf() {} void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } void solve() { int k = 0; string s; cin >> s; k = 0; for (int i = 0; i < s.size(); i++) { if (k && s[i] == B ) { k--; ...
/** * 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; ; vector<pair<int, int>> vec; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k, a, b, c; c = 1; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a >> b; vec.push_back(make_pair(a * -1, b)); } sort(...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; int a[N]; int per[N]; int main() { int n; cin >> n; for (int i = 0; i < n - 1; i++) { scanf( %d , &a[i]); } int ls = a[0]; set<int> st; for (int i = 1; i <= n; i++) { st.insert(i); } for (int...
#include <bits/stdc++.h> using namespace std; const int Inf = (1 << 30) - 1; const long long lInf = (1LL << 62) - 1; const int mInf = 0x7f7f7f7f; const int Maxn = 200010; vector<int> a[Maxn]; pair<int, int> S[Maxn << 1]; int f[Maxn]; int t[Maxn]; int n, m, ans; void solve(int k) { map<int, int...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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 2 of the License...
#include <bits/stdc++.h> using namespace std; class Timer { clock_t start; string name; public: Timer() { name = ; start = clock(); } Timer(string s) { name = s; start = clock(); } ~Timer() { fprintf(stderr, %s: %.3gs n , name.c_str(), ...
#include <bits/stdc++.h> using namespace std; const int N = (int)2e3 + 113; long long n, k, cnt = 0; int main() { cin >> k >> n; while (n > k) { if (n % k != 0) { cout << NO ; return 0; } n /= k; cnt++; } if (n == k) { cout << YES << endl << cnt; ...
/* * 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 = 1e5; long long int n; long long int t[2 * N]; int main() { long long int n, k; cin >> n >> k; long long int a[k], ans = 1e18, g = 0; for (int i = 0; i < k; i++) { cin >> a[i]; if (n % a[i] < ans) { ans = n % a[i]; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_5_e // // Generated // by: wig // on: Mon Jun 26 08:25:04 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Auth...
#include <bits/stdc++.h> using namespace std; set<pair<int, int> > second; int arr[(int)(1e5) + 30]; int main() { int n, m; int u, v; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> u >> v; second.insert(make_pair(u, v)); second.insert(make_pair(v, u)); } for (int i...
#include <bits/stdc++.h> using namespace std; double xp, yp, vp; double x, y, v, r; const double pi = acos(-1); double cal(double x0, double y0, double x1, double y1) { double ji = x0 * x1 + y0 * y1; double L0 = sqrt(x0 * x0 + y0 * y0); double L1 = sqrt(x1 * x1 + y1 * y1); double cosA = ji / L...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 9; vector<int> getBorder(const string str) { int n = str.size(); vector<int> border(n, -1); for (int i = 1, j = -1; i < n; i++) { while (j >= 0 && str[i] != str[j + 1]) { j = border[j]; } if (str[i] == str[j + ...
#include <bits/stdc++.h> using namespace std; ifstream Cin( input.txt ); ofstream Cout( output.txt ); int main() { long long i, n4 = 0, n7 = 0, n; string a, b; cin >> a >> b; for (i = 0; i < a.length(); i++) if (a[i] != b[i]) { if (a[i] == 4 ) n4++; else ...
#include <bits/stdc++.h> using namespace std; const int N = 1.1e6; int ans; int n, m; vector<int> F; int S[N][7][7]; int s(int i, int a, int b) { if (i == m) return (F[i] - a) / 3; if (i + 1 == m) return (F[i] - a) / 3 + (F[i + 1] - b) / 3; int loc = S[i + 1][b][0]; for (int j = 0; j < 3; ...
`include "gate.v" module Not16(input[15:0] in, output[15:0] out); Not g15(in[15], out[15]); Not g14(in[14], out[14]); Not g13(in[13], out[13]); Not g12(in[12], out[12]); Not g11(in[11], out[11]); Not g10(in[10], out[10]); Not g09(in[9], out[9]); Not g08(in[8], out[8]); Not g07(in[7], out[7]); Not g...
#include <bits/stdc++.h> using namespace std; long long n, a[15]; long long M[5][5]; long long s; long long check() { long long rs[5], cs[5]; memset(rs, 0, sizeof(rs)); memset(cs, 0, sizeof(cs)); long long d1 = 0, d2 = 0; for (long long i = 1; i <= n; i++) { for (long long j = 1; j <...
/** * 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...
// dig /* ------------------------------------------------------------------------------- Copyright 2014 Parallax Inc. This file is part of the hardware description for the Propeller 1 Design. The Propeller 1 Design is free software: you can redistribute it and/or modify it under the terms of the GNU General Public ...
`timescale 1ns / 1ps module fake_tone( input rst, input clk, input ym_p1, output onebit ); wire [15:0] tone, linear; wire sh, so; ramp_a_tone tonegen( .rst(rst), .clk(clk), .tone(tone) ); sh_encode encoder( .rst(rst), .ym_p1(ym_p1), .data(tone), .sh(sh), .so(so) ); ym_linearize linearizer( .rst(rst), .sh...
#include <bits/stdc++.h> using namespace std; long long a[200010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int f = 0; for (int i = 1; i < n; i++) if (a[i] != a[i - 1]) { f = 1; break; ...
// (C) 2001-2016 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> #pragma GCC optimize( O2 ) using namespace std; const int MAX = 3e5 + 5; const long long MAX2 = 11; const long long MOD = 1000000007; const long long MOD2 = 1000005329; const long long INF = 2e18; const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; const int dc[] = {0, 1, 0, -1, ...
#include <bits/stdc++.h> using namespace std; int main() { int n, co; int a[100019]; cin >> n >> co; int count = 0; for (int i = 0; i < n; i++) { cin >> a[i]; count += a[i] / 10; a[i] %= 10; } sort(a, a + n); reverse(a, a + n); for (int i = 0; i < n; i++) { ...
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--) { int n; cin>>n; string a; cin>>a; if(a[0]== 2 &&a[1]== 0 &&a[2]== 2 &&a[3]== 0 ) cout<< YES << n ; else 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 la...
// Copyright (C) 2017-2020 The Project X-Ray Authors. // // Use of this source code is governed by a ISC-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/ISC // // SPDX-License-Identifier: ISC `default_nettype none // ====================================================...
#include <bits/stdc++.h> using namespace std; const int maxn = 100; int n, x[maxn], y[maxn], r; void write(int x) { if (x <= 50) printf( %d , x); else { printf( (50+ ); write(x - 50); printf( ) ); } } void work() { for (int i = 1; i < n; i++) printf( ( ); for (int...
`timescale 1ns / 1ps //AND Gate module andgate(a, b, out); input a, b; output out; assign out = a & b; endmodule //Testbench definition for AND Gate module andgate_tb; wire t_out; reg t_a, t_b; andgate my_gate( .a(t_a), .b(t_b), .out(t_out) ); initial begin $monitor(t_a, t_b, t_out); t_a = 1'b0;...
#include <bits/stdc++.h> using namespace std; long long a[505]; long long mod = 998244353; long long dp[505][505]; long long get_ans(long long l, long long r) { if (dp[l][r]) return dp[l][r]; if (l >= r) return 1; long long pl = l, _min = 1e9; for (long long i = l; i <= r; i++) { if (a[i...
#include <bits/stdc++.h> using namespace std; long i, j, m, n, p, q, r, s, a, b; string aa, bb; int main() { cin >> n; scanf( %ld:%ld , &a, &b); if (n == 12) { if (a == 0) aa = 01 ; else if (a >= 13) { p = a % 10; if (p == 0) { aa = 10 ; } else...
#include <bits/stdc++.h> const int N = 1e6 + 5, P = 1e9 + 9; inline int ksm(int a, int b) { int r = 1; for (; b; b >>= 1, a = (long long)a * a % P) if (b & 1) r = (long long)r * a % P; return r; } int n, q, a[N], t[N], f[N], F[N]; struct mat { int s[2][2]; inline friend mat operator+...
#include <bits/stdc++.h> using namespace std; unsigned long long n, H; unsigned long long bound[60]; unsigned long long cnt(unsigned long long p, unsigned long long h, unsigned long long n) { if (h == 1) { if (p == 0 && n == 1) return 1; if (p == 1 && n == 2) return 1; ...
//----------------------------------------------------------------------------- // ISO14443-A support for the Proxmark III // Gerhard de Koning Gans, April 2008 //----------------------------------------------------------------------------- // constants for the different modes: `define MASTER 3'b000 `define S...
module system ( clk_50_clk, kernel_clk_clk, memory_mem_a, memory_mem_ba, memory_mem_ck, memory_mem_ck_n, memory_mem_cke, memory_mem_cs_n, memory_mem_ras_n, memory_mem_cas_n, memory_mem_we_n, memory_mem_reset_n, memory_mem_dq, memory_mem_dqs, memory_mem_dqs_n, memory_mem_odt, memory_mem_dm, memory_oct...
module timer # ( parameter WIDTH = 64, parameter USE_2XCLK = 0, parameter S_WIDTH_A = 2 ) ( input clk, input clk2x, input resetn, // Slave port input [S_WIDTH_A-1:0] slave_address, // Word address input [WIDTH-1:0] slave_writedata, input slave_read, input sla...
`define WIDTH_P 2 /**************************** TEST RATIONALE ******************************* 1. STATE SPACE Number of possible values for a thermometer code input of WIDTH_P is WIDTH_P+1. Hence it is feasible to exhaustively test the DUT. This test module generates thermometer codes as input to the DUT sta...
module \$__XILINX_RAM64X1D (CLK1, A1ADDR, A1DATA, B1ADDR, B1DATA, B1EN); parameter [63:0] INIT = 64'bx; parameter CLKPOL2 = 1; input CLK1; input [5:0] A1ADDR; output A1DATA; input [5:0] B1ADDR; input B1DATA; input B1EN; RAM64X1D #( .INIT(INIT), .IS_WCLK_INVERTED(!CLKPOL2) ) _TECHMAP_REPLACE_ ( .DPRA...