Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03196 (python)

Fixed submission:
import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


divisors=[]

for i in range(2,round(P**(1/N))+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


for i in reversed(range(1,p+1)):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)

divisors=[]
for i in range(1,p+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)
Problem p03197 (python)

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
count = 0
ans = ["first", "second"]
for i in range(N):
    if a[i] % 2 == 1:
        count += 1
if count > 0:
    print(ans[0])
else:
    print(ans[1])

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(input()) for i in range(N)]
a.sort()
ans=["second","first"]
print(ans[(a[-1]-a[-2])%2])
Problem p03206 (python)

Fixed submission:
D = int(input())
ans="Christmas"
for i in range(25 - D):
  ans += " Eve"
  
print(ans)

Buggy submission (verdict: Runtime Error):
D = int(input)
ans="Christmas"
for i in range(25 - D):
  ans += " Eve"
  
print(ans)
Problem p03220 (python)

Fixed submission:

N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=max(H) - x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans))
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
ct = [[0,0] for i in range(N)]
for i in range(N):
  ct[i]=list(map(int,input().split()))
ct.append([-1,T])
ct.sort(key=lambda x:x[1])
index = ct.index([-1,T])
if index==0:
  print("TLE")
else:
  ans = sorted(ct[:index],key=lambda x:x[0])
  print(ans[0][0])

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
ct = [[0,0] for i in range N]
for i in range(N):
  ct[i]=list(map(int,input().split()))
ct.append([-1,T])
ct.sort(reverse=True,key=lambda x:x[1])
index = ct.index([-1,T])
if index==0:
  print("TLE")
else:
  ans = sorted(ct[:index],key=lambda x:x[0])
  print(ans[0][0])
Problem p03241 (python)

Fixed submission:
import fractions
N, M = map(int, input().split())

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N, M = map(int, input().split())

k = M // N　+ 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp =  max(M - (N-1)*i,1)
    ans = max(ans, fractions.gcd(i, tmp))

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N, M = map(int, input().split())

k = M // N　+ 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    ans = max(ans, max(fractions.gcd(i, M - (N-1)*i), 1))

print(ans)
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int, input().split()))

odd = collections.defaultdict(int)

even = collections.defaultdict(int)

for i in range(n):
    if i % 2 == 0:
        even[v[i]] += 1

    else:
        odd[v[i]] += 1

even = list(even.items())
odd = list(odd.items())

