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

Fixed submission:
S=input()
T=input()
convert = {}
flag=1
for s,t in zip(S,T):
  if s in convert and convert[s]!=t:
    flag=0
    break
  convert[s] = t
after = convert.values()
if len(after)!= len(set(after)):
  flag = 0

print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]]=[dics[S[i]],i]
  else :
    dics[S[i]]=[i]
  if T[i] in dic:
    dic[T[i]]=[dic[T[i]],i]
  else:
    dic[T[i]]=[i]

for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and S[i] in dic and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]]=[dics[S[i]],i]
  else :
    dics[S[i]]=[i]
  if T[i] in dic:
    dic[T[i]]=[dic[T[i]],i]
  else:
    dic[T[i]]=[i]
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]]=[dics[S[i]],i]
  else :
    dics[S[i]]=[i]
  if T[i] in dic:
    dic[T[i]]=[dic[T[i]],i]
  else:
    dic[T[i]]=[i]
print(dic)
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]]=[dics[S[i]],i]
  else :
    dics[S[i]]=i
  if T[i] in dic:
    dic[T[i]]=[dic[T[i]],i]
  else:
    dic[T[i]]=i
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]].append(i)
  else :
    dics[S[i]]=i
  if T[i] in dic:
  	dic[T[i]].append(i)
  else:
    dic[T[i]]=i
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")
Problem p03805 (python)

Fixed submission:
from collections import deque
def dfs(v,N,memo):
    ans =0
    if not False in memo.values():
        return 1
    for u in E[v]:
        if memo[u]!=True:
            memo[u] = True
            ans += dfs(u,N,memo)
            memo[u] = False
    return ans
N,M = list(map(int,input().split()))
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,N+1)}
for i in range(M):
    u,v = list(map(int,input().split()))
    E[u].append(v)
    E[v].append(u)
memo[1] = True
print(dfs(1,N,memo))

Buggy submission (verdict: Runtime Error):
from collections import deque
def dfs(v,N,memo):
    ans =0
    if not False in memo.values():
        return 1
    for u in E[v]:
        if memo[u]!=True:
            memo[u] = True
            ans += dfs(u,N,memo)
            memo[u] = False
    return ans
N,M = list(map(int,input().split()))
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,M+1)}
for i in range(M):
    u,v = list(map(int,input().split()))
    E[u].append(v)
    E[v].append(u)
memo[1] = True
print(dfs(1,N,memo))
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] = s[3] and s[4] = s[5]:
    print('Yes')
else
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else
    print('No')
Problem p03705 (python)

Fixed submission:
n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
if a > b:
  print(0)
elif n == 1 and a != b:
  print(0)
else:
  print(fst - sec + 1)

Buggy submission (verdict: Runtime Error):
    n, a, b = map(int, input().split())
    fst = (n - 1) * b + a
    sec = (n - 1) * a + b
    if a > b:
      print(0)
    elif n == 1 and a != b:
      print(0)
    else:
      print(fst - sec + 1)
Problem p03315 (python)

Fixed submission:
s = input()
ans = 0
for x in s:
  if x == '+':
    ans+=1
  else:
    ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
for x in s:
  if x == '+':
    ans++
  else:
    ans--
print(ans)
Problem p02754 (python)

Fixed submission:
n,a,b=map(int,input().split())
amari=n%(a+b)
cnt=n//(a+b)
print(cnt*a+min(amari,a))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a==0:
  print('0')
elif (a+b)*(10**100 )<=n:
  print(a*(10**100))
    
else:
  amari=n%(a+b)
  cnt=int(n/(a+b))
if amari<=a:
  print(cnt*a+amari)
