text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long a[1111]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); long long n, ans = 0; cin >> n; for (long long i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + 1 + n); for (long long i = 1; i <...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; string s, t; cin >> n >> s >> t; string ss = s, tt = t; sort(ss.begin(), ss.end()); sort(tt.begin(), tt.end()); if (ss != tt) cout << -1 << n ; else { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 58, SQ = 500; int LE[maxn], LO[maxn], par[maxn], a[maxn], root[maxn], lazy[maxn], m; inline void make(int j) { int lase = -1, laso = -1; int l = j * SQ; for (int i = l; i - l < SQ; i++) { a[i] ^= lazy[j]; if (a[i]) ...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ns / 1ps `default_nettype none module qmca_clk_gen( input CLKIN, // 48M ...
#include <bits/stdc++.h> using namespace std; int n, step; vector<string> ans; bool isi[256]; int now[26]; string eb(int p) { return string( e ) + char(p + a ) + x ; } string sz(int p) { return string( ) + char(p + 0 ); } void dfs(int x) { if (x == step) { if (isi[n]) { printf( %d ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math,O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx ) using namespace std; template <class U, class V> istream& operator>>(istream& is, pair<U, V>& p) { is >> p.first >> p.second; ret...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11.06.2017 19:10:02 // Design Name: // Module Name: DD // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is dis...
// // Copyright (c) 2002 Stephen Williams (steve at icarus.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 (...
/** * 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 = 150007; const double eps = 1e-8; int n; double l, r, mid, sm[N], mxp[N], mnp[N]; struct note { double p, t, c; int id; } a[N], b[N]; int cmp(note x, note y) { return x.c > y.c; } int cmp0(note x, note y) { return x.p < y.p; } int ch...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); int n, p, k; cin >> n >> p >> k; map<int, int> mp; long long sol = 0; for (int i = 0; i < n; i++) { int x; cin >> x; ...
// ============================================================== // 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 num[100 + 5][100 + 5], ans[100 + 5][100 + 5]; int row[100 + 5], col[100 + 5]; int main() { int n, m; while (scanf( %d%d , &m, &n) != EOF) { int i, j, k; int ii, jj, kk; memset(row, 0, sizeof(row)); memset(col, 0, sizeof(col)); ...
#include <bits/stdc++.h> using namespace std; set<long long> myset; int base; int N; long long A[100005]; map<long long, int> Map; int ANS[600000]; int T[1200000]; int Lo[300000]; int ql, qu; int P[300000]; void update(int ind) { ind += base; T[ind] = ind - base; while (1) { in...
// dig /* ------------------------------------------------------------------------------- Copyright 2014 Parallax Inc. This file is part of the hardware description for the Propeller 1 Design. The Propeller 1 Design is free software: you can redistribute it and/or modify it under the terms of the GNU Genera...
#include <bits/stdc++.h> using namespace std; const long long int Maxn3 = 1e3 + 10; const long long int Maxn4 = 1e4 + 10; const long long int Maxn5 = 1e5 + 10; const long long int Maxn6 = 1e6 + 10; const long long int Maxn7 = 1e7 + 10; const long long int Maxn8 = 1e8 + 10; const long long int Maxn9 = 1e...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( avx2 ) #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; void solve() { int n; cin >> n; vector<int...
/** * 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, a[300100], b[300100], pos[300100]; vector<pair<int, int> > ans; inline void ws(int xx, int yy) { ans.push_back(make_pair(xx, yy)); } int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); pos[a[i]] = 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...
// DESCRIPTION: Verilator: Verilog Test module // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; re...
#include <bits/stdc++.h> namespace chtholly { char buf[1 << 23], *p1 = buf, *p2 = buf; inline int read() { int x = 0, f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) f ^= c == - ; for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 0 ); return f ? x : -x; } tem...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int n = (int)s.size(); vector<vector<int>> a(26, vector<int>(n + 1)); for (int i = 1; i < n + 1; ++i) { a[s[i - 1] - a ][i] += 1; } for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; long long d; d = min(a, b) * 2 + c * 2; if (a != b) { d++; } cout << d; }
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code ...
#include <bits/stdc++.h> int GCD(int u, int v) { while (v != 0) { int r = u % v; u = v; v = r; } return u; } int main() { int amtV; int amtE; std::vector<std::pair<int, int>> graph; std::cin >> amtV >> amtE; int connected = 0; int remaining = amtE; if (amt...
#include <bits/stdc++.h> using namespace std; string onezero(int n) { string s = 1 ; for (int i = 1; i < n; ++i) { s += 0 ; } return s; } string findSum(string str1, string str2) { if (str1.length() > str2.length()) swap(str1, str2); string str = ; int n1 = str1.length(), n...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: bg2_new.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ============================...
#include <bits/stdc++.h> using namespace std; const int MAN = 110; const int MAM = 60; int dp[MAN][MAM][2]; int INF = -100000000; int main() { string str; int m; while (cin >> str >> m) { int len = str.size(); memset(dp, 0, sizeof(dp)); for (int i = 0; i <= len; ++i) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: // Design Name: // Module Name: GDA_St_N8_M8_P6 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: //...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 0; i < n; i++) { cout << 1 << ; } cout << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int MAXN = 4e4 + 44; const long long INF = 1e11 + 9; const double eps = 1e-12; int main() { int t; scanf( %d , &t); long long x1, y1, x2, y2, n, m; long long x3, y3, x4, y4; long long answ = 0, ansb = 0; while (t--) { scanf( %ll...
/* * 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 n, m, s, d; vector<int> a; map<int, int> p, q; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> s >> d; a.resize(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); i...
#include <bits/stdc++.h> using namespace std; int main() { long long w1, h1, w2, h2; cin >> w1 >> h1 >> w2 >> h2; cout << 2 * (w1 + h1 + h2) + 4 << endl; return 0; }
#include <bits/stdc++.h> inline int A(int x, int y) { return x && y; } inline int O(int x, int y) { return x ^ y; } inline int X(int x, int y) { return x || y; } int main() { int t1, t2, t3, t4; scanf( %d%d%d%d , &t1, &t2, &t3, &t4); int a1 = O(t1, t2); int a2 = X(t3, t4); int a3 = A(t2, t3)...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 10; long long inf = 1e18; set<pair<long long, pair<int, int> > > s; vector<pair<pair<int, int>, long long> > vec; long long dp[2][maxn][maxn], arr[maxn][maxn]; long long ps[maxn][maxn]; int n, m, a, b; bool mark[maxn][maxn]; void i...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, a[N], to[N]; vector<int> idx[N]; int is[N]; bool ok() { for (int i = 0; i < n; ++i) is[a[i]] ^= 1; bool prv = 0; for (int i = 1; i <= n; ++i) { if (!is[i]) continue; if (prv) return 0; prv = 1; } ...
#include <bits/stdc++.h> using namespace std; vector<long long> v; void SieveOfEratosthenes(long long n) { bool prime[n + 1]; memset(prime, true, sizeof(prime)); for (long long p = 2; p * p <= n; p++) { if (prime[p] == true) { for (long long i = p * p; i <= n; i += p) prime[i] = false; ...
#include <bits/stdc++.h> using namespace std; int main() { long int quant, mul; scanf( %ld %ld , &quant, &mul); long int *nums = (long int *)calloc(quant, sizeof(long int)); set<long int> s; for (long int i = 0; i < quant; i++) { scanf( %ld , &nums[i]); } sort(nums, nums + quant); ...
#include <bits/stdc++.h> const double PI = 3.1415926535897932384626433; const int KL = 1e5 + 10; const long long MOD = 1e9 + 7; using namespace std; struct point { long double x, y; void go(long long x1, long long y1) { x = x1; y = y1; } void read() { cin >> x >> y; } point ope...
/* * Titor - System - Simulation testbench * Copyright (C) 2012 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 yo...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, temp; cin >> n; map<int, int> a, b; for (int i = 0; i < n; i++) { cin >> temp; a[temp]++; } for (int i = 0; i < n; i++) { cin >> temp; b[tem...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a; vector<vector<int> > gr(n + 1, a); int any; int th; for (int i = 1; i <= n; i++) { cin >> th; if (th != 0) { gr[i].push_back(th); gr[th].push_back(i); } } ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t_order_a (/*AUTOARG*/ // Outputs m_from_clk_lev1_r, n_from_clk_lev2, o_from_com_levs11, o...
/* 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; const double eps = 1e-9; const double pi = acos(-1.0); const int N = 100010; int n; long long x, y, a[N]; void solve() { for (int i = 0; i < (int)(n); ++i) a[i] = 1; a[0] = y - n + 1; for (int i = 0; i < (int)(n); ++i) x -= ((a[i]) * (a[i])); i...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> const int maxn = (int)1e6; const int mod = (int)1e9 + 7; using namespace std; int n; long long dp[maxn]; long long a[maxn]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { cin >> a[i]; } dp[0] = abs(a[0]); for (int i = 1; i < n; i++) { d...
/* * Copyright (c) 2001 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) * ...
// // Avalon MM Slave for parallel input/output camera registers // module avalon_camera ( // Avalon clock interface signals input clk, input reset_n, // Signals for Avalon-MM slave port input [4:0] avs_s1_address, input avs_s1_read, output reg [31:0] avs_s1_readdata, input avs_s1_write...
module mojo_com_logic #( parameter ADDR_SPACE = 256 )( input clk, input rst, //SPI Addressing Interface input [ADDR_SPACE_BITS-1:0] reg_addr, input write, input new_req, input [7:0] write_value, output [7:0] read_value, input in_transaction, //Interface, doesn't guarantee atomicity output [8*ADDR_SPAC...
#include <bits/stdc++.h> using namespace std; long long x, y, m, aux, rs = 0; void neg() { rs = (-y) / x; rs++; y = y + rs * x; } void rec() { aux = x + y; rs++; if (aux < m) { y = x; x = aux; rec(); } } int main() { cin >> x >> y >> m; aux = max(x, y)...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int testCases = 1; cin >> testCases; while (testCases--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (n %...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, k; cin >> n >> k; string x; cin >> x; string ans = x; string y = ; long long p = n; for (long long i = 1; i < n; i++) { long long j; y = ...
#include <bits/stdc++.h> using namespace std; int main() { long long int N, cn = 0, Z = 0, max = 0; cin >> N; int arr[N]; for (int i = 0; i < N; i++) { cin >> arr[i]; } for (int i = 0; i < N; i++) { cn = 0; for (int j = i + 1; j < N; j++) { if (arr[i] == arr[j] && a...
// (C) 1992-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 simulati...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.1 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (win64) Build 881834 Fri Apr 4 14:15:54 MDT 2014 // Date : Thu Jul 24 13:33:40 2014 // Host : CE-2013-124 running 64-bit Service Pa...
/** * 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 MAXN = 810, maxn = 200010; long long n, m, k, top, cnt, num; struct wy { long long x, y, z; } t[maxn]; inline long long cmp(wy a, wy b) { return a.z < b.z; } long long b[MAXN], c[MAXN], a[MAXN][MAXN], w[maxn]; inline void discrete() { ...
#include <bits/stdc++.h> using namespace std; long long vis[200005], cnt[200005], arr[200005]; void solve() { long long i, j, k, l, m, n, x, sz = 0, flag = 1, mx = 0; cin >> n; for (i = 0; i <= n; i++) vis[i] = cnt[i] = 0; for (i = 0; i < n; i++) { cin >> arr[i]; cnt[arr[i]]++; i...
#include <bits/stdc++.h> using namespace std; const int maxn = 4e5 + 5; int head[maxn], e[maxn << 1], nxt[maxn << 1], cnt = 1; void addedge(int u, int v) { e[++cnt] = v, nxt[cnt] = head[u], head[u] = cnt; e[++cnt] = u, nxt[cnt] = head[v], head[v] = cnt; } int s[maxn], t[maxn]; int f[maxn], num; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Wilson Snyder. // Very simple test for interface pathclearing `ifdef VCS `define UNSUPPORTED_MOD_IN_GENS `endif `ifdef VERILATOR `define UNSUPPORTED_MOD_IN_GENS `endif mod...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long w, h, k, arr[4], brr[1000000], ans; cin >> w >> h; for (int i = 0; i < 4; i++) { cin >> k; for (int j = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { long int mx = 0, n; cin >> n; vector<long int> vec; for (int i = 0; i < n; i++) { long int x; cin >> x; vec.push_back(x); } if (vec.size() == 1) { cout << 1 << endl; return 0; } for (int i = 0;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int test; cin >> test; while (test--) { int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] != ? ) { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 510; bitset<510> can[maxn][2][64]; int N, M; long long ans, best[maxn][2]; inline long long dfs(int now, int last) { if (best[now][last ^ 1] != -1) return best[now][last ^ 1]; else best[now][last ^ 1] = 0; for (int i = 59...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; int b[5005], cnt, pr[800], f[800][5001], n, at[5005], sum[800][5001]; long long ans; int ss[5005], tmp[5005], sa, st; int main() { for (int i = 2; i <= 5000; i++) { if (b[i]) continue; for (int j = 2; j * i <= 5000; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; while (~scanf( %d %d %d %d , &n, &a, &b, &c)) { if (1 == n || n == 0) { printf( 0 n ); } else if (2 == n) { printf( %d n , min(a, b)); } else { if (c > max(a, b)) { printf( %d n , (...
/* Generated by Yosys 0.3.0+ (git sha1 3b52121) */ (* src = "../../verilog/byte2wordsel.v:1" *) module Byte2WordSel(H_i, L_i, Y_o, Shift_i, Mask_i); wire [15:0] \$auto$splice.cc:141:get_spliced_signal$6 ; (* src = "../../verilog/byte2wordsel.v:13" *) wire [15:0] \$auto$splice.cc:237:run$7 ; (* src = "../../ver...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int lim = sqrt(n) + 1; if (!(n & 1)) { cout << n / 2 << endl; return 0; } for (long long int i = 3; i <= lim + 1; i++) { if (n % i == 0) { cout << (n - i) / 2 + 1 << endl...
#include <bits/stdc++.h> using namespace std; int n; bool vis[100][100]; char g[100][100]; void dfs(int a, int b) { if (vis[a][b] || a > n || a < 1 || b < 1 || b > n || g[a][b] == 1 ) return; vis[a][b] = 1; dfs(a + 1, b); dfs(a, b + 1); dfs(a - 1, b); dfs(a, b - 1); } int dist(pai...
#include <bits/stdc++.h> using namespace std; vector<pair<int, pair<int, int> > > g[300043]; int main() { int n, m, k; scanf( %d %d %d , &n, &m, &k); for (int i = 0; i < m; i++) { int x, y, w; scanf( %d %d %d , &x, &y, &w); --x; --y; g[x].push_back(make_pair(y, make_pair(...
#include <bits/stdc++.h> const int N = 1010; int n, k, a[N], a2[N], used[N], m, d, ans; std::list<int> list; int t; void spendTimeUntil(int setSz) { while (list.size() > setSz) { d = round(100 * (double)m / (double)n); for (int x : list) { if (a2[x] + 1 == d && !used[x]) { us...
// (c) Copyright 2012-2013 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 g...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *) (* \VV/ **************************************************************) (* // * Th...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; long long xabs(long long a) { return a < 0 ? -a : +a; } bool check(long long p, long long q, long long x, long long y, long long a, long long b) { if (a * x + b * y == p && a * y - b * x == q) return true; els...
#include <bits/stdc++.h> using namespace std; inline int rdi() { int d; scanf( %d , &d); return d; } inline char rdc() { scanf( ); return getchar(); } inline string rds() { string s; cin >> s; return s; } inline double rddb() { double d; scanf( %lf , &d); re...
// ---------------------------------------------------------------------- // Copyright (c) 2016, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; inline int read() { int 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(); } return x * f;...
//----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 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 ...
/** * 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...
//----------------------------------------------------------------- // MPX 32-bit Soft-Core Processor // V0.1 // Ultra-Embedded.com // Copyright 2011 - 2012 // // Email: // // License: LGPL // // If you ...
#include <bits/stdc++.h> using namespace std; int a[27] = {0}; int main() { int i, j, m, n, t; string s; cin >> n; cin >> s; for (i = 0; i < n; i++) a[s[i] - a + 1]++; for (i = 1; i <= 26; i++) if (a[i] == n) { cout << NO << endl; return 0; } for (i = 0;...
// 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 Apr 09 10:10:04 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; template <class T> void chmin(T& a, const T& b) { if (a > b) a = b; } template <class T> void chmax(T& a, const T& b) { if (a < b) a = b; } int n, d; const int geta = 260; const int MX = 30000; int dp[30010][520]; int cnt[30010]; int main()...
/** * 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 ntest = 0, test = 0; inline void init(); inline void run(); inline void stop() { ntest = test - 1; } int main() { init(); while (++test <= ntest) { run(); } return 0; } const int INF = (int)1E9 + 5; const double EPS = 1E-11; con...
//======================================================= // Ports generated by Terasic System Builder //======================================================= module vid_io_demo( //////////// CLOCK ////////// input CLOCK_50, input CLOCK2_50, input CLOCK3_50, ///////...
/** * 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 INFINITE = (int)(0xffffffff >> 2); int n; int gs[600]; int dp[600][600]; int run(int l, int r) { if (l > r) return 0; if (l == r) return 1; if (dp[l][r] != INFINITE) { return dp[l][r]; } dp[l][r] = min(dp[l][r], run(l + 1, r) ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) cout << (n * n) / 2 << endl; else cout << (n / 2) * (n / 2) + (n / 2 + 1) * (n / 2 + 1) << endl; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) if ((i + j) % 2 == 0)...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ /* * S/GMII cycle asynchronous fifo. * */ module sgmii_fifo ( input rst_in, input clk_in, input clk_out, input [8:0] fifo_in, input push, output full, output [8:0] fifo_out, input pop...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int maxnnn = (int)1e6 + 10; int aaaa[maxnnn]; int bbbb[maxnnn]; int l[maxnnn]; int r[maxnnn]; int nnnnn...
#include <bits/stdc++.h> using namespace std; int test, n, mx, i; double l, r, m, eps = 0.000001, a[100005]; double pref(double tm) { double pos = 0, speed = 1; for (int i = 0; i < n; i++) { if ((a[i] - pos) <= tm * speed) tm -= (a[i] - pos) / speed, pos = a[i], speed += 1; else { ...