Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(w):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(max(0,m-1))

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(w):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(max(0,m-1))

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(h):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(m-1)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(w):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(max(0,m-1))
Buggy python submission (verdict: Time Limit Exceeded):
l=input()
deg=len(l)-1
mod=10**9+7
ans=(3**deg)%mod
x=[]
n=len(l)
for i in range(1,n+1):
    if l[-i]=='1':
        x.append(i)
c=len(x)
ans+=2**c
for i in range(1,c):
    ans+=((2**(c-i))*(3**(x[i-1]-1)))%mod
    ans%=mod
print(ans)

Fixed submission:
l=input()
deg=len(l)-1
mod=10**9+7
ans=(3**deg)%mod
x=[]
n=len(l)
for i in range(1,n+1):
    if l[-i]=='1':
        x.append(i)
c=len(x)
ans+=2**c
two=(2**c)%mod
three=1
x_ref=1
for i in range(1,c):
    if two%2==0:
        two=two//2
    else:
        two=(two+mod)//2
    three=(three*3**(x[i-1]-x_ref))%mod
    x_ref=x[i-1]
    ans+=(two%mod)*(three%mod)
    ans%=mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n,m,k=map(int,input().split())
mod=10**9+7
s=math.factorial(n*m-2)//(math.factorial(n*m-k)*math.factorial(k-2))
cnt=0
s%=mod
a=(m*m*s)%mod
for d in range(1,n):
        cnt+=d*(n-d)*a
        cnt%=mod
a=(n*n*s)%mod
for d in range(1,m):
        cnt+=d*(m-d)*a
        cnt%=mod
print(cnt)

Fixed submission:
import math
n,m,k=map(int,input().split())
mod=10**9+7
s=math.factorial(n*m-2)//(math.factorial(n*m-k)*math.factorial(k-2))
cnt=0
s%=mod
a=(m*m*s)%mod
for d in range(1,n):
        cnt+=d*(n-d)*a
        cnt%=mod
a=(n*n*s)%mod
for d in range(1,m):
        cnt+=d*(m-d)*a
        cnt%=mod
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n,m,k=map(int,input().split())
mod=10**9+7
s=math.factorial(n*m-2)//(math.factorial(n*m-k)*math.factorial(k-2))
cnt=0
s%=mod
for d in range(1,n):
        cnt+=d*(n-d)*m*m*s
        cnt%=mod
for d in range(1,m):
        cnt+=d*(m-d)*n*n*s
        cnt%=mod
print(cnt)

Fixed submission:
import math
n,m,k=map(int,input().split())
mod=10**9+7
s=math.factorial(n*m-2)//(math.factorial(n*m-k)*math.factorial(k-2))
cnt=0
s%=mod
a=(m*m*s)%mod
for d in range(1,n):
        cnt+=d*(n-d)*a
        cnt%=mod
a=(n*n*s)%mod
for d in range(1,m):
        cnt+=d*(m-d)*a
        cnt%=mod
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
d={i:[] for i in range(n)}
for i in range(m):
    x,y,z=map(int,input().split())
    d[x-1].append(y-1)
    d[y-1].append(x-1)
cnt=0
c=set()
for i in range(n):
    if i in c:
        continue
    c.add(i)
    q=[i]
    while(q):
        p=q.pop(0)
        l=d[p]
        for x in l:
            if x in c:
                continue
            q.append(x)
            c.add(x)
    cnt+=1
print(cnt)

Fixed submission:
def connected_components(graph):
    seen = set()
    def component(n):
        nodes = set([n])
        while nodes:
            n = nodes.pop()
            seen.add(n)
            nodes |= set(graph[n]) - seen
            yield n
    for n in graph:
        if n not in seen:
            yield component(n)

def print_gen(gen):
    print(len([list(x) for x in gen]))

n,m=map(int,input().split())
d={i:[] for i in range(n)}
for i in range(m):
    x,y,z=map(int,input().split())
    d[x-1].append(y-1)
    d[y-1].append(x-1)

print_gen(connected_components(d))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
d={i:[] for i in range(n)}
for i in range(m):
    x,y,z=map(int,input().split())
    d[x-1].append(y-1)
    d[y-1].append(x-1)
cnt=0
c=set()
for i in range(n):
    if i in c:
        continue
    c.add(i)
    q=[i]
    while(q):
        p=q.pop(0)
        l=d[p]
        for x in l:
            if x in c:
                continue
            q.append(x)
            c.add(x)
    cnt+=1