else:
  print(cnt*(a+1))
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
ans=6-(a+b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=6-(a+b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a,b)
ans=6-(a+b)
print(ans)
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c>= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input.split())
print('bust') if a+b+c>= 22 else print('win')
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b[0]+b[2:])
print(a*b//100)

Buggy submission (verdict: Runtime Error):
from math import floor
a,b=input().split()
a=int(a)
b=list(b)
b=int(b[0]+b[2:])
print(floor(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=b[0]+b[2:]
print(int(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))
Problem p02689 (python)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[[] for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
ans=0
for i in range(n):
  f=1
  for j in l[i]:
    if h[i]<=h[j]:
      f=0
  if f:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
x=int(input())
t=int(x**0.2)
for i in [t-1,t,t+1,t+2,t+3]:
  if  i**5+1==x:
    print(i,-1,sep=' ')
  elif i**5-1==x:
    print(i,1,sep=' ')
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
if b//k*k>=a:
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
n,m,s=map(int,input().split())
a=[]
q=[[0]]
while q:
  x=q.pop()
  if len(x)<=n:
    if x[-1]==0:
      for j in range(1,m+1):
        c=x+[j]
        q.append(c)
    else:
      for j in range(x[-1],m+1):
        c=x+[j]
        q.append(c)
  else:
    a.append(x)
li=[tuple(map(int,input().split())) for _ in  range(s)]

ans=0
for A in a:
  s=0
  for i,j,k,l in li:
    if A[j]-A[i]==k:
      s+=l
  ans=max(ans,s)
print(ans)
Problem p02712 (python)

Fixed submission:
n=int(input())
s=0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        s+=i
print(s)

Buggy submission (verdict: Runtime Error):
n=str(input())
s=0
for i in range(1,n+1):
    if i%3!=0 or i%3!=0:
        s+=i
print(s)

Buggy submission (verdict: Runtime Error):
n=str(input())
s=0
for i in range(1,n+1):
    if i%3!=0 or i%3!=5:
        s+=i
print(s)
Problem p02753 (python)

Fixed submission:
a=input()
if len(set(a))==1:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
from collections import deque
S=deque(input())
q=int(input())
rev=False
for i in range(q):
  c=list(input().split())
  if c[0]=='1':
    rev=not rev
  elif c[1]=='1' and rev:
    S.appendleft(c[2])
  elif c[1]=='2' and not rev:
    S.appendleft(c[2])
  else:
    S.append(c[2])
if rev:
  S.reverse()
ans=''.join(S)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
S=deque(input())
q=int(input())
for i in range(q):
  c=list(input().split())
  if c[0]=='1':
    S.reverse()
  elif c[1]=='1':
    S.appendleft(c[2])
  elif c[1]=='2':
    S.append(c[2])
ans=''.join(S)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
S=deque(input())
q=int(input())
for i in range(q):
  c=list(input().split())
  if c[0]=='1':
    S.reverse()
  elif c[0]=='2':
    if c[1]=='1':
      S.appendleft(c[2])
    elif c[1]=='2':
      S.append(c[2])
ans=''.join(S)
print(ans)
Problem p02759 (python)

Fixed submission:
n=int(input())
print(n//2+n%2)

Buggy submission (verdict: Runtime Error):
class SegmentTree:
    def __init__(self,orig,func,unit):
        _len= len(orig)
        self.func = func
        self.size = 1 << (_len-1).bit_length()
        self.tree = [unit] * self.size + orig + [unit] *(self.size-_len)
        self.unit = unit
        
        for i in range(self.size -1,0,-1):
            self.tree[i] = func(self.tree[i*2], self.tree[i*2+1])
            
    def update(self, i, v):
        i+=self.size
        self.tree[i] = v
        while i:
            i//=2
            self.tree[i]=self.func(self.tree[i*2],self.tree[i*2+1])
    
    def find(self,l,r):
        l+=self.size
        r+=self.size
        ret=self.unit
        while l<r:
            if l&1:
                ret = self.func(ret,self.tree[l])
                l+=1
            if r&1:
                r-=1
                ret=self.func(ret,self.tree[r])
            l//=2
            r//=2
        return ret
      
import sys
input = sys.stdin.readline
from operator import or_

input()
seg = SegmentTree([1 << ord(x) - 97 for x in input()[:-1]], or_, 0)
ans = []
for _ in range(int(input())):
  f, x, y = input().split()
  if f == "1":
    seg.update(int(x) - 1, 1 << ord(y) - 97)
  else:
    ans.append(bin(seg.find(int(x) - 1, int(y))).count("1"))
print(*ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np
n,m,k=map(int,input().split())
link=[[] for _ in range(n)]
block=[[]  for _ in range(n)]
ans=[]
s=[]
for i in range(m):
    a,b=map(int,input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)
for i in range(k):
  a,b=map(int,input().split())
  block[a-1].append(b-1)
  block[b-1].append(a-1)
for i in range(n):#スタートの選び方
    visited=set()
    q=deque([i])
    while len(q)>0:
        x=q.pop()
        visited.add(x)
        for j in link[x]:
            if j in visited:
              continue
            elif j in q:
              continue
            else:q.append(j)
    ans.append(len(visited))
    s.append(visited)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=0
ans=[]
for _ in range(n):
  ans.append('a')
for i in range(m):
  s,c=map(int,input().split())
  if ans[s-1]!='a' and ans[s-1]!=str(c):
    a=-1
  ans[s-1]=str(c)
if ans[0]=='a' and n!=1:
  ans[0]='1'

if ans[0]=='0' and n!=1:
  a=-1
if ans[0]=='a' and n==1:
  ans[0]='0'
for j in range(n):
  if ans[j]=='a':
    ans[j]='0'
if a==-1:
  print(a)
else:
  print(''.join(ans))
Problem p02762 (python)

Fixed submission:
class UnionFind():
    def __init__(self,n):
      self.n=n
      self.root=[-1]*(n+1)
      self.rank=[0]*(n+1)
      
    def find(self,x):
      if self.root[x]<0:
        return x
      else:
        self.root[x]=self.find(self.root[x])
        return self.root[x]
    
    def unite(self,x,y):
      x=self.find(x)
      y=self.find(y)
      if x==y:
        return 0
      elif self.rank[x]>self.rank[y]:
        self.root[x]+=self.root[y]
        self.root[y]=x
      else:
        self.root[y]+=self.root[x]
        self.root[x]=y
        if self.rank[x]==self.rank[y]:
          self.rank[y]+=1
          
    def Same(self,x,y):
      return self.find(x)==self.find(y)
    
    def size(self,x):
      return -self.root[self.find(x)]
import sys
input=sys.stdin.buffer.readline
n,m,k=map(int,input().split())
link=UnionFind(n)
f=[0]*n
block=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    link.unite(a,b)
    f[a]+=1
    f[b]+=1
for _ in range(k):
    a,b=map(int,input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)
ans=[]
for i in range(n):
  ret=link.size(i)-f[i]-1
  for j in block[i]:
    if link.Same(i,j):
      ret-=1
  ans.append(ret)
print(*ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
q=[]
friend=[0]*n
block=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    q.append({a-1,b-1})
    friend[a-1]+=1
    friend[b-1]+=1
while 1:
    a=q.pop()
    for j in q:
        if len(j&a)!=0:
            j|=a
            count=0
            break
    else:
        q=[a]+q
    if count>len(q):
        break
    count+=1
s=[0]*n
for i in range(n):
  for j in range(len(q)):
    if i in q[j]:
      s[i]=j
for _  in range(k):
    a,b= map(int,input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)
ans=[-1]*n
for i in range(n):
  for j in q[s[i]]:
    ans[i]-=block[i].count(j)
for i in range(n):
  ans[i]+=len(q[s[i]])
for i in range(n):
  ans[i]-=friend[i]
print(*ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np
n,m,k=map(int,input().split())
link=[[] for _ in range(n)]
block=[[]  for _ in range(n)]
ans=[]
s=[]
for i in range(m):
    a,b=map(int,input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)
for i in range(k):
  a,b=map(int,input().split())
  block[a-1].append(b-1)
  block[b-1].append(a-1)
for i in range(n):#スタートの選び方
    visited=set()
    q=deque([i])
    while len(q)>0:
        x=q.pop()
        visited.add(x)
        for j in link[x]:
            if j in visited:
              continue
            elif j in q:
              continue
            else:q.append(j)
    ans.append(len(visited))
    s.append(visited)
Problem p02785 (python)

Fixed submission:
n,k=map(int,input().split())
q=[int(i) for i in input().split()]
q.sort(reverse=True)
print(sum(q[k:]))

Buggy submission (verdict: Runtime Error):
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
if k==0:
  print(sum(q))
  exit()
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))

Buggy submission (verdict: Runtime Error):
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))
Problem p02793 (python)

Fixed submission:
from fractions import gcd
MOD=10**9+7
N,*A=map(int,open(0).read().split())

def lcm(a,b):
  return a*b//gcd(a,b)
s=1
for i in A:
  s=lcm(s,i)
s%=MOD
ans=0
for i in A:
  ans+=s*pow(i,MOD-2,MOD)
  ans%=MOD
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
import numpy as np
mod=10**9+7
def lcm(a,b):
  s=fractions.gcd(a,b)
  return a*b//s

n=int(input())
a=list(map(int,input().split()))
l=a[0]
for i in a:
  l=lcm(l,i)
ans=0
a=np.array(a)
ans=int(sum(l/a%mod)%mod)
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
import numpy as np
mod=10**9+7
def lcm(a,b):
  s=fractions.gcd(a,b)
  return a*b//s

n=int(input())
a=list(map(int,input().split()))
l=a[0]
for i in a:
    l=lcm(l,i)
a=np.array(a)
print(int(sum(l/a%mod)%mod))
Problem p02862 (python)

Fixed submission:
x,y=map(int,input().split())
if (2*x-y)%3!=0 or (x-2*y)%3!=0:
  print(0)
  exit()
a=(2*x-y)//3
b=(2*y-x)//3
if a<0 or b<0:
  print(0)
  exit()
mod=10**9+7
def comb(x,y):
    s=1
    t=1
    for i in range(1,y+1):
        s=s*(x-i+1)%mod
        t=t*(i)%mod
    return (s*pow(t,mod-2,mod))%mod
print(comb(a+b,min(a,b)))

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
a=(2*x-y)/3
b=(-x+2*y)/3
if (2*x-y)%3!=0:
    print(0)
    exit()
a=int(a)
b=int(b)
if a<0 or b<0:
  print(0):
    exit()
mod=10**9+7
if a==0 or b==0:
  print((a+b)%mod)
  exit()
def comb(x,y):
    s=x
    t=1
    for i  in range(1,y):
        s=(s*(x-i))%mod
    for j  in range(1,y+1):
        t=(t*j)%mod
    return (s*pow(t,mod-2,mod))%mod
print(comb(a+b,min(a,b)))
Problem p03805 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
link=[[]for j in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  link[a-1].append(b-1)
  link[b-1].append(a-1)
s=list(range(1,n))
res=0
for perm in list(itertools.permutations(s)):
  last=0
  ok=True
  for i in range(n-1):
    if perm[i] not in link[last]:
      ok=False
      break
    else:
      last=perm[i]
  if ok==True:
    res=res+1
print(res)

Buggy submission (verdict: Runtime Error):
import itertools
for i in range(m):
  a,b=map(int,input().split())
  link[a-1].append(b-1)
  link[b-1].append(a-1)
s=list(range(1,n))
res=0
for perm in list(itertools.permutations(s)):
  last=0
  ok=True
  for i in range(n-1):
    if perm[i] not in link[last]:
      ok=False
      break
    else:
      last=perm[i]
  if ok==True:
    res=res+1
print(res)

Buggy submission (verdict: Runtime Error):
for i in range(m):
  a,b=map(int,input().split())
  link[a-1].append(b-1)
  link[b-1].append(a-1)
s=list(range(1,n))
res=0
for perm in list(itertools.permutations(s)):
  last=0
  ok=True
  for i in range(n-1):
    if perm[i] not in link[last]:
      ok=False
      break
    else:
      last=perm[i]
  if ok==True:
    res=res+1
print(res)
Problem p02580 (python)

Fixed submission:
import collections
import numpy as np

h, w, m = map(int, input().split())
lst_ = []
h_lst = [0]*h
w_lst = [0]*w
for i in range(m):
    h_, w_ = map(int, input().split())
    lst_.append([h_, w_])
    h_lst[h_-1] += 1
    w_lst[w_-1] += 1

h_count = max(h_lst)
w_count = max(w_lst)
h_cand = set([i+1 for i, h_ in enumerate(h_lst) if h_ == h_count])
w_cand = set([i+1 for i, w_ in enumerate(w_lst) if w_ == w_count])
#print(h_cand, w_cand)

count = 0
for bomb in lst_:
    if bomb[0] in h_cand and bomb[1] in w_cand:
        count += 1

ans = max(h_lst) + max(w_lst)
if count < len(h_cand)*len(w_cand):
    print(ans)
else:
    print(ans-1)

Buggy submission (verdict: Runtime Error):
import collections
import numpy as np

h, w, m = map(int, input().split())
lst_ = []
for i in range(m):
    h, m = map(int, input().split())
    lst_.append([h, m])

lst = np.array(lst_)
h_lst = collections.Counter(lst[:,0])
w_lst = collections.Counter(lst[:,1])

def get_cand(sub_lst):
    sub_lst = sub_lst.most_common()
    cand = []
    for sub in sub_lst:
        if sub[1] != sub_lst[0][1]:
            break
        cand.append(sub[0])
    return cand, sub_lst[0][1]

h_cand, h_count = get_cand(h_lst)
w_cand, w_count = get_cand(w_lst)

flag = False
for h in h_cand:
    if flag:
        break
    for w in w_cand:
        if not [h,w] in lst_:
            #print("bomber: ", h_count, w_count)
            flag = True
            break
ans = h_count + w_count
if flag:
    print(ans)
else:
    print(ans-1)
Problem p02897 (python)

Fixed submission:
n=int(input())
count=0
for i in range(1,n+1):
    if i%2==1:
        count+=1
print(count/n)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
yaku=[]
flag=0
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        yaku.append(i)
ans=len(yaku)
flag=0
for i in range(1,len(yaku)+1):
    flag=0
    for j in range(i+1,len(yaku)+1):
        if yaku[-i]%yaku[-j]==0:
            flag=1
            #print(i)
            break
    if flag==1:
        ans-=1
        #print("ans=",ans)
print(ans+1)
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
manzoku=0
dish_b=100
for i in range(n):
    dish=a[i]
    manzoku+=b[dish-1]
    if dish==dish_b+1:
        manzoku+=c[dish_b-1]
    dish_b=dish
print(manzoku)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
manzoku=0
dish_b=100
for i in range(n):
    dish=a[i]
    manzoku+=b[dish-1]
    if dish==dish_b+1:
        manzoku+=c[dish_b-1]
    dish_b=dish
print(manzoku)
Problem p02987 (python)

Fixed submission:
# coding: utf-8
# Your code here!
from collections import Counter

S = input()
S = list(S)


if(Counter(S).most_common(2)[0][1]!=4):
    c1 = Counter(S).most_common(2)[0][1]
    c2 = Counter(S).most_common(2)[1][1]
    if(c1==c2):
        if(c1==2):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
from collections import Counter

S = input()
S = list(S)


c1 = Counter(S).most_common(2)[0][1]
c2 = Counter(S).most_common(2)[1][1]

if(c1==c2):
    if(c1==2):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
from collections import Counter

S = input()
S = list(S)


c1 = Counter(S).most_common(2)[0][1]
c2 = Counter(S).most_common(2)[1][1]

if(c1==c2):
    if(c1==2):
        print("Yes")
    else:
        print("No")
else:
    print("No")
Problem p03038 (python)

Fixed submission:
from operator import itemgetter
              

N, M = map(int, input().split())
A = input().split()
A = list(map(int, A))
A.sort()


cng = []
for i in range(M):
    B, C = map(int, input().split())
    cng.append((B,C))
    
cng = sorted(cng, key=itemgetter(1),reverse=True)

f=1
i=0
crd_cnt=0
crd_idx=0
while(f==1):
    if(A[i]<=cng[crd_idx][1]):
        A[i] = cng[crd_idx][1]
        crd_cnt += 1
    else:
        f=0

    if(N==crd_cnt):
        f=0

    if(crd_cnt==cng[crd_idx][0]):
        crd_idx += 1
        crd_cnt = 0
    
    if(M==crd_idx):
        f=0
    elif(i+1==N):
        f=0
    
    i+=1

print(sum(A))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
              

N, M = map(int, input().split())
A = input().split()
A = list(map(int, A))
A.sort()


cng = []
for i in range(M):
    B, C = map(int, input().split())
    cng.append((B,C))
    
cng = sorted(cng, key=itemgetter(1),reverse=True)

f=1
i=0
crd_cnt=0
crd_idx=0
while(f==1):
    if(A[i]<=cng[crd_idx][1]):
        A[i] = cng[crd_idx][1]
        crd_cnt += 1
    else:
        f=0

    if(N==crd_cnt):
        f=0

    if(crd_cnt==cng[crd_idx][0]):
        crd_idx += 1
        crd_cnt = 0
    
    if(M==crd_idx):
        f=0
    
    i+=1

print(sum(A))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
              

N, M = map(int, input().split())
A = input().split()
A = list(map(int, A))
A.sort()

cng = []
for i in range(M):
    B, C = map(int, input().split())
    cng.append((B,C))
    
cng = sorted(cng, key=itemgetter(1),reverse=True)
f=1
i=0
crd_cnt=0
crd_idx=0
while(f==1):
    if(A[i]<=cng[crd_idx][1]):
        A[i] = cng[crd_idx][1]
        crd_cnt += 1
    else:
        f=0
        
    if(crd_cnt==cng[crd_idx][0]):
        crd_idx += 1
        crd_cnt = 0
    
    if(M==crd_idx):
        f=0
    
    i+=1

print(sum(A))