Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
import sys
input = sys.stdin.readline
a=[int(input()) for _ in range(q)]
for _ in range(1,n+1):
   if k-q+a.count(_)>0:
      print("Yes")
   else:
      print("No")

Fixed submission:
n,k,q=map(int,input().split())
import sys
input = sys.stdin.readline
a=[int(input()) for _ in range(q)]
import collections
c=collections.Counter(a)
for _ in range(1,n+1):
   if k-q+c[_]>0:
      print("Yes")
   else:
      print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
a=[]
for _ in range(q):
   a.append(int(input()))
for i in range(1,n+1):
   if k-q+a.count(i)>0:
      print("Yes")
   else:
      print("No")

Fixed submission:
n,k,q=map(int,input().split())
import sys
input = sys.stdin.readline
a=[int(input()) for _ in range(q)]
import collections
c=collections.Counter(a)
for _ in range(1,n+1):
   if k-q+c[_]>0:
      print("Yes")
   else:
      print("No")
Buggy python submission (verdict: Runtime Error):
m,d=map(int,input().split())
if 22>d:
    print(0)
else:
    a=22
    ans=0
    while d>=a:
        b=str(a)
        if 2>int(b[0]) or 2>int(b[1]):
            a+=1
        else:
            if m >= int(b[0])*int(b[1]):
                ans+=1
                a+=1
            else:
                a+=1
print(ans)

Fixed submission:
m,d=map(int,input().split())
if 22>d:
    print(0)
else:
    a=22
    ans=0
    while d>=a:
        b=str(a)
        if 2>int(b[0]) or 2>int(b[1]):
            a+=1
        else:
            if m >= int(b[0])*int(b[1]):
                ans+=1
                a+=1
            else:
                a+=1
    print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3] or s[3]==s[4]:
    print("bad")
else:
    print("good")

Fixed submission:
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
    print("Bad")
else:
    print("Good")

Buggy python submission (verdict: Runtime Error):
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3] or s[3]==s[4]:
    print("good")
else:
    print("bad")

Fixed submission:
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
    print("Bad")
else:
    print("Good")

Buggy python submission (verdict: Runtime Error):
s = list(input())
if s//1000==s//100-s//1000*10:
    print("good")
    if s//100-s//1000*10==s//10-s//100*10+s//1000*100:
        print("good")
        if s//10-s//100*10+s//1000*100==s-s//10*10+s//100*100-s//1000*1000:
print("bad")        

Fixed submission:
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def amari(x,y):
    return x//y if x%y==0 else x//y+1

cnum=b//c-amari(a,c)+1
dnum=b//d-amari(a,d)+1
cdnum=b//lcm(c,d)-amari(a,lcm(c,d))+1

print(b-a+1-cnum-dnum+cdnum)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def amari(x,y):
    return x//y if x%y==0 else x//y+1

cnum=b//c-amari(a,c)+1
dnum=b//d-amari(a,d)+1
cdnum=b//lcm(c,d)-amari(a,lcm(c,d))+1

print(b-a+1-cnum-dnum+cdnum)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def amari(x,y):
    return x//y+1 if x%y!=0 else x//y

cnum=b//c-amari(a,c)+1
dnum=b//d-amari(a,d)+1
cdnum=b//lcm(c,d)-amari(a,lcm(c,d))+1

print(b-a+1-cnum-dnum+cdnum)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def amari(x,y):
    return x//y if x%y==0 else x//y+1

cnum=b//c-amari(a,c)+1
dnum=b//d-amari(a,d)+1
cdnum=b//lcm(c,d)-amari(a,lcm(c,d))+1

print(b-a+1-cnum-dnum+cdnum)
Buggy python submission (verdict: Runtime Error):
n, k= map(int, input().split())
s=input()
s[k], lower()
print("s")

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])

Buggy python submission (verdict: Runtime Error):
n, k= map(int, input().split())
s=input()
s[k], lower()
print(s)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])
Buggy python submission (verdict: Runtime Error):
a,b,t= map(int, input().split())
s=(10*t+5)//a
print(sb)