print(cnt)

Fixed submission:
def connected_components(graph):
    seen = set()
    def component(n):
        nodes = set([n])
        while nodes:
            n = nodes.pop()
            seen.add(n)
            nodes |= set(graph[n]) - seen
            yield n
    for n in graph:
        if n not in seen:
            yield component(n)

def print_gen(gen):
    print(len([list(x) for x in gen]))

n,m=map(int,input().split())
d={i:[] for i in range(n)}
for i in range(m):
    x,y,z=map(int,input().split())
    d[x-1].append(y-1)
    d[y-1].append(x-1)

print_gen(connected_components(d))
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
while(su<n):
    n_ = math.ceil(n*(stage-1)/stage)
    if n_ == su:
        nums.append(1)
        nums.append(n-su-1)
        break
    nums.append(n_-su)
    su+=n_-su
    if su>=ch:
        nums.append(n-su)
        break
    stage += 1
ans=[]
next_div_num = 0
k=len(nums)
for i in range(k):
    next_div_num += nums[k-1-i]
    if nums[k-1-i] == 1:
        continue
    sho = n//next_div_num
    d = next_div_num-1
    if d==0 or sho>d:
        continue
    if sho == n%d:
        ans.append(d)
print(sum(ans))

Fixed submission:
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
        elif sho>n%d:
            d-=1
            if d==0 or sho>d:
               continue
            if sho == n%d:
                ans.append(d)
    print(sum(ans))

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
while(su<n):
    n_ = math.ceil(n*(stage-1)/stage)
    if n_ == su:
        nums.append(1)
        nums.append(n-su-1)
        break
    nums.append(n_-su)
    su+=n_-su
    if su>=ch:
        nums.append(n-su)
        break
    stage += 1
ans=[]
next_div_num = 0
k=len(nums)
for i in range(k):
    next_div_num += nums[k-1-i]
    if nums[k-1-i] == 1:
        continue
    sho = n//next_div_num
    d = next_div_num-1
    if d==0 or sho>d:
        continue
    if sho == n%d:
        ans.append(d)
print(sum(ans))

Fixed submission:
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
        elif sho>n%d:
            d-=1
            if d==0 or sho>d:
               continue
            if sho == n%d:
                ans.append(d)
    print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
import copy
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n=int(input())
a=[int(x) for x in input().split()]
tmp=0
for i in range(n):
    gcd=gcd_list(a[1:])
    if gcd>tmp:
        tmp=gcd
    a.append(a.pop(0))
print(tmp)

Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n=int(input())
a=[int(x) for x in input().split()]
l=[0]
r=[0]
for i in range(n):
    l.append(fractions.gcd(l[i],a[i]))
    r.append(fractions.gcd(r[i],a[(i+1)*-1]))
r = r[::-1]
m = []
for i in range(n):
    m.append(fractions.gcd(l[i],r[i+1]))
print(max(m))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
import copy
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n=int(input())
a=[int(x) for x in input().split()]

tmp=0
for i in range(n):
    l=copy.copy(a)
    _=l.pop(i)
    gcd=gcd_list(l)
    if gcd>tmp:
        tmp=gcd
print(tmp)

Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n=int(input())
a=[int(x) for x in input().split()]
l=[0]
r=[0]
for i in range(n):
    l.append(fractions.gcd(l[i],a[i]))
    r.append(fractions.gcd(r[i],a[(i+1)*-1]))
r = r[::-1]
m = []
for i in range(n):
    m.append(fractions.gcd(l[i],r[i+1]))
print(max(m))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
b=[x for x in a if x>0]
c=[x for x in a if x<=0]
if len(c)%2==0:
    s=sum(b)
    s-=sum(c)
    print(s)
else:
    c.append(b.pop(0))
    s=sum(b)
    s-=sum(c[:-2])
    if c[-1] > c[-2]*-1:
        s+=c[-1]
        s+=c[-2]
        print(s)
    else:
        s-=c[-1]
        s-=c[-2]
        print(s)


Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
b=[x for x in a if x>0]
c=[x for x in a if x<=0]
if len(b)==0:
    if len(c)%2==0:
        print(sum(c)*-1)
    else:
        print(sum(c[:-1])*-1+c[-1])
elif len(c)%2==0:
    s=sum(b)
    s-=sum(c)
    print(s)
