text stringlengths 59 71.4k |
|---|
// (C) 2001-2016 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... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, r; cin >> n; if (n == 0) { cout << 1 << endl; return 0; } r = n % 4; if (r == 1) { cout << 8 << endl; } else if (r == 2) { cout << 4 << endl; } else if (r == 3) { cout << 2 <... |
#include <bits/stdc++.h> using namespace std; const int N = 5050; int c, d; char ch[N]; int Calc(int b, int e) { c = 0, d = 0; int ret = 0, i; for (i = b; i <= e; i++) { if (ch[i] == ( ) c++; if (ch[i] == ) ) { if (c) c--; else { if (d > 0) ... |
#include<bits/stdc++.h> #define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);} using namespace std; const int mxn=2e5+5,mod=1e9+7; int dp[mxn][20],a[mxn],nxt[mxn],n; vector<int>prime_factors[mxn]; void sieve(){ for(int i=2;i<mxn;i++){ if(prime_factors[i].empty()){ nxt[i]=mxn; ... |
`include "hglobal.v"
`default_nettype none
`define NS_DBG_NXT_ADDR(adr) ((adr >= MAX_ADDR)?(MIN_ADDR):(adr + 1))
`define NS_DBG_SRC 9
`define NS_DBG_RED 10
module io_1to2
#(parameter
MIN_ADDR=1,
MAX_ADDR=1,
OPER_1=`NS_GT_OP,
REF_VAL_1=0,
IS_RANGE=`NS_FALSE,
OPER_2=`NS_GT_OP,
REF_VAL_2=0,
ASZ=`NS... |
/* Model for xilinx async fifo*/
module fifo_async_104x16
(/*AUTOARG*/
// Outputs
full, prog_full, almost_full, dout, empty, valid,
// Inputs
wr_rst, rd_rst, wr_clk, rd_clk, wr_en, din, rd_en
);
parameter DW = 104;//104 wide
parameter DEPTH = 16; //
//##########
//# RESET/CLO... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_ASSERT_ON
wire xzcheck_enable;
`ifdef OVL_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
assign xzcheck_... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_sync_flops.v ////
//// ////
//// ... |
/*
Copyright (c) 2015 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 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 MAX = 1e5 + 5; const int inf = 1e9 + 1; const long long OO = 1e18; long long p1, p2, c1, c2, w1, w2; long long solve() { long long a2, b1, b3, ans = 0; for (int i = 0; i <= min(p1 / w1, c1); i++) { long long a2 = min((p1 - i * w1) / w2, c... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200; const int maxm = maxn * maxn; const int INF = 0x3f3f3f3f; int n, k, s, ans, res; int a[maxn]; int dp[maxn][maxm]; inline int read() { int x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) ch = getchar(); while (ch... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; const int N = 2010, M = N * N; int n, m, dist[N][N], deg[N][N], fx[N][N], fy[N][N]; char str[N][N]; pair<int, int> p[M]; int hh, tt; bool st[N][N]; void topsort() { hh = 0; tt = -1; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1024; int n; int a[maxn], b[maxn], c[maxn]; vector<int> g[maxn]; vector<pair<pair<int, int>, int> > ans; void add(int v, int u, int x) { ans.push_back({{v, u}, x}); } int gfs(int v, int par, int d) { if (g[v].size() == 1) return v; 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 law... |
#include <bits/stdc++.h> using namespace std; const long long oo = 1000000007; vector<long long> G; bool v[1000010]; long long a[1000010]; long long f[1000010]; long long p, k, i, j, ans; void dfs(long long o, long long st) { v[o] = 1; if (!v[(o * k) % p]) { dfs((o * k) % p, st + 1); }... |
#include <bits/stdc++.h> using namespace std; vector<int> d[256]; int mask[256]; vector<int> q; bool b[256]; bool good[256]; int kd[256]; vector<int> g; vector<pair<pair<int, int>, pair<int, int> > > res; int n; int need; void Debug(vector<int> A) { for (int i = 0; i < A.size(); i++) { ... |
#include <bits/stdc++.h> using namespace std; mt19937 gen(time(NULL)); const long double eps = 1e-9; const int inf = 1e9; const int mod = 1e9 + 7; const long long infinity = 2 * 1e18; vector<int> g[100005]; int n, m, q; int p2[100005], d[100005], cmp[100005]; int rt[100005]; vector<int> plen[10000... |
#include <bits/stdc++.h> int const INF = 2e9; int const MOD = 1000000007; int const MAXN = 100010; using namespace std; int n, m, sum1, sum2, ans; int a[MAXN], b[MAXN]; int main() { ios_base::sync_with_stdio(0); cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < m;... |
#include <bits/stdc++.h> using namespace std; int64_t *arry[3]; int main(void) { int64_t n, p, q, r; cin >> n >> p >> q >> r; for (int i = 0; i < 3; i++) { arry[i] = (int64_t *)malloc(sizeof(int64_t) * n); } for (int i = 0; i < n; i++) { int buf; cin >> buf; arry[0][i] ... |
//-----------------------------------------------------------------------------
// The FPGA is responsible for interfacing between the A/D, the coil drivers,
// and the ARM. In the low-frequency modes it passes the data straight
// through, so that the ARM gets raw A/D samples over the SSP. In the high-
// frequency mo... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, m; long long c[maxn], ans, s; vector<int> g[maxn]; bool v[maxn]; void dfs(int a) { s = min(s, c[a]); v[a] = 1; for (int i = 0; i < g[a].size(); i++) { int b = g[a][i]; if (!v[b]) dfs(b); } } int m... |
#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; int a[111111], b[111111], n, m, k; int main() { while (scanf( %d%d%d , &n, &m, &k) != EOF) { for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= m; i++) scanf( %d , &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + m); ... |
module fa1242(
output ml,
output md,
output mc,
output rstb,
input clk_s, // should be slower than 5Mhz
input rst);
parameter IDLE = 0;
parameter RST = 1;
parameter RST_WAIT = 2;
parameter SET_FUNCTION = 3;
parameter SET_FUNCTION_WAIT = 4;
// attn settings
wire [10:0] al = 0;
wire [10:0] ar = 0;
// mode setting... |
module Control (
input irq, PC31,
input [5:0] OpCode, Funct,
output [2:0] PCSrc,
output [1:0] RegDst, MemtoReg, //nextPC,
output RegWrite, ALUSrc1, ALUSrc2, Branch,
MemWrite, MemRead, ExtOp, LuOp, Sign,
output reg Jump,
//output [3:0] ALUOp,
output reg [5:0] ALUFun
);
wi... |
module test_LEDState(
//Avalon System control signal.
input rsi_MRST_reset, // reset_n from MCU GPIO
input csi_MCLK_clk,
//Avalon-ST LED Control.
output [23:0] aso_fled0_data,
output aso_fled0_valid,
//Avalon-ST LED Control.
output [23:0] aso_fled1_data,
output aso_fled1_valid,
//Avalon-ST... |
#include <bits/stdc++.h> using namespace std; int sol[] = {19, 873, 834, 665}; int main() { int a, b; bool found = false; cin >> a >> b; for (int i = 0; i < (int)sizeof(sol) / (int)sizeof(int); i++) { found = true; break; } if (found) cout << a + b << endl; else ... |
#include <bits/stdc++.h> using namespace std; int a[100005]; int main() { int n, x; scanf( %d%d , &n, &x); int sum = 0; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); sum += a[i]; } if (n == 1) { if (a[0] == x) printf( YES n ); else printf( NO n )... |
#include <bits/stdc++.h> using namespace std; int num[105]; double cal(int w, int e, int s) { if (e < s) return 1.0; double res = 1, dw = (double)w, de = (double)e; for (int i = 0; i < s; i++) { res = res * de / dw; dw--; de--; } return 1.0 - res; } int main() { int n... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1LL << 28; const long long mod = 1LL; vector<int> adj[30]; long long b_search(int val, int indx) { int lo, hi, mid; long long ans = 1e12; lo = 0; hi = (int)adj[indx].size() - 1; while (lo <= hi) { mid = (lo + hi) / 2... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int main() { int n, k, sol = 0; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); int maxB = (a[n - 1] - a[0]) / (k - 1); vector<int> ble(maxB + 2); vector<vec... |
/*
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#include <bits/stdc++.h> using namespace std; int n, q, a[300005], ans[300005]; vector<pair<int, int> > queries[300005]; int tree[1200006]; void upd(int l, int r, int pos, int x) { if (l == r) { tree[pos]++; return; } int mid = l + r >> 1; if (x <= mid) upd(l, mid, pos << 1, ... |
#include <bits/stdc++.h> using namespace std; double dp[2005][2005]; int main() { ios::sync_with_stdio(0); a: int n, t; double p; cin >> n >> p >> t; dp[0][0] = 1.0; for (int i = 1; i <= t; i++) dp[i][0] = dp[i - 1][0] * (1.0 - p); for (int j = 1; j <= n; j++) dp[0][j] = 0.0; for... |
#include <bits/stdc++.h> using namespace std; int q[123456]; vector<int> sq; int main() { int n, k; int a, b; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %d%d , &a, &b); sq.push_back(min(2 * a, b) - min(a, b)); q[i] = min(a, b); 1; } sort(sq.begin... |
#include <bits/stdc++.h> using namespace std; const int maxn = 110; int n, m; string s; int a[maxn]; int main() { cin >> n >> m; int cnt = 0; while (n--) { cin >> s; if (s[0] == a ) { int x; cin >> x; int num = 0; bool flag = false; for (int i... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const double eps = 1e-6; template <typename A, typename B> ostream& operator<<(ostream& os, const pair<A, B>& p) { return os << p.first << , << p.second; } template <typename T> struct point { T x, y; point(T xx = 0,... |
//Legal Notice: (C)2018 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> #pragma GCC optimize( O3 ) const long long INF = 0x3f3f3f3f3f3f3f3f; const long long llinf = (1LL << 61); const int inf = (1 << 30); const int nmax = 4e5 + 50; const int mod = 1e9 + 7; using namespace std; string s; long long n, a[nmax], st[4 * nmax], i, lzy[4 * nmax], x, q, s... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ae_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 !!!... |
/*
* Copyright (c) 2000 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)
* ... |
`timescale 1ns/10ps
module c25Board (
clk, // clock I1
reset, // reset I1
// io
buttons, // buttons I4
leds, // leds O4
// rs232
rx, // receive I1
tx, // send O1
// flash 32M x16
flashWeN, // write enable O1
flashCsN, // c... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 1, inf = 1e18; vector<pair<long long, long long> > a, b; vector<pair<pair<long long, long long>, long long> > z; long long add[4 * N], t[4 * N]; void push(long long v, long long l, long long r) { t[v] += add[v]; if (l != r - 1) ... |
/*############################################################################
* PROGRAMMABLE DELAY ELEMENT
*
* NOTE: NOT AVAILABLE IN HR BANKS!
*
*############################################################################
*/
module ODELAYE2 (/*AUTOARG*/
// Outputs
CNTVALUEOUT, DATAOUT,
// Inputs
... |
#include <bits/stdc++.h> using namespace std; int n, m, a[1000006], ans[1000006]; bool b[1000006]; stack<pair<int, int> > s1, s2; int main() { int i, j; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); scanf( %d , &m); for (i = 1; i <= m; i++) { scanf( %d , &j); b[... |
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize( Ofast ) using namespace std; namespace ywy { char v[300][300]; long long dk1[300], dk2[300]; int dp[600]; typedef struct _p { long long h1, h2; _p() { h1 = 2333; h2 = 6663; } frie... |
////////////////////////////////////////////////////////////////////////////////////
//
// pGB, yet another FPGA fully functional and super fun GB classic clone!
// Copyright (C) 2015-2016 Diego Valverde ()
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Gene... |
/**
* 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; using point = pair<int, int>; int D(point a, point b, point c) { return a.first * (b.second - c.second) - a.second * (b.first - c.first) + (b.first * c.second - b.second * c.first); } int main() { int n, d; cin >> n >> d; vector<point> p... |
/*
* Copyright 2017 Google Inc.
*
* 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 by applicable law or agreed to... |
#include <bits/stdc++.h> const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 1e6 + 5; const double eps = 1e-9; using namespace std; double xp, yp, vp, x, y, v, r, R; double P, len, L; pair<double, double> pos[2]; double f(double dphi) { if (dphi > pi) d... |
/**
* 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) 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)
// ... |
// (c) Copyright 1995-2019 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 n; double p[1001]; double getp(unsigned long long a, unsigned long long b) { unsigned long long st = 1, ed = 1; double ret; while (st < a) st = st * 10; while (ed < b) ed = ed * 10; if (ed > b) ed = ed / 10; if (st > a) st = st / 10; ... |
#include <bits/stdc++.h> using namespace std; bool isprime[1000001]; void sieve() { for (long long i = 0; i <= 1000001; i++) { isprime[i] = true; } isprime[0] = false; isprime[1] = false; for (long long i = 2; i * i <= 1000001; i++) { if (isprime[i] == true) { for (long lon... |
#include <bits/stdc++.h> using namespace std; double sqr(double x) { return x * x; } double distsqr(double x, double y, double a, double b) { return sqr((x - a)) + sqr((y - b)); } double cosine_angle(double a, double b, double c) { return (double)(sqr(a) + sqr(b) - sqr(c)) / ((double)2.0 * a * b); }... |
#include <bits/stdc++.h> using namespace std; const int inft = 1000000009; const int MAXN = 2000006; bool P[MAXN]; int SP[MAXN]; int PAL[MAXN]; char S[123]; bool pal(int a) { sprintf(S, %d , a); reverse(S, S + strlen(S)); int q; sscanf(S, %d , &q); return a == q; } int main() {... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n <= 70000) { ++n; int x = n; int a[10] = {0}; for (int i = 0; i < 4; i++) { int m = x % 10; ++a[m]; x = x / 10; } int count = 0; for (int i = 0; i < 10; i... |
#include <bits/stdc++.h> using namespace std; const int N = 105, M = N * N; int n; int a[N]; int f[N][M]; vector<pair<int, int> > b; int main() { scanf( %d , &n); int sum = 0; for (int i = 1; i <= n; i++) { scanf( %d , a + i); sum += a[i]; } sort(a + 1, a + n + 1); b.pu... |
/**
* 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; int n, m; int x, y; vector<int> v1[200086], v2[200086]; bool ins[200086]; bool vis[200086], vis1[200086], vis2[200086]; bool e[200086]; int ans; void dfs(int i) { vis[i] = ins[i] = true; for (int j = 0; j < v1[i].size(); j++) { int to = v1[i]... |
#include <bits/stdc++.h> using namespace std; int main() { string nameOne, nameTwo, tmpOne, tmpTwo; cin >> nameOne >> nameTwo; int n; cin >> n; cout << nameOne << << nameTwo << endl; for (int i = 0; i < n; i++) { cin >> tmpOne; cin >> tmpTwo; if (tmpOne == nameOne) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> Height(n); vector<int> count(n, 0); for (int i = 0; i < n; i++) { cin >> Height[i]; } int x = 0, after = 1, befor = 0; while (after < n && Height[x] >= Height[after]) { count[0]++; ... |
/*
* Titor - System - Bank selection manager
* Copyright (C) 2013 Sean Ryan Moore
*
* 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 ... |
#include <bits/stdc++.h> int main(void) { int i, j, k, m, n, max_length, length; char string[101]; for (n = 0, scanf( %s , string); string[n]; n++) ; for (m = 1, max_length = 0; m < n; m++) { for (i = m - 1; i >= 0; i--) { for (j = i, k = m, length = 0; k && string[j] == string[k];... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<int, int>> G[262144]; int d1[26][262144]; pair<int, int> d2[2][262144]; int vis[2][262144]; long long mod = 998244353ll; long long qpow(long long x, long long y) { long long a = x, ans = 1; while (y) { if (y & 1) ans = (an... |
#include <bits/stdc++.h> using namespace std; vector<int> graph[100001]; int color[100001]; vector<int> b, w; void bfs(int v) { queue<int> q; q.push(v); color[v] = 1; b.push_back(v); while (!q.empty()) { int v = q.front(); q.pop(); for (int u : graph[v]) { if (col... |
#include <bits/stdc++.h> using namespace std; int n, d; int a[105]; int main() { ios_base::sync_with_stdio(false); cin >> n >> d; for (int i = 0; i < n; i++) cin >> a[i]; int dp[n][n]; sort(a, a + n); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) dp[i][j] = a[j] - a[i];... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ns / 1ps
module clk_gen(
input CLKIN,
output wire BUS_CLK,
outp... |
/*
* Copyright 2017 Google Inc.
*
* 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 by applicable law or agreed to... |
#include <bits/stdc++.h> using namespace std; long long mas[1010]; unordered_map<long long, int> sootv; long long num[100100]; long long gcd(long long a, long long b) { if (!a) return b; return gcd(b % a, a); } int main() { int n; long long k; cin >> n >> k; for (int i = 0; i < n; ... |
//----------------------------------------------------------------------------
// Wishbone SRAM controller
//----------------------------------------------------------------------------
module wb_sram16 #(
parameter adr_width = 19,
parameter latency = 0 // 0 .. ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; int main() { long long n, k; cin >> n >> k; map<int, int, greater<int> > st; long long n1 = n; for (int i = 0; n1 > 0; ++i) { if (n1 & 1) st[i] = 1; n1 >>= 1; } k -= (int)(st.size()); if (k < 0) {... |
#include <bits/stdc++.h> using namespace std; int n, i; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> n >> s; for (i = 1; i <= n; i++) { if (n % i == 0) { reverse(s.begin(), s.begin() + i); } } cout << s; } |
#include <bits/stdc++.h> using namespace std; const long long mm = 2; long long n, m0[mm][mm], m1[mm][mm] = {{0, 1}, {2, 1}}, mz[mm][mm], tmp[mm][mm], pwk, dv = 1e9 + 7; void cop(long long x[mm][mm], long long y[mm][mm]) { long long i, j; for (i = 0; i < mm; i++) { for (... |
#include <bits/stdc++.h> using namespace std; int t, n, a[110]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); for (int i = 0; i < n; i++) a[i] %= 2; int sum = 0; for (int i = 0; i < n; i++) sum += a[i]; if (... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( O1 ) #pragma GCC optimize( O2 ) #pragma GCC optimize( Os ) #pragma GCC optimize( Ofast ) #pragma GCC target( avx2 ) #pragma GCC optimization( unroll-loops ) long long int gcd(long long int a, long long int b) { return (b ? gcd... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > AdjList; vector<int> dist; vector<int> unused; void update() { queue<int> now; for (int i = 0; i < unused.size(); i++) { dist[unused[i]] = 0; now.push(unused[i]); } while (!now.empty()) { int u = now.front(); ... |
/**
* 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... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_no_underflow (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter min ... |
#include <bits/stdc++.h> const int MAXN = (int)1e5 + 5; const int MODN = (int)1e9 + 7; int inf = 0x3f3f3f3f; using namespace std; char str[MAXN]; int num[MAXN]; int a[MAXN]; struct Com { int cost; int qua; } c[MAXN]; int cmp(Com a, Com b) { return a.cost < b.cost; } int main() { int 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> using namespace std; int to[2000]; char used[2000]; int a[2000]; int s; char res[3000]; int calc(int x, char &f) { f = 0; int cnt = 1; if (x == s) f = 1; while (to[x] != -1) { ++cnt; x = to[x]; if (x == s) { f = 1; cnt = 1; }... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9e18; const int inf = 2147483647; long long qpow(long long a, long long b, long long mod) { long long r = 1; for (; b; b >>= 1) { if (b & 1) r = (r * a) % mod; a = (a * a) % mod; } return r; } const int N = 1e5 +... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, t, d; cin >> n >> m; map<long long, long long> mp; set<pair<long long, long long> > st; vector<long long> a(n), c(n); for (int i = 0; i < n; i++) { cin >> a[i]; mp[i] = a[i]; } for (int i = 0; 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... |
/**
* 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... |
//Legal Notice: (C)2016 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 len, cnt[8010], f[8010], nxt[8010]; char st[8010]; void kmp(char *st, int len, int nxt[]) { nxt[0] = nxt[1] = 0; for (int i = 1; i < len; i++) { int j = nxt[i]; while (j && st[i] != st[j]) { j = nxt[j]; } nxt[i + 1] = st[j... |
// file: clk_wiz_v3_2.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... |
#include <bits/stdc++.h> using namespace std; const int mxN = 1e5, mxV = 7001; int n, q, qt, xi, yi, zi; bitset<mxV> in[mxV], cq[mxV], ms[mxN], c; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); for (int i = 1; i < mxV; ++i) { for (int j = 0; (j += i) < mxV;) in[j][i] = 1; ... |
#include <bits/stdc++.h> using namespace std; int m, n, l, r, mid, t; int a[200002], b[200002], ida[200002], idb[200002], to[200002]; long long ans[200002] = {}; template <class T> void read(T &x) { x = 0; int f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) f |= (ch == - ), ch = ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.