Fixed submission:
a,b,t=map(int,input().split())
print((t//a)*b)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a1=a%10
b1=b%10
c1=c%10
d1=d%10
e1=e%10
ar=[a1,b1,c1,d1,e1]
a2=a//10
b2=b//10
c2=c//10
d2=d//10
e2=e//10
k=10
s=0
for i in ar:
    if i==0:
        s+=10
        continue
    minimini=min(i,k)
    if minimini==i:
        k=i
    else:
        s+=10
print((a2+b2+c2+d2+e2)*10+minimini+s)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a1=a%10
b1=b%10
c1=c%10
d1=d%10
e1=e%10
ar=[a1,b1,c1,d1,e1]
a2=a//10
b2=b//10
c2=c//10
d2=d//10
e2=e//10
k=10
s=0
minimini=-1
for i in ar:
    if i==0:
        continue
    minimini=min(i,k)
    if i<k:
        k=i
for i in ar:
    if i==0:
        continue
    if i==minimini:
        minimini-=1
        continue
    else:
        s+=10
print((a2+b2+c2+d2+e2)*10+minimini+1+s)
Buggy python submission (verdict: Runtime Error):
H, W=int(HW[0]),int(HW[1])
h, w=int(hw[0]),int(hw[1])
ans=(W-w)*(H-h)
print(ans)

Fixed submission:
H, W=map(int, input().split())
h, w=map(int, input().split())
ans=(W-w)*(H-h)
print(ans)

Buggy python submission (verdict: Runtime Error):
H, W=int(HW[0]),int(HW[1])
h, w=int(hw[0]),int(hw[1])
print((W-w)*(H-h))

Fixed submission:
H, W=map(int, input().split())
h, w=map(int, input().split())
ans=(W-w)*(H-h)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
if int(s[4:5])>4:
    print("TBD")
else:
    print("Heisei")

Fixed submission:
s=input()
if s[5]=="0":
    if int(s[6])>4:
        print('TBD')
    else:
        print('Heisei')
else:
    print('TBD')
Buggy python submission (verdict: Runtime Error):
t,x=map(int,input().split())
print(round((t/x),4)))

Fixed submission:
t,x=map(int, input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a+b-n>0:
  ans=a+b-n
else:
  ans==0
print(min(a,b),ans,sep=' ')

Fixed submission:
n,a,b=map(int,input().split())
if a+b-n>0:
  ans=a+b-n
else:
  ans=0
print(min(a,b),ans,sep=' ')
Buggy python submission (verdict: Runtime Error):
|AB|,|BC|,|CA|=map(int, input().split())
ans=(|AB|*|BC|*|CA|/max(|AB|,|BC|,|CA|))/2
print(ans)

Fixed submission:
a,b,c=map(int, input().split())
ans=(a*b)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
print(s.count(2))

Fixed submission:
s=input()
print(s.count('2'))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n==1:
    print("Hello World")
elif n==2:
    ans=a+b
    print(ans)

Fixed submission:
a=int(input())
if a==1:
    print('Hello World')
    exit()
b=int(input())
c=int(input())
print(b+c)
Buggy python submission (verdict: Runtime Error):
a,b -map(int, input().split())
if 9>a and 9>b:
    print("Yay!")
else:
    print(":(")

Fixed submission:
a,b =map(int, input().split())
if 9>a and 9>b:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
N, *d = map(int, open(0).read().split())
c=list(set(*d))
print(len(c))

Fixed submission:
n=int(input())
s = []
for _ in range(n):
    s.append(input()) 
print(len(list(set(s))))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(math.floor((a+b)/2))

Fixed submission:
a,b=map(int,input().split())
import math
print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for_ in range(6):
  if s[_]=='1':
    ans+=1
print(ans)


Fixed submission:
s=input()
ans=0
for _ in range(6):
  if s[_]=='1':
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
ans=0
for_ in range(6):
  if s[_]==1:
    ans+=1
print(ans)

Fixed submission:
s=input()
ans=0
for _ in range(6):
  if s[_]=='1':
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
ck=0
for i in range(n//2):
  if not n[i]==n[-1-i]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')


Fixed submission:
n=input()
ck=0
for i in range(len(n)//2):
  if not n[i]==n[-1-i]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n=input()
ck=0
for _ in range(n//2):
  if not n[_]==n[-1-_]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')

Fixed submission:
n=input()
ck=0
for i in range(len(n)//2):
  if not n[i]==n[-1-i]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b-a=<0:
  print('delicious')
elif b-a=<x and not b-a=<0:
  print('safe')
else:
  print('dangerous')


Fixed submission:
x,a,b=map(int,input().split())
if 0>=b-a:
  print('delicious')
elif x>=b-a and b-a>0:
  print('safe')
else:
  print('dangerous')

Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if -a+b=<0:
  print('delicious')
elif -a+b=<x and not -a+b=<0:
  print('safe')
else:
  print('dangerous')

Fixed submission:
x,a,b=map(int,input().split())
if 0>=b-a:
  print('delicious')
elif x>=b-a and b-a>0:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
    if n<400:
        return 1
    elif n<800:
        return 2
    elif n<1200:
        return 3
    elif n<1600:
        return 4
    elif n<2000:
        return 5 
    elif n<2400:
        return 6 
    elif n<2800:
        return 7 
    elif n<3200:
        return 8 
    else:
        return 9

for _ in range(n):
    co=color(r[_])
    rlist.append(co)

ans1=len(set(rlist))
if rlist.count(9)==0:
    print(ans1,ans1,sep=" ")

elif ans1==1:
    print(1,min(8,rlist.count(9),sep=" ")

else:
    print(min(8,ans1-1),min(8,ans1-1+rlist.count(9)),sep=" ")
         

Fixed submission:
n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
    if n<400:
        return 1
    elif n<800:
        return 2
    elif n<1200:
        return 3
    elif n<1600:
        return 4
    elif n<2000:
        return 5 
    elif n<2400:
        return 6 
    elif n<2800:
        return 7 
    elif n<3200:
        return 8 
    else:
        return 9

for _ in range(n):
    co=color(r[_])
    rlist.append(co)

ans1=len(set(rlist))

if rlist.count(9)==0:
    print(ans1,ans1,sep=" ")

else:    
    if ans1==1:
        print(1,rlist.count(9),sep=" ")

    else:
        print(ans1-1,ans1-1+rlist.count(9),sep=" ")

Buggy python submission (verdict: Runtime Error):
n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
    if n<400:
        return 1
    elif n<800:
        return 2
    elif n<1200:
        return 3
    elif n<1600:
        return 4
    elif n<2000:
        return 5 
    elif n<2400:
        return 6 
    elif n<2800:
        return 7 
    elif n<3200:
        return 8 
    else:
        return 9

for _ in range(n):
    co=color(r[_])
    rlist.append(co)

ans1=len(set(rlist))
if rlist.count(9)==0:
    print(ans1,ans1,sep=" ")

elif ans1=1:
    print(1,min(8,rlist.count(9),sep=" ")

else:
    print(min(8,ans1-1),min(8,ans1-1+rlist.count(9)),sep=" ")

Fixed submission:
n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
    if n<400:
        return 1
    elif n<800:
        return 2
    elif n<1200:
        return 3
    elif n<1600:
        return 4
    elif n<2000:
        return 5 
    elif n<2400:
        return 6 
    elif n<2800:
        return 7 
    elif n<3200:
        return 8 
    else:
        return 9

for _ in range(n):
    co=color(r[_])
    rlist.append(co)

ans1=len(set(rlist))

if rlist.count(9)==0:
    print(ans1,ans1,sep=" ")

else:    
    if ans1==1:
        print(1,rlist.count(9),sep=" ")

    else:
        print(ans1-1,ans1-1+rlist.count(9),sep=" ")
Buggy python submission (verdict: Runtime Error):
a,op,b=map(input().split())
if op=="+":
   print(int(a)+int(b))
else:
   print(int(a)-int(b))

Fixed submission:
a,op,b=input().split()
if op=="+":
   print(int(a)+int(b))
else:
   print(int(a)-int(b))
Buggy python submission (verdict: Runtime Error):
c=input()
if c="a"  or c="i" or c="u" or c="e" or c="o":
   print("vowel")
else:
   print("consonant")

Fixed submission:
c=input()
if c=="a"  or c=="i" or c=="u" or c=="e" or c=="o":
   print("vowel")
else:
   print("consonant")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
if a%x==0:
    m=a//x
else:
    m=a//x+1
ans=0
while b>=m*x:
    ans+=1
    m+=1
print(ans)

Fixed submission:
a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
m=a//x
ans=0
while b>=m*x:
    if m*x>=a:
        ans+=1
    m+=1
print(ans)

Fixed submission:
a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
k=a
ans=0
while b>=k:
    if k%x==0:
        ans+=1
    k+=1
print(ans)

Fixed submission:
a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)
Buggy python submission (verdict: Runtime Error):
w=input()
if len(w)%2==1:
   print('No')
else:
   c=0
   import string
   for _ in string.ascii_lowercase:
      if not w.count(_)%2==0:
         c+=1
if c==0:
   print('Yes')
else:
   print('No')

Fixed submission:
w=input()
c=0
if len(w)%2==1:
   print('No')
else:
   import string
   for _ in string.ascii_lowercase:
      if not w.count(_)%2==0:
         c+=1
   if c==0:
      print('Yes')
   else:
      print('No')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
grid = [set() for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    grid[u].add(v)
    grid[v].add(u)

cnt = 0
best = 0
visited = set()


def dfs(x):
    global cnt
    if x in visited:
        return
    cnt += 1
    visited.add(x)
    for i in grid[x]:
        dfs(i)


for i in range(n):
    cnt = 0
    dfs(i)
    best = max(best, cnt)

print(best)


Fixed submission:
n, m = map(int, input().split())
grid = [set() for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    grid[u].add(v)
    grid[v].add(u)

cnt = 0
best = 0
visited = set()

import sys
sys.setrecursionlimit(1000000)

def dfs(x):
    global cnt
    if x in visited:
        return
    cnt += 1
    visited.add(x)
    for i in grid[x]:
        dfs(i)


for i in range(n):
    cnt = 0
    dfs(i)
    best = max(best, cnt)

print(best)
Buggy python submission (verdict: Runtime Error):
from math importsqrt
n, p = map(int, input().split())
r = 0
for i in range(n):
  x, y = map(int, input().split())
  if sqrt(x*x+y*y) <= p:
    r += 1
print(r)

Fixed submission:
from math import sqrt
n, p = map(int, input().split())
r = 0
for i in range(n):
  x, y = map(int, input().split())
  if sqrt(x*x+y*y) <= p:
    r += 1
print(r)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = set()
for i in range(n):
  s.insert(input())
print(len(s))

Fixed submission:
n = int(input())
s = set()
for i in range(n):
  s.add(input())
print(len(s))
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define UM unordered_map
#define MP map
#define ST set
#define US unordered_set
#define V vector
#define S string
#define D deque
#define L list
#define Q queue
#define PQ priority_queue
#define D deque
#define PII pair<int, int>
#define P pair
#define DB double
#define LDB long double
#define FOR(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define FFOR(i, n) for (int(i) = 0; (i) <= (n); ++(i))
#define RFOR(i, n) for (int(i) = (n)-1; (i) >= 0; --(i))
#define all(grid) (grid).begin(), (grid).end()
#define rall(grid) (grid).rbegin(), (grid).rend()

const int dr[] = {0, 1, 0, -1};
const int dc[] = {1, 0, -1, 0};

template <typename T>
void read(T& a) {
  a = 0;
  char c;
  while ((c = cin.peek()) < 48 or c > 57) cin.get();
  while ((c = cin.get()) > 47 and c < 58) a = (a << 3) + (a << 1) + c - 48;
}

template <typename T, typename... Args>
void read(T& a, Args&&... args) {
  read(a);
  read(forward<Args>(args...)...);
}

template <typename T>
void write(const S& sep, const S& end, T n) {
  char c[128] = {0};
  int i = 0;
  for (; n; ++i, n /= 10) c[i] = n % 10;

  for (--i; i >= 0; --i) cout.put(c[i] + 48);

  cout.write(end.c_str(), end.size() * sizeof(char));
}

template <typename T, typename... Args>
void write(const S& sep, const S& end, T n, Args&&... args) {
  char c[128] = {0};
  int i = 0;
  for (; n; ++i, n /= 10) c[i] = n % 10;

  for (--i; i >= 0; --i) cout.put(c[i] + 48);

  cout.write(sep.c_str(), sep.size() * sizeof(char));
  write(sep, end, forward<Args>(args...)...);
}
void solve() {
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  V<unsigned LL> red(a), green(b), colourless(c);
  FOR(i, a) {
      cin >> red[i];
  }
  FOR(i, b) {
      cin >> green[i];
  }
  FOR(i, c) {
      cin >> colourless[i];
  }
  sort(rall(red));
  sort(rall(green));
  FOR(i, x) {
      colourless.push_back(red[i]);
  }
  FOR(i, x) {
      colourless.push_back(green[i]);
  }
  sort(rall(colourless));
  cout << accumulate(begin(colourless), begin(colourless) + x + y, 0ULL) << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}


Fixed submission:
x,y,a,b,c=map(int,input().split())
*p,=sorted(map(int, input().split()))
*q,=sorted(map(int, input().split()))
*r,=map(int, input().split())

p=p[-x:]
q=q[-y:]
r=sorted(p+q+r)
print(sum(r[-x-y:]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
*li,=map(int, input().split())
from collections import Counter
c = Counter()
for i in li:
    c[i] += 1
ans=0
from math import comb
for i in c.values():
    ans += comb(i, 2)
for i in li:
    print(ans - comb(c[i], 2) + comb(c[i-1], 2))
  

Fixed submission:
n = int(input())
*li,=map(int, input().split())
from collections import Counter
c = Counter()
for i in li:
    c[i] += 1
ans=0
from math import comb
for i in c.values():
    ans += comb(i, 2)
for i in li:
    print(ans - comb(c[i], 2) + comb(c[i]-1, 2))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = int(input())
normal = 0
for i in range(n):
  li = input().split()
  if int(li[0]) == 1:
    normal ^= 1
  else:
    k = int(li[1]) - 1
    k ^= normal
    if k == 1:
      s += li[2]
    else:
      s = li[2] + s
print(s if normal == 0 else s[::-1])      

Fixed submission:
from collections import deque
s = deque(list(input()))
n = int(input())
normal = 0
for i in range(n):
  li = input().split()
  if int(li[0]) == 1:
    normal ^= 1
  else:
    k = int(li[1]) - 1
    k ^= normal
    if k == 1:
      s.append(li[2])
    else:
      s.appendleft(li[2])
print(''.join(s) if normal == 0 else ''.join(list(s)[::-1]))
Buggy python submission (verdict: Runtime Error):
s=str("As=str("ACL")
n=int(input())
print(s*n)

Fixed submission:
s=str("ACL")
n=int(input())
print(s*n)
Buggy python submission (verdict: Runtime Error):
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = 1
b = 1
c = 1
for i in range(N):
  a = pow(10, n, MOD)
  b = pow(9, n, MOD)
  c = pow(8, n, MOD)
ans = a - (2 * b) + c
if ans < 0:
  ans += MOD
print(ans)

Fixed submission:
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = pow(10, N, MOD)
b = pow(9, N, MOD)
c = pow(8, N, MOD)
ans = (a - (2 * b) + c) % MOD
if ans < 0:
  ans += MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import floor, ceil
N = int(input())
WHITE = 0
RED = 1
str = list(map(str, list(input())))
r = []
w = []

for i in range(N):
  w.append(i) if str[i] == "W" else r.append(i)
  str[i] = WHITE if str[i] == "W" else RED
r.reverse()

max_count = max(len(r), len(w))
count = 0
for i in range(max_count):
  if r[i] - w[i] < 0:
    count = i
    break

print(count)


Fixed submission:
from math import floor, ceil
N = int(input())
WHITE = 0
RED = 1
str = list(map(str, list(input())))
r = []
w = []

for i in range(N):
  w.append(i) if str[i] == "W" else r.append(i)
  str[i] = WHITE if str[i] == "W" else RED
r.reverse()
max_count = min(len(r), len(w))
count = 0
for i in range(max_count):
  if r[i] - w[i] > 0:
    count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
from math import floor, ceil
N = int(input())
WHITE = 0
RED = 1
str = list(map(str, list(input())))
r = []
w = []

for i in range(N):
  w.append(i) if str[i] == "W" else r.append(i)
  str[i] = WHITE if str[i] == "W" else RED
r.reverse()

max_count = max(len(r), len(w))
count = 0
for i in range(max_count):
  if r[i] - w[i] < 0:
    count = i
    break

print(count)


Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 0
r = 10**10

while r > l + 1:
    m = (r+l)//2
    count = 0
    for i in a:
        if i <= m:
            continue
        count += (i)//m
        
    if count > k:
        l = m
    else:
        r = m
    
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = list(map(int, input().split()))
idx = dict()

def find(idx, K):
  res = 0
  idx[K] -= 1
  for key in idx:
    if idx[key] != 0:
      res += int(idx[key] * (idx[key] - 1) / 2)
  return res
  
for i in A:
  if i in idx:
    idx[i] += 1
  else:
    idx[i] = 1
    
for i in range(N):
  print(find(copy.copy(idx), A[i]))



Fixed submission:
import copy
N = int(input())
A = list(map(int, input().split()))
A_sum = 0
A2 = []
idx = dict()

for i in A:
  if i in idx:
    idx[i] += 1
  else:
    idx[i] = 1
    
for key in idx:
  if idx[key] == 1:
    idx[key] = [idx[key], 0]
  else:
    temp = int(idx[key] * (idx[key] - 1)/2)
    A_sum += temp
    temp = temp - int(temp * (idx[key] - 2) / idx[key])
    idx[key] = [idx[key], temp]
  
for i in range(N):
  key = A[i]
  print(A_sum - idx[key][1])
Buggy python submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))
A -= K
if A < 0:
  B += A
  A = 0
if B < 0:
  B = 0
print(A, B)a

Fixed submission:
A, B, K = list(map(int, input().split()))
A -= K
if A < 0:
  B += A
  A = 0
if B < 0:
  B = 0
print(A, B)
Buggy python submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
if X > Y:
  X, Y = Y, X

if ((2*X-Y) % 3 != 0) or (2*X-3 < 0):
  print(0)
  exit()
A = (2*X-Y)//3
B = Y-X+A
N = A+B
nu = 1
de = 1

for i in range(B+1, N+1):
  nu = (nu * i) % (10 ** 9 + 7)
for i in range(1, A+1):
  de = (de * i) % (10 ** 9 + 7)
print((nu * pow(de, -1, 10 ** 9 + 7) ) % (10 ** 9 + 7))

Fixed submission:
import math
X, Y = map(int, input().split())
if X > Y:
  X, Y = Y, X

if ((2*X-Y) % 3 != 0) or (2*X-Y < 0):
  print(0)
  exit()
A = (2*X-Y)//3
B = Y-X+A
N = A+B
nu = 1
de = 1
for i in range(B+1, N+1):
  nu = (nu * i) % (10 ** 9 + 7)
for i in range(1, A+1):
  de = (de * i) % (10 ** 9 + 7)
  
print((nu * pow(de, -1, 10 ** 9 + 7) ) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
import math
A, B, X = map(int, input().split())
h = X / (A*A)
r = 0
deg = 0
if (2 * X) - (B * A * A) > 0:
  r = math.atan(2 * (B-H) / A)
elif (2 * X) - (B * A * A) == 0:
  r = math.atan(B / A)
else:
  h = (2 * X) / (A * B)
  r = math.atan(B / h)
deg = math.degrees(r)
print(deg)

Fixed submission:
import math
A, B, X = map(int, input().split())
h = X / (A*A)
r = 0
deg = 0
if (2 * X) - (B * A * A) > 0:
  r = math.atan(2 * (B-h) / A)
elif (2 * X) - (B * A * A) == 0:
  r = math.atan(B / A)
else:
  h = (2 * X) / (A * B)
  r = math.atan(B / h)
deg = math.degrees(r)
print(deg)