source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <iostream> #include <vector> #include <string> #include <sstream> #include <cmath> #include <set> using namespace std; string solve(vector<int> &a, int n) { int lim = (n-1)/2; int u, v, temp; for (int i = 0; i <= lim; i++) { u = n-2*i-2; v = n-2*i - 1; /* cout << u << " " << v << endl; ...
C++
95b35c53028ed0565684713a93910860
5a8d791f75f05e0b47a439732971380e
1,200
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int a[maxn]; int main(){ #ifdef lmj_debug freopen("1.in","r",stdin); #endif int T; cin>>T; while(T--){ int n; cin>>n; for (int i=1;i<=n;i++){ scanf("%d",&a[i]); ...
C++
95b35c53028ed0565684713a93910860
443cedfbce36b76df7f21e2f5cc7a71f
1,200
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int a[maxn]; int main(){ #ifdef lmj_debug freopen("1.in","r",stdin); #endif int T; cin>>T; while(T--){ int n; cin>>n; for (int i=1;i<=n;i++){ scanf("%d",&a[i]); ...
C++
95b35c53028ed0565684713a93910860
6e652929549669916ba654d1bb4eb46a
1,200
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int a[maxn]; int main(){ #ifdef lmj_debug freopen("1.in","r",stdin); #endif int T; cin>>T; while(T--){ int n; cin>>n; for (int i=1;i<=n;i++){ scanf("%d",&a[i]); ...
C++
95b35c53028ed0565684713a93910860
66feb5660a2c20347db9a3b4bba0b5ad
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int n,a[200005]; bool solve() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=n;i>2;i-=2) if(min(a[i],a[i-1])<max(a[i-2],a[i-3])) return 0; return 1; } int main() { int __;cin>>__; while(__--) puts(solve()?"YES":"NO"); }
C++
95b35c53028ed0565684713a93910860
f182cd501e60a54150465ea4aaf4a790
1,200
PASSED
#include<iostream> #include<bits/stdc++.h> #define ll long long #include<vector> #include<map> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--) { ll n; cin>>n; vector<ll>v(n),v1; for(int i=0;i<n;i++)cin>>v[i]; int flag=0; ...
C++
95b35c53028ed0565684713a93910860
705ad0be445be60d038dca6abde6d936
1,200
PASSED
#include <bits/stdc++.h> #define int long long int #define sync {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);} //INPUT: #define testcase int t; cin >> t; while(t--) #define rep(i,a,b) for(int i=a;i<=b;i++) #define revrep(i,a,b) for(int i=a;i>=b;i--) //SHORTCUTS: #define endl "\n" #de...
C++
95b35c53028ed0565684713a93910860
354c9455b67f82e86ab4f9b7a5210efb
1,200
PASSED
#include <stdio.h> #include <bits/stdc++.h> using namespace std; int solve(){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); if(n&1){ if(a[0]>a[1] || a[0]>a[2]){ printf("NO\n"); return 0; } for(int i=1;i<n-2;i+=2) for(int j=i+2;j<=i+3;j++) if(a[i]...
C++
95b35c53028ed0565684713a93910860
9a88029daedd1bf081e93f07d95fab29
1,200
PASSED
#include <stdio.h> #include <bits/stdc++.h> using namespace std; int solve(){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); if(n&1){ if(a[0]>a[1] || a[0]>a[2]){ printf("NO\n"); return 0; } } bool k=n&1; for(int i=k;i<n-2;i+=2) for(int j=i+2;j<=i+3...
C++
95b35c53028ed0565684713a93910860
1f8ac7e5f4ef181479d794ea38b125e0
1,200
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
e055ac6ce5fb651a9853f1daa5a6fc9e
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
8c271e12cf8a920608806eae5cc672cf
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
74a0438d06771f7eb64d869174b68639
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
f9cb79fe4777bb9e14e7dadf8fbbc6f7
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
5f60340d1de633b8d964fb719e3ef5dc
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
037e763c710f716fc481de5ee7a6ea07
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
bd7723dba936afaa390e6d5c15e8ca04
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
2a8e8c2f71946ec9b252d65b9c3f454d
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
503ff1cdf1eb5c9549ee99327d460005
1,800
PASSED
#include "bits/stdc++.h" // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define m_os tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_stati...
C++
9afb205f542c0d8ba4f7fa03faa617ae
0a16005e66ae751a0ed934449b528690
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #pragma GCC optimize(2) #pragma GCC optimize(3,"Ofast","inline") #define endl '\n' #define pii pair<int,int> #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int maxn=1e6+5; int e[...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
72fb9ca5e389e738f300e201986354bd
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,m;cin>>n>>m; vector<int>indeg(n,0),outdeg(n,0); vector<vector<int>>adj(n); for (int i = 0;i<m;++i){ int x,y;cin>>x>>y; --x; --y; outdeg[x]++; indeg[y]++; adj[x].push_back(y); ...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
8470544d611a5b6e837165a1e258c8c6
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,m;cin>>n>>m; vector<int>indeg(n,0),outdeg(n,0),di(n,0); vector<vector<int>>adj(n); set<pair<int,int>>edge; for (int i = 0;i<m;++i){ int x,y;cin>>x>>y; --x; --y; outdeg[x]++; inde...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
e8ebb70967cb1ad11b7275df8c486cb9
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,m;cin>>n>>m; vector<int>indeg(n,0),outdeg(n,0),di(n,0); vector<vector<int>>adj(n); set<pair<int,int>>edge; for (int i = 0;i<m;++i){ int x,y;cin>>x>>y; --x; --y; outdeg[x]++; inde...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
d5a94a4507fd11bf9e02e2cb42a1c8bc
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define FOR(i, N) for (int i = 0;...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
7abd03538a708df6694c9b41b29261cc
2,000
PASSED
/* ▄█ ▄████████ ▄▄▄▄███▄▄▄▄ ▄█ █▄ ▄████████ ▄████████ ▄█ ▄█▄ ███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ▄███▀ ███▌ ███ ███ ███ ███ ███ ███ ███ ███ █▀ ███ ███ ███▐██▀ ███▌ ███ ███ ███ ...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
711bc9ad009876dcc8e83fca5b5801a0
2,000
PASSED
/* ▄█ ▄████████ ▄▄▄▄███▄▄▄▄ ▄█ █▄ ▄████████ ▄████████ ▄█ ▄█▄ ███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ▄███▀ ███▌ ███ ███ ███ ███ ███ ███ ███ ███ █▀ ███ ███ ███▐██▀ ███▌ ███ ███ ███ ...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
ae702912776c8a288ed385cd1f1df789
2,000
PASSED
#include <bits/stdc++.h> using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container:...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
933d37ea63068d669b18ea0e9f1c5be3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container:...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
f1b4a50d9f48b1926414f0e348105c52
2,000
PASSED
#include <bits/stdc++.h> using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container:...
C++
2d3af7ca9bf074d03408d5ade3ddd14c
3323ae506f7963915d3b99826e511019
2,000
PASSED
n = int(input()) arr = list(map(int, input().split())) min_two = [100000000, 100000000] result = 100000000 for i in range(n): if i < n - 1: x, y = arr[i], arr[i + 1] big, small = max(x, y), min(x, y) if big < small * 2: cnt = big - small big -= cnt * 2 ...
Python
f4a7c573ca0c129f241b415577a76ac2
e698e4010a0efc3ee49288a155a11e18
2,000
PASSED
def s(a, b): if b*2<=a: return (a+1)//2 else: c = a-b a -= c*2 b -= c ll = c+(b//3)*2+b%3 return ll n = int(input()) a = list(map(int, input().split())) b = sorted(a) mn1 = b[0] mn2 = b[1] ans1 = (mn1+1)//2+(mn2+1)//2 for i in range(n-1): i...
Python
f4a7c573ca0c129f241b415577a76ac2
291dcf711d99dd8ffd52d7257238b5d8
2,000
PASSED
#https://codeforces.com/blog/entry/71884 import sys input = sys.stdin.readline from math import inf, gcd, log, log2, floor, ceil, sqrt from collections import Counter, defaultdict, deque from heapq import heappush, heappop, heapify from functools import lru_cache from itertools import permutations, accumulate ...
Python
f4a7c573ca0c129f241b415577a76ac2
eb45e2e7c8c059af9af5b7e928493dec
2,000
PASSED
#https://codeforces.com/blog/entry/71884 import sys input = sys.stdin.readline from math import inf, gcd, log, log2, floor, ceil, sqrt from collections import Counter, defaultdict, deque from heapq import heappush, heappop, heapify from functools import lru_cache from itertools import permutations, accumulate ...
Python
f4a7c573ca0c129f241b415577a76ac2
bb6d1e043517f1434ab8c8c7ce24ddc9
2,000
PASSED
#https://codeforces.com/blog/entry/71884 import sys input = sys.stdin.readline from math import inf, gcd, log, log2, floor, ceil, sqrt from collections import Counter, defaultdict, deque from heapq import heappush, heappop, heapify from functools import lru_cache from itertools import permutations, accumulate ...
Python
f4a7c573ca0c129f241b415577a76ac2
db780b87db1a1c49cefa96f36e9d803f
2,000
PASSED
n = int(input()) ## Author- Rajan a = list(map(int,input().split())) answer = 10**14 # Infinite #### Case - adjacents are broken #### for i in range(n-1): f , s = a[i], a[i+1] if(f>=2*s or s>= 2*f): ...
Python
f4a7c573ca0c129f241b415577a76ac2
e9a4190c58374916d3373bded95f6df3
2,000
PASSED
n = int(input()) a = list(map(int,input().split())) answer = 10**14 # Infinite #### Case - adjacent #### for i in range(n-1): f , s = a[i], a[i+1] if(f>=2*s or s>= 2*f): # One adjacent is t...
Python
f4a7c573ca0c129f241b415577a76ac2
5fc5a4b73c365b77ecf5455167f5b8e4
2,000
PASSED
from sys import stdin,stdout from collections import defaultdict input=stdin.readline #print=stdout.write ###-----------Code Begins----------## n = int(input()) a = list(map(int,input().split())) answer = 10**14 for i in range(n-1): if(a[i]>=2*a[i+1] or a[i+1]>2*a[i]): answer = min(answer, (max(...
Python
f4a7c573ca0c129f241b415577a76ac2
727639e45857817637cf8cb9e04b5e5d
2,000
PASSED
def greedy1(lst): return (lst[0] + 1) // 2 + (lst[1] + 1) // 2 def calc2(a, b): ans = min(a, b) a -= ans b -= ans ans += (a + b + 1) // 2 return ans def greedy2(lst): ans = 10_000_000 for i in range(1, len(lst) - 1): ans = min(ans, calc2(lst[i-1], lst[i+1])) r...
Python
f4a7c573ca0c129f241b415577a76ac2
a7d962a661454d7384f7f6b8e14504e3
2,000
PASSED
import sys from collections import * sys.setrecursionlimit(10**5) itr = (line for line in sys.stdin.read().strip().split('\n')) INP = lambda: next(itr) def ni(): return int(INP()) def nl(): return [int(_) for _ in INP().split()] import math def solve(n,arr): best = 2e6 cur = 2e6 for i...
Python
f4a7c573ca0c129f241b415577a76ac2
29653410d5497e0461ef160ffee65924
2,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ull unsigned long long int #define pb push_back #define ff first #define INF 1e18 #define nl "\n" #define sp " " #define ss second using namespace std; using namespace __gnu_pbds; temp...
C++
0ce05499cd28f0825580ff48dae9e7a9
9c582970d32f15be1564d2fdf918ad89
1,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ull unsigned long long int #define pb push_back #define ff first #define INF 1e18 #define nl "\n" #define sp " " #define ss second using namespace std; using namespace __gnu_pbds; temp...
C++
0ce05499cd28f0825580ff48dae9e7a9
112fd8df66ec783dff633a91f35537d5
1,200
PASSED
#include <bits/stdc++.h> using ll = long long; using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); ll t; cin >> t; while(t--){ ll n; cin >> n; vector<ll> a(2*n+1); for(ll i=0;i<n;++i){ ll x; cin >> x; a[x...
C++
0ce05499cd28f0825580ff48dae9e7a9
6d4f102524671806251097e0a97bfa79
1,200
PASSED
// Problem: B. Pleasant Pairs // Contest: Codeforces - Codeforces Round #728 (Div. 2) // URL: https://codeforces.com/problemset/problem/1541/B // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; #define int long long #define...
C++
0ce05499cd28f0825580ff48dae9e7a9
f9d1e25a137a9375b0a7a1918a7b57f8
1,200
PASSED
#include<iostream> #define maxn 300000 long long a[maxn]; using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; long long sum = 0; for(int i = 1; i <= n; ++i) cin >> a[i]; for(int i = 1; i <= n; ++i) for(int j = a[i]...
C++
0ce05499cd28f0825580ff48dae9e7a9
b362289c7a25a26ffdeca09f9efd26b1
1,200
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define x first #define y second using namespace std; ll read() { ll x = 0, w = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') { w = -1; } ch = getchar(); } while (isdigit(ch)) { ...
C++
0ce05499cd28f0825580ff48dae9e7a9
28379f76ffd6e9ad7ae6d49cc4e30d4f
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second typedef long long ll; typedef pair<long long,long long> pll; ll t, n,ans; pll arr[200005]; int main() { cin >> t; while(t--) { cin >> n; for (int i=1;i<=n;i++) { cin >> arr[i].fi; arr[i]....
C++
0ce05499cd28f0825580ff48dae9e7a9
139335fff2c2ccf4819edf2c8ef0b103
1,200
PASSED
#include<iostream> #include<algorithm> #include<cmath> using namespace std; typedef long long ll; const int N = 1e5 + 10; int t, n, a[N], c[N * 2]; ll cnt; void cnt_f( ll x ){ int x1 = 1.0 * x; for( int i = 1; i < sqrt( x1 ); i++ ){ if( !( x % i ) ){ int indexl = c[i]; int index...
C++
0ce05499cd28f0825580ff48dae9e7a9
fbee07fe835d5e2ba08bb6e17790a506
1,200
PASSED
#include<bits/stdc++.h> #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll; using namespace std; const int N = 1e6 + 10; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1e9 + 7; char nc() { static char buf[1000000], *p = buf, *q = buf; return p ...
C++
0ce05499cd28f0825580ff48dae9e7a9
1c3cf7bbbf61ec51462e01f2f82fa688
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int c; cin >> c; while(c--){ int tamanho; long long aux, pares=0; cin >> tamanho; vector<pair<long long, int>> a(tamanho); for(int i=0; i<tamanho; i++){ cin >> a[i].first; a[i...
C++
0ce05499cd28f0825580ff48dae9e7a9
36d92d1f21d09ab4427e2f789afed56d
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int u = 0; u < n; u++) { int a; cin >> a; if (a % 2 != 0) { for (int i = 2; i < a - 2; i += 2) cout << i << ' ' << i - 1<< ' '; cout << a << ' ' << a - 2 << ' ' << a - 1; } else for (int i = 2; i ...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
2d25e5d1e91e881e56222aa190c890ac
800
PASSED
#include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { int t,n; scanf("%d",&t); for(int i=0;i<t;i++){ scanf("%d",&n); if(n%2==0){ for(int i=1;i<=n-1;i+=2){ printf("%d %d",i+1,i); if(i==n-1) printf("...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
309d7a2b7ff7d9348f31c32b1df3a9c3
800
PASSED
#include<iostream> using namespace std; int main(int argc, char *argv[]) { int t,n,i,j,tem; cin>>t; while(t--){ cin>>n; int a[200]; //cout<<n<<" "; if(n%2==0){ for(i=1;i<n;i++){ //a[i]=i+1; if(i%2==1){ tem=i; a[i]=i+1; cout<<i+1<<" "; }else{ a[i]=tem; cout...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
40ab3175dcf01e2ef17de0d3e6c51a4f
800
PASSED
#include<stdio.h> #include<iostream> #include<algorithm> #include<stack> #include<math.h> #include<stdlib.h> #include<string.h> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { int n; int cat[101]; scanf("%d",&n); for(int i=1;i<=n;i++) cat[i] = i; for(int i=1;i<n;i+=2) swap(c...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
fc83ebeecf675f802df8b989e8557943
800
PASSED
// // Created by A on 2021/11/10. // #include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--){ int n; cin >> n; vector<int> a(n+1); fill(a.begin(), a.end(), 0); for (int i = 1; i <= n; ++i) a[i] = i; if(n % 2 == 0){ ...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
e048ee4837883d42d588183e980a1823
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t, n, i; cin >> t; while(t--) { cin >> n; if (n == 2) { cout << "2 1" << endl; } else if(n == 3) { cout << "3 1 2" << endl; } else if (n&1){ for(i = 1; i+3 <= n; i...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
ff25fe53ea1b9a2491115af9155af3d0
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; vector<int> v; for(int i=1; i<=n; i++) { v.push_back(i); } if(n%2==0) { for(int i=0; i<n-1; i+=2) { ...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
d6fa40e22f2962eef21f2cf723f7b5bc
800
PASSED
#include <bits/stdc++.h> #define IO \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define int long long #defi...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
37e1299ff12989d0c27cb65b8cdb004b
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; main() { ll n ; ll t; cin>>t; vector<int>a(1000); while(t--){ ll n; cin>>n; for(int i=1;i<=n;i++){a[i]=i;} for(int i=1;i<n;i+=2){swap(a[i],a[i+1]);} if(n%2!=0){ swap(a[n],a[n-1]); } ...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
d3b568422b250a539fda3df3f241cc4b
800
PASSED
/**https://userpic.codeforces.org/2030744/title/60d78eb318e6b42d.jpg https://userpic.codeforces.org/2030744/title/60d78eb318e6b42d.jpg https://userpic.codeforces.org/2030744/title/60d78eb318e6b42d.jpg**/ #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define bg begin() ...
C++
f89bd4ec97ec7e02a7f67feaeb4d3958
92ab0bb14c843666bcc0ba50f49a1c87
800
PASSED
#include <bits/stdc++.h> using namespace std; bool huiwen(int x); char a[10007]; int main() { char c; int n, m, k; scanf("%d", &n); ; for (int i = 0; i < n; i++) { scanf("%d %d", &m, &k); getchar(); for (int j = 0; j < m; j++) scanf("%c", &a[j]); if (...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
88414733c0857832b214db2c222c7205
800
PASSED
#include <bits/stdc++.h> #define fastio ios::sync_with_stdio(false); #define MAXN 10000000 #define INF 0x3f3f3f3f #define LOOP(i, n, s) for (; (i) < (n); (i) += (s)) #define endl '\n' using namespace std; using ii = pair<int, int>; using ll = long long int; int solve(string s, int n, int k) { bool palindrome = tr...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
92e240ffab49fb4835c0e47d8ab5449f
800
PASSED
#include <bits/stdc++.h> using namespace std; int solve(int n, int k, string s) { string sn = s; reverse(s.begin(), s.end()); if (k == 0 || sn == s) return 1; return 2; } int main() { int t; cin >> t; while (t--) { int n, k; string s; cin >> n >> k...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
fa330245365a1306a25a6853c68ce69f
800
PASSED
#include<iostream> #include<cstring> #include<string> #include<algorithm> using namespace std; const int N = 1010; int t, n, m; int pd(string s1) { string s2=s1; reverse(s1.begin(),s1.end()); return (s2 == s1); } int main() { int k; cin >> t; while (t--) { //string s; // //cin>>n>>m; //cin >> s; //if(m...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
05182464a9447c994f9ed0021ffe0e67
800
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; bool isPal(string s){ int i =0; int j =s.length()-1; while(i<j){ if(s[i] != s[j]) return false; i++; j--; } return true; } int main() { int tc; cin>>tc; while(tc--){ int n,k; ...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
d5697eae02acdccf9f556cd8d71cb9cf
800
PASSED
#include <bits/stdc++.h> using namespace std; bool palydrom(int len, string list){ for (int i = 0 ; i < len ; i++){ if(list[i] != list[len - (i+1)] ){ return 0; } }return 1; } int main() { int test_cases,length,nbOpp; cin >> test_cases; for ( int i = 0; i< test_cases ; i++){ cin >> length >> nbOpp; st...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
5f75d58df9f76134e0ad6f4e7f188bf1
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int T; ios::sync_with_stdio(0); cin>>T; while(T--) { int n,k; cin>>n>>k; char s[1010]; cin>>s+1; int mid=n/2,l,r,flag=0; if(n%2==0) { l=mid;r=mid+1; } else { l=mid;r=mid+2; } while(l) { if(s[l]==s[r]) { flag=0; ...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
1cf8d0cb13b271b39eab8bc41d5990bf
800
PASSED
#include<math.h> #include<iostream> #include<string.h> #include<algorithm> using namespace std; const int maxn=2e5+10; const int INF=1e9; const int mode=1e9+7; int main() { int num; scanf("%d",&num); for (int i=0;i<num;i++) { int n,k; scanf("%d",&n); scanf("%d",&k); char ...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
8cb1a0dfebb72acfdaa5ddd99ce4b0ee
800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long typedef long long ll ; typedef pair <int, int > pii ; typedef vector <int> vi ; // #define endl '\n' #define vec vector #define all(v) (v).begin() , (v).end() #define minof(v) min_element(all(v)) #define maxof(v) max_element(all(v)) #define rev(v)...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
e61f4ccaf55d928e0359ab440250ad8c
800
PASSED
#include<iostream> #include<cstring> #include<algorithm> #define int long long using namespace std; const int N=10000; signed main(){ int t; cin>>t; while(t--){ int ans=0; int a,b; cin>>a>>b; char v[102]; cin>>v; int l=strlen(v); if(b==0){ cout<<"1"<<endl; continue; } // if(a==1){ // cout<<...
C++
08cd22b8ee760a9d2dacb0d050dcf37a
83c12897b67d3fb16548943bac417b6f
800
PASSED
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #include <unordered_map> #include <unordered_set> #include <ctime> #define long long long using namespace std; long...
C++
ac8519dfce1b3b1fafc02820563a2dbd
f9a8c1ee38b492e0ca64f45af7cb9504
2,700
PASSED
#include <cstdio> int a[300005],b[300005],c[300005],d[300005],f[300005]; int main() { int n,q,mod,cnt,l,r; char op; scanf("%d%d%d",&n,&q,&mod); f[1]=1; for(int i=2;i<=n;i++) f[i]=(f[i-1]+f[i-2])%mod; for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) ...
C++
ac8519dfce1b3b1fafc02820563a2dbd
9118fd9e6b8908b88c1fa922c5f6018e
2,700
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; inline int read(){int f=1,x=0;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;} inline void write(int x){if (x<0){putchar('-');x=-x;}if(x>9) write(x/10);putch...
C++
ac8519dfce1b3b1fafc02820563a2dbd
23c772ea40b3c0cfe1d4c5136f2239b6
2,700
PASSED
#include<bits/stdc++.h> using namespace std; int mod,n,q,zs; int a[300005],b[300005],c[300005],d[300005],f[300005]; void add(int x,int val){ if(val==0 || x>n){ return; } if(d[x]==0){ zs--; } d[x]=((d[x]+val)%mod+mod)%mod; if(d[x]==0){ zs++; } } int main(){ scanf("%d%d%d",&n,&q,&mod); ...
C++
ac8519dfce1b3b1fafc02820563a2dbd
07049989aeba1ca249a6d4d79b13ffad
2,700
PASSED
#include<iostream> #include<algorithm> #include<vector> #include<queue> #include<stack> #include<numeric> #include<cstdio> #include<cstdlib> #include<cstring> #include<deque> #include<string> #include<cmath> #include<map> #include<iomanip> #include<set> #include<array> #include<cassert> #include<comple...
C++
ac8519dfce1b3b1fafc02820563a2dbd
1af7dc083c90c2daa444097a5159af87
2,700
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1e7+10; int a[maxn],b[maxn],c[maxn],d[maxn]; int f[maxn]; int z=0; int n,q,mod; inline void jia(int x,int val){ if(val==0||x>n)return; if(d[x]==0)z--; d[x]=((d[x]+val)%mod+mod)%mod; if(d[x]==0)z++; } int main(){ scanf("%d%d%d",&n,&q,&mod)...
C++
ac8519dfce1b3b1fafc02820563a2dbd
dd75af8b1b5f4bc6214994ba4af5c7f0
2,700
PASSED
#pragma GCC optimize(2,3) #include<algorithm> #include<iostream> using namespace std; #define int long long #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) const int N=3e5+10; char op[3]; int f[N],a[N],b[N],n,q,mod,cnt,l,r; inline void cal(int i,int x){ x=(x%mod+mod)%mod; if(i>n||x==0) return;...
C++
ac8519dfce1b3b1fafc02820563a2dbd
0e529b7d2bec16e47027fb238a519bd8
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define For(i,j,k) for(int i=j;i<=k;i++) #define Rof(i,j,k) for(int i=j;i>=k;i--) #define int long long #define N 300010 int a[N],f[N],n,q,tot=0,mod; inline void modi(int id,int val){ val=(val%mod+mod)%m...
C++
ac8519dfce1b3b1fafc02820563a2dbd
4f208323c1634f6412cb27cbcf06baf1
2,700
PASSED
#include<bits/stdc++.h> using namespace std; int n,q,mod,l,r,op,a[300005],b[300005],c[300005],d[300005],f[300005],cnt; char C[15]; int main() { scanf("%d %d %d",&n,&q,&mod); for(int i = 1;i <= n;i++) scanf("%d",&a[i]); for(int i = 1;i <= n;i++) scanf("%d",&b[i]),c[i] = ((a[i] - b[i]) % mod + mod) % mod...
C++
ac8519dfce1b3b1fafc02820563a2dbd
4a93cfca102996941cf7c87ae5be6008
2,700
PASSED
#include<bits/stdc++.h> using namespace std; int n,q; int a[300005],b[300005],c[300005],d[300005],cnt,f[300005],md,l,r,p; char op; inline void Update(int x,int w) { if(x>n) return; cnt-=(d[x]!=0); d[x]+=w; if(d[x]>=md) d[x]-=md; cnt+=(d[x]!=0); } int main() { scanf("%d%d%d",&n,&q,&md); f[1]=1; ...
C++
ac8519dfce1b3b1fafc02820563a2dbd
5db9528266b11cc676886ac374c55d43
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define lli long long int #define all(x) x.begin(),x.end() #define pb push_back #define pf push_front #define MAX(a,b,c) max(a,max(b,c)) #define MIN(a,b,c) min(a,min(b,c)) #define fast ios_base::sync_with_stdio(false); cin.tie(0); #define endline "\n" #define F first #defin...
C++
9fb84ddc2e04fd637812cd72110b7f36
59cef2aad523c5c1d71fa330fda55078
1,000
PASSED
/* in the name of god */ #include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 6; const int INF = INT_MAX; const int N = 1001; typedef long long int ll; #define pb push_back #define mp make_pair #define pll pair <ll , ll> #define F first #define S second #define int ll //#de...
C++
9fb84ddc2e04fd637812cd72110b7f36
67aed291add7854b163bcf1b418003ec
1,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <vector> #include<cstdio> #include <math.h> #include <vector> #include <deque> #include <string> #include <set> #include <map> #include <queue> #include <stdio.h> #include <cstdlib> #include <ra...
C++
9fb84ddc2e04fd637812cd72110b7f36
31a4adc9cb4cc0a97572ff8844b9a505
1,000
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; int fib(int n){ if(n==1||n==2) return 1; else return fib(n-2)+fib(n-1); } void solve(){ int n,x; cin>>n>>x; if(x==1) { cout<<"YES\n"; for(int i=1;i<=n*x;i++) { c...
C++
9fb84ddc2e04fd637812cd72110b7f36
4849b55311c4980b5ff06861024a23de
1,000
PASSED
#pragma GCC optimize("Ofast,no-stack-protector") //Author: Woody #include<bits/stdc++.h> //#define int long long #define mp make_pair #define eb emplace_back #define rep(n) for(int i=0;i<n;i++) #define rep2(n) for(int j=0;j<n;j++) #define F first #define S second #define all(v) v.begin(),v.end() #define SZ(x...
C++
9fb84ddc2e04fd637812cd72110b7f36
e610b367dd445b431644a50360682be3
1,000
PASSED
#include<bits\stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,k; cin>>n>>k; if(n==1) { if(k==1){ cout<<"YES\n"; cout<<1<<'\n'; } else ...
C++
9fb84ddc2e04fd637812cd72110b7f36
ebb52598e43761e63e0fa3ea5bef4c0d
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i,a,n) for(int i=a; i < n; i++) #define in(x) cin >> x; #define out(x) cout << x << '\n'; #define vi vector<int> #define pii pair<int,int> // first problem // int main(){ // ios :: sync_with_stdio ( false ); // cin ....
C++
9fb84ddc2e04fd637812cd72110b7f36
67cce4926a768975ac149de43d308432
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i,a,n) for(int i=a; i < n; i++) #define in(x) cin >> x; #define out(x) cout << x << '\n'; #define vi vector<int> #define pii pair<int,int> // first problem // int main(){ // ios :: sync_with_stdio ( false ); // cin ....
C++
9fb84ddc2e04fd637812cd72110b7f36
e1377a43d8b2547a3a9326d3bd0209d2
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i,a,n) for(int i=a; i < n; i++) #define in(x) cin >> x; #define out(x) cout << x << '\n'; #define vi vector<int> #define pii pair<int,int> // first problem // int main(){ // ios :: sync_with_stdio ( false ); // cin ....
C++
9fb84ddc2e04fd637812cd72110b7f36
53926addc40f0a7925854658f84ce68f
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define endl "\n" /*for interactive problems remove this line*/ /* -for ordered set problems policy based data sucture header //PBDS */ typedef long long ll; ll mod = pow(10, 9) + 7; typedef unsigned long long ull; int gcdExtended(int a, int b, int *x, i...
C++
9fb84ddc2e04fd637812cd72110b7f36
a81065393cd3625245311aa36d03077a
1,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
a9b538ee7623b5b3398c20a837c7d588
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
02aca16beb2c7b34bb9c9cffb5ed8a5b
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
015e1c6e0db0c5dd652865d40b61ea24
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
0aa3f1a58b06cae1b4a1c850b684dbfa
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
b9948ba7a461cac98bbb71a4650e1daf
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
5a713ac82281d1986fa3ffaae45ad2d6
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
e97497dc14ab775ed8f55d14e719fc91
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
95531394360f83a5d28585762294ac28
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
e44f3aacab90d3ddf599cef54145d56a
2,000
PASSED
// D #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
84e79bd83c51a4966b496bb767ec4f0d
e702bc343eabd0fd3c760cef36ddb867
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS 1 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 5; ll n, x, y; ll a[N]; ll b; int flag = 0; int main() { ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); int T; cin >> T; while (T--) { flag = 0; cin >>n>> ...
C++
d17752513405fc68d838e9b3792c7bef
b205a6150f484ae4903910405c714d0d
1,400
PASSED