else:
    c.append(b.pop(0))
    s=sum(b)
    s-=sum(c[:-2])
    if c[-1] > c[-2]*-1:
        s+=c[-1]
        s+=c[-2]
        print(s)
    else:
        s-=c[-1]
        s-=c[-2]
        print(s)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
s=[a for a in input()]
s=[a.replace('.','0') for a in s]
s=[a.replace('#','1') for a in s]
s=[int(a) for a in s]
p=[i for i, x in enumerate(s) if x == 1]
s = np.array(s)
cnt = np.sum(s)
for i in p:
    s[-1 * (n-i):] = 1 - s[-1 * (n-i):]
    _cnt = np.sum(s)
    if cnt > _cnt:
        cnt =_cnt
print(cnt)

Fixed submission:
n=int(input())
s=input()
cnt =s.count('#')
l =[cnt]
for i in range(n):
    if s[n-i-1] == '#':
        cnt -= 1
        l.append(cnt)
    else:
        cnt+=1
        l.append(cnt)
print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=[a for a in input()]
s=[a.replace('.','0') for a in s]
s=[a.replace('#','1') for a in s]
s=[int(a) for a in s]
p=[i for i, x in enumerate(s) if x == 1]
s = np.array(s)
cnt = np.sum(s)
for i in p:
    s[-1 * (n-i):] = 1 - s[-1 * (n-i):]
    _cnt = np.sum(s)
    if cnt > _cnt:
        cnt =_cnt
print(cnt)

Fixed submission:
n=int(input())
s=input()
cnt =s.count('#')
l =[cnt]
for i in range(n):
    if s[n-i-1] == '#':
        cnt -= 1
        l.append(cnt)
    else:
        cnt+=1
        l.append(cnt)
print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=[a for a in input()]
s=[a.replace('.','0') for a in s]
s=[a.replace('#','1') for a in s]
s=[int(a) for a in s]
s = np.array(s)
cnt = np.sum(s)
for i in range(n):
    s[-1 * (i+1)] = 1 - s[-1 * (i+1)]
    _cnt = np.sum(s)
    if cnt > _cnt:
        cnt =_cnt
print(cnt)

Fixed submission:
n=int(input())
s=input()
cnt =s.count('#')
l =[cnt]
for i in range(n):
    if s[n-i-1] == '#':
        cnt -= 1
        l.append(cnt)
    else:
        cnt+=1
        l.append(cnt)
print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
s=[a for a in input()]
x = []
for a in s:
    if a == '.':
        x.append(0)
    else:
        x.append(1)
s = np.array(x)
ans = np.zeros(n).astype(np.uint8)
cnt = np.sum(s != ans)
for i in range(n):
    ans[-1 * (i+1)] = 1
    _cnt = np.sum(s != ans)
    if cnt > _cnt:
        cnt = _cnt
print(cnt)


Fixed submission:
n=int(input())
s=input()
cnt =s.count('#')
l =[cnt]
for i in range(n):
    if s[n-i-1] == '#':
        cnt -= 1
        l.append(cnt)
    else:
        cnt+=1
        l.append(cnt)
print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
f1=False
f2=False
while(1):
  f1=False
  f2=False
  x1=s.find('10')
  if x1==-1:
    f1=True
  x2=s.find('01')
  if x2==-1:
    f2=True
  if f1 and f2:
    break
  elif f1:
    x=x2
  elif f2:
    x=x1
  else:
    x=min(x1,x2)
  s=s[:x]+s[x+2:]
  cnt+=1
print(cnt*2)

Fixed submission:
s=input()
cnt=0
idx=0
while(1):
  if idx >=len(s):
    break
  if s[idx:idx+2] in ('01','10'):
    cnt+=1
    s=s[:idx]+s[idx+2:]
    idx = max(0,idx-1)
  else:
    idx+=1
print(cnt*2)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
cnt=0
f1=False
f2=False
while(1):
  f1=False
  f2=False
  x1=s.find('10')
  if x1==-1:
    f1=True
  x2=s.find('01')
  if x2==-1:
    f2=True
  if f1 and f2:
    break
  elif f1:
    x=x2
  elif f2:
    x=x1
  else:
    x=min(x1,x2)
  s=s[:x]+s[x+2:]
  cnt+=1
print(cnt*2)

Fixed submission:
s=input()
cnt=0
idx=0
while(1):
  if idx >=len(s):
    break
  if s[idx:idx+2] in ('01','10'):
    cnt+=1
    s=s[:idx]+s[idx+2:]
    idx = max(0,idx-1)
  else:
    idx+=1
