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... |
// ISP1362.v
// This file was auto-generated as part of a SOPC Builder generate operation.
// If you edit it your changes will probably be lost.
`timescale 1 ps / 1 ps
module ISP1362 (
input wire avs_hc_clk_iCLK, // hc_clock.clk
input wire avs_hc_reset_n_iRST_N, // hc_reset_... |
#include <bits/stdc++.h> int main(void) { int n, i; scanf( %d , &n); for (i = 1; i <= n; i++) { if ((i % 2) != 0) { printf( I hate ); if (i == n) { printf( it ); break; } } else { printf( I love ); if (i == n) { printf( it... |
#include <bits/stdc++.h> const int inf = 0xfffffff; const long long INF = 1ll << 61; using namespace std; int num[1000000 + 5]; int b[1000000 + 5]; int c[1000000 + 5]; int n; int ans; void init() { memset(num, 0, sizeof(num)); memset(b, 0, sizeof(b)); memset(c, 0, sizeof(c)); ans = 0; ... |
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, 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 ... |
#include <bits/stdc++.h> bool pr[3001]; int prm[3001]; using namespace std; void primes() { int i, j; for (i = 0; i < 3001; i++) pr[i] = true; pr[0] = false; pr[1] = false; for (i = 2; i <= sqrt(3000); i++) { if (pr[i]) { for (j = i; i * j <= 3001; j += 1) { pr[i * j]... |
#include <bits/stdc++.h> using namespace std; int main() { pair<int, int> a[555555]; double n, k, t, l = -1, r = 1e12, c, maxx, yes = 0; int i; cin >> n; for (i = 0; i < n; i++) scanf( %d%d , &a[i].first, &a[i].second); for (k = 0; k < 300; k++) { maxx = -1e30; c = (l + r) * 0.5;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, i, c = 0, b; cin >> n; char name[15]; for (i = 0; i < n; i++) { cin >> name; cin >> b >> a; if (b >= 2400 && a > b) c = 1; } if (c == 1) cout << YES << endl; else cout << NO << endl; ... |
#include <bits/stdc++.h> using namespace std; int n; int a[111111], b[111111], ra[111111]; set<pair<int, int> > s; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 0, _n = (int)(n); i < _n; i++) cin >> a[i], a[i]--, ra[a[i]] = i; for (int i = 0, _n = (int)(n); i < _n; i++) cin ... |
#include <bits/stdc++.h> using namespace std; namespace fft { struct num { double x, y; num() { x = y = 0; } num(double x, double y) : x(x), y(y) {} }; inline num operator+(num a, num b) { return num(a.x + b.x, a.y + b.y); } inline num operator-(num a, num b) { return num(a.x - b.x, a.y - b.y); ... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Sun Sep 22 02:35:48 2019
// Host : varun-laptop running 64-bit Service Pac... |
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b; cin >> a >> b; while (1) { if (a >= (2 * b)) { a = a % (2 * b); } else if (b >= (2 * a)) b = b % (2 * a); else break; if ((a == 0 || b == 0)) break; } cout << a << <... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; const long long int INFLL = 1e18 + 10; const long double EPS = 1e-8; const long double EPSLD = 1e-14; const long long int MOD = 1000000007; template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <cl... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; double E = 2.71828182846; double PI = 3.1415926535897932384626433832795; double EPS = 1e-9; const int ROOT = 444; const int MAXN = 300100; const int ROOTN = 555; int n; int gcd(int a, int b) { while (b) { ... |
#include <bits/stdc++.h> using namespace std; string findSum(string str1, string str2) { if (str1.length() > str2.length()) swap(str1, str2); string str = ; int n1 = str1.length(), n2 = str2.length(); reverse(str1.begin(), str1.end()); reverse(str2.begin(), str2.end()); int carry = 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; const int MAXN = 100005; string a, b; int n; int x[MAXN], y[MAXN]; void pre() { int cnt = 0, len = b.size(); for (int i = 0; i < n; i++) { if (cnt == len) continue; if (b[cnt] == a[i]) { x[cnt] = i; cnt++; } } cn... |
#include <bits/stdc++.h> using namespace std; int main() { ifstream in( date.in ); ofstream out( date.out ); long long nr2, k, rez[4001], con = 0, nr, n, pli[4001], plp[4001], inc[4001], i, j; cin >> n; for (i = 1; i <= n; i++) cin >> pli[i] >> plp[i] >> inc[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... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2010 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version : ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1007; long long lcp[MAXN][MAXN]; string s; bool cmp(pair<long long, long long> a, pair<long long, long long> b) { long long l = lcp[a.second][b.second]; long long al = a.second - a.first + 1; long long bl = b.second - b.first + 1; ... |
#include <bits/stdc++.h> using namespace std; const int MOD(1000000007); const int INF((1 << 30) - 1); const int MAXN(); int main() { long long k, b, t; int n; cin >> k >> b >> n >> t; long long z = 1; int num = 0; while (z <= t) { z = z * k + b; num++; } printf( %d... |
#include <bits/stdc++.h> using namespace std; int n, q, p; long long* pt; long long a[200000], k, sum = 0LL; int main() { cin >> n >> q; for (int i = (0); i < (n); i++) { cin >> a[i]; if (i) a[i] += a[i - 1]; } for (int i = (0); i < (q); i++) { cin >> k; sum += k; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<long long int> a(n); vector<long long int> b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b... |
/*************************************************************************
* *
* Copyright (C) 2016,2017 Alves, Fredy. *
* All rights reserved. Email: *
* ... |
/**
* 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> #pragma GCC optimize( Ofast ) #pragma GCC optimize( O3 ) #pragma GCC optimize( O2 ) #pragma GCC optimize( inline ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) using namespace std; const int INF = 1e9 + 7; i... |
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; cout << + ; for (int i = 0; i < 24; i++) cout << - ; cout << + n ; int r1 = (k + 1) / 3; bool enough = 0; int passenegrs = 0; for (int i = 0; i < 27; i++) { if (i == 0 || i == 23 || i == 25) ... |
/**
* 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 err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << endl; err(++it, args...); } const long long mod = pow(10, 9) + 7; const long long 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... |
/////////////////////////////////////////////////////////////////////
//// ////
//// FFT/IFFT 256 points transform ////
//// ////
//// Authors: Anatoliy Sergienko, V... |
#include <bits/stdc++.h> using namespace std; int a, b, res; int check(int a, int b) { return a < b; } int main() { scanf( %d%d , &a, &b); if (a == b) { printf( infinity ); return 0; } res = 0; a -= b; if (a < 0) { printf( 0 ); return 0; } for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > g; vector<int> col; int n, m; void dfs(int v) { int cnt = 0; for (size_t i = 0; i < g[v].size(); i++) if (col[g[v][i]] == col[v]) cnt++; if (cnt > 1) { col[v] ^= 1; for (size_t i = 0; i < g[v].size(); 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... |
module PS_flops_ex_mem_lsu(
in_mem_wr_data,
in_rd_en,
in_wr_en,
in_ld_st_addr,
in_mem_tag,
in_exec_value,
in_gm_or_lds,
out_mem_wr_data,
out_rd_en,
out_wr_en,
out_ld_st_addr,
out_mem_tag,
out_exec_value,
out_gm_or_lds,
clk,
rst
);
input [8191:0] in_mem_wr_data;
input [3:0] in_rd_en;
inp... |
#include <bits/stdc++.h> using namespace std; pair<int, int> _e[600005], ex[600005]; vector<int> ee[600005]; int nt, rr = 0, dn = 1, colnum, dfnn, _enum, nn, mm, n, m, ca, idnum, num, top, hd[600005], dfn[600005], low[600005], instk[600005], a[600005], b[600005], col[600005], dffn[600005], d... |
#include <bits/stdc++.h> using namespace std; vector<int> G[100009]; map<string, int> pr; struct comp { bool operator()(const pair<string, int>& l, const pair<string, int>& r) { return l.second > r.second; } }; int main() { pr[ captain ] = 1; pr[ man ] = 2; pr[ child ] = 3; pr[... |
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; long long mod = 1000000007LL; long long mod2 = 998244353LL; int n, m, k; bool a[1000005]; int main() { cin >> n >> m >> k; memset(a, false, sizeof(a)); for (int i = 1; i <= n; ++i) { int ai; scanf( %d , &ai);... |
#include <bits/stdc++.h> using namespace std; int n, d, ff = 1, bb = 1; long long mx; pair<long long, long long> f[100005]; int main() { scanf( %d%d , &n, &d); for (int i = 1; i <= n; i++) scanf( %d%d , &f[i].first, &f[i].second); sort(f + 1, f + n + 1); for (int i = 2; i <= n; i++) f[i].secon... |
/*
* 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 i; double x, y, n, a, b, rsa, rsb = 1; long long cmmdc(long long a, long long b) { while (a && b) (a > b ? a %= b : b %= a); return a + b; } int main() { ios_base::sync_with_stdio(0); cin >> x >> y >> n; for (b = 1; b <= n; ++b) { a... |
//
// 8192 bytes, 32bit interface
`timescale 1ns/1ps
module next_hop_ram(clk, addr, data_in, data_out, we, en, reset);
input clk;
input [12:2] addr;
input [31:0] data_in;
output [31:0] data_out;
input [3:0] we;
input en;
input reset;
wire [3:0] dip;
RAMB16_S9_altera ram0 (
.address ( addr[12:2] ... |
#include <bits/stdc++.h> using namespace std; struct Node { int id, k; }; const int N = 2e5 + 10; int a[N]; int C[N]; Node b[N]; int n; int lowbit(int x) { return (x & -x); } int sum(int x) { int ret = 0; while (x > 0) { ret += C[x]; x -= lowbit(x); } return ret; } ... |
#include <bits/stdc++.h> using namespace std; void solve() { string s; int first; cin >> s >> first; string w = string(s.length(), w ); for (int i = 0; i < s.length(); i++) { if (s[i] == 0 ) { if (i - first >= 0) w[i - first] = 0 ; if (i + first < s.length()) w[i + first... |
#include <bits/stdc++.h> using namespace std; const int Z = (int)3e3 + 111; const int N = (int)1e6 + 111; const int INF = (int)1e9 + 111; const int MOD = (int)1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string t, ans; cin >> t; int k; if (t.size()... |
`include "defines.v"
`include "HRbridge.v"
`timescale 1ns/1ps
/*module connectRouter_nobuffer
#(parameter addr = 4'b0000) //No. 0 connect router, port 0
(
input `control_w port_l0_i,
output `control_w port_l0_o,
input `control_w FIFO_l0_i,
output `control_w FIFO_l0_o,
input bfull_... |
/*
* 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() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long int n; cin >> n; string s; cin >> s; long long int p = 0, q = 0, t = 0, r = 0, l = 0; for (long long int i = 0; s[i] != 0 ; i++) { if (s[i] ==... |
// -*- Mode: Verilog -*-
// Filename : wb_dump.v
// Description : Dump signals for waveform debugging
// Author : Philip Tracton
// Created On : Wed Dec 2 14:22:59 2015
// Last Modified By: Philip Tracton
// Last Modified On: Wed Dec 2 14:22:59 2015
// Update Coun... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, x; cin >> n >> m; x = m - n; if (x >= 2 && n % 2 == 0) cout << n << << n + 1 << << n + 2 << endl; else if (x >= 3 && n % 2 != 0) cout << n + 1 << << n + 2 << << n + 3 << endl; else ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; vector<long long int> vec(n); for (int i = 0; i < n; i++) { cin >> vec[i]; } sort(vec.begin(), vec.end()); long long int sum = vec[n - 1]; ... |
//Copyright (C) 1991-2003 Altera Corporation
//Any megafunction design, and related netlist (encrypted or decrypted),
//support information, device programming or simulation file, and any other
//associated documentation or information provided by Altera or a partner
//under Altera's Megafunction Partne... |
#include <bits/stdc++.h> using namespace std; int main() { { int s, v1, v2, t1, t2; cin >> s >> v1 >> v2 >> t1 >> t2; int time1, time2; time1 = (s * v1) + (2 * t1); time2 = (s * v2) + (2 * t2); if (time1 < time2) cout << First << endl; else if (time2 < time1) ... |
// file: Clock50MHz_tb.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 no... |
module decoder (cx,d);
output [6:0] d;
input [11:0] cx;
reg [6:0] d;
reg [4:0] s;
reg [11:0] cx1;
parameter s0 = 5'b01110;
parameter s1 = 5'b10000;
parameter s2 = 5'b01000;
parameter s3 = 5'b01111;
parameter s4 = 5'b11010;
parameter s5 = 5'b11011;
parameter s6 = 5'b00000;
parameter s7 = 5'b10000;
para... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; long long i, j, n; int ar[N]; int main() { for (int i = 2; i < N; i++) { for (int j = i + i; j < N; j += i) { ar[j] += j / i; } } cin >> n; long long sum = 0; for (int i = 2; i <= n; i++) sum += ar[i]; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Names: Andrew Camps, Jason Tran
// Create Date: 09/17/2017 05:35:13 PM
// Module Name: CIRCUIT1
//////////////////////////////////////////////////////////////////////////////////
module CIRCUIT4(a, b, c,... |
module t (/*AUTOARG*/
// Inputs
clk, reset_l
);
input clk;
input reset_l;
reg inmod;
generate
if (1) begin
// Traces as genblk1.ingen
integer ingen;
initial $display("ingen: {mod}.genblk1 %m");
end
endgenerate
integer rawmod;
initial begin
begin
integer u... |
//-----------------------------------------------------------------------------
//-- Generacion de baudios
//-- Señal cuadrada, de periodo igual a la frecuencia de los baudios indicados
//-- El ancho del pulso positivo es de 1 ciclo de reloj
//--
//-- (c) BQ. August 2015. written by Juan Gonzalez (obijuan)
//----------... |
//
// 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; int main() { int n; cin >> n; string s; cin >> s; map<char, int> mp; for (char c : s) mp[c]++; cout << 2 * min(mp[ L ], mp[ R ]) + 2 * min(mp[ U ], mp[ D ]) << endl; } |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int N = 3e3 + 4; long long dp[N]; int main() { int n; scanf( %d , &n); vector<pair<int, int>> v(n); for (int i = 0; i < n; i++) scanf( %d , &v[i].first), scanf( %d , &v[i].second); sort(v.begin(), v.end()); ... |
#include <bits/stdc++.h> using namespace std; int q, n; long long s, cur; char str[100100]; int main() { scanf( %lld%d , &s, &q); while (q--) { scanf( %lld , &cur); scanf( %s , str); n = strlen(str); for (int i = 0; i < n; i++) { long long t = 1; while (cur % (t... |
// 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 : Sun May 28 18:34:35 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; void Yahia74() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); } const int N = 3e5 + 74, OO = 0x3f3f3f3f, MOD = (int)1e9 + 7; int main() { Yahia74(); long long n, d; cin >> n >> d; long long ans = n, c = 9, t = 10; while... |
// Copyright (c) 2000-2009 Bluespec, Inc.
// 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, pub... |
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return + s + ; } string to_string(char c) { return + string(1, c) + ; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } template <typename A... |
// $Id: rtr_channel_output.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistrib... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int l = 1, r = 0; int a[MAXN], b[MAXN], now[MAXN], num[MAXN << 1], cnt[MAXN], ans[MAXN]; map<int, int> ms; struct Change { int p, x, y; } c[MAXN]; struct Query { int l, r, t, id; bool operator<(const Query &A) const { ... |
// (C) 2001-2011 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 doc... |
module etx_io (/*AUTOARG*/
// Outputs
txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n, txo_data_p,
txo_data_n, tx_wr_wait, tx_rd_wait,
// Inputs
reset, txi_wr_wait_p, txi_wr_wait_n, txi_rd_wait_p, txi_rd_wait_n,
tx_lclk_par, tx_lclk, tx_lclk_out, tx_frame_par, tx_data_par,
ecfg_tx_enable, ecfg_tx_... |
// (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 ... |
/**
* 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... |
/**
* 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; typedef vector<long long int> vi; typedef vector<vi> vvi; typedef vector<pair<long long int, long long int> > vii; typedef vector<vii> vvii; typedef vector<bool> vb; const long long int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1}; const long long int dx8[] ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a; cin >> n >> a; vector<int> checkpt; for (int i = 0; i < n; i++) { int t; cin >> t; checkpt.push_back(t); } sort(checkpt.begin(), checkpt.end()); long long distance = 0; if (n == 1) { cout << ... |
/**
* 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; const int N = 10; int h[20][20]; long double E[20][20]; bool vis[20][20]; void init() { for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 10; j++) { cin >> h[i][j]; } } } pair<int, int> go_next(int x, int y) { if (x % 2 == ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n; cin >> n; map<int, int> m; long long int a[n]; for (int j = 0; j < n; j++) { cin >> a[j]; m[a[j] % 3]++; } long long int res = m[0]; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: IIT Roorkee
// Engineers: Rohith Asrk, Nitin Sethi, Sri Vathsa, Shashwat Kumar
//
// Create Date: 09:42:40 04/08/2017
// Design Name:
// Module Name: Generation
// Project Name: FPGA Implementa... |
module alu_wb_queue(
in_rfa_queue_entry_serviced,
in_vgpr_dest_data,
in_sgpr_dest_data,
in_exec_wr_vcc_value,
in_vgpr_wr_mask,
in_wfid,
in_instr_pc,
in_vgpr_dest_addr,
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 501010; int n, k; int a[maxn], b[maxn]; long long s; int cnt; priority_queue<pair<int, int> > q; void Check(int d) { s = 0; cnt = 0; for (int i = 1; i <= n; ++i) { q.push(make_pair(d - a[i], 0)); int tmp = b[i] - q.to... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } int main() { long long int n, a, b, t, ans, g; cin >> t >> a >> b; if (a > b) swap(a, b); n = (b / gcd(a, b)); if (n > LLONG_MAX / a) { ... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time ba... |
// 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 Jun 05 11:21:36 2017
// Host : GILAMONSTER running 64-bit major release (... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: vram.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, fu = 0; char ch = getchar(); for (; ch < 48 || ch > 57; ch = getchar()) fu |= (ch == - ); for (; ch > 47 && ch < 58; ch = getchar()) x = x * 10 + ch - 0 ; return fu ? -x : x; } int n, mx = -1000000000, mn = 100000... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: zero_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/24 20:45:40
// Design Name:
// Module Name: D_ff_with_synch_reset_behavior_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// D... |
#include <bits/stdc++.h> using namespace std; int n, a[500010], x, sz; long long ans; int main() { scanf( %d , &n); for (int step = 1; step <= n; step++) { scanf( %d , &x); while (a[sz - 1] > a[sz] && a[sz] <= x && sz >= 2) { ans += min(a[sz - 1], x); sz--; } a[++... |
// (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; int n, i, j, m, x, y; const int N = 1e5 + 7; int t, S, q, ans; int main() { ios_base::sync_with_stdio(false); cin >> t >> S >> q; while (S < t) { S *= q; ans++; } cout << ans; } |
// dma_data_consumer
// dma_data_supplier
// dma_access_controller
//
// çàäà÷à. ÷èòàòü è ïèñàòü ðàçíûå îáëàñòè ïàìÿòè, îäíîâðåìåííî â 4 ïîòîêà
// è ñðàâíèâàòü ïðî÷èòàííîå ñ çàïèñàííûì. ×èòàòü áóðñòàìè 1-N1 áàéò ñ ïàóçîé 0-N2 òàêòîâ ìåæäó êàæäûìè
//
//
module dma_tester(
input wire clk,
in... |
// (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; void IO() { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { IO(); int t; cin >> t; while (t--) { long long int n; cin >> n; l... |
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c... |
#include <bits/stdc++.h> using namespace std; int main() { int k[3]; while (cin >> k[0] >> k[1] >> k[2]) { bool flag = false; int one = 0, two = 0, three = 0, four = 0; for (int i = 0; i < 3; i++) { if (k[i] == 1) one++; if (k[i] == 2) two++; if (k[i] == 3) three++;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.