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 la... |
//altera message_off 10230
`timescale 1 ps / 1 ps
module alt_mem_ddrx_burst_tracking
# (
// module parameter port list
parameter
CFG_BURSTCOUNT_TRACKING_WIDTH = 7,
CFG_BUFFER_ADDR_WIDTH = 6,
CFG_INT_SIZE_WIDTH = 4
)
(
// port list
ctl_clk,
ct... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e7 + 1; char used[MAXN] = {0}; int lowest_divisor[MAXN]; int numbers[2][MAXN], numbers2[2][MAXN]; void sieve() { for (int i = 2; i < MAXN; i += 2) { used[i] = 1; lowest_divisor[i] = 2; } for (long long i = 3; i < M... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
function int int123(); int123 = 32'h123; endfunction
function bit f_bit ; in... |
/*
* 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; vector<vector<pair<int, long long> > > g; int n, a[100005]; bool erased[100005]; void dfs(int cur, long long cost, long long minCost) { if (cost - minCost > 1ll * a[cur]) { erased[cur] = 1; return; } for (int i = 0; i < g[cur].size(); i++) ... |
// Computer_System_VGA_Subsystem_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module Computer_System_VGA_Subsystem_avalon_st_adapter #(
parameter in... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except 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... |
// (C) 2001-2017 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... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:51:28 11/07/2015
// Design Name: TopModuleTransfLineal
// Module Name: C:/Users/Camilo/Documents/Xilinx_Workspace/Transflineal/Rot_tst.v
// Project Name: Transfli... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, j, s1 = 1, s2 = 1, d = 0; cin >> n >> m; if (n == 1 && m == 1) { cout << 0 << endl; cout << 1 << << 1 << endl; cout << 1 << << 1 << endl; exit(0); } if (n == 1 && m == 2) { cout << 0 << ... |
#include <bits/stdc++.h> int MakeTB(unsigned int *A, unsigned int *B, unsigned int *T, unsigned int N, unsigned int StartBit) { for (unsigned int i = 0; i < N - 1; i++) if (A[i] == 0) if (B[i] == 0) { if (i > 0 && T[i] != 0) return 0; T[i] = 0; T[i + 1] = 0... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long int LINF = 0x3f3f3f3f3f3f3f3fll; int g; bool endswith(string a, string b) { if ((int)((a).size()) < (int)((b).size())) return 0; for (int i = 0; i < (int)((b).size()); i++) if (a[(int)((a).size()) - 1 - i] ... |
/*
* Check declarations and repeat declarations in nested modules.
*/
timeunit 100us;
timeprecision 1us;
// A local time unit is OK.
module check_tu_nest;
timeunit 10us;
module nested;
timeunit 100us;
timeunit 100us;
endmodule
timeunit 10us;
endmodule
// A local time precision is OK.
module check_tp... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9; const long long MD = 1e9 + 7; const double pi = acos(-1); struct segmentTree { long long tl = 1, tr = (1ll << 21); segmentTree* left = nullptr; segmentTree* right = nullptr; long long val = 0; segmentTree(long long tl... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> r; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; r.push_back(tmp); } int m_lng = 0; for (int i = 0; i < n; i++) { int cnt = 1; int lng = 0; int sum = 0; ... |
#include <bits/stdc++.h> using namespace std; long long int i, j, ft; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int n; cin >> n; vector<long long int> v[n]; for (i = 0; i < (n - 1); i++) { long long int b, c; cin >> b >> c; v[b - 1].push_back(c - 1)... |
#include <bits/stdc++.h> using namespace std; int vis[5][5]; int ac[5][5], bc[5][5]; pair<int, int> sum[100]; pair<int, int> cal(int a, int b) { if (a == 1) { if (b == 1) return pair<int, int>(0, 0); else if (b == 2) return pair<int, int>(0, 1); return pair<int, int>(1, 0... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Park_Transform.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ----------------------------------------------------... |
// -- (c) Copyright 2010 - 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... |
#include <bits/stdc++.h> using namespace std; int need, e; int mat[128][128]; bool found; int add; int v; int main() { memset(mat, 0, sizeof mat); cin >> need; e = 0; while (e < need) { found = false; for (int i = 1; i <= v && found == false; i++) for (int j = i + 1; j ... |
(*
Copyright © 2006-2008 Russell O’Connor
Permission is hereby granted, free of charge, to any person obtaining a copy of
this proof and associated documentation files (the "Proof"), to deal in
the Proof without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, subl... |
/**
* 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; template <class T> void read(T &x) { int f = 0; x = 0; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) f |= (ch == - ); for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; if (f) x = -x; } const int N = 20, mod = 998244353... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, w; string s; cin >> t; while (t--) { cin >> n >> s; bool flag = 0; if (n % 2) { for (int i = 0; i < n; i += 2) { if ((s[i] - 0 ) % 2) { flag = 1; break; } ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int MAXN = 1000010; int get() { int x; bool f = 0; char c; while (!isdigit(c = getchar())) if (c == - ) f = 1; x = c - 48; while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - 48; if (f) ... |
#include <bits/stdc++.h> using namespace std; using std::bitset; const double Pi = acos(-1); namespace fastIO { template <class T> inline void read(T &x) { x = 0; bool fu = 0; char ch = 0; while (ch > 9 || ch < 0 ) { ch = getchar(); if (ch == - ) fu = 1; } while (ch <... |
#include <bits/stdc++.h> using namespace std; int n, kov = 1; int t[502][502]; void ert(int a, int b) { t[a][b] = kov, kov++; } int main() { cin >> n; if (n <= 2) { cout << -1 << n ; return 0; } if (n == 3) { cout << 1 << << 3 << << 2 << n ; cout << 5 << ... |
#include <bits/stdc++.h> using namespace std; int buff1, buff2; void solution(vector<int> v) { map<int, int> counter; for (int n : v) counter[n]++; vector<int> counts; for (auto it : counter) { counts.push_back(it.second); } sort(counts.begin(), counts.end(), greater<int>()); int... |
#include <bits/stdc++.h> using namespace std; int n, sol; multiset<int> S; multiset<int>::iterator p; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { int val; scanf( %d , &val); S.insert(val); } long long s = 0; for (int i = 1; i <= n; i++) { p = S.lowe... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x * 10) + (ch - 0 ); ch = getchar(); } ... |
/**
* 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<int> graph[123490]; bool attacked[123490], visited[123490]; int n, m, parent[123490]; int dist, last; void dfs(int u, int depth) { if (attacked[u]) { if (dist < depth) { dist = depth; last = u; } else { if (dist == ... |
module TBCTRL (
input HRESETn,
input HCLK,
// input
input HREADYin,
input HREADYout,
input HWRITEin,
input HWRITEout,
input HSEL,
input HGRANT,
// Output
output MAPSn,
output MDPSn,
output DENn,
output SDPSn,
output SRSn
);
// Master
wire MasterReadData;
wire SlaveAddrPhaseSel;
wire Mas... |
#include <bits/stdc++.h> using namespace std; struct UnionFind { int n; vector<int> p, rank; int findSet(int i) { return (p[i] == i ? i : (p[i] = findSet(p[i]))); } bool isSameSet(int i, int j) { return (findSet(i) == findSet(j)); } void unionSet(int i, int j) { if (!isSameSet(i, j)) { ... |
/*
verilog cpu module.
*/
`include "defines.v"
module millcpu(
input wire clk, rst,
input wire [`REGW-1:0] ins,
output wire mem_we,
output wire [`REGW-1:0] paddr, mem_waddr, mem_wdata
);
wire gr_we, pc_we, pc_ie, zf;
wire [`STGW-1:0] cs;
wire [`REGO-1:0] gr_raddr1, gr_raddr2, gr_waddr;
wire [`RE... |
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(T a) { return a * a; } #pragma comment(linker, /STACK:16777216 ) int n; char s[105]; string str; int main() { gets(s); str = s; n = strlen(s); for (int i = n - 1; i > 0; --i) for (int j = 0; j <= n - i; +... |
#include <bits/stdc++.h> using namespace std; int main() { string a; cin >> a; long long int x = a.length(); std::vector<long long int> v; long long int c = 0; long long int d = 0; for (long long int i = 0; i < x; i++) { if (a[i] == b ) { d++; } if (a[i] == a ... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
//
// (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected und... |
#include <bits/stdc++.h> using namespace std; int main() { long int n; cin >> n; int event, police = 0, ans = 0; for (int i = 0; i < n; i++) { cin >> event; if (event == -1) { if (police == 0) ans++; else police--; } else police += event;... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: cpu_dma_queue.v
// Project: NF2.1
// Description:
// a slim CPU rx_fifo and tx_fifo connecting to the DMA interface
//
// Note that both rx_f... |
/**
* 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) 2002 Michael Ruff (mruff at chiaro.com)
//
// 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... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int pos[n + 1]; for (int i = 0; i < n; i++) { int x; cin >> x; pos[x] = i; } int curIndex = 0; for (int i = 0; i < n; i++) { int x; cin >... |
/**
* 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... |
module FBModule(
input clk,
input store_strb,
input [1:0] sel,
input signed[12:0] ai_in,
input signed [12:0] aq_in,
input signed [12... |
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define ll unsigned int #define endl n #define mp make_pair #define hcf __gcd #define test cout<< hello ;... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t ();
// See also t_math_width
// This shows the uglyness in width warnings across param modules
// TODO: Would be nice to also show relevant ... |
#include <bits/stdc++.h> using namespace std; int main() { int l; cin >> l; string s; cin >> s; if (l < 26) { cout << NO n ; return 0; } int f[26] = {}; for (int i = 0; i < l; i++) f[tolower(s[i]) - a ]++; for (int i = 0; i < 26; i++) if (f[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 k; long long int m, lim = 2e18; long long int dp[70][70][2]; long long int solve(string s, int pos, int k, bool f) { if (k < 0) return 0; if (pos == (int)s.size()) { return (k == 0); } if (dp[pos][k][f] != -1) return dp[pos][k][f]; lo... |
/*
* 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; bool con = false; for (int i = 1; i < 32000; i++) { double M = 2 * n - i * (i + 1); double k = (-1.0 + sqrtl(1 + 4 * M)) / 2.0; if (k <= 0) break; if (abs((long long int)k - k) <= 1e-9) { con ... |
`include "macros.vh"
////////////////////////////////////////////////////////////////////////////////////////////////////
// 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
// ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:26:48 02/11/2016
// Design Name:
// Module Name: GameLoader
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
module top;
reg pass = 1'b1;
reg in;
wire bf1, bf2, nt1, nt2, pd1, pd2, pu1, pu2;
initial begin
// $monitor(bf1, bf2,, nt1, nt2,, pd1, pd2,, pu1, pu2,, in);
if (bf1 !== 1'bx && bf2 !== 1'bx) begin
$display("Buffer failed, expected 2'bxx, got %b%b", bf1, bf2);
pass = 1'b0;
end
if (nt... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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)
// ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &x) { x = 0; char ch = getchar(); int fh = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) fh = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getcha... |
#include <bits/stdc++.h> using namespace std; int main() { long long ans = 0; int n, m, k = 0; scanf( %d %d , &n, &m); vector<int> v(1e7); for (int i = 0; i < n; i++) { scanf( %d , &k); ans += v[(k ^ m)]; v[k]++; } printf( %I64d , ans); } |
#include <bits/stdc++.h> using namespace std; struct dd { int k1; char k2; } a[25000]; bool cmp(struct dd q, struct dd b) { return q.k1 > b.k1; } int main() { int i, j, m, n, sum; char b[1000]; gets(b); sum = 0; char k = a ; scanf( %d , &m); for (i = 0; i < 26; i++) { ... |
#include <bits/stdc++.h> using namespace std; set<string> S; string line[1010], a[1010], s; int n = 0, ans = 0, file = 0; int main() { while (getline(cin, s)) line[++n] = s; for (int i = 1; i <= n; i++) { int cur = 0; a[i] = ; for (int j = 0; j < line[i].size(); j++) { a[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int a; long long x[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472,... |
/**
* 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 MX = 1234567; const double PI = acos(-1.0), EPS = 1e-9; long long N, arr[MX]; long long gcd(long long a, long long b) { while (a > 0 && b > 0) { if (a > b) a %= b; else b %= a; } return a + b; } int main() { ... |
// wasca_mm_interconnect_0_avalon_st_adapter_004.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 193
`timescale 1 ps / 1 ps
module wasca_mm_interconnect_0_avalon_st_adapter_004 #(
parameter inBits... |
#include <bits/stdc++.h> using namespace std; int c[105], sum[105]; pair<int, int> p[105]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &c[i]); sum[i] = sum[i - 1] + c[i]; } int st = 1, tot = 0; for (int i = 1; i <= n; i++) { if (sum[i... |
#include <bits/stdc++.h> using namespace std; long long power(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; x = (x * x) % p; } return res; } int main() { cin.tie(0); cout.tie(0); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string p( / ), t; while (n--) { string foo; cin >> foo; if (foo == pwd ) { cout << p << endl; } else { string dir; cin >> dir; dir += / ; for (int i = 0; i < ... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } int power(int a, int b, int m, int ans = 1) { for (; b; b >>= 1, a = 1LL * 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... |
module memory_tb;
// Constants
parameter data_width = 32;
parameter address_width = 32;
parameter depth = ;
parameter bytes_in_word = 4-1; // -1 for 0 based indexed
parameter bits_in_bytes = 8-1; // -1 for 0 based indexed
parameter BYTE = 8;
parameter start_addr = 32'h80020000;
// Input Ports
reg clock;
reg [address_... |
#include <bits/stdc++.h> using namespace std; const long long N = 810000; inline long long read() { long long s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = (s << 3) + (s << 1) + (c... |
/*
File: synchronizer.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 Free Softwar... |
//i2s_controllerv
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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 right... |
/*
* 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, potezi = 1, bodovi = 0; scanf( %d , &n); pair<int, int> a[n]; for (int i = 0; i < n; i++) { scanf( %d %d , &a[i].second, &a[i].first); } sort(a, a + n); for (int i = n - 1; i >= 0; i--) { if (!potezi) break; ... |
#include <bits/stdc++.h> using namespace std; long long getmax(long long arr[]) { long long m = 0; for (long long i = 0; i < 26; i++) { m = max(m, arr[i]); } return m; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m; cin >> n >> ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e6 + 10; int n, k, count1; int a[MAX]; int res = 1e19 + 10; int binary_search1(int x, int l, int r) { int res = 0; while (l <= r) { int mid = (l + r) >> 1; if (a[mid] <= x) { res = mid; l = mid + 1; } el... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } int power(int a, int b, int m, int ans = 1) { for (; b; b >>= 1, a = 1LL * a *... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; long long f[N]; const int mod = 1000000007; int main() { string s; cin >> s; s += , ; long long ans = 1; int l = s.size(); f[0] = 1, f[1] = 1, f[2] = 2; for (int i = 3; i <= l; i++) f[i] = (f[i - 1] + f[i - 2]) % ... |
#include <bits/stdc++.h> using namespace std; const int Mod = 1e9 + 7; int main() { long long N, M, ans = 0, Last = 0; scanf( %I64d%I64d , &N, &M); long long Min = min(N, M); for (long long i = 1, j; i <= Min; i = j + 1) { j = min(N / (N / i), M); long long tmp; if (j & 1LL) ... |
#include <bits/stdc++.h> using namespace std; int getsum(string st) { int rest = 0; for (int i = 0; i < st.size(); i++) { rest += st[i] - 0 ; } return rest; } string streverse(string st) { for (int i = 0; i < st.size() / 2; i++) { char tmp = st[i]; st[i] = st[st.size() - 1... |
/*******************************************************************************
* 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 ... |
/**
* 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 long long int inf = 1000000000000000; string s; vector<long long> prim; set<long long> prim2; void primeFactors(int n) { while (n % 2 == 0) { prim.push_back(2); prim2.insert(2); n = n / 2; } for (int i = 3; i <= sqrt(n); i = i... |
#include <bits/stdc++.h> const long long N = 50050; const long long Q = 2e18; const long long mod = 1e9 + 7; const long long MAGIC = 30; using namespace std; int a, b, c, n; void solve() { cin >> a >> b >> c >> n; if (a + b - c >= n || c > a || c > b) { cout << -1 << n ; } else { ... |
/**
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, dist1, dist2; char ch[3], a; ch[0] = getchar(); a = getchar(); ch[2] = getchar(); cin >> n; n = n % 4; if (n == 1 && ((ch[0] == ^ && ch[2] == > ) || (ch[0] == > && ch[2] == v ) || (ch[0] ==... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
#include <bits/stdc++.h> using namespace std; struct Q { int r1, r2, c1, c2, idx; }; int n, m, k, q; Q qs[200001]; vector<int> qAtRow[100001]; vector<int> qAtCol[100001]; vector<int> atCol[100001]; vector<int> atRow[100001]; bool must[200000]; bool res[200000]; int v[100001]; int Z = 40000... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; string s; cin >> s; int x = 0, y = 0, pos = 0, coin = 0; if (s[0] == R ) x++; else y++; if (y > x) pos = 2; if (x > y) pos = 1; fo... |
#include <bits/stdc++.h> using namespace std; const int ALPH = z - a + 1; const int W = 1000 * 1000; const int MOD = 1000 * 1000 * 1000 + 7; template <typename T> vector <int> computePrefPref(const T &s) { int n = s.size(); vector <int> res(n + 1, 0); int i = 1,... |
#include <bits/stdc++.h> using namespace std; int ins[300]; struct Rec { int n, p; int a[10]; } st[1000000]; void Print(int now) { int i, j, x, pre, ret; if (now == 0) return; pre = st[now].p; ret = st[now].a[st[now].n - 1]; for (i = 0; i < st[pre].n; i++) for (x = 2; x <= 8;... |
#include <bits/stdc++.h> using namespace std; int n, m, v[1005], xi, yi; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , &v[i]); int res = 0; while (m--) { scanf( %d %d , &xi, &yi); xi--, yi--; res += min(v[xi], v[yi]); } printf( %d n , res); ... |
//-----------------------------------------------------------------------------
// system_v_vid_in_axi4s_0_wrapper.v
//-----------------------------------------------------------------------------
(* x_core_info = "v_vid_in_axi4s_v2_01_a" *)
module system_v_vid_in_axi4s_0_wrapper
(
vid_in_clk,
rst,
vid_d... |
///////////////// ** reset_ctrl ** //////////////////////////////////////////
//
// This module is clocked at 40MHz. It waits for a trigger pulse synchronous to
// 40MHz before initiating one of two reset routines
//
// idelay_rst_trig causes a reset of the idelayctrl and idelay instances. The idelayctrl
// is has it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.