print(cnt*2)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[[int(x) for x in input().split()] for _ in range(n)]
d={i:0 for i in range(m)}
for i in range(n):
    k=a[i][0]
    for j in range(k):
        d[a[i][j]] += 1
cnt=0
for key in d:
    if d[key] == n:
        cnt+=1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
a=[[int(x) for x in input().split()] for _ in range(n)]
d={i:0 for i in range(m)}
for i in range(n):
    k=a[i][0]
    for j in range(k):
        d[a[i][j+1]-1] += 1
cnt=0
for key in d:
    if d[key] == n:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,m,d = map(int,input().split())

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks*n = 2*np.max(n-2*d,0) + 2*d)
ave = oks*(m-1)/n/n
print(ave)

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

if(a+b ==15):
    print("+")
elif(a*b == 15):
    print("*")
else:
    print("x")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
x=[]
for i in range(len(s)):
     for j in range(1,len(s)-i+1):
          x.append(s[i:i+j])
x=list(set(x))
x.sort()
print(x[k-1])

Fixed submission:
s=input()
k=int(input())
x=set()
for i in range(len(s)):
     for j in range(1,min(len(s)-i+1,k+1)):
          x.add(s[i:i+j])
x=list(x)
x.sort()
print(x[k-1])

Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
x=[]
for i in range(len(s)):
     for j in range(1,len(s)-i+1):
          x.append(s[i:i+j])
x=list(set(x))
x.sort()
print(x[k-1])

Fixed submission:
s=input()
k=int(input())
x=set()
for i in range(len(s)):
     for j in range(1,min(len(s)-i+1,k+1)):
          x.add(s[i:i+j])
