text
stringlengths
59
71.4k
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:38:23 05/10/2015 // Design Name: // Module Name: sbox1 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; int main() { int test_time, x = 0; cin >> test_time; for (int i = 0; i < test_time; ++i) { string temp; cin >> temp; for (int j = 0; j < temp.length(); ++j) { if (temp[j] == - ) { x--; break; } else if (...
#include <bits/stdc++.h> using namespace std; void fastio() { cin.tie(nullptr); cin.sync_with_stdio(false); } using LL = long long; using LD = long double; const LL MOD = 1e9 + 7; const LL INF = LLONG_MAX; const LL N = 2e5 + 1; int main() { fastio(); LL n; cin >> n; vector<LL> ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; vector<int> G[maxn], a, b; int n, m, flag; int col[maxn]; bool bfs(int s) { queue<int> p; p.push(s); col[s] = 1; while (!p.empty()) { int from = p.front(); p.pop(); int len = G[from].size(); for (...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
#include <bits/stdc++.h> const int N = 1e6 + 5; using namespace std; int n, k, a[N], cnt[N], Min = N; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; Min = min(Min, a[i]); cnt[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 law...
module DriveOutput ( input clk, input store_strb, input feedfwd_en, input use_strobes, input [9:0] start_proc, input [9:0] end_proc, input [4:0] Ldelay, input [1:0] opMode, //0 = sample-by-sample, 1 = constant DAC, 2 = Pulse mean removal // input signed [12:0] constDac_val, //input signed [29:0] din, input s...
#include <bits/stdc++.h> int32_t gcd(int32_t a, int32_t b) { if (b == 0) return a; return gcd(b, a % b); } int32_t mpf(int32_t n, std::vector<int32_t>& primes) { for (int32_t i = 0; i < primes.size(); i++) if (n % primes[i] == 0) return primes[i]; return 1; } int main() { int32_t num...
`include "elink_constants.vh" module erx_clocks (/*AUTOARG*/ // Outputs rx_lclk, rx_lclk_div4, rx_active, erx_nreset, erx_io_nreset, // Inputs sys_nreset, soft_reset, tx_active, sys_clk, rx_clkin ); //Frequency Settings (Mhz) parameter FREQ_RXCLK = 300; parameter FREQ_IDELAY =...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_dp_maca_l.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1}; const int N = 1e6 + 10; const int mod = 1e9 + 7; const double pi = acos(-1); const double eps = 1e-8; const long long INF = 2e10; template <class T> void _print(T arg) { cout << arg << ; } templa...
#include <bits/stdc++.h> using namespace std; int main() { char s[55], t[55], i = 0, j = 0; scanf( %s , s); scanf( %s , t); while (t[i] != 0 ) { if (t[i] == s[j]) j++; i++; if (j >= strlen(s)) break; } cout << j + 1; return 0; }
#include <bits/stdc++.h> using namespace std; int pot(int x, int y) { if (y == 0) { return 1; } else { return x * pot(x, y - 1); } } int bin(int x, int y) { if ((x == 0 && y != 0) || (y == 0 && x != 0)) { return 1; } else { return bin(x, y - 1) + bin(x - 1, y); } ...
#include <bits/stdc++.h> using namespace std; ifstream in( in.txt ); ofstream out( out.txt ); long long a[1000006], b[1000006]; long long fortza(long long n, long long put) { if (!put) return 1; if (put == 1) return n; if (put & 1) return (fortza((n * n) % 998244353, put / 2) * n) % 998244353; ...
#include <bits/stdc++.h> using namespace std; const int INF = 2000000005; const long long INFLL = 1000000000000000009; const long long MOD = 1000000007; long long W[1005][1005], N, M, K; int main() { for (int i = (1); i <= (1000); i++) W[i][0] = 1; for (int j = (1); j <= (1000); j++) { long lo...
module AND(in1,in2,out);//and operator input [31:0] in1; input [31:0] in2; output [31:0] out; and A0(out[0],in1[0],in2[0]); and A1(out[1],in1[1],in2[1]); and A2(out[2],in1[2],in2[2]); and A3(out[3],in1[3],in2[3]); and A4(out[4],in1[4],in2[4]); and A5(out[5],in1[5],in2[5]); and A6(out[6],in1[6],in2[6]); a...
// file: dcm.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a licens...
#include <bits/stdc++.h> using namespace std; int n, k, plen; char p[200], ar[200]; char res[200]; int preone[200]; bool pos, found; bool is_start(int ind) { if (plen + ind > n) return false; for (int l = 0; l < plen; l++) if (p[l] != res[l + ind]) return false; return true; } bool b...
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return a; ...
/* * DSI Shield * Copyright (C) 2013-2014 twl <> * * 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 pro...
/* 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,...
// Copyright 2011-2013 Ettus Research 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 program is ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T Min(T x, T y) { return x < y ? x : y; } template <class T> inline T Max(T x, T y) { return x > y ? x : y; } bool MOP1; long long T, n, res; long long head[(105)], nxt[(105)], to[(105)], line; void add(long long x, lo...
#include <bits/stdc++.h> using namespace std; struct node { long long x, y; int id; bool operator<(const node& b) const { if (y != b.y) return y < b.y; else return x < b.x; } } a[210000], b[210000], c, d[210000]; vector<node> q; int n, num, last; int ans[210000]; ...
#include <bits/stdc++.h> using namespace std; int sol(const vector<long long>& a, int n, int m, long long t) { long long s = 0; for (int i = 0; i < m; i++) s += a[i]; int ans = 0; for (int i = 0; i <= n && s * i <= t; i++) { int cnt = (m + 1) * i; long long r = t - s * i; for (int ...
`default_nettype none `timescale 1ns/1ns module tb_dly(); wire clk, reset; clock clock(clk, reset); reg in; wire start; wire out50ns, out70ns, out100ns, out150ns; wire out200ns, out250ns, out400ns, out800ns; dly50ns dstart(clk, ~reset, in, start); dly50ns d50ns(clk, ~reset, start, out50ns); dly70ns d70ns(cl...
#include <bits/stdc++.h> using namespace std; int n, c, a[100005], sign[100005]; bool sign_ch[100005]; int main() { cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; sign[n] = 1; c = a[n]; for (int i = n - 1; i >= 1; i--) { if (c >= a[i]) { c -= a[i]; sign[i] = -1; ...
module t; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire w11; // From bp3 of FswBypassArbiter.v wire w12; // From bp3 of FswBypassArbiter.v // End of automatics /*AUTOREG*/ wand w0; wor w1; tri0 w2; tri1 w3; triand ...
// // Copyright (c) 2014 Jan Adelsbach <>. // 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 Foundation, either version 3 of the License, or // (at your optio...
#include <bits/stdc++.h> using namespace std; int N; int P[101010]; int V[101010]; vector<int> E[101010]; double T[101010]; void dfs(int cur, double tim) { tim += 1; T[cur] = tim; for (auto& r : E[cur]) { double el = (V[cur] - 1 - V[r]) * 0.5; dfs(r, tim + el); } } void sol...
/* * 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 ...
/** * 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(nullptr); long long n; cin >> n; string s; cin >> s; for (long long i = 0; i < n - 1; i++) { if (s[i] > s[i + 1]) { cout << YES << endl; cout << i + 1 << << 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...
#include <bits/stdc++.h> using namespace std; int read(int &x) { return scanf( %d , &x); } int read(long long &x) { return scanf( %lld , &x); } int read(double &x) { return scanf( %lf , &x); } int read(int &x, int &y) { return scanf( %d%d , &x, &y); } int read(long long &x, long long &y) { return scanf( %ll...
#include <bits/stdc++.h> using namespace std; long long x[200001], y[200001], dp[200001], n; bool s[200001]; long long find_upper_bound(long long l, long long r, long long value) { long long mid, index = 1; while (l <= r) { mid = l + (r - l) / 2; if (x[mid] >= value) { index = mid; ...
// DSP48E1 // [1] 7 Series DSP48E1 User Guide UG479 (v1.9) September 27, 2016 // Figure 2-8 and Table 2-6 shows details `include "bin_mux/bin_mux.sim.v" `include "b1reg_mux/b1reg_mux.sim.v" `include "b2reg_mux/b2reg_mux.sim.v" `include "bc_mux/bc_mux.sim.v" `include "bmult_mux/bmult_mux.sim.v" `include "../nreg/nreg....
//Integer to IEEE Floating Point Converter (Double Precision) //Copyright (C) Jonathan P Dawson 2013 //2013-12-12 module float_to_double( input_a, input_a_stb, output_z_ack, clk, rst, output_z, output_z_stb, input_a_ack); input clk; input rst;...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:46:56 04/06/2015 // Design Name: division // Module Name: S:/a/asw011/public/PrimeFactorization/testDivision.v // Project Name: PrimeFactorization // Target Devic...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:102400000,102400000 ) const int N = 1e5 + 10, M = 1024; int a[N], cnt[N], n, k, x; int main() { scanf( %d %d %d , &n, &k, &x); int ai; for (int i = 1; i <= n; i++) { scanf( %d , &ai); a[ai]++; } for (...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; bool flag = false; cin >> s; stringstream ss(s); char arr[2 * n]; int min0 = 10; int max0 = 0; int min1 = 10; int max1 = 0; for (int i = 0; i < 2 * n; i++) { arr[i] = s.at(i); ...
/* * Copyright (c) 2002 Stephen Williams () * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
/** * 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 = 5000 + 5, mod = 1000 * 1000 * 1000 + 7; long long dp[N][N], ps[N]; int main() { long long n, a, b, k; cin >> n >> a >> b >> k; a--, b--; for (int i = 0; i < n; i++) { dp[0][i] = 1; } dp[0][b] = 0; for (int i = 0; i < n...
/* * 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; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long a, b; cin >> a >> b; if (a == b) { cout << infinity << n ; return 0; } if (a < b) { cout << 0 << n ; return 0; } ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; string s; cin >> n; cin >> s; int l = 0, r = n - 1, x = 0, y = 0; while (s[l] == < ) { l++; x++; } while (s[r] == > ) { r--; ...
#include <bits/stdc++.h> using namespace std; int n; long long k, x; long long a[200010]; int main() { int n; while (cin >> n >> k >> x) { int negative = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] < 0) ++negative; } if (negative % 2 == 0) { i...
#include <bits/stdc++.h> using namespace std; long long a, b, n; long long power(long long b, long long p) { if (p == 0) return 1; long long ret = power(b, p / 2); ret *= ret; if (p & 1) ret *= b; return ret; } long long check(long long x) { return a * power(x, n); } int main() { cin...
#include <bits/stdc++.h> using namespace std; template <class node> struct link_cut_tree { bool connected(node* u, node* v) { return lca(u, v) != NULL; } int depth(node* u) { access(u); return get_sz(u->ch[0]); } node* get_root(node* u) { access(u); while (u->ch[0]) u = u->...
#include <bits/stdc++.h> using namespace std; const int N = 100100; int n, q; long long int m; vector<long long int> mods; long long int w[N]; long long int phi(long long int x) { long long int ans = x; for (long long int i = 2; i * i <= x; i++) { if (x % i == 0) { ans -= ans / 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...
#include <bits/stdc++.h> using namespace std; long long int binExp(long long int x, long long int n, long long int m) { long long int res = 1; while (n) { if (n & 1) res = (res * x) % m; x = (x * x) % m; n >>= 1; } return res; } long long int modInv(long long int i, long long 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...
#include <bits/stdc++.h> using namespace std; int n; pair<pair<int, int>, int> a[100100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; a[i].first.first = x; } for (int i = 1; i <= n; i++) { int x;...
//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 law...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_aea_e // // Generated // by: wig // on: Wed Aug 18 12:44:01 2004 // cmd: H:/work/mix_new/MIX/mix_0.pl -strip -nodelta ../../constant.xls // // !!! Do not edit this file! Autogenerated by MIX !!...
#include<bits/stdc++.h> using namespace std; const int N = 2000 + 10; int n; bool flag[N]; bool Query(int l1, int r1, int l2, int r2) { printf( ? %d %d n , r1 - l1 + 1, r2 - l2 + 1); for (int i = l1; i <= r1; i++) printf( %d%c , i, n [i == r1]); for (int i = l2; i <= r2; i++) printf( %...
// cog_alu /* ------------------------------------------------------------------------------- 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 Pub...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (k > (n % 2 == 0 ? n * n / 2 : (n * n + 1) / 2)) { cout << NO << endl; return 0; } cout << YES << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (k && (i...
#include <bits/stdc++.h> using namespace std; long long int n, k, s; vector<long long int> v, ans; void build(const int &last, const int &i, const int &k, const bool &increasing) { if (!k) return; else if (last != v[i] and int(v.size()) - i == k) ans.push_back(v[i]), build(v[i],...
#include <bits/stdc++.h> using namespace std; struct point { long double x, y; }; point a1, a2, a3, a4, b1, b2, b3, b4, c; int l, r, u, d; bool corner(point b) { if (b.x <= r && b.x >= l && b.y <= u && b.y >= d) return true; else return false; } pair<long double, long double> lin...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k, h = 0; cin >> n >> k; vector<int> v; for (int i = 0; i < n; i++) v.push_back(i); for (int ki = 1; ki <= k; ki++) { int x; cin >> x; x = x - (x / (n)) * (n)...
/** * 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> char str[100005], ans[100005]; int out[100005]; struct Edge { int link[400005], next[400005], son[400005], l; void clear() { l = 0; memset(son, 0, sizeof(son)); } void addedge(int x, int y) { link[++l] = y; next[l] = son[x]; son[x] = l; } ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; using LL = long long; #define mk make_pair const int MAX_N = 3E5 + 100; const int MAX_LOG_N = 18 + 1; int n, m; vector<int> G[MAX_N]; //================================= int log2Static[M...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); if (n > min(m, k)) printf( No n ); else printf( Yes n ); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; const int N = 100005; int n, m, k; vector<int> adj[N]; int cnt[N]; int mark[N]; int pass; int aux[N]; bool ta[N]; bool clique(int x) { pass++; mark[x] = pass; int id = 0; for (int i : a...
#include <bits/stdc++.h> using namespace std; int tree[2000005] = {0}, num[500005] = {0}, dp[500005] = {1}; void modify(int index, int l, int r, int ql, int qr, int v) { if (ql <= l && qr >= r) { tree[index] = v; return; } int mid = (l + r) >> 1; if (ql <= mid && qr >= l) modify(index ...
// (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...
/** * 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; map<pair<long long, long long>, long long> mp; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m; cin >> n >> m; for (long long i = 0; i < m; i++) { long long a, b; cin >> a >> b; a--; ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1 << 28; const long long LINF = 1ll << 61; inline long long getnum() { register long long r = 0; register bool ng = 0; register char c; c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); if (c == - )...
#include <bits/stdc++.h> using namespace std; const int max_n = 1000, max_k = 100; int dp[max_n][max_k]; int p[max_n + 5]; int main() { int n, k, mod; cin >> n >> k >> mod; p[0] = 10 % k; for (int i = 0; i < n; i++) p[i + 1] = p[i] * 10 % k; memset(dp, 0, sizeof dp); for (int dig = 1; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2014 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", ...
#include <bits/stdc++.h> using namespace std; int t, n; char s[505050]; int a[1 << 20], b[1 << 20]; const int L = 20, FN = (1 << L); int rev[FN]; const long double pi = 3.1415926535897932384626433832795028841971l; const long double two_pi = pi * 2; struct cp { long double x, y; cp() {} cp(...
/** * 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 into the Public Domain, for any use, // without warranty, 2012 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Test: tri t; bufif1 (t, ...
#include <bits/stdc++.h> #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; template <class T> using vec = std::vector<T>; bool __hack = std::ios::sync_with_stdio(false); auto __hack1 = cin.tie(nullptr); struct Input { Input(istream &in) : in(&in) {} tem...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; string str[n]; for (int i = 0; i < n; i++) cin >> str[i]; int brr[m]; for (int i = 0; i < m; i++) cin >> brr[i]; int count = 0; for (int i = 0; i < m; i++) { int arr[5] = {0}; for (int j =...
#include <bits/stdc++.h> using namespace std; template <typename T> void printArray(T arr, int l) { for (int i = 0; i < l; i++) cout << arr[i] << ; cout << endl; } int main(void) { int n, k; cin >> n >> k; vector<int> floors; for (int i = 0; i < n; i++) { int temp; cin >...
// 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 : Mon Feb 13 12:46:39 2017 // Host : WK117 running 64-bit major release (build ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; class matrix { public: int row, col; std::vector<std::vector<int>> num; matrix(int row, int col, int defaultValue = 0) { this->num = std::vector<std::vector<int>>(row, std::vector<int>(col, defaultValue)); ...
#include <bits/stdc++.h> using namespace std; int main() { char dir; cin >> dir; string m; cin >> m; string kboard = qwertyuiopasdfghjkl;zxcvbnm,./ ; if (dir == R ) { for (int i = 0; i < m.length(); i++) { int index = kboard.find(m[i]); cout << kboard[index - 1]; ...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ps/1ps module tb_gcd8; parameter DELAY = 1; parameter NUM_DATA = 6; parameter [7:0] x_data [0:NUM_DATA-1] = {13, 5, 12, 16, 1, 4}; parameter [7:0] y_data [0:NUM_DATA-1] = {5, 13, 16, 12, 4, 1}; integer counter; reg activate_0r; wire activate_0a; reg x_0a; wire x_0r; reg [7:0] x_0d; reg...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; void Read(int &p) { p = 0; char c = getchar(); for (; c < 0 || c > 9 ; c = getchar()) ; for (; c >= 0 && c <= 9 ; c = getchar()) p = p * 10 + c - 0 ; } int n, k; struct Node { long long siz; int mxx[12], mnn[12]; bool opera...
#include <bits/stdc++.h> using namespace std; const int N = 2005; int x[N], y[N], c[N], k[N], f[N]; int s[N], st, tu[N], tv[N]; struct node { int u, v; long long s; bool operator<(const node &p) const { return s < p.s; } } d[N * N + N]; int dis(int a, int b) { return abs(x[a] - x[b]) + abs(y[a...
// (c) Copyright 1995-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 property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; long long n; char str[1000010]; long long cntu[1000010]; long long cntd[1000010]; long long sumu[1000010]; long long sumd[1000010]; long long CNTU; long long CNTD; int main() { scanf( %I64d%s , &n, str + 1); for (long long i = 1; i <= n; i++) { ...