even.sort(key=lambda x: x[1], reverse=True)
odd.sort(key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if len(even) == 1 and len(odd) == 1:
        print(n // 2)
    elif len(even) == 1:
        print(n - (even[0][1] + odd[1][1]))
    elif len(odd) == 1:
        print(n - (even[1][1] + odd[0][1]))
    else:
        print(min(n - (even[1][1] + odd[0][1]),
              n - (even[0][1] + odd[1][1])))
else:
    print(n - (even[0][1] + odd[0][1]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))

odd = [v[i] for i in range(n) if i % 2 == 0]
even = [v[i] for i in range(n) if i % 2 == 1]

t = collections.Counter(odd).most_common()
t2 = collections.Counter(even).most_common()

t = list(t.items())
t.sort(reverse=True)

t2 = list(t2.items())
t2.sort(reverse=True)


t.append([0, 0])
t2.append([0, 0])
ans = t[0][1] + t2[0][1]
if t[0][0] == t2[0][0]:
    ans = max(t[0][1] + t2[1][1], t[1][1]+t2[0][1])
print(n - ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))

odd = collections.defaultdict(int)

even = collections.defaultdict(int)

for i in range(n):
    if i % 2 == 0:
        even[v[i]] += 1

    else:
        odd[v[i]] += 1

even = list(even.items())
odd = list(odd.items())

even.sort(key=lambda x: x[1], reverse=True)
odd.sort(key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if len(even) == 1 and len(odd) == 1:
        print(n // 2)
    elif len(even) == 1:
        print(n - (even[0][1] + odd[1][1]))
    elif len(odd) == 1:
        print(n - (even[1][1] + odd[0][1]))
    else:
        print(min(n - (even[1][1] + odd[0][1])),
              (n - (even[0][1] + odd[1][1])))
else:
    print(n - (even[0][1] + odd[0][1]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))

odd = collections.defaultdict(int)

even = collections.defaultdict(int)

for i in range(n):
    if i % 2 == 0:
        even[v[i]] += 1

    else:
        odd[v[i]] += 1

even = list(even.items())
odd = list(odd.items())

even.sort(key=lambda x: x[1], reverse=True)
odd.sort(key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if len(even) == 1 and len(odd) == 1:
        print(n // 2)
    elif len(even) == 1:
        print(n - (even[0][1] + odd[1][1]))
    elif len(odd) == 1:
        print(n - (even[1][1] + odd[0][1]))
    else:
        print(min(n - (even[1][1] + odd[0][1])),
              print(n - (even[0][1] + odd[1][1])))
else:
    print(n - (even[0][1] + odd[0][1]))
Problem p03251 (python)

Fixed submission:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

x=sorted(x)
y=sorted(y)

if x[-1] < y[0] and X < y[0] and x[-1] < Y:
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

x.sort
y.sort

if x[-1] <= y[0] and X <= y[0] and x[-1] =< Y:
  print("No War")
else:
  print("War")
Problem p03261 (python)

Fixed submission:
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=" "
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
    exit(0)
  elif prev[-1]!=word[0] and i != 0:
    print("No")
    exit(0)
  siritori[word]+=1
  prev=word
print("Yes")

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
  siritori[word]+=1
  prev=word
print("Yes")

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = imput()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
  siritori[word]+=1
  prev=word
print("Yes")

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = imput()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
    siritori[word]+=1
print("Yes")
Problem p03274 (python)

Fixed submission:
N, K = map(int, input().split())
x = list(map(int, input().split()))
import bisect
id = bisect.bisect_left(x,0)
ans=10**10
if id == N:
  print(abs(x[N-K]))
  exit(0)
for i in range(max(0,(K+id)-N),min(id+1,K)):
  right = x[K+id-1-i]
  left=0
  if i>0:
    left =x[id-i]
  tmp=min(abs(left)*2+right,right*2+abs(left)) 
  ans=min(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N, K = map(int, input().split())
x = list(map(int, input().split()))
id = bisect.bisect_left(x, 0)
ans = max(x) - min(0, min(x))
if id >= K:
    ans = min(ans, x[id-K])
if id + K - 1 < N:
    ans = min(ans, x[id+K-1])

for i in range(max(0, id - K + 1), id):
    ans = min(ans, -x[i]*2 + x[i+K-1], -x[i]+x[i+K-1]*2)

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = list(map(int, input().split()))

plus = [i for i in x if i >= 0]
minus = [i for i in x if i <= 0]
ans = (x[-1] - x[0])*2
if len(plus) >= K:
    ans = plus[K-1]
if len(minus) >= K:
    ans = min(ans, minus[-K])
for i in range(1, min(len(plus), len(minus))):
    tmp = plus[K-1-i] - (minus[-i])*2
    ans = min(tmp, ans)

    tmp = plus[K-1-i]*2 - minus[-i]
    ans = min(tmp, ans)

print(ans)
Problem p03288 (python)

Fixed submission:
R = int(input())
if R < 1200:
  print("ABC")
else:
  if R < 2800:
    print("ARC")
  else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
  print("ABC")
else:
    if R < 2800:
      print("ARC")
  else:
      print("AGC")

Buggy submission (verdict: Runtime Error):
R = int(input())
if R < 1200:
  print("ABC")
else:
    if R < 2800:
    print("ARC")
  else:
    print("AGC")
Problem p03293 (python)

Fixed submission:
S=input()
T=input()
for i in range(len(S)):
  if S[i:]+S[:i]==T:
    print("Yes")
    exit(0)
    
print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
ss=s+s
n=len(s)
for i in range(n):
  if ss[i:]=t:
    print("Yes")
    exit(0)

print("No")

Buggy submission (verdict: Runtime Error):
S,T=input().split()
for i in range(len(S)):
  if S[i:]+S[:i]==T:
    print("Yes")
    exit(0)
    
print("No")

Buggy submission (verdict: Runtime Error):
S,T=input().split()
for i in range(len(S)):
  if S[i:]+S[:i]==T:
    print("Yes")
    exit(0)
    
print("No")

Buggy submission (verdict: Runtime Error):
S,T=input.split()
for i in range(len(S)):
  if S[i:]+S[:i]==T:
    print("Yes")
    exit(0)
    
print("No")
Problem p03311 (python)

Fixed submission:
import math
N=int(input())
A=list(map(int,input().split()))

B=[A[i]-i for i in range(N)]
B.sort()
temp=0

if N%2==0:
  ans = B[N//2]
  ans2= B[N//2 -1]
  temp=0
  for j in range(N):
    temp+= abs(B[j] - ans)
  temp2=0
  for j in range(N):
    temp2+= abs(B[j] - ans2)
  ans= min(temp,temp2)
else:
  ans = B[N//2]
  temp=0
  for j in range(N):
    temp+= abs(B[j] - ans )
  ans=temp
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
import math
N=int(input())
A=list(map(int,input().split()))
diff_dic=collections.defaultdict(int)


B=[A[i]-(i+1) for i in range(N)]
for i in range(N):
  diff_dic[B[i]]+=1
  
diff_list=sorted(list(diff_dic.items()), key=lambda x:x[1],reverse=True)
ans=diff_list[0][0]
temp=0

ans=sum(diff_list) / N
temp=0
for j in range(N):
  temp+= abs(A[j] - (int(ans) + j + 1) )


temp2=0
for j in range(N):
  temp2+= abs(A[j] - (math.ceil(ans) + j + 1) )
print(min(temp,temp2))

Buggy submission (verdict: Runtime Error):
import collections
import math
N=int(input())
A=list(map(int,input().split()))
diff_dic=collections.defaultdict(int)


B=[A[i]-(i+1) for i in range(N)]
for i in range(N):
  diff_dic[B[i]]+=1
  
diff_list=sorted(list(diff_dic.items()), key=lambda x:x[1],reverse=True)
ans=diff_list[0][0]
temp=0

ans=sum(diff_list) / N
temp=0
for j in range(N):
  temp+= abs(A[j] - (int(ans) + j + 1) )
print(temp)

temp2=0
for j in range(N):
  temp2+= abs(A[j] - (math.ceil(ans) + j + 1) )
print(temp2)
Problem p03323 (python)

Fixed submission:
A,B = map(int, input().split())
if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if A < = 8 and B <= 8:
    print("Yay!")
else:
    print(":(")
Problem p03338 (python)

Fixed submission:
import collections
N=int(input())
S =input()
def countchar(s1,s2):
  ret=0
  table=collections.defaultdict(int)
  for x in s1:
    table[x]+=1
  for x in s2:
    if x in table and table[x]>0:
      ret+=1
      table[x]=0
  return(ret)
ans=0
for i in range(1,N):
  X=S[:i]
  Y=S[i:]
  ans=max(ans,countchar(X,Y))
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S =input()
def countchar(s1,s2):
  table=collections.defaultdict(int)
  for x in s1:
    table[x]+=1
  for x in s2:
    if x in table and table[x]>0:
      ret+=1
      table[x]=0
  return(ret)
ans=0
for i in range(1,N):
  X=S[:i]
  Y=S[i:]
  ans=max(ans,countchar(X,Y))
print(ans)
Problem p03355 (python)

Fixed submission:
import collections
s = input()
K = int(input())

abc = collections.defaultdict(list)

for i in range(len(s)):
  for j in range(1,K+1):
    if i+j <= len(s):
        abc[s[i:i+j]].append(i)


abc = list(abc.items())
abc.sort(key=lambda x: x[0])

print(abc[K-1][0])

Buggy submission (verdict: Runtime Error):
import collections
s = input()
K = int(input())

abc = collections.defaultdict(list)

for i in range(len(s)):
  for j in range(1,K+1):
    if i+j < len(s):
        abc[s[i:i+j]].append(i)


abc = list(abc.items())
abc.sort(key=lambda x: x[0])


print(abc[K][0])
Problem p03360 (python)

Fixed submission:
a=list(map(int,input().split()))
K=int(input())
maxa=a.pop(a.index(max(a)))
print((maxa*(2**K))+sum(a))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
K=int(input)
maxa=a.pop(a.index(max(a)))
print((maxa*(2**K))+sum(a))
Problem p03362 (python)

Fixed submission:
def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

from itertools import combinations
N=int(input())

prime_list=primes(55555)
id=4
ans=[prime_list[i] for i in range(len(prime_list)) if prime_list[i]%5==2]

print(" ".join(map(str,ans[:N])))

Buggy submission (verdict: Runtime Error):
import collections
from itertools import combinations
N = int(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


num = [i for i in range(2, 55556)]
num = collections.deque(num)
dp = [set() for i in range(N)]
dp[0] = {num.popleft()}
for i in range(1, N):
    if i < 5:
        tmp = num.popleft()
        while(is_prime(tmp) != True):
            tmp = num.popleft()
        dp[i] = dp[i-1] | {tmp}
    else:
        flag = False

        while(flag != True):
            tmp = num.popleft()
            while(is_prime(tmp) != True):
                tmp = num.popleft()
            for x in combinations(dp[i-1], 4):
                if is_prime(sum(x) + tmp):
                    flag = False
                    break
                else:
                    flag = True
        if flag:
            dp[i] = dp[i-1] | {tmp}

print(" ".join(map(str, dp[N-1])))
Problem p03369 (python)

Fixed submission:
print(700+100*input().count("o"))

Buggy submission (verdict: Runtime Error):
print(700+100*input().count("o")
Problem p03378 (python)

Fixed submission:
N,M,X=map(int,input().split())
A=list(map(int,input().split()))
left = [A[i] for i in range(M) if A[i] < X ]
right = [A[i] for i in range(M) if A[i] > X]
print(min(len(left),len(right)))

Buggy submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
A=list(map(int,input().split()))
left = [A[i] for i in range(N+1) if A[i] < X ]
right = [A[i] for i in range(N+1) if A[i] > X]
print(min(len(left),len(right)))
Problem p03380 (python)

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


ans=a.pop(a.index(max(a)))

for i in range(n - 1):
    if a[i] > ans / 2:
        a[i] = [ans - a[i],a[i]]
    else:
        a[i] = [a[i],a[i]]
a = sorted(a,reverse = True)

print(str(ans) + " " + str(a[0][1]))

Buggy submission (verdict: Runtime Error):
import math
import bisect


def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


n = int(input())

a = list(map(int, input().split()))
a.sort()

ncr = 0
ans = [0, 0]

id = bisect.bisect_left(a[:n-1], a[n-1]//2)
if abs(a[-1]/2 - a[id]) <= abs(a[-1] - a[id+1]):
    ans = id
else:
    ans = id+1

print(a[-1], a[ans])
Problem p03389 (python)

Fixed submission:
ABC=list(map(int,input().split()))
ABC.sort()
ans=0
ans+=(ABC[2]-ABC[0])//2
if (ABC[2]-ABC[0])%2==1:
  ans+=(ABC[2]-ABC[1])//2
  if (ABC[2]-ABC[1])%2 == 1:
    ans+=1
  else:
    ans+=2  
else:
  ans+=(ABC[2]-ABC[1])//2
  if (ABC[2]-ABC[1])%2 == 1:
    ans+=2

print(ans)

Buggy submission (verdict: Runtime Error):
ABC=map(int,input().split())
ABC.sort()
ans=0
ans+=(ABC[2]-ABC[0])//2
if (ABC[2]-ABC[0])%2==1:
  ans+=(ABC[2]-ABC[0])//2
  ABC[0]=ABC[2]-1
  ans+=(ABC[2]-ABC[1])//2
  if (ABC[2]-ABC[1])%2 == 1:
    ans+=1
  else:
    ans+=2  
else:
  ans+=(ABC[2]-ABC[1])//2
  if (ABC[2]-ABC[1])%2 == 1:
    ans+=2
  else:
    ans+=1
print(ans)
Problem p03401 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))

cost=[abs(A[i]-A[i+1]) for i in range(N-1)]
costsum=total=sum(cost)+abs(A[0])+abs(A[N-1])
for i in range(N):
  total=costsum
  if i == 0:
    total-=abs(A[i])
    total-=cost[i]
    total+=abs(A[i+1])
  elif i == N-1:
    total-=abs(A[i])
    total+=abs(A[i-1])
    total-=cost[i-1]
  else:
    total-=cost[i]
    total-=cost[i-1]
    total+=abs(A[i+1]-A[i-1])
  print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))

cost=[abs(A[i]-A[i+1] for i in range(N-1))]

for i in range(N):
  total=sum(cost)+abs(A[0])+abs(A[N-1])
  if i == 0:
    total-=abs(A[i])
    total-=cost[i]
    total+=abs(A[i+1])
  elif i == N-1:
    total-=abs(A[i])
    total+=abs(A[i-1])
    total-=cost[i-1]
  else:
    total-=cost[i]
    total-=cost[i-1]
    total+=abs(A[i+1]-A[i-1])
  print(total)
Problem p03408 (python)

Fixed submission:
import collections
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[x]-=1
table=table.values()
table=[x for x in table if x >= 0]
table.append(0)
print(max(table))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[x]-=1
table=table.values()
table=[x for x in table if x >= 0]
print(max(table))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
s=[int(input()) for i in range(N)]
M=int(input())
t=[int(input()) for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
s=[int(input()) for i jn range(N)]
M=int(input())
t=[int(input()) for i in range(M)]

table=collections.defaultdict(int)
for x in s:
  table[x]+=1
for x in t:
  table[t]+=1
table=table.values()
table=[x for x in table if x >= 0]
print(sum(table))
Problem p03411 (python)

Fixed submission:
N = int(input())
ab = [[0, 0] for i in range(N)]
b = [0]*N
cd = [[0, 0] for i in range(N)]
d = [0]*N

for i in range(N):
    ab[i] = list(map(int, input().split()))
for i in range(N):
    cd[i] = list(map(int, input().split()))

points = [[] for i in range(N)]
points2 = [[] for i in range(N)]
cd.sort(key=lambda x: x[0])
ab.sort(key=lambda x: x[1], reverse=True)

points.sort(key=lambda x: len(x))
ans = 0

for i in range(N):
    for j in range(N):
        if ab[i][0] < cd[j][0] and ab[i][1] < cd[j][1]:
            ans += 1
            cd[j][0] = -1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ab = [[0, 0] for i in range(N)]
b = [0]*N
cd = [[0, 0] for i in range(N)]
d = [0]*N

for i in range(N):
    ab[i] = list(map(int, input().split()))
for i in range(N):
    cd[i] = list(map(int, input().split()))

points2 = [[] for i in range(N)]
ab.sort(key=lambda x: x[0])
ab.sort(key=lambda x: x[1])

for i in range(N):
    for j in range(N):
        if ab[i][0] < cd[j][0] and ab[i][1] < cd[j][1]:
            points2[j].append(i)

points2.sort(key=lambda x: len(x))
ans = 0

for i in range(N):
    if len(points[i]) == 0:
        continue
    for j in range(i+1, N):
        if points[i][0] in points[j]:
            points[j].pop(points[j].index(points[i][0]))
    ans += 1
print(ans)
Problem p03417 (python)

Fixed submission:
N, M = map(int, input().split())
ans = 0
if N >= 3:
    if M >= 3:
        ans = (N-2)*(M-2)
    else:
      if M == 2:
        ans=0
      else:
        ans=N-2
else:
    if N == 2:
      ans=0
    else:
      if M == 2:
        ans=0
      elif M == 1:
        ans=1
      else:
        ans=M-2
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

first = N*M
ans = 0

def reverse(x):
    if x == 0:
        return(1)
    else:
        return(0)


field = [[0]*(M+2) for i in range(N+2)]

for i in range(1, N+1):
    for j in range(1, M+1):
        field[i-1][j-1] = reverse(field[i-1][j-1])
        field[i][j-1] = reverse(field[i][j-1])
        field[i+1][j-1] = reverse(field[i+1][j-1])
        field[i-1][j] = reverse(field[i-1][j])
        field[i][j] = reverse(field[i][j])
        field[i+1][j] = reverse(field[i+1][j])
        field[i-1][j+1] = reverse(field[i-1][j+1])
        field[i][j+1] = reverse(field[i][j+1])
        field[i+1][j+1] = reverse(field[i+1][j+1])
ans = 0

for i in range(1, N+1):
    ans += sum(field[i][1:M+1])

print(ans)
Problem p03424 (python)

Fixed submission:
N=int(input())
S=list(input().split())
if "Y" in S:
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input.split())
if "Y" in S:
  print("Four")
else:
  print("Three")