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...
/* * 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 main() { int t; cin >> t; while (t--) { int n, cnt = 0; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.rbegin(), a.rend()); for (int i = 0; i < n; i++) { if (cnt <...
#include <bits/stdc++.h> using namespace std; const int N = 100 + 20; const int LG = 15; int a[N], cnt[N]; map<vector<int>, int> mp; int main() { ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; cnt[i] = __bui...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long arr[n + 2]; for (int i = 1; i <= n; i++) cin >> arr[i]; long long cume[n + 2], cumo[n + 2], rcume[n + 2], rcumo[n + 2]; cume[0] = 0; cumo[0] = 0; for (int i = 1; i <= n; i++) { if (i % 2) { ...
//----------------------------------------------------------------- // RISC-V Top // V0.6 // Ultra-Embedded.com // Copyright 2014-2019 // // // // License: BSD //--------------------------...
#include <bits/stdc++.h> using namespace std; int main() { long long T; cin >> T; while (T--) { long long n; cin >> n; long long i, j = 1; cout << 2 ; for (i = 1; i < n; i++) { j += 2; cout << j << ; } cout << endl; } return 0; } ...
#include <bits/stdc++.h> using namespace std; int r, c, d[1020][1020], used[1020][1020]; string s[1020]; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; long long ans = 0; bool ok(int x, int y) { return x >= 0 && x < r && y >= 0 && y < c && s[x][y] != T ; } void bfs(int x, int y) { used[x...
`default_nettype none module j1( input wire clk, input wire resetq, output wire io_rd, output wire io_wr, output wire [15:0] mem_addr, output wire mem_wr, output wire [15:0] dout, input wire [15:0] io_din, output wire [12:0] code_addr, input wire [15:0] insn_from_memory, input wire interrup...
#include <bits/stdc++.h> const int N = 100010; int n; int head[N], to[2 * N], next[2 * N], graphmr; double ans; inline void add(int x, int y) { int p = graphmr++; to[p] = y; next[p] = head[x]; head[x] = p; } inline void dfs(int x, int fa, int dis) { ans += 1.0 / dis; for (int i = h...
#include <bits/stdc++.h> using namespace std; const int SCALE = 101; int g[SCALE * 2][SCALE * 2]; int tx, ty; int stepr[4] = {0, -1, 0, 1}; int stepc[4] = {-1, 0, 1, 0}; string s; bool BuildMap(const string& s) { int x = 0; int y = 0; memset(g, 0, sizeof(g)); g[(x + SCALE)][(y + SCALE)] ...
#include <bits/stdc++.h> using namespace std; string itoa(int x) { string s = ; char c; if (x < 0) x *= -1, s += - ; while (x) { c = x % 10 + 48; s += c; x /= 10; } if (s[0] == - ) reverse(s.begin() + 1, s.end()); else reverse(s.begin(), s.end()); if...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ // // Terasic DE0 Nano SoC (Cyclone V SoC) Development Board // module de0_nano_soc ( input FPGA_CLK1_50, input FPGA_CLK2_50, input FPGA_CLK3_50, input [1:0] BUTTON, input [3:0] SW, output [7...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int cur = 1; long long num = 1; while (cur != n + 1) { if (cur != 1) cout << cur * 1ll * cur * 1ll * cur + 2 * cur * cur + 1; else cout << 2; cout << endl; cur++; } ...
/* * 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 main() { int n; cin >> n; if (n % 10 <= 5) { cout << (n / 10) * 10; } else { cout << ((n / 10) + 1) * 10; } }
#include <bits/stdc++.h> using namespace std; int n; int a[101]; int dp[101][1 << 17]; int M[61]; vector<int> prime; bool isprime(int num) { int i; for (i = 2; i < num; ++i) { if (num % i == 0) return 0; } return 1; } void pre() { int i, j; for (i = 2; i < 60; ++i) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n, greater<int>()); deque<int> d; d.push_front(arr[0]); int i; for (i = 1; i < n; i++) { if (arr[i] != arr[0]) break; } ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5, maxm = 100010; int n, m, h[maxm][maxn], v[maxm][maxn]; long long f[maxm][1 << maxn]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < m - 1; i++) for (int j = 0; j < n; j++) scanf( %d , &h[i][j]); for (int i = 0; i < m;...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: California State University San Bernardino // Engineer: Bogdan Kravtsov // Tyler Clayton // // Create Date: 14:30:00 10/31/2016 // Module Name: D_MEM // Project Name: MIPS // ...
#include <bits/stdc++.h> using namespace std; class BigInt { public: int sign; string s; BigInt() : s( ) {} BigInt(string x) { *this = x; } BigInt(int x) { *this = to_string(x); } BigInt negative() { BigInt x = *this; x.sign *= -1; return x; } BigInt normalize(i...
module IBUF(input I, output O); assign O = I; endmodule module IOBUFE(input I, input E, output O, inout IO); assign O = IO; assign IO = E ? I : 1'bz; endmodule module ANDTERM(IN, IN_B, OUT); parameter TRUE_INP = 0; parameter COMP_INP = 0; input [TRUE_INP-1:0] IN; input [COMP_INP-1:0] IN_B...
#include <bits/stdc++.h> using namespace std; const long long N = 2e6 + 10; const long long mod = 998244353; long long power(long long x, long long y) { x = x % mod, y = y % (mod - 1); long long ans = 1; while (y > 0) { if (y & 1) { ans = (1ll * x * ans) % mod; } y >>= 1; ...
// MBT: This module has a broken interface because it uses bypass_i as a live input, which could use glitching // MBT: This module should never be used in actual synthesized RTL; it must be hardened. // For this reason, I am guarding it with an ifndef SYNTHESIS and we can fix it later. `include "bsg_defines.v" ...
#include <bits/stdc++.h> using namespace std; inline void read(long long &x) { long long f = 1; x = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(); } ...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
#include <bits/stdc++.h> using namespace std; const int N = 1000005; const int MAXN = 1e5 + 5; const int LG = 22; int dp[51][51][51][51]; int n; int a[55][55]; int get(int tli, int tlj, int rbi, int rbj) { int res = a[rbi][rbj]; if (tli > 0) res = res - a[tli - 1][rbj]; if (tlj > 0) res = re...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 1000; const long long INF64 = 1e18; const int N = 1001000; const int MOD = 1e9 + 7; const double EPS = 1E-9; long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); } int add(int first, int second, int m) { firs...
#include <bits/stdc++.h> using namespace std; const int Maxn = 10005; const int Maxb = 31; struct linker { int x, y, id; linker(int x = 0, int y = 0, int id = 0) : x(x), y(y), id(id) {} bool operator<(const linker &b) const { if (y != b.y) return y > b.y; if (x != b.x) return x > b.x; ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, sum, mod1, mod, mod2; cin >> a >> b >> c; sum = (a + b); if ((a >= b || a <= b) && (c <= sum)) { if (c == a) { cout << YES << endl; } else if (c == sum) { cout << YES << endl; } else { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; bool cmax(int &a, int b) { return (a < b) ? a = b, 1 : 0; } bool cmin(int &a, int b) { return (a > b) ? a = b, 1 : 0; } template <typename T> T read() { T ans = 0, f = 1; char ch = getchar(); while (!isdigit(ch) && ch != - ) c...
/* Copyright (c) 2014-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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2021 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `ifdef verilator `define stop $stop `else `define stop `endif `define checks(gotv,expv) do if ((gotv) !=...
#include <bits/stdc++.h> using namespace std; const int buffer_size = 1 << 20; int rd_char() { static char buf[buffer_size]; static int l = buffer_size, r = buffer_size; if (l == r && r == buffer_size) { r = fread(buf, sizeof(char), 1 << 20, stdin); l = 0; } if (l == r) return EOF;...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string sub; for (int i = 0; i < k; i++) { sub.push_back( k ); } long long int count = 0; set<string> arra; for (int i = 0; i < n; i++) { string a; cin >> a; arra.insert(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...
#include <bits/stdc++.h> using namespace std; const double pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862; void gn(int &x) { int sg = 1; char c; while (((c = getchar()) < 0 || c > 9 ) && c != - ) ; if (c == - ) sg = -1, x = 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 law...
#include <bits/stdc++.h> using namespace std; using DB = double; using LL = long long; using PII = pair<int, int>; void err() { puts( ); } template <template <typename...> class T, typename t, typename... Args> void err(T<t> a, Args... args) { for (auto x : a) cout << x << ; err(args...); } ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x; vector<int> a; cin >> n >> k; vector<int> w(k); for (int i = 0; i < n; i++) { cin >> x; a.push_back(x); } for (int i = 0; i < k; i++) { for (int j = i; j < n; j += k) { w[i] += a[j]; }...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char s = getchar(); while (s < 0 || s > 9 ) { if (s == - ) f *= -1; s = getchar(); } while (s >= 0 && s <= 9 ) { x = (x << 1) + (x << 3) + s - 0 ; s = getchar(); } ...
module npc (iaddr, branch, jump, ins, jiaddr, imm16, imm26, riaddr, niaddr); input branch, jump; input [31:0] ins; input [31:0] jiaddr;// Jump to instruction address. input [31:0] iaddr;// Instruction Address. input [15:0] imm16; input [25:0] imm26; output [31:0] riaddr;// Return instruction address; out...
/* This file is part of JT51. JT51 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. JT51 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n, m; vector<int> g[MAXN]; int max1[MAXN], max2[MAXN]; bool vis[MAXN]; void dfs(int v) { vis[v] = true; for (auto to : g[v]) { if (!vis[to]) { dfs(to); if (max1[v] <= max1[to] + 1) { max2[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...
#include <bits/stdc++.h> #define mp make_pair #define fi first #define se second #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (in...
// Directive indicates that 1ns is the time period used when specifying delays // (i.e., #10 means 10ns); 100ps is the smallest unit of time precision that // will be simulated (100ps = .1ns; thus #.1 is meaningful, #.00001 is equivalent // to #0) `timescale 1ns / 100ps module testbench (); reg clk; reg reset_;...
#include <bits/stdc++.h> using namespace std; int k[5] = {100, 20, 10, 5, 1}; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; while (cin >> n) { long long ans = 0; for (int i = 0; i < 5; i++) { ans += n / k[i]; n %= k[i]; } cout << ans << n ;...
#include <bits/stdc++.h> using namespace std; vector<int> v[1000005]; int ok[2][1000005]; int main() { int q; cin >> q; while (q--) { int n; cin >> n; for (int i = 0; i < n; i++) ok[0][i] = 0; set<int> s; for (int i = 0; i < n; i++) s.insert(i); int cnt = 0; ...
#include <bits/stdc++.h> int x[30]; template <class T> inline void read(T &num) { num = 0; char c = getchar(); T sign = 1; while (c < 0 || c > 9 ) { if (c == - ) sign = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { num = (num << 1) + (num << 3) + (c ^ 48); ...
/* Copyright (c) 2014 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,...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { long long n, side = 0, ans = 0; cin >> n; int i = (n + 1) % 4; if (i == 0) ans = n + 1; else if (i == 1 || i == 3) ans = 4 * n + 1; else ans = 2 * n + 1; ...
#include <bits/stdc++.h> using namespace std; int a, b, t, c, j, k, T, i, A[1028], B[1028], C[1028]; int main() { cin >> a >> b; while (a > 0) { a--; t++; if (t == b) { t = 0; a++; } j++; } cout << j; }
`timescale 1ns / 1ps module ym_sync( input rst, input clk, // YM2151 pins input ym_p1, input ym_so, input ym_sh1, input ym_sh2, input ym_irq_n, input [7:0] ym_data, // output reg ym_p1_sync, output reg ym_so_sync, output reg ym_sh1_sync, output reg ym_sh2_sync, output reg ym_irq_n_sync, output ...
#include <bits/stdc++.h> using namespace std; long long calc2(long long a, long long b, long long c, long long ab, long long ac, long long bc, long long abc) { long long parts[] = {a - ab - ac + abc, b - ab - bc + abc, c - ac - bc + abc, ...
module reset_and_status #( parameter PIO_WIDTH=32 ) ( input clk, input resetn, output reg [PIO_WIDTH-1 : 0 ] pio_in, input [PIO_WIDTH-1 : 0 ] pio_out, input lock_kernel_pll, input fixedclk_locked, // pcie fixedclk lock input mem0_local_cal_success, input...
/** * 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 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 ...
module spdif_dai_varclk #( parameter MIN_CLK_PER_HALFBIT = 4, parameter MAX_CLK_PER_HALFBIT = 31, parameter MAX_CLK_PER_HALFBIT_LOG2 = 5, // 32 max parameter NUM_RATE = 5 )( input wire clk, input wire rst, input wire signal_i, output wire [23:0] data_o, output wire ack_o, output ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a % b != 0) return gcd(b, a % b); return b; } int main() { int n, x = 0, y = 0; cin >> n; string a, b; cin >> a >> b; int k = a.size() * b.size() / gcd(a.size(), b.size()); for (int i = 0; i < k; i++) { ...
#include <bits/stdc++.h> using namespace std; long long n, q, x, y, ans; int main() { cin >> n >> q; while (q--) { cin >> x >> y; ans = 0; if ((x & 1) == (y & 1)) { ans += (x - 1) / 2 * n; x = x % 2; if (x) ans += (y + 1) / 2; else ans ...
/*************************************************************************************************** ** fpga_nes/hw/src/cpu/apu/apu_pulse.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that ...
#include <bits/stdc++.h> using namespace std; const int N = 205; int n, siz[N], s[N][N], ori[N][N], tot[N], pos[N]; vector<int> ans; int read() { int x = 0, f = 1; char s; while ((s = getchar()) > 9 || s < 0 ) if (s == - ) f = -1; while (s >= 0 && s <= 9 ) x = (x << 1) + (x ...
#include <bits/stdc++.h> using namespace std; bool fl, vis[200005]; int en, d[200005], head[200005]; struct edge { int u, v, w, nxt; } e[200005 * 4], e0[200005]; void dfs(int); void adde(int, int, int); int calc(int x) { int ans = 0; while (x) { ans ^= x & 1; x >>= 1; } r...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Jeremy Bennett. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/); typedef enum int { PADTYPE_DEFAULT = 32'd0, PADTYPE_GPIO, PADTYPE_VDD, ...
#include <bits/stdc++.h> using namespace std; const int mmax = 1e6 + 10; const int eps = 1e-9; struct node { string name; } s[105]; long long cmp(node a, node b) { if (a.name == b.name) return a.name < b.name; return a.name < b.name; } int main() { long long n; while (cin >> n) { ...
#include <bits/stdc++.h> using namespace std; long double PI = 3.14159265359; long long inf = 1000000000000000007; long long mod = 1000000007; long long mod1 = 998244353; const bool multi = 0; long long DP[500007]; long long s[500007]; vector<long long> G[500007]; long long ans = inf, n; void dfs(...
#include <bits/stdc++.h> using namespace std; int a[10][10], b[10][10]; struct per { int x, y; }; int k; queue<per> q, q2; void bf2() { while (!q2.empty()) { per aux; aux = q2.front(); q2.pop(); int xx = aux.x - 1, yy = aux.y - 1; if (b[xx][yy] == 0) { b[xx][y...
#include <bits/stdc++.h> using namespace std; bool alph[26] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}; bool check(string s) { for (int i = 0; i < s.length(); i++) if (!alph[s[i] - A ]) return false; return true; } int main() { string...
/** * 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, p, k; int a[333333]; long long ans; map<int, int> mp, mpb; int main() { scanf( %d%d%d , &n, &p, &k); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { mp[a[i]]++; } for (map<int, int>::iterator it = ...
#include <bits/stdc++.h> using namespace std; std::mt19937 rnd( (int)std::chrono::steady_clock::now().time_since_epoch().count()); long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int NDIG = 6; const int MAXQ = 100000; const int MAXSUM = 999999; int nvals; int g...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; cin >> n; long long int a[n + 1]; for (long long int i = 1; i <= n; i++) { cin >> a[i]; } long long int f = 0; for (long long int i = 1; i <= n; i++)...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Tue Jun 06 02:48:32 2017 // Host : GILAMONSTER running 64-bit major release (...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, n, i, min1, min2, max1, max2, a[10000], b[10000]; cin >> n; t = n; while (n--) { cin >> a[i] >> b[i]; i++; } max1 = a[0]; max2 = b[0]; min1 = a[0]; min2 = b[0]; for (i = 0; i < t; i++) { ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 5; int minn[MAX], maxx[MAX], h[MAX]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> h[i]; int block = 1; minn[1] = h[1]; maxx[1] = h[1]; for (int i = 2; i <= n; ++i) { if (maxx[block] <= h[i]...
// megafunction wizard: %LPM_MUX% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_MUX // ============================================================ // File Name: datamux.v // Megafunction Name(s): // LPM_MUX // // Simulation Library Files(s): // lpm // ================================================...
#include <bits/stdc++.h> using namespace std; template <typename T> void deb(T v[], long long n) { if (false) cerr << ARRAY : ; long long i; for (i = 0; i < n; i++) if (false) cerr << v[i] << ; if (false) cerr << endl; } template <typename T> void deb(set<T> s) { if (false) ...
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 7; const int M = 2e6 + 7; const int lim = 1e6; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; long long ksm(long long a, long long b, long long p) { long long ret = 1; while (b) { if (b & 1) (ret *= a) %= p; (a *= ...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2014, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOUT THE // EXPRESSED WRITTEN CONSENT OF VIPcore Group // // VIPcore : http://soc.fudan.edu.cn/vip // IP Owner : Yibo FA...
module node_router(clk, rst, Data_in_N, Data_in_S, Data_in_W, Data_in_E, Data_in_ready_N, Data_in_ready_S, Data_in_ready_W, Data_in_ready_E, Data_out_N, Data_out_S, Data_out_W, Data_out_E, Data_out_ready_N, Data_out_ready_S, Data_out_ready_W, Data_out_ready_E, Data_in_valid_N, Data_in_valid_E, Data_in_valid_S, Dat...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
/* * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:16:09 07/10/2009 // Design Name: // Module Name: spi // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: // R...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int lazy[maxn << 2]; int a[maxn], c[maxn]; void pushup(int l, int r, int rt) { lazy[rt << 1] = lazy[rt << 1 | 1] = lazy[rt]; lazy[rt] = 0; } void update(int L, int R, int c, int l, int r, int rt) { if (L <= l && R >= r) { ...
#include <bits/stdc++.h> using namespace std; struct fastIO { inline fastIO operator>>(int& num) { num = 0; char c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); bool foo = 0; if (c == - ) { foo = 1; c = getchar(); } while (c >= 0...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: book.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===================================...
//------------------------------------------------------------------------------ // (c) Copyright 2013-2015 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 propert...
#include <bits/stdc++.h> using namespace std; long long a[] = {0, 1, 2, 9, 64, 625, 7776, 117649, 2097152}; const long long M = 1000000007ll; int main(void) { std::ios::sync_with_stdio(false); long long k, n, m, t; while (cin >> n >> m) { n -= m; t = 1; k = n; while (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; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int q; cin >> q; while (q--) { int a, b, n, S; cin >> a >> b >> n >> S; int x = min(a, S / n); cout << (S - x * n <= b ? YES : NO ) << n ; } ...
// This is the Avalon slave for the motor controller // Registers 0-5 store the direction and on/off switch for each motor // Registers 8-13 store the respective duty cycle // The output should be fed to GPIO pins in the SOPC configuration `include "defines.v" module slave_controller(input clk, input chipselect, inpu...
#include <bits/stdc++.h> using namespace std; vector<long long> V, L, Q; vector<string> P; map<int, int> M; set<char> S; set<char>::iterator it; long long n, m, a, b, c, d, e, f, cnt, x, y, z, t; string s, p, ans, temp; long long arr[1001]; bool xy = 0; char bd; int main() { ios_base::sync_w...
#include <bits/stdc++.h> using namespace std; const int maxn = 3000 + 10; int sum, d[maxn], dp[maxn][2]; vector<pair<int, int> > edge[maxn]; int min(int a, int b) { return a < b ? a : b; } void dfs(int u, int f, int w) { if (f == -1) { sum = 0; d[u] = 0; dp[u][0] = dp[u][1] = 0; } ...
#include <bits/stdc++.h> using namespace std; struct ad { int l, r, i; bool operator<(const ad a) const { if (l != a.l) return l < a.l; return r > a.r; } }; const int INF = 1000000000; const int MAXN = 200005; const int SZ = 1 << 18; int N, M, A, B; long long res, resi, resj, C; ...
#include <bits/stdc++.h> using namespace std; const long long int inf = (long long int)1e18 + 19; const long long int mod = (long long int)1e9 + 7; void cazz() { long long int t = 1, i; long double j, n; cin >> t; while (t--) { cin >> n; i = 3, j = -1; while (j < n) { j...