x=list(x)
x.sort()
print(x[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
l=[i for i in range(1,b+1)]
l=l[a-1:]
l=l[:k]+l[-k:]
l=list(set(l))
l.sort()
for i in l:
    print(i)

Fixed submission:
a,b,k=map(int,input().split())
l=[i for i in range(a,min(a+k,b+1))]
s=[i for i in range(max(a,b-k+1),b+1)]
l=l+s
l=list(set(l))
l.sort()
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
import math
x,y=map(int,input().split())
a=x*y/math.gcd(x,y)
a-=x
if a>0 and a<10**19:
     print(int(a))
else:
     print(-1)

Fixed submission:
import fractions
x,y=map(int,input().split())
a=x*y/fractions.gcd(x,y)
a-=x
if a>0 and a<10**19:
     print(int(a))
else:
     print(-1)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
print(max(x-t,0))

Fixed submission:
x,t = map(int,input().split())
print(max(x-t,0))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
c=[]
s=a[0]
cnt=1
while(1):
    if s==2:
        print(cnt)
        sys.exit()
    if s in c:
        print(-1)
        sys.exit()
    c.append(s)
    s=a[s-1]
    cnt+=1

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
c=set()
s=a[0]
cnt=1
while(1):
    if s==2:
        print(cnt)
        sys.exit()
    if s in c:
        print(-1)
        sys.exit()
    c.add(s)
    s=a[s-1]
    cnt+=1

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
c=[]
s=a[0]
cnt=1
while(1):
    if s==2:
        print(cnt)
        sys.exit()
    if s in c:
        print(-1)
        sys.exit()
    c.append(s)
    s=a[s-1]
    cnt+=1

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
c=set()
s=a[0]
cnt=1
while(1):
    if s==2:
        print(cnt)
        sys.exit()
    if s in c:
        print(-1)
        sys.exit()
    c.add(s)
    s=a[s-1]
    cnt+=1
Buggy python submission (verdict: Runtime Error):
a,b = inpur().split()
if a == b:
    print("H")
else:
    print("D")

Fixed submission:
a,b = input().split()
if a == b:
    print("H")
else:
    print("D")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: cp932 -*-

import sys
import os
import re
import datetime
import bisect

### main ###

X = input()

restS = []
for c in X:
    #print("c = {}".format(c))
    restS.append(c)
    if c == 'T':
        while(len(restS) >= 2):
            #print("restS = {}, last 2 string = {} ".format(restS, restS[-2:]))
            if("".join(restS[-2:]) == 'ST'):
                #print("hit")
                restS = restS[:-2]
                #print("new restS = {}".format(restS))
            else:
                #print("no hit")
                break # out of while

print(len(restS))

Fixed submission:
# -*- coding: cp932 -*-

import sys
import os
import re
import datetime
import bisect

### main ###

X = input()

restS = []
for c in X:
    #print("c = {}".format(c))
    restS.append(c)
    if c == 'T':
        while(len(restS) >= 2):
            #print("restS = {}, last 2 string = {} ".format(restS, restS[-2:]))
            if("".join(restS[-2:]) == 'ST'):
                #print("hit")
                #restS = restS[:-2] # TLE
                del restS[-2:]
                #print("new restS = {}".format(restS))
            else:
                #print("no hit")
                break # out of while

print(len(restS))
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
#!/usr/bin/python

a,b=map(int,raw_input().split())

N=pow(10,9)+7
n=1000000000
#a=141421
#b=173205

def modpow(b,e,m): 

    result=1

    while(e!=0): 
          if(e&1==1): 
             result=(result*b)%m 
          e>>=1
          b=(b*b)%m
    
    return result

def combination(n,r,N):
    bunshi=1
    for i in range(n-r+1,n+1):
        bunshi=(bunshi*i)%N
    bunbo=1
    for i in range(1,r+1):
        bunbo=(bunbo*i)%N
    return bunshi*modpow(bunbo,N-2,N)

#pow(2,n)-nCa-nCb-1
#nCr=n!/((n-r)!*r!)だから
#bunshi=n*n-1*・・・*n-r+1
#bunbo=1*・・・*r
#Nが素数だから、フェルマーの小定理より
#modpow(a,N-1,N)=1
#a*pow(a,N-2)=pow(a,N-1)=1(modN)
#より。aのmodNでの逆元はpow(a,N-2)になる。
#r!の逆元が欲しいから、modpow(bunbo,N-2,N)を掛ける。

print (modpow(2,n,N)-combination(n,a,N)-combination(n,b,N)-1)%N

Fixed submission:
#coding:utf-8
#!/usr/bin/python

n,a,b=map(int,raw_input().split())

N=pow(10,9)+7
#n=1000000000
#a=141421
#b=173205

def modpow(b,e,m): 

    result=1

    while(e!=0): 
          if(e&1==1): 
             result=(result*b)%m 
          e>>=1
          b=(b*b)%m
    
    return result

def combination(n,r,N):
    bunshi=1
    for i in range(n-r+1,n+1):
        bunshi=(bunshi*i)%N
    bunbo=1
    for i in range(1,r+1):
        bunbo=(bunbo*i)%N
    return bunshi*modpow(bunbo,N-2,N)

#pow(2,n)-nCa-nCb-1
#nCr=n!/((n-r)!*r!)だから
#bunshi=n*n-1*・・・*n-r+1
#bunbo=1*・・・*r
#Nが素数だから、フェルマーの小定理より
#modpow(a,N-1,N)=1
#a*pow(a,N-2)=pow(a,N-1)=1(modN)
#より。aのmodNでの逆元はpow(a,N-2)になる。
#r!の逆元が欲しいから、modpow(bunbo,N-2,N)を掛ける。

print (modpow(2,n,N)-combination(n,a,N)-combination(n,b,N)-1)%N
Buggy python submission (verdict: Runtime Error):
li = list(map(input().split()))
sum = 0;
for i in li:
  if(li[i] != li[i + 1]):
    sum += 1
  if((i+1) >= len(li)):
    break;
print(sum)


Fixed submission:
li = list(input())
sums = 0
leng = int(len(li))

for i in range(leng):
    now = i
    if (now + 1) >= leng:
        break
    if(li[now] == li[now + 1]):
        if(li[now + 1] == '0'):
            li[now + 1] = '1'
        else:
            li[now + 1] = '0'
        sums += 1
print(sums)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
i = int(0)
l = list()
if a > b:
    maxim = a
else:
    maxim = b
for i in range(1,100):
        if ((a % i) == 0) and ((b % i) == 0):
            l.append(i)
        elif maxim < i:
            break

n = int(len(l))
if c == 1:
    n = n
else:
    n -= c
print(l[n])

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

if (b / a) >= c:
    print(c)
elif a > b:
    print(0)
else:
    print(int(b / a))
Buggy python submission (verdict: Runtime Error):
n = input()
a = input()

if (n % 500)<= a:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
a = int(input())

if (n % 500) <= a:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
3 4 5


Fixed submission:
a, b, c = (int(i) for i in input().split())
print(a*b//2)