text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> int main() { static char xx[100 + 1], yy[100 + 1]; int n, i; scanf( %s%s , xx, yy); n = strlen(xx); for (i = 0; i < n; i++) if (xx[i] < yy[i]) { printf( -1 n ); return 0; } printf( %s n , yy); return 0; } |
// file: clk32to40_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 disclai... |
/*
* Planar mode graphics for VGA
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* VGA FML support
* Copyright (C) 2013 Charley Picker <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; long long m, mi, mid; long long v[3]; v[0] = a; v[1] = b; v[2] = c; sort(v, v + 3); a = v[2]; b = v[0]; c = v[1]; if (a - b < c) { cout << 0 ; } else { m... |
//-----------------------------------------------------------------------------
//
// (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
... |
#include <bits/stdc++.h> int n, p[110], i, j, cnt; char s[110]; int main() { scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d , &p[i]); gets(s); for (i = 0; i < n; i++) { gets(s); cnt = 0; for (j = 0; s[j]; j++) if (s[j] == a || s[j] == e || s[j] == i || s[j] == ... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { int a, b; while (scanf( %d%d , &a, &b) != EOF) { int g = gcd(a, b); int x = -1, y = -1; for (int dx = 1; dx <= 1000; ++dx) for (int dy = 1; dy <= 1000; ++dy) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, num = 0, dem = 0; cin >> n; if (n % 2 == 0) { num = (n / 2) - 1; dem = (n / 2) + 1; } else { num = n / 2; dem = n - num; } set<int> x, ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 5; int n, m, i; int k1, k2, k3, t1, t2, t3; long long a[MAX], b[MAX], t[MAX]; int main() { cin >> k1 >> k2 >> k3 >> t1 >> t2 >> t3 >> n; for (i = 0; i < n; i++) { scanf( %d , &a[i]); b[i] = a[i]; } for (i = 0; i ... |
#include <bits/stdc++.h> using namespace std; #define ll long long int void solve() { ll p,a,b,c; cin >> p >> a >> b >> c; ll ans = 1e18 + 1; if(p%a != 0) ans = min(a - p%a, ans); else ans = 0; if(p%b != 0) ans = min(b - p%b, ans); else ans = 0; if(p%c... |
#include <bits/stdc++.h> using namespace std; int static_init = []() { ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed; return 0; }(); constexpr int N = 3e5; int32_t n, x[2], c[N + 1], p[N + 1]; int64_t t[N + 2]; bool run(bool sw) { for (int k1 = 1; k1 <= n; k1++) { int i1 = ... |
#include <bits/stdc++.h> using namespace std; void swap(long long &a, long long &b) { long long t = a; a = b; b = t; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; long long my_pow(long long a, long long n) { long long res = 1; while (n) { if (n & 1) res *= a; a *= a; n >>= 1; } return res; } const int mn = 10010; vector<int> v[mn]; vector<int> s(mn, 0); voi... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, k; cin >> n >> k; vector<long long> arr(n); for (auto& i : arr) cin >> i; long long l = 0, r = 2, ans = 0; while (r < n) { if (arr[r] - arr[... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, x; cin >> n >> x; long long int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); long double rich_sum = 0; long long int poor_idx = -... |
/*
* 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 cnt[300007]; int main() { int n, k; scanf( %d%d , &n, &k); string s; cin >> s; int check = 100; for (int i = (0); i <= ((int)s.size() - 1); ++i) ++cnt[s[i] - a ]; for (int i = ( a ); i <= ( z ); ++i) { if (k >= cnt[i - a ]) ... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd(228); const int M = 1791791791; const int B = 239; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<string> a(n), b(m); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; ... |
#include <bits/stdc++.h> using namespace std; int digitMask = 0; int c[20]; int factorize(int n, int pos) { int curPos = pos; c[curPos] = 0; while (n > 0) c[curPos++] = n % 10, n /= 10; curPos--; curPos = max(curPos, pos); for (int i = pos, j = curPos; i < j; i++, j--) swap(c[i], c[j]); ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic Single-Port Synchronous RAM ////
//// ////
//// This file is part of memory li... |
//*****************************************************************************
// (c) Copyright 2009 - 2010 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
/... |
#include <bits/stdc++.h> using namespace std; int a[1000010], n, mo = 1000000007; long long dp[1000010], ans; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , a + i); a[i]--; } dp[1] = min(a[1], a[2]); for (int i = 2; i <= n; i++) { dp[i] = ... |
#include <bits/stdc++.h> using namespace std; int n, m; int k; bool debug = false; int a[105]; int main() { cin >> n; for (int i = 0, x; i < n; i++) { scanf( %d , &x); a[x]++; } for (int i = 0; i < 105; i++) k += a[i] / 2; printf( %d n , k / 2); return 0; } |
#include <bits/stdc++.h> using namespace std; template <class Ta, class Tb> inline Tb cast(Ta a) { stringstream ss; ss << a; Tb b; ss >> b; return b; }; const double EPS = 1e-9; const int INF = 1000000000; const int MOD = 1000000007; const int diri[8] = {-1, 0, 1, 0, -1, 1, 1, -1}; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1010; const double eps = 1e-9; const double pi = acos(-1.0); int Sng(double x) { if (x < -eps) return -1; if (x > eps) return 1; return 0; } class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) ... |
#include <bits/stdc++.h> using namespace std; int S[100009], cnt[1 << 7], num[1 << 7]; char s[100009]; int len, n, nu; inline long long rd() { long long x = 0; char c = getchar(); bool f = 0; while (!isdigit(c)) { if (c == - ) f = 1; c = getchar(); } while (isdigit(c)) { ... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
* for EE577b Troy WideWord Processor Project
*/
`timescale 1ns/10ps
/**
* `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 uni... |
/**
* 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; mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count()); int a[105], vis[105]; vector<int> v[105]; int main() { int n; cin >> n; for (int i = 1; i <= 2 * n; ++i) cin >> a[i]; int ans = 0; for (int i = 1; i <= 2 * n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; int n, adj[166][166]; bool h[166]; vector<char> V[166], r; string a[105]; void dfs(char x) { h[x] = true; for (typeof(V[x].begin()) it = V[x].begin(); it != V[x].end(); it++) if (!h[*it]) dfs(*it); r.push_back(x); } int main() { 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... |
#include <bits/stdc++.h> using namespace std; string s; void output(const string& block) { string t; istringstream in(block); while (in >> t) cout << t; cout << endl; } int main(int argc, char* argv[]) { string block; string em; em += char(1); block = em; while (getline(cin... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { long long n, m; cin >> n >> m; long long ans; if (n < m) { ans = 0; } else if (n == m) ans = m % 10; else { int d = m % 10; int rem[10]; r... |
#include <bits/stdc++.h> using namespace std; int n, m; int check(int x) { int sum = 0; if (n <= ceil(x / 2)) sum++; if (m <= ceil(x / 3)) sum++; if ((n + m <= ceil(x / 2) + ceil(x / 3) - ceil(x / 6))) sum++; if (sum == 3) return 1; return 0; } int main() { cin >> n >> m; int x... |
#include <bits/stdc++.h> using namespace std; inline void fast_and_furious() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } int n; long long a[1005], b[1005], u, l, ans; int main() { fast_and_furious(); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; char ss[8][5] = { 1869 , 6198 , 1896 , 1689 , 1986 , 1968 , 1698 }; string s; int x, cnt, vis[1000010]; int main() { cin >> s; int len = s.length(); for (register int i = 0; i < len; i++) { if (s[i] == 0 ) cnt++; else if (!vi... |
#include <bits/stdc++.h> using namespace std; vector<long long> adj[100007][2]; long long ecnt[100007][2] = {0}; long long ss[100007] = {0}; long long sum = 0; long long n, m, q; int main() { cin >> n >> m; for (long long i = 0; i < m; i++) { long long a, b; cin >> a >> b; --a; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, w, b; int a[100]; cin >> n >> w >> b; for (int i = 0; i < n; i++) cin >> a[i]; int mini, maxi; if (w <= b) { mini = w; maxi = b; } else { mini = b; maxi = w; } int st = 0, endi = n - 1, cost... |
#include <bits/stdc++.h> using namespace std; long long a[110000], b[110000], dp[110000][5]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, i, j, k; vector<long long> v; cin >> n; for (i = 1; i < n; i++) { cin >> a[i]; } for (i ... |
module ula_k(
input [7:0] operator1,
input [7:0] operator2,
input [7:0] operation_alu,
output reg [7:0] result_alu,
output reg overflow
);
always @(operator1 or operator2)
begin
case(operation_alu)
8'b00000000: result_alu = operator1 + operator2;
8'b00000001: result_alu = operator1 - oper... |
`timescale 1ns/10ps
/**
* `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 base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
#include <bits/stdc++.h> using namespace std; constexpr long long mod = 1000000007; const long long INF = mod * mod; const long double eps = 1e-12; const long double pi = acosl(-1.0); long long mod_pow(long long x, long long n, long long m = mod) { long long res = 1; while (n) { if (n & 1) res... |
#include <bits/stdc++.h> int S, T, n, m, l, vol[200020]; int dis[400040], pos[400040], q[400040 * 2]; int E, u[200020], v[200020], go[400040], to[400040]; void AE(int s, int t) { to[++E] = t; v[s] = u[s] ? go[v[s]] = E : u[s] = E; } int spfa(int maxq) { register int i, j, k, top, tail; memse... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
/*
* 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<pair<long long int, long long int> > v; long long int indegree[300005]; long long int vis[300005]; long long int parent[300005]; long long int getpar(long long int child) { if (parent[child] == child) return child; else return parent[c... |
#include <bits/stdc++.h> double a, b, c, d, x, y; int main() { scanf( %lf%lf%lf%lf , &a, &b, &c, &d); x = a / b; y = c / d; printf( %lf , x / (1.0 - (1.0 - x) * (1.0 - y))); } |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; string s; cin >> s; int freq[26] = {0}; vector<int> v; for (int i = 0; i < s.length(); ++i) { freq[s[i] - a ]++; } for (int i ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; vector<int> v(n, 0); for (int i = 0; i < n; i++) { cin >> v[i]; } m--; int p = -1; for (int i = m + 1; i < n; i++) { if (v[i] != 0 && v[i] <= k) { if (p == -1 || abs(m - 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... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int n, nn, sz[133333], p; vector<int> g[133333], V; void dfs_sz(int x, int par) { sz[x] = 1; for (int to : g[x]) { if (to != par) { dfs_sz(to, x); sz[x] += sz[to]; } } if (sz[x] == n / 2 || sz... |
#include <bits/stdc++.h> using namespace std; int main() { istream& in = cin; int n; in >> n; vector<string> v; for (int i = 0; i < n; i++) { string str; in >> str; v.push_back(str); } set<char> use; map<char, set<char> > use2; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1, c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f ^= 1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return f ? x : -x; } const int N = 200005; int n, m; char s[N]; struct H... |
#include <bits/stdc++.h> using namespace std; const int MX = 200005; int ans, cnt0, cnt1, lth, pos1[MX], pos0[MX], pre[MX], nxt[MX]; char s[MX]; bool vis[MX]; int main() { scanf( %s , s + 1); lth = strlen(s + 1); for (int i = 1; i <= lth; i++) { if (s[i] == 0 ) pos0[++cnt0] = 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) 2014, Segiusz 'q3k' Bazanski <>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this l... |
/**
* 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
/* This file is part of JT51.
JT51 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 your option) any later version.
JT51 is distributed in the hope tha... |
#include<cstdio> #include<iostream> #include<cstring> #include<string> #include<cmath> #include<map> #include<algorithm> #include<vector> #include<set> #define Quick ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define ll long long #define INF 0x3f3f3f3f #define PI acos(-1) #define mem... |
#include <bits/stdc++.h> using namespace std; long long int n; vector<long long int> a, b; struct segmentTree { vector<long long int> t; segmentTree() { t.resize(4 * n); } void add(long long int ind, long long int x, long long int v = 0, long long int tl = 0, long long int tr = n) { ... |
#include <bits/stdc++.h> using namespace std; int dist[551000]; long long int sum = 0; set<long long int> ans; int fTemp[551000]; int freq[551000]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> dist[i + 1]; ... |
// wasca_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.0 145
`timescale 1 ps / 1 ps
module wasca_nios2_gen2_0 (
input wire clk, // cl... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; char A[N]; char B[N]; int buck[128]; int ans[128]; bool ok() { for (int i = a ; i <= z ; ++i) if (buck[i] > ans[i]) return false; return true; } int main() { scanf( %s , A); scanf( %s , B); int aa = strlen(... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, k; cin >> n >> k; long long int i, a[n + 1]; for (i = 1; i <= n; i++) cin >> a[i]; if (a[1] == a[n]) { cout << 1 << endl; return; } if (k == 1 && a[1] != a[n]) { cout << -1 << endl; retu... |
//-----------------------------------------------------------------------------
//
// (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 pro... |
#include <bits/stdc++.h> using ull = unsigned long long; using ll = long long; using ld = long double; using namespace std; const ll mod = 998244353; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, m, k, t; cin >> n >> k >> m >> t; deque<bool> cur(n); cur[k - 1] = 1; ... |
module ddr3_data_exercise_sm (rst, clk, cmd_rdy, datain_rdy, read_data, read_data_valid, wl_err, cmd_valid, cmd, cmd_burst_cnt, addr, write_data, data_mask);
input wire rst;
input wire clk;
input wire cmd_rdy;
input wire datain_rdy;
input wire [63:0] read_data;
input wire read_data_valid;
input wire wl_err;
o... |
#include <bits/stdc++.h> using namespace std; int n, k; long long c(int a, int b) { long long res = 1; for (int i = 1; i <= b; ++i) { res = res * (a + 1 - i) / i; } return res; } int main() { scanf( %d%d , &n, &k); long long ans = 1; for (int i = 1; i <= k; ++i) { if (i... |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; long long fastpower(long long x, long long n, long long M) { if (n == 0) return 1; else if (n % 2 == 0) return fastpower((x * x) % M, n / 2, M); else return (x * fastpower((x * x) % M, (n - 1) / 2, M)) % M; } lo... |
/*
* Copyright (c) 2015 Steven Stallion
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of cond... |
#include <bits/stdc++.h> using namespace std; string s, t, k; string str(string a) { if (a[1] == X ) swap(a[1], a[3]); else if (a[2] == X ) swap(a[2], a[3]); else if (a[0] == X ) swap(a[0], a[2]), swap(a[2], a[3]); string b = a.substr(0, 3); return b; } int main() { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long k; cin >> n >> k; k -= (long long)n * (n + 1) / 2; if (k < 0) { cout << -1 << endl; return 0; } long long sum = (long long)n * (n + 1) / 2; vector<int> ans; for (int i = n - 1; 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... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); long long t = 1; while (t--) { long long n, m; cin >> n >> m; long long len = n, l, r; for (long long i = 0; i < m; i++) { cin >> l >> r; len = min(len, r ... |
#include <bits/stdc++.h> using namespace std; int n; string s, t; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> t; int ph = 0; pair<int, int> mh = {0, 0}; for (int i = 0; i < n; i++) { if (t[i] == ( ) ph++; else ph--; mh = min(mh,... |
/*
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_buf_p0_even.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it a... |
#include <bits/stdc++.h> using namespace std; long long p[10], n, res; int main() { std::ios::sync_with_stdio(0); cin.tie(0); cin >> n; p[1] = 2; p[2] = 3; p[3] = 5; p[4] = 7; res = 0; for (int a = 1; a <= 4; a++) res += n / p[a]; for (int a = 1; a <= 4; a++) for (int... |
#include <bits/stdc++.h> #pragma GCC optimize( O2,Ofast,inline,unroll-all-loops,-ffast-math ) #pragma GCC target( avx,sse2,sse3,sse4,popcnt ) using namespace std; int nxt[100010][26], f[255][255][255], pos[26], n, q, a = 0, b = 0, c = 0; char s[100010], A[255], B[255], C[255]; template <class T> void read... |
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n, ans = 0, num[101], temp, minn = 1e9 + 7, maxx = 0, ann; for (int i = 1; i <= 100; i++) num[i] = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &temp); ... |
/**
* 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 solve() { int m, k; cin >> m >> k; if (m % 2 == 0) { printf( %d n , m + k * 2); } else { int t; for (int i = 3; i <= m; i += 2) { if (m % i == 0) { t = i; break; } } k--; m += t... |
#include <bits/stdc++.h> using namespace std; vector<long long> a[100005], vis(100005, 0), tree[100005], lev[2]; long long n, m, k; set<long long> v; stack<long long> st; void dfs(long long node, long long par) { vis[node] = 1; st.push(node); for (auto i : a[node]) if (!vis[i] and v.find(i... |
#include <bits/stdc++.h> using namespace std; inline void minimize(int &x, int y) { x = min(x, y); } inline void maximize(int &x, int y) { x = max(x, y); } const int N = 200000 + 1067; int n, m; int val[N], pos[N], it[N], res[N]; vector<int> to[N]; struct Node { int id, a; } node[N]; bool comp(N... |
#include <bits/stdc++.h> using namespace std; const long long M = 5005; const int MOD = 998244353; const int MX = 3e5 + 5; const long long INF = 1e18; const long double PI = acos((long double)-1); void msm() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } int sol... |
#include <bits/stdc++.h> using namespace std; char s[120][120]; int n, m; int main() { int i, j, k, res = 30, now = 0; string ss = ; scanf( %d%d , &n, &m); for (i = 0; i < n; i++) scanf( %s , s[i]); for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { char c = s[i][j]; ... |
#include <bits/stdc++.h> using namespace std; int const N = 3e5 + 10, oo = 1e9, M = 64; long long const OO = 1e18; int mod = oo + 7; double const eps = 1e-4, PI = acos(-1); int n, k, in[N]; int cc = 0, m = 0, cnt = 0; vector<int> dv[N]; bool brute(int i, int h) { if (h > k) return 0; if (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> using namespace std; int main() { int o; long long w, s, t; cin >> o; for (int i = 0; i < o; i++) { cin >> w >> s >> t; long long minnn = min(s, t); cout << (w - minnn) + 1 << n ; } } |
#include <bits/stdc++.h> using namespace std; int n, m; struct point { double x, y, z; } P[5200]; inline double sqr(double x) { return x * x; } inline double dist(point a, point b) { return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y) + sqr(a.z - b.z)); } inline double len(point a, point b, point c) { ... |
/*
* 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; void solve() { long long int n; cin >> n; long long int a, c1 = 0, c2 = 0, c3 = 0; vector<long long int> v1; vector<long long int> v2; vector<long long int> v3; for (int i = 1; i <= n; i++) { cin >> a; if (a == 0) { v3.pus... |
`define ADDER_WIDTH 064
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int A[2]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; long long ans = 0; cin >> n; while (cin >> n) { ++A[n]; if (!n) ans += A[1]; } cout << ans << endl; return 0; } |
module instructionmemory(output [31:0] data,input [6:0] addr,input clk);
reg [31:0] data;
reg [7:0] memdata [511:0];
initial
begin
memdata[0] = 8'b10001101; //load
memdata[1] = 8'b10100001;
memdata[2] = 8'b00000000;
memdata[3] = 8'b00000000;
memdata[4] = 8'b10001101; //load
memdata[5] = 8'b10100010... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.