id int64 251M 307M | language stringclasses 11
values | verdict stringclasses 119
values | source stringlengths 0 60.3k | problem_id stringclasses 500
values | type stringclasses 2
values | difficulty stringclasses 4
values |
|---|---|---|---|---|---|---|
291,582,075 | Python 3 | OK | def solve():
n = int(input())
h = map(int, input().split())
m = {}
for i in h:
m[i] = m.get(i, 0) + 1
print(n - max(m.values()))
t = int(input())
for i in range(t):
solve() | 2031A | right_submission | none |
291,615,319 | Python 3 | OK | from collections import Counter
tc = int(input())
for _ in range(tc):
n = int(input())
v = list(map(int, input().split()))
freq = Counter(v)
max_frequency = max(freq.values())
print(n - max_frequency) | 2031A | right_submission | none |
300,368,503 | PyPy 3-64 | OK | for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
f={}
for i in a:
if i in f:
f[i]+=1
else:
f[i]=1
mx=max(f.values())
print(n-mx) | 2031A | right_submission | none |
297,915,599 | Java 8 | OK | import java.util.Scanner;
public class Penchik_and_modern_monument{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt(),min=sc.nextInt(),l=1,m=1;
for(int i=1;i<n;i++){
int a... | 2031A | right_submission | none |
291,618,956 | Java 21 | OK | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-- > 0){
int n = s.nextInt();
int a[] = new int[n];
int min = -1, ans = 0;
for(int i = 0;... | 2031A | right_submission | none |
291,587,816 | Java 8 | OK | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class Tej {
public static void tej(FastIO sc) {
int n = sc.nextInt();
int[] a = new int[n];
for(int i=0; i<n; i++) a[i] = sc.nextInt();
i... | 2031A | right_submission | none |
292,881,421 | C++17 (GCC 7-32) | OK | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<long long , long long>
#define vi vector<int>
using namespace std;
ll M = 1000000007;
int MM = 998244353 ;
ll MMM = 1e18 + 4;
ll powpow(ll a, ll b)
{
if(b==1) return a;
ll x = powpow(a,b/2)%M;
if(b%2) retu... | 2031A | right_submission | none |
293,987,520 | C++20 (GCC 13-64) | OK | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <chrono>
#include <deque>
#include<climits>
#include <set>
#include <map>
#include <ctime>
#include<random>
#include <queue>
#include <stack>
#include <unordered_map>
#include<unordered_set>
#define... | 2031A | right_submission | none |
291,577,066 | C++20 (GCC 13-64) | OK | /**
* author: tourist
* created: 15.11.2024 04:35:20
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
... | 2031A | right_submission | none |
293,196,579 | C++23 (GCC 14-64, msys2) | OK | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
void solve() {
int n;
std::cin >> n;
std::vector<int> h(n);
for (int i = 0; i < n; i++) {
std::cin >> h[i];
}
int ans = 0;
for (int l = ... | 2031A | right_submission | none |
291,583,500 | C++23 (GCC 14-64, msys2) | OK | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define all(vec) vec.rbegin(), vec.... | 2031A | right_submission | none |
291,601,945 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include <iostream>
using namespace std;
int f[51];
int main()
{
int t,i,n,j,a,x;
cin >> t;
for (i=0; i<t; i++){
cin >> n;
x=0;
for (j=0; j<n; j++){
cin >> a;
f[a]++;
x=max(x, f[a]);
}
cout << n-x << '\n';
for (j=0; j<... | 2031A | wrong_submission | easy |
302,464,193 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
for (int i=0;i<t;i++) {
int n;
cin>>n;
int h[n];
for (int j=0;j<n;j++) {
cin>>h[j];
}
if(n==1)
cout<<0<<endl;
else if(n==2)
cout<<1<<endl;
... | 2031A | wrong_submission | easy |
302,696,674 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <iostream>
using namespace std;
int main (){
int t; cin >> t;
while (t--) {
int n; cin >> n;
int a[n + 1]; a[0] = -1;
int x = 1;
int y = 1;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] == a[i - 1]) {
y++;
... | 2031A | wrong_submission | easy |
291,650,754 | Python 3 | WRONG_ANSWER on test 2 | a=int(input())
for i in range(a):
b=int(input())
c=list(map(int,input().split()))
if c==(sorted(c))[::-1]:
d=len(set(c))
if d==len(c):
print(len(c)-1)
else:
print(len(c)-d)
else:
print(0) | 2031A | wrong_submission | easy |
296,419,107 | Python 3 | WRONG_ANSWER on test 2 | t = int(input())
for _ in range(t):
n = int(input())
lst = list(map(int, input().split()))
count = 0
for i in range(n - 1):
if lst[i] > lst[i + 1]:
count += 1
print(count) | 2031A | wrong_submission | easy |
291,644,011 | Python 3 | WRONG_ANSWER on test 2 | a=int(input())
for i in range(a):
b=int(input())
c=list(map(int,input().split()))
d=0
for e in range(1,b):
if c[e]<c[e-1]:
d+=1
print(d) | 2031A | wrong_submission | easy |
291,623,142 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int i = 0; i < t; i++) {
int n = scanner.nextInt();
int[] heights = new int[n];
... | 2031A | wrong_submission | easy |
293,078,205 | Java 21 | WRONG_ANSWER on test 2 | import java.util.Scanner;
public class PMMonument {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int[] h= new int[n];
for(int i = 0; i < n; i++ ){
... | 2031A | wrong_submission | easy |
291,581,922 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | /*
Author : kmv a.k.a kzhi
K41 IT CHV
*/
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define FOR(i,a,b) for (int i = a ; i <= b; ++ i)
#define FOD(i,a,b) for (int i = a; i >= b; -- i)
#define BIT(mask,i) ((mask >> i) & 1)
#define MASK(i) ... | 2031A | wrong_submission | medium |
292,435,140 | C++23 (GCC 14-64, msys2) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector <int> vec;
for (int i=0; i<n; i++){
int x=0;
cin>>x;
vec.push_back(x);
}
sort(vec... | 2031A | wrong_submission | medium |
291,624,407 | Python 3 | WRONG_ANSWER on test 2 | def min_operations_to_non_decreasing(n, heights):
operations = 0
max_height = heights[0]
# Iterate through array starting from second element
for i in range(1, n):
# If current height is less than previous maximum
# We need to increase it to at least max_height
if heights[i]... | 2031A | wrong_submission | medium |
291,653,494 | Python 3 | WRONG_ANSWER on test 2 | t=int(input())
while t>0:
t-=1
n=int(input())
li=list(map(int,input().split(" ")))
s=set(li)
print(len(s)-1) | 2031A | wrong_submission | medium |
293,929,166 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
import java.io.*;
import java.math.*;
public class sub {
/*
* /\_/\ (= ._.) / > \>
*/
static int mod = 998244353;
public static void main(String args[]) {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int a[] = new int[n];
for(int i = 0;i<n;i++)a[i]=sc.nextI... | 2031A | wrong_submission | medium |
291,641,317 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
public class monument {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t>0)
{
int n=sc.nextInt();
int A[]=new int[n];
for(int i=0;i<n;i++)
{
A[... | 2031A | wrong_submission | medium |
292,446,597 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
using namespace std;
const int N=5e5;
int n,a[N];
void solve(){
cin>>n;
map<int,int> mp;
for(int i=1;i<=n;i++){
cin>>a[i];
mp[a[i]]=1;
}
cout<<mp.size()-1<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
... | 2031A | wrong_submission | hard |
291,592,780 | C++23 (GCC 14-64, msys2) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3e5+9;
int a[N], b[N];
void haha()
{
int n;cin >> n;int cnt =0;
if(n == 1) cnt = 0;
else if(n == 2)
{
if(a[1] > a[2]) cnt = 1;
}
else if(n >= 3)
{
for(int i = 1; i <= n; i++)
{
cin >> a[i];
b[i] = a[i];
}
sort(b+1,... | 2031A | wrong_submission | hard |
291,589,053 | PyPy 3-64 | WRONG_ANSWER on test 2 | t = int(input())
for i in range(t):
h = int(input())
k = list(map(int,input().split()))
print(k[0]-k[-1]) | 2031A | wrong_submission | hard |
291,618,569 | Python 3 | WRONG_ANSWER on test 2 | t=int(input())
for _ in range(t):
n=int(input())
h=list(map(int,input().split(" ")))
le=len(h)
mle=le*-1
if len(h)==1:
print(0)
continue
else:
c=0
for i in range(n-1):
if h[i]>h[i+1]:
c+=1
h[i],h[i+1]=h[i+1],h[i]
... | 2031A | wrong_submission | hard |
291,666,348 | Java 8 | WRONG_ANSWER on test 2 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-- !=0){
int n=sc.nextInt();
int[] arr=new int[n];
int min=Integer.MAX_VALUE;
int max=Integer.MIN_VAL... | 2031A | wrong_submission | hard |
291,605,472 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[... | 2031A | wrong_submission | hard |
276,166,302 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
constexpr int inf = 1E9;
void solve() {
int n, m;
std::cin >> n >> m;
int t0, t1, t2;
std::cin >> t0 >> t1 >> t2;
std::vector<std::vector<std::array<int, 3>>> adj(n);
for (int i ... | 2000G | right_submission | none |
276,159,138 | C++20 (GCC 13-64) | OK | /**
* author: tourist
* created: 13.08.2024 07:59:57
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt;
cin >> tt;
while (tt--) {
int n, m;
cin >> n... | 2000G | right_submission | none |
289,341,417 | C++17 (GCC 7-32) | OK | // headers
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <queue>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
const in... | 2000G | right_submission | none |
276,356,347 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | # include <bits/stdc++.h>
using namespace std;
# define int long long
vector<tuple<int,int,int>> g[100005];
int t0, t1, t2;
int n, m;
bool ok(int time, int start, int goal){
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> q;
int dis[n+1];
memset(dis, 0x3f, sizeof(dis));
dis[start... | 2000G | wrong_submission | easy |
293,740,538 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <bits/stdc++.h>
using namespace std;
long long inf = numeric_limits<long long>::max();
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long t;
cin>>t;
vector<int> ans(t);
int count = 0;
while (t--){
count++;
long long n,m;
cin>>n>>m;
... | 2000G | wrong_submission | easy |
288,448,359 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 5;
struct edge {
int v;
int w1;
int w2;
int nxt;
} e[N << 1];
int head[N], ind;
int vis[N];
struct node {
int v;
int t;
bool operator<(const node &a) const {
return t < a.t;
}
};
void a... | 2000G | wrong_submission | easy |
276,338,442 | PyPy 3-64 | WRONG_ANSWER on test 2 | # https://codeforces.com/contest/2000
import sys
from heapq import heappush, heappop
input = lambda: sys.stdin.readline().rstrip() # faster!
INF = 10 ** 18
def dijkstra(n, adj, start, finish, t_start, walk_call, t1, t2):
dist = [INF] * n
dist[start] = t_start
queue = []
heappush(queue, (dist[... | 2000G | wrong_submission | easy |
276,305,567 | PyPy 3-64 | WRONG_ANSWER on test 2 | import heapq
import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def make_graph(n, m):
l = 2 * m + n
x, y, s = [0] * (2 * l), [0] * (2 * l), [0] * (((n + 1) << 1) + 3)
for i in range(0, m << 2, 4):
u, v, l1, l2 = map(int, input().split())
for k in range(2):
... | 2000G | wrong_submission | easy |
276,291,364 | PyPy 3-64 | WRONG_ANSWER on test 2 | I = lambda : list(map(int, input().split(' ')))
R = lambda : (int(input()))
import math
from collections import defaultdict
from collections import deque
from heapq import heappop, heappush, heapify
def is_possible(node, e, t0, t1, t2):
dis = [float('inf') for i in range(n + 1)]
dis[1] = node[0][0]
... | 2000G | wrong_submission | easy |
276,845,167 | Java 21 | WRONG_ANSWER on test 2 | //package Codeforces;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.*;
public class CallDuringTheJo... | 2000G | wrong_submission | easy |
276,843,516 | Java 21 | WRONG_ANSWER on test 2 | //package Codeforces;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.*;
public class CallDuringTheJo... | 2000G | wrong_submission | easy |
276,274,261 | C++14 (GCC 6-32) | WRONG_ANSWER on test 8 | #include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
const int maxn = 1e5 + 5, ninf = 0x80000000;
int T, n, m, t0, t1, t2, et[maxn];
struct Edge{
int to, l1, l2;
Edge(int to, int l1, int l2){
this->to = to;
this->l1 = l1;
this->l2 = l2;
}
};
... | 2000G | wrong_submission | medium |
277,476,713 | Java 21 | TIME_LIMIT_EXCEEDED on test 8 | import java.io.*;
import java.util.*;
public class Main {
public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353;
public static void main(String args[]){
try {
PrintWriter o = new PrintWriter(System.out);
boolean multiTest = true;
// init
... | 2000G | wrong_submission | medium |
277,104,325 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 9 | import math
from collections import Counter
import sys
import heapq
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, m = map(int, input().split())
eventTime, startCall, endCall = map(int, input().split())
neighbourNodes = [[] for i in range(n)]
for i in range(m... | 2000G | wrong_submission | medium |
276,326,449 | Python 3 | TIME_LIMIT_EXCEEDED on test 10 | # Author : Omm Praksh Sahoo
# Calm, Down... Wrong Submission Have 10 Mins Penalty
import heapq
I = lambda: input()
II = lambda: int(input())
MII = lambda: map(int, input().split())
LI = lambda: list(input().split())
LII = lambda: list(map(int, input().split()))
LGMII = lambda: map(lambda x: int(x) - 1, input().split())... | 2000G | wrong_submission | medium |
276,231,245 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 11 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#def... | 2000G | wrong_submission | medium |
288,835,419 | Java 21 | TIME_LIMIT_EXCEEDED on test 15 | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int n=sc.nextInt(),m=sc.nextInt(),t0=sc.nextInt(),t1=sc.nextInt(),t2=sc.nextInt();
List<int[]> path[]=new List[n... | 2000G | wrong_submission | medium |
277,286,268 | C++14 (GCC 6-32) | TIME_LIMIT_EXCEEDED on test 17 | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define deb(x...)
#endif
const int mod = 1000000007; // 998244353;
const int N = 2 * 1e5 + 5;
const int INF = 1000000000000000000;
void solve()
{
int n, m, t0, t1, t2, u, v, l1,... | 2000G | wrong_submission | hard |
276,462,954 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 17 | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5+10;
int ar[N],n,m;
vector<array<int,3>> q[N];
int t0,t1,t2;
int dist[N];
inline bool check(int mid){
for(int i=1; i<=n; i++) dist[i] = 1e15;
dist[1] = mid;
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<i... | 2000G | wrong_submission | hard |
279,273,564 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 17 | import heapq, math
from collections import Counter, defaultdict, deque
from functools import cache
import io,os
import sys
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
t = int(input())
ret = []
MOD = 1_000_000_007
for _ in range(t):
# n = int(input())
n, m = list(map(int, input().sp... | 2000G | wrong_submission | hard |
277,988,465 | Java 8 | TIME_LIMIT_EXCEEDED on test 17 | import java.io.*;
import java.util.*;
public class CallDuringTheJourney {
public static PrintWriter out;
public static void main(String[] args)throws IOException{
JS sc=new JS();
out=new PrintWriter(System.out);
int t=sc.nextInt();
outer: while(t-->0) {
int n=sc.nextInt();
... | 2000G | wrong_submission | hard |
276,832,367 | Java 21 | TIME_LIMIT_EXCEEDED on test 17 | //package Codeforces;
import java.util.*;
public class CallDuringTheJourney {
final static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int testcases = sc.nextInt();
for (int test = 0; test<testcases; ++test) {
int n = sc.nextInt();
... | 2000G | wrong_submission | hard |
277,221,391 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 18 | # Created by Ketan_Raut
# Copyright © 2024 iN_siDious. All rights reserved.
import sys,os
import random
from math import *
from string import ascii_lowercase,ascii_uppercase
from collections import Counter, defaultdict, deque
from itertools import accumulate, combinations, permutations
from heapq import heappushpop, he... | 2000G | wrong_submission | hard |
274,739,311 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
void solve() {
int l, r;
std::cin >> l >> r;
int ans = 0;
int min = -1;
for (int x = 1, t = 1; x <= r; x *= 3, t++) {
if (l >= x) {
min = t;
}
ans += std... | 1999E | right_submission | none |
274,738,972 | C++20 (GCC 13-64) | OK | /**
* author: tourist
* created: 06.08.2024 10:42:02
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
const int M = int(2e5) + 10;
vector<int> ops(M);
for (int i ... | 1999E | right_submission | none |
275,012,153 | C++17 (GCC 7-32) | OK | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5+1;
vector<long long> temp(N);
void solve() {
int l,r;
cin>>l>>r;
long long ans = 0;
int a = l;
int cnt = 0;
ans += 2*1LL*(temp[l]-temp[l-1]);
ans += temp[r]-temp[l];
cout<<ans<<endl;
}
int main() {
for(int i=1;i<=N;i... | 1999E | right_submission | none |
275,023,194 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 2 | #include<iostream>
#include<vector>
#define int int64_t
using namespace std;
int32_t cal(int n){
if(n<3)return 1;
return 1+cal(n/3);
}
int32_t main(){
int t;
cin>>t;
while(t--){
int l,r;
cin>>l>>r;
vector<int>vc(3e5+1,0);
vc[1]=1;
for(int i=2;i<3e5+1;i++){
... | 1999E | wrong_submission | easy |
291,327,132 | C++17 (GCC 7-32) | WRONG_ANSWER on test 2 | #include<bits/stdc++.h>
#define R register
using namespace std;
const int MAXN=200005;
int T,l,r,d[MAXN];
void solve(){
cin>>l>>r;
int s=0;
s+=2*d[l];
long long tl=l+1,tr=r;
while(tl<=tr){
s+=d[tl];
tl++;
if(d[tl]!=d[tl-1])break;
}
while(tl<=tr){
... | 1999E | wrong_submission | easy |
283,894,548 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <bit>
using namespace std;
#define hash #
#define remr %
#define cmp ==
#define ll long long int
#define ld long double
#define get1(n) \
ll n; \
cin >> n;
#define get2(a, b) \
ll a, b; \
cin... | 1999E | wrong_submission | easy |
274,915,842 | PyPy 3-64 | WRONG_ANSWER on test 2 | import math
def solve(l, r):
ans = 0
done = False
num = -1
if r - l + 1 == 2:
ans += (math.floor(math.log(l, 3)) + 1) * 2
ans += math.floor(math.log(r, 3)) + 1
print(ans)
return
for i in range(l, r + 1):
if i % 3 == 2 and not done:
num = i
... | 1999E | wrong_submission | easy |
283,974,605 | Python 3 | TIME_LIMIT_EXCEEDED on test 2 | def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s)]))
def invr():
return(map(int,input().split()))
def operations(x):
res = 0
while x != 0:
x //= 3
res += 1
return res
def solve():
... | 1999E | wrong_submission | easy |
277,896,392 | Python 3 | TIME_LIMIT_EXCEEDED on test 2 | import math
t = int(input())
for _ in range(t):
l, r = list(map(int, input().split()))
y,x =l, l+1
dp = [-1]*(r-l+1)
count = 0
while y != 0:
y = math.floor(y/3)
count += 1
dp[0] = count
count = 0
while x != 0:
x = math.floor(x/3)
count += 1
dp... | 1999E | wrong_submission | easy |
274,977,637 | Java 21 | WRONG_ANSWER on test 2 | import java.util.*;
public class Codechef {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int l = sc.nextInt(), r = sc.nextInt();
double tans = (Math.log(l) / Math.log(3));
long ans = 0;
// long min = Long.MAX_VALUE;
long mi... | 1999E | wrong_submission | easy |
296,189,183 | Java 21 | WRONG_ANSWER on test 2 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.security.KeyStore.Entry;
import java.util.*;
import java.util.regex.Pattern;
import java.io.*;
public class test {
static int gcd(int a, int b) {
if (a == 0)
... | 1999E | wrong_submission | easy |
274,862,277 | C++14 (GCC 6-32) | TIME_LIMIT_EXCEEDED on test 3 | #include<bits/stdc++.h>
#define ll long long
#define ln '\n'
#define ld long double
using namespace std;
const int M = 2e5 + 10;
const ll mod = 1e9 + 7;
int main() {
int t;
cin >>t;
while(t--){
ll l,r,sum=0;
cin >>l>>r;
ll x=l;
while(x){
sum++;
x/=3;
}
for (int i=l+1;i<=r;i++){
x=i;
if (i... | 1999E | wrong_submission | medium |
275,030,247 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 3 | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int N =2e5 + 5;
//int mp[N];
void solve(){
int l,r;
cin >> l >> r;
int ans = 0;
int k = 1;
int cnt = 1;
while(k < l){
k *= 3;
cnt ++;
}
// cout << cnt << '\n';
int nxt;
if(k == l) nxt = k * 3;
else cnt --,nxt = k;
// cout << ans << '... | 1999E | wrong_submission | medium |
274,954,720 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 3 | def totalDivisoes(n):
if n == 1:
return 1
num = potencias[0]
index = 0
while n >= num:
index += 1
num = potencias[index]
return index
n = int(input())
potencias = []
for i in range(13):
potencias.append(pow(3, i))
for _ in range(n):
l, r = map(int, inpu... | 1999E | wrong_submission | medium |
274,913,667 | Python 3 | TIME_LIMIT_EXCEEDED on test 3 | def compute_steps(idx):
if idx == 0:
return 0
if memo[idx] != -1:
return memo[idx]
memo[idx] = 1 + compute_steps(idx // 3)
return memo[idx]
def main():
test_cases = int(input().strip())
# Initialize memoization array
max_size = 2 * 10**5 + 1
global memo
memo = [-1... | 1999E | wrong_submission | medium |
275,447,153 | Java 21 | TIME_LIMIT_EXCEEDED on test 3 | import java.util.*;
public class b2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long t = sc.nextLong();
while(t-->0){
long l = sc.nextLong();
long r = sc.nextLong();
long count = 0;
for(long i = l; i <= r; ... | 1999E | wrong_submission | medium |
275,026,832 | Java 21 | TIME_LIMIT_EXCEEDED on test 3 | import java.util.*;
public class tripleOp {
public static int OptimizePow(long k){
double n = 0;
n = ((Math.log10(k))/(Math.log10(3))) + 1;
return (int)(n);
}
public static void main(String args[]){
try(Scanner sc = new Scanner(System.in)){
int test = sc.nex... | 1999E | wrong_submission | medium |
275,167,603 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 3 | #include<iostream>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<cstring>
#include<fstream>
#include<queue>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
void solve(){
long long l,r,ans=0;
cin>>l>>r;
long long ll=l,lll=l+1;
while(ll){
ll/=3;... | 1999E | wrong_submission | hard |
274,885,820 | C++20 (GCC 13-64) | TIME_LIMIT_EXCEEDED on test 3 | #include <bits/stdc++.h>
#define sz size
#define int long long
#define cy cout << "YES"<<"\n"
#define cn cout << "NO" <<"\n"
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fend "\n"
using namespace std;
void solve()
{
int l,r;
cin>>l>>r;
vector<int>v;
int x = 3;
... | 1999E | wrong_submission | hard |
291,465,572 | PyPy 3-64 | TIME_LIMIT_EXCEEDED on test 3 | def log(a, b):
res = 0
while a > 0:
a //= b
res += 1
return res
def solve():
l, r = list(map(int, input().split()))
ans = log(l, 3)
for i in range(l, r + 1):
ans += log(i, 3)
print(ans)
t = int(input())
for _ in range(t):
solve() | 1999E | wrong_submission | hard |
275,245,025 | Python 3 | TIME_LIMIT_EXCEEDED on test 3 | import sys
input = sys.stdin.readline
def pow_of_3():
ll=[]
ll.append(3)
sums=9
while(sums<=2*(10**5)):
ll.append(sums)
sums*=3
ll.append(sums)
return ll
ll=pow_of_3()
# print(ll[-1])
def binary_search(i):
if(i<ll[0]):
return 0
elif(i>=ll[-1]):
return len... | 1999E | wrong_submission | hard |
274,981,639 | Java 8 | TIME_LIMIT_EXCEEDED on test 3 | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader(){br = new BufferedReader(new InputStreamReader(System.... | 1999E | wrong_submission | hard |
275,266,752 | Java 21 | TIME_LIMIT_EXCEEDED on test 3 | import java.util.Scanner;
public class E {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t != 0) {
t--;
int l = sc.nextInt();
int r = sc.nextInt();
int[] op=new int[r+1];
op... | 1999E | wrong_submission | hard |
260,500,447 | PyPy 3-64 | OK | s = input()
q=[[]]
it = iter(q)
cur = next(it)
for c in s:
if c=="(":
x = []
cur.append(x)
q.append(x)
if c==")":
cur = next(it)
def dumps(u):
q = [(0,v) for v in u]
s = []
while q:
pc,u = q.pop()
if pc==0:
s.append("(")
q.app... | 1970A2 | right_submission | none |
259,671,822 | Java 21 | OK | import java.util.Scanner;
public class Main {
static int N = 500000;
static int[] ll = new int[N + 1];
static int[] rr = new int[N + 1];
public static void dfs(int i) {
if (i != 0)
System.out.print("(");
int j = rr[i] - 1;
while (j >= ll[i]) {
dfs(j);
... | 1970A2 | right_submission | none |
259,508,664 | PyPy 3-64 | OK | a = input()
n = len(a)
prefix = []
cur = -1
i = 0
o, t = 0, 0
while i < n:
cur += 1
obj = o
o, t = 0, 0
while i < n:
if a[i] == '(':
o += 1
elif t == obj:
break
else:
t += 1
prefix.append(cur)
i += 1
last = [0]*(prefix[-1]... | 1970A2 | right_submission | none |
287,818,536 | PyPy 3-64 | OK | import sys
import functools
# from typing_extensions import Self
input = sys.stdin.readline
from math import floor, exp
# sys.setrecursionlimit(200000)
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = inp... | 1970A2 | right_submission | none |
259,514,210 | C++17 (GCC 7-32) | OK | #include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n;
string s;
vector<int> adj[N];
string ans;
void dfs(int u, int f) {
if (u) ans.push_back(')');
for (int v : adj[u]) {
if (v != f) {
dfs(v, u);
}
}
if (u) ans.push_back('(');
}
void solve() {
cin >> s;
n = s.length();
queue... | 1970A2 | right_submission | none |
260,095,699 | C++20 (GCC 13-64) | OK | //#include <__msvc_all_public_headers.hpp>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define int ll
ve... | 1970A2 | right_submission | none |
283,730,243 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=5e5+5;
vector<char>vec[N];
void solve()
{
string s;
cin>>s;
int n=s.length();
int x=0,l=0,r,d=0;
while (d<n)
{
bool flag=false;
for (int j=d;j<n;j++)
{
if (s[j]==')')
{... | 1970A2 | right_submission | none |
259,476,686 | C++20 (GCC 13-64) | OK | #include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::string s;
std::cin >> s;
const int n = s.size();
int res = 0;
std::vector<std::vector<int>> vec;
int i = 0;
while (i < n) {
vec.p... | 1970A2 | right_submission | none |
293,200,537 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.size();
vector<int> pos(n);
for (int i = 0; i < n; i++) {
pos[i] = i + 1; // 1-based positions
}
// To reconstruct t, we need to... | 1970A2 | wrong_submission | easy |
259,504,811 | C++20 (GCC 13-64) | WRONG_ANSWER on test 2 | #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <array>
#include <set>
#include <limits.h>
#include <fstream>
#include <unordered_map>
#include <queue>
#include <array>
#include <cmath>
#include <bitset>
struct ELEMENT {
char c;
int id = 0;
int balance = 0;
... | 1970A2 | wrong_submission | easy |
259,493,168 | C++17 (GCC 7-32) | WRONG_ANSWER on test 4 | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
string s; cin>>s;
vector<tuple<int,int,char> > v;
for(int i=0,c=0;i<s.length();i++)
v.emplace_back(c,i,s[i]),c+=(s[i]=='('?1:-1);
sort(v.begin(),v.end());
for(auto [x,y,z]:v)cout<<z;
cout<<... | 1970A2 | wrong_submission | easy |
300,298,972 | Python 3 | WRONG_ANSWER on test 4 | string = str(input()).strip()
scores = {}
current = 0
for i,v in enumerate(string):
scores[i] = current
if v == "(":
current += 1
else:
current -= 1
sorter = sorted(scores,key=lambda a: (scores[a],a))
for i in sorter:
print(string[i],end="") | 1970A2 | wrong_submission | easy |
259,697,571 | Python 3 | WRONG_ANSWER on test 4 | s = input()
n = len(s)
SUM = [0] * n
for i in range(1, n): SUM[i] = SUM[i - 1] + (1 if s[i - 1] == '(' else -1)
print(*map(lambda x: x[1], sorted(zip(SUM, s), key=lambda x: x[0])), sep='') | 1970A2 | wrong_submission | easy |
259,496,515 | Python 3 | WRONG_ANSWER on test 4 | s=input()
t = s.split(')')
ans = [t[0]]
index = len(ans)
for c in t[1:]:
count = len(c)
if not count:
ans[index-1] += ')'
else:
ans[index-1] += '('
ans.insert(index, ')')
for _ in range(count-1):
ans.insert(index, '(')
index -= 1
if not index:
inde... | 1970A2 | wrong_submission | easy |
262,246,109 | Java 21 | WRONG_ANSWER on test 4 | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
int t = 1;
//t = f.nextInt();
while (t > 0) {
solve();
t--;
}
w.flush();
w.close();
}
static int mod = 9... | 1970A2 | wrong_submission | easy |
259,495,649 | Java 21 | WRONG_ANSWER on test 4 | import java.util.Scanner;
public class balanced_shuffle_2 {
public static String output(String s) {
StringBuilder[] groups = new StringBuilder[s.length() + 1];
int balance = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (groups[balance] ==... | 1970A2 | wrong_submission | easy |
259,494,588 | C++17 (GCC 7-32) | TIME_LIMIT_EXCEEDED on test 8 | #include <bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef long long LL;
string check(string s) {
int n = s.size() - 1;
std::vector<PII> tmp;
int cnt = 0;
for (int i = 1; i <= n; i ++) {
tmp.emplace_... | 1970A2 | wrong_submission | medium |
263,086,564 | C++17 (GCC 7-32) | WRONG_ANSWER on test 8 | #include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, long long> &a,
const pair<long long, long long> &b)
{
return (a.second < b.second);
}
void solve()
{
string s;
cin >> s;
vector<pair<long long, long long>> v;
long long PB = 0;
for (long long i ... | 1970A2 | wrong_submission | medium |
260,406,863 | Python 3 | WRONG_ANSWER on test 8 | def balanced_unshuffle(s):
# Initialize a list to store tuples of character, position, and prefix balance
seq = [(s[i], i, s[:i].count('(') - s[:i].count(')')) for i in range(len(s))]
# Sort the list of tuples based on prefix balance in increasing order,
# breaking ties by position in decreasing or... | 1970A2 | wrong_submission | medium |
259,951,575 | Python 3 | WRONG_ANSWER on test 8 | def balanced_shuffle(s):
n = len(s)
# Prepare list to hold the prefix balance, position, and character
entries = []
# Calculate prefix balances
balance = 0
for i, char in enumerate(s):
if char == '(':
balance += 1
else: # char == ')'
balance -= ... | 1970A2 | wrong_submission | medium |
302,463,306 | Java 21 | WRONG_ANSWER on test 8 | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
int []a=new int[s.length()];
Map<Integer,List<Integer>>mp=new HashMap<>(); //to store balance factor: corresponding indices ... | 1970A2 | wrong_submission | medium |
301,657,187 | Java 21 | WRONG_ANSWER on test 8 | import java.io.*;
import java.util.*;
public class BalancedUnshuffle {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int[][] a = new int[s.length()][3];
for(... | 1970A2 | wrong_submission | medium |
262,005,696 | C++17 (GCC 7-32) | WRONG_ANSWER on test 8 | #include<bits/stdc++.h>
using namespace std;
struct Shuffle
{
int balance;
int p;
char c;
};
bool cmp(Shuffle a,Shuffle b)
{
if(a.balance==b.balance)
return a.p>b.p;
else
return a.balance<b.balance;
}
int main()
{
vector<Shuffle> v;
string s;
cin>>s;
int n=0;
for(int i=0;i<s.size();i++)
{
v.push_back({n... | 1970A2 | wrong_submission | hard |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5