text stringlengths 59 71.4k |
|---|
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: five_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; long long int mod(long long int x) { return (((x) % 1000000007) + 1000000007) % 1000000007; } long long int mod1(long long int x, long long int m) { return (((x) % m) + m) % m; } long long int solve() { string s; cin >> s; long long int d = c... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; const int p = 257; const long long mods = 1610612741; const int maxn = 200010; long long hash1[maxn][2]; int cntzero[maxn]; char s[maxn]; int N; long long pp[maxn]; void gethash(char s[]) { hash1[0][0] = 0; hash1... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; int lca[400100][20]; int len[400100]; long long s[400100][20]; int w[400100]; int main() { ios::sync_with_stdio(false); int Q; cin >> Q; int cnt = 0; int last = 0; len[0] = 1; for (long long q = 0; q < (l... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> deg(n), s(n); for (int i = 0; i < n; i++) cin >> deg[i] >> s[i]; vector<pair<int, int>> edges; queue<int> q; for (int i = 0; i < n; i++) if (deg[i] == 1) q.push(i); while (!q.empty()) { ... |
/*
* 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... |
//
// .. hwt-autodoc::
//
module FsmExample (
input wire a,
input wire b,
input wire clk,
output reg[2:0] dout,
input wire rst_n
);
reg[1:0] st = 0;
reg[1:0] st_next;
always @(st) begin: assig_process_dout
case(st)
0:
dout = 3'b001;
... |
/**
* 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 Abs(int x) { if (x < 0) return -x; return x; } int N, M, K; bool no[2001][2001] = {false}, visited[2001] = {false}, rooted[2001] = {false}, notgo[2001]; vector<int> G[2001], g[2001]; int cn = 0; bool run = true; void dfs(int r) { if ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, l; cin >> n >> l; vector<int> a(n, 0), b(n, 0); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; if (n == 1) cout << YES n ; el... |
#include <bits/stdc++.h> using namespace std; int n; long long m; int soln[51]; long long mr = 0; int main() { cin >> n >> m; --m; for (int k = 1; k < n; ++k) { mr = mr * 2 + (m & 1); m >>= 1; } int i = 1, j = n; for (int k = 1; k <= n; ++k) { if (mr & 1) so... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { int n, k, temp; cin >> n >> k; set<int> s; for (int i = 0; i < n; i++) { cin >> temp; s.insert(temp); } set<int>::reverse_iterator it; int count = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int a, b, c, m; int flag = 0; int c1 = 0, c2 = 0, c3 = 0; int t; cin >> a >> b >> c >> m; t = 0; for (int i = min(c, m); i <= 2 * c && i <= 2 * m; i++) ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Transform_dq_to_ABC.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -----------------------------------------------... |
#include <bits/stdc++.h> using namespace std; template <typename T> T BigMod(T b, T p, T m) { if (p == 0) return 1; if (p % 2 == 0) { T s = BigMod(b, p / 2, m); return ((s % m) * (s % m)) % m; } return ((b % m) * (BigMod(b, p - 1, m) % m)) % m; } template <typename T> T ModInv(T ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, ind, sum = 0; cin >> n; long long mas[n]; for (long long i = 0; i < n; i++) { cin >> mas[i]; sum += mas[i]; } cin >> m; long long arr[m]; sort(mas, mas + n); for (long long i = 0; i < m; i++) {... |
//Legal Notice: (C)2015 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long x, y, z; scanf( %d , &n); for (int i = 1; i <= n; i++) { long long ans = 0; scanf( %lld%lld , &x, &y); if (x >= y) { ans += y; printf( %lld n , ans); continue; } long lon... |
#include <bits/stdc++.h> using namespace std; int n; int s[220]; int d[220]; int sol[220]; vector<pair<int, int> > v; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; cin >> n; for (int(i) = (0); (i) < (n); (i)++) cin >> s[i] >> d[i]; for (int(i) = (0); (i) < (n); (i)++) { ... |
/*
File: ewrapper_link_receiver.v
This file is part of the Parallella FPGA Reference Design.
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
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 Fr... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long N = 1e6 + 5; const long long inf = 1e18; long long powermod(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; ... |
// (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> using namespace std; struct node { int h, w, r; } edge[110]; bool vis[11]; int x[5000000]; int n, k, t; void init() { cin >> n >> k >> t; for (int i = 1; i <= k; i++) cin >> edge[i].h >> edge[i].w >> edge[i].r; } void solve() { int l = 0; for (int 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { double n, a, d, t, v; cin >> n >> a >> d; double minitime = 0; for (int i = 0; i < n; i++) { cin >> t >> v; double t1 = v / a; double s = a * 0.5 * t1 * t1; if (s > d) { t += sqrt(2 * d / a); } else { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; while (cin >> n) { string x; cin >> x; long long c = 0; long long arr[n + 5]; memset(arr, 0, sizeof(arr)); for (long long i = 0; i < n; i++) { if (x[i] == < ) { if ((i - 1) < 0 || a... |
#include <bits/stdc++.h> using namespace std; const int N = 2000 + 11; const int MOD = 1e9 + 7; int dp[N][2][2][N]; int m, d; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> m >> d; string s1, s2; cin >> s1 >> s2; s1 = . + s1; s2 = . + s2; d... |
#include <bits/stdc++.h> using namespace std; const int N = 10000000; bool f[N] = {1, 1}; long long p, q, rub, primepi, res; long long rev(long long x) { long long res; for (res = 0; x; x /= 10) { res = res * 10 + x % 10; } return res; } int main() { cin >> p >> q; for (long ... |
#include <bits/stdc++.h> int const N = 1100; int n, m, ans, ans1; int map[N][N]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) map[i][j] = -1; for (int i = 1; i <= n; ++i) { int x; scanf( %d , &x); for (int j = 1; j <= x; ++j) ... |
#include <bits/stdc++.h> using namespace std; int chk[300004][3]; int visit[300004]; vector<int> vec[300004]; vector<pair<int, int>> vecp; void dfs(int x) { visit[x] = 1; for (int i = 0; i < vec[x].size(); i++) { if (visit[vec[x][i]] == 0) { dfs(vec[x][i]); chk[x][0] += chk[vec... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, m, k; cin >> n >> m >> k; map<long long, long long> cnt1, cnt2; vector<long long> a(n), b(m); for (long long i = 0; i < n; i++) { cin >> a[i]... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> using namespace std; const int N = 301; int i, j, l, r, k, x, y, z, t, tot; int f[N][26], sum[N], p[N], q[N]; long long A[N][N], E[N][N], tmp[N][N]; long long n, m, a[N], INF, ans; char s[N]; void build(int value) { int x = 0, t; for (int i = 0; i < strlen(s); i++) { ... |
module dff0_test(n1, n1_inv, clk);
input clk;
output n1;
reg n1 = 32'd0;
output n1_inv;
always @(posedge clk)
n1 <= n1_inv;
assign n1_inv = ~n1;
endmodule
module dff1_test(n1, n1_inv, clk);
input clk;
(* init = 32'd1 *)
output n1;
reg n1 = 32'd1;
output n1_inv;
always @(posedge clk)
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; int vis[maxn], p[maxn]; int plen; void prime() { memset(vis, 0, sizeof(vis)); plen = 0; for (int i = 2, k = 4; i < maxn; ++i, k += i + i - 1) { if (!vis[i]) { p[plen++] = i; if (k < maxn) { for (in... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 1010, Maxm = 20; const unsigned long long Seed = 19990213; const long long Mod = 1000000007; int n, m, cnt, tot1, fst1[Maxn], pre1[Maxn << 1], to1[Maxn << 1], tot2, fst2[Maxm], pre2[Maxm << 1], to2[Maxm << 1], bel[Maxm], tot[Maxm], sta... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int i, j, n, s = 0, c = 0, x, k, y, m, z, ans = 0; cin >> n >> m; cin >> x >> z >> y; vector<long long int> a(n), b(m); for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < m; i++) { cin >> b[i]; }... |
#include <bits/stdc++.h> using namespace std; int N; struct node { int val, pos; } A[2005]; int res[2005]; int cmp1(node a, node b) { return a.val > b.val; } int main() { A[0].val = 0x7fffffff; cin >> N; for (int i = 1; i <= N; i++) { scanf( %d , &A[i].val); A[i].pos = i; }... |
#include <bits/stdc++.h> using namespace std; int read() { char ch = getchar(); int x = 0; while (ch < 0 || ch > 9 ) ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return x; } const int maxn = 2e5 + 5, inf = 1e9; struct Data { int next, to, w; ... |
module note_pitch2dds(CLK, NOTE, PITCH, ADDER);
input wire CLK;
input wire [6:0] NOTE;
input wire [13:0] PITCH;
output reg [31:0] ADDER;
reg [32:0] ADDER_sum;
reg [7:0] ADDER_mul;
reg [3:0] state;
reg [6:0] NOTE_local;
reg [13:0] PITCH_local;
initial begin
NOTE_local <= 7'd0;
PITCH_local <= 14'd08192; // 0 - pit... |
/*
* Wishbone asynchronous bridge with slave register slice
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Softwa... |
/**
* 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: 15:10:55 03/06/2016
// Design Name:
// Module Name: mult4
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
/**
* 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> const int N = 3e5 + 10; const int mod = 1e9 + 7; int n; std::vector<int> edge[N]; std::pair<int, int> v[N]; int q; std::pair<int, int> query[N]; int queue[N]; std::pair<int, int> range[N]; int father[N]; int degree[N]; int fastPower(int x, int y) { int ret = 1; f... |
/******************************************************
A fifo controller verilog description.
******************************************************/
module fifo(datain, rd, wr, rst, clk, dataout, full, empty);
input [7:0] datain;
input rd, wr, rst, clk;
output [7:0] dataout;
output full, empty;
wire [7:... |
#include <bits/stdc++.h> using namespace std; const int maxk = 50, maxn = 100; int k, x, n, m; inline int calc(int x, int y) { if (!x && y == 2) return 1; return 0; } struct node { long long c1[2], c2[2][2]; bool h, t; node operator+(const node &Other) const { node N = {}; N.... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 07/02/2016 03:58:56 PM
// Design Name:
// Module Name: FSM_Convert_Fixed_To_Float
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename TT> ostream& operator<<(ostream& out, pair<T, TT> t) { return out << ( << t.first << , << t.second << ) ; } template <typename T> ostream& operator<<(ostream& out, vector<T> t) { for (int i = 0; i < ((int)(t).size()); ... |
#include <bits/stdc++.h> using namespace std; int n, k, a[100009], dau, cuoi, d[100009], c[100009], Res; string st; void Input() { cin >> n >> k >> st; for (int i = 0; i < n; ++i) { a[i + 1] = st[i] - a ; } } void Solve() { dau = 1; cuoi = 1; d[0] = 0; c[0] = 0; while ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 10; int n, k; int a[MAXN], f[MAXN]; int bsL(int l, int r, int val) { int pos = -1; while (l <= r) { int mid = (l + r) >> 1; if (a[mid] >= val) { pos = mid; r = mid - 1; } else l = mid + 1; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10, mod = 998244353; int mu[maxn], n, m, l[51], r[51], prime[maxn], cnt; bool is_composite[maxn]; int dp[maxn], pre[maxn]; int cal(int d) { int M = m / d; for (int i = 1; i <= M; i++) dp[i] = 0; dp[0] = 1; for (int i = 1; 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,... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n; long long p[200002], i[200002], v[200002], lvl[200002], ans; vector<int> G[200002]; void dfs(int x, int par) { if (par) lvl[x] = lvl[par] + 1; for (auto it : G[x]) { if (it == par) continue; dfs(it, x); a... |
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2006 Xilinx, Inc.
// This design is confidential and proprietary of Xilinx, All Rights Reserved.
//////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; vector<pair<long long, long long> > g[N]; int n, m; stack<int> st; bool inStack[N]; int cmp[N], ind[N], low[N], cnt, cont; void dfs(int x) { ind[x] = low[x] = cnt++; st.push(x); inStack[x] = true; for (int i = 0; i < g[... |
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 29; int main() { ios::sync_with_stdio(0); int n; cin >> n; int a[n]; for (int i = 0; i < (n); i++) cin >> a[i]; int b[n]; for (int i = 0; i < (n); i++) cin >> b[i]; set<int> rem; int top = 0; for (int i = 0;... |
//----------------------------------------------------------------------------
// Copyright (C) 2015 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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> hl(n, -1); vector<pair<pair<int, int>, int>> v(n); for (int i = (0); i < (n); i++) { cin >> v[i].first.first >> v[i].first.second; ... |
#include <bits/stdc++.h> using namespace std; const int N = 21; void solve() { int n, x; cin >> n; vector<int> cnt(N, 0); for (int i = 0; i < n; i++) { cin >> x; for (int j = 0; j < N; j++) { if (x >> j & 1) cnt[j]++; } } long long ans = 0; for (int i = 0; i <... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n; cin >> a >> b >> n; bool aa = 0, bb = 1; if (a < b) swap(a, b), swap(aa, bb); for (int i = 0; i < a - (n + 1) / 2 - (n % 2 == 0); i++) cout << aa; for (int i = 0; i < (n + 1) / 2; i++) cout << aa << bb; for (int i = ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000; int centroid[maxn]; int parent[maxn]; int subtree[maxn]; int heaviest[maxn]; vector<int> graph[maxn]; void dfs(int u, int p = 0) { parent[u] = p; subtree[u] = 1; heaviest[u] = 0; int vert = 0; for (auto v : graph... |
#include <bits/stdc++.h> using namespace std; const int kN = 2e5 + 10; int N, M; struct Ele { long long len; char c; void read() { len = 0; char s[30]; scanf( %s , s); for (int i = 0; s[i]; i++) { if (s[i] == - ) { c = s[i + 1]; break; } e... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3005; const double PI = acos(-1); struct Point { ll x, y; }; inline Point operator+(const Point &a, const Point &b) { return {a.x + b.x, a.y + b.y}; } inline Point operator-(const Point &a, const Point &b) { ... |
/*============================================================================
This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point
Arithmetic Package, Release 1, by John R. Hauser.
Copyright 2019 The Regents of the University of California. All rights
reserved.
Redistribution an... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 + 10; int n, d[MAXN], id[MAXN]; bool b[MAXN][MAXN]; bool cmp(int a, int b) { if (d[a] > d[b]) return true; if (d[a] < d[b]) return false; return a < b; } int main() { scanf( %d , &n); if (n == 4) puts( -1 ), exit(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... |
/**
* 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, x; cin >> n >> x; int cnt = 0; for (int j = 1; j * j <= x; j++) { if (x % j == 0) { if (j <= n && x / j <= n) { if (j * j == x) cnt++; else cnt += 2; } } } ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; const int INF = 1000000000; int n, m, numV; int head[MAXN], e_cnt, s, t; bool volunt[MAXN]; struct Edg { int v, next; } edg[MAXN * 4]; inline void add(int a, int b) { edg[e_cnt].v = b; edg[e_cnt].next = head[a]; hea... |
#include <bits/stdc++.h> const int inf = (1ll << 30) - 1; const int maxn = (int)1e5 + 10; using namespace std; int n; vector<int> g[100100]; int a[100100]; int in[100100]; int out[100100]; int dp[100100]; map<int, int> t[400400]; int timer = 0; void dfs(int v) { in[v] = timer; a[timer] =... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double eps = 1e-9; const int inf = 2000000000; const long long infLL = 9000000000000000000; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin >> n; string second; ci... |
#include <bits/stdc++.h> void swap(int *, int *); int main() { int i, j, k; int n; scanf( %d , &n); int arr[n]; for (i = 0; i < n; i++) { scanf( %d , &arr[i]); } int limit = n / 2; for (i = 0; i < limit; i++) { if (i % 2 == 0) { swap(&arr[i], &arr[n - i - 1]); ... |
#include <bits/stdc++.h> using namespace std; void read(int &x) { x = 0; int f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -f; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; x *= f; } void print(int x) { if (x < 0) putchar( - ),... |
// (c) Copyright 1995-2017 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; int main() { long long n, i, tmp_ara1, tmp_ara2; vector<long long> ara1(2000007, -1), ara2(2000007, -1), ans(200007, -1), in_front; cin >> n; for (i = 1; i <= n; i++) { cin >> tmp_ara1 >> tmp_ara2; ara1[tmp_ara1] = tmp_ara2; ara... |
#include <bits/stdc++.h> using namespace std; int main() { int m, n; scanf( %d%d , &m, &n); int t[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) scanf( %d , &t[i][j]); } int latest[m]; fill(latest, latest + m, 0); for (int i = 0; i < n; i++) { for (int j... |
// -*- Mode: Verilog -*-
// Filename : test_tools.v
// Description : Tools to help with test cases
// Author : Philip Tracton
// Created On : Wed May 27 21:11:18 2015
// Last Modified By: Philip Tracton
// Last Modified On: Wed May 27 21:11:18 2015
// Update Count ... |
#include <bits/stdc++.h> int vi[60], ho[60]; int main() { int n, k, i; int x, y; scanf( %d , &n); for (k = 1; k <= n * n; k++) { scanf( %d%d , &x, &y); if (vi[x] || ho[y]) continue; vi[x] = 1; ho[y] = 1; printf( %d , k); } } |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, k, l; cin >> n >> i >> j >> k >> l; int man = (abs(k - i) + abs(l - j)); if (i == n && k == 0 || k == n && i == 0) cout << min(man + 2 * min(n - j, n - l), man + 2 * min(j, l)); else if (j == n && l == 0 || l == n && j... |
#include <bits/stdc++.h> using namespace std; int prime[1000100]; void get_prime() { for (int i = 2; i < 1000100; i++) { if (!prime[i]) { for (int j = i * 2; j < 1000100; j += i) { prime[j] = i; } } } for (int i = 2; i < 1000100; i++) { if (!prime[i]) { ... |
#include <bits/stdc++.h> using namespace std; int main() { priority_queue<pair<int, int> > pq1, pq2; int n, w; cin >> n; for (int i = 0; i < n; i++) cin >> w, pq1.push({-w, i}); n <<= 1; for (int i = 0; i < n; i++) { char ch; cin >> ch; pair<int, int> cur; int ret; ... |
#include <bits/stdc++.h> using namespace std; int ans; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) { int k = i ^ j; if (k >= j && k <= n && i + j > k && i + k > j && j + k > i) ans++; } cout << ans; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:52:59 10/11/2013
// Design Name:
// Module Name: FSM_Main
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
/*
-- ============================================================================
-- FILE NAME : gpio.v
-- DESCRIPTION : General Purpose I/O
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito VKì¬
-- =======... |
`timescale 1ns / 1ps
module computer(
`ifdef VERILATOR
input clk,
input reset
`endif
);
wire iack;
wire [63:0] iadr;
wire istb;
wire [31:0] idatiL;
wire [63:32] idatiH; // unused; just to make iverilog happy.
wire [63:0] ddato, ddati, dadr;
wire [1:0] dsiz;
wire dwe, dcyc, dstb, dsigned, dack;
wire [11:0]... |
#include <bits/stdc++.h> using namespace std; long long int n, k, pres[300005], cont[300005]; vector<long long int> fcts[300005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; long long int tot = 0; pres[1] = 1; for (long long int i = 1; i <= n; ++i) for (int... |
#include <bits/stdc++.h> using namespace std; const int N = 105; const int mod = 1e9 + 7; int sub[N][N][N]; int pref[N][N]; int suff[N][N]; int ans[N]; int pw[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, X; cin >> n >> X; string s; cin >> s; s = & + s; ... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[300004]; int n, nr, r, Min, poz, f1, f2, ch1, ch2, sol, soli, sol2, i, j, l, v[300004], m[300004]; char s[300004], b[300004]; bool ok1, ok2; int main() { scanf( %d , &n); scanf( %s , &s); nr = 0; Min = 1000000000; for (... |
#include <bits/stdc++.h> using namespace std; int main() { int c, v0, v1, a, l; cin >> c >> v0 >> v1 >> a >> l; int d = 1; int r = v0; int tmp = v0; while (1) { if (r >= c) break; tmp = tmp + a; if (tmp > v1) tmp = v1; r += (tmp - l); d++; } cout << d <<... |
//////////////////////////////////////////////////////////////////////
//// ////
//// adbg_or1k_status_reg.v ////
//// ////
//// ... |
//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> using namespace std; inline void read(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = (c & 15); while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15); x = v * f;... |
#include <bits/stdc++.h> using namespace std; const int max_N = 2e5 + 10; const int l_N = 20; int st[l_N][max_N]; int lg[max_N]; int inp[max_N]; vector<int> bits[30]; int query_max(int i, int j); int main() { { int j = 0; for (int i = 0; i < max_N; ++i) { while ((1 << j) <= i) ... |
//
// Author: Xiangfu Liu
//
// This is free and unencumbered software released into the public domain.
// For details see the UNLICENSE file at the root of the source tree.
//
// There are 5 registers
// 0x0 R Firmware version
// 0x1 RW Counter enable/disable, enable: 1, disable: 0
// 0x2 RW Counter write enable,... |
// megafunction wizard: %LPM_DIVIDE%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_DIVIDE
// ============================================================
// File Name: sa1_div.v
// Megafunction Name(s):
// LPM_DIVIDE
//
// Simulation Library Files(s):
// lpm
// =======================================... |
/**
* 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: cpx_dp_macc_r.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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.