Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
    if a%3==1:
        s=a*b
        x=(a//3)*b
        y=((a-(a//3))//2)*b
        z=s-x-y

        e=(a-(a//3))*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))
    elif a%3==2:
        s=a*b
        x=((a//3)+1)*b
        y=((a-(a//3)-1)//2)*b
        z=s-x-y
        e=(a-(a//3)-1)*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))
j=min(h,w)
if (h%3==0)or(w%3==0):
    print(0)
elif j==1:
    print(1)
    sys.exit()
    
else:
    k=s(h,w)
    ans.append(k)
    r=s(w,h)
    ans.append(r)
    
# print(ans)
print(min(ans))
    


Fixed submission:
h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
    for i in range(a):
        s=a*b
        x=i*b
        y=((a-i)//2)*b
        z=s-x-y

        d=(a-i)*(b//2)
        e=s-x-d
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        res=min((ma-mi),(mc-mn))
        ans.append(res)
    return min(ans)
        
f=s(h,w)
g=s(w,h)
print(min(f,g))
    
# print(ans)
# print(min(ans))

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
    if a%3==1:
        s=a*b
        x=(a//3)*b
        y=((a-(a//3))//2)*b
        z=s-x-y

        e=(a-(a//3))*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))
    elif a%3==2:
        s=a*b
        x=((a//3)+1)*b
        y=((a-(a//3)-1)//2)*b
        z=s-x-y
        e=(a-(a//3)-1)*(b//2)
        d=s-x-e
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        return(min((ma-mi),(mc-mn)))

if h<w:
    h,w=w,h
if (h%3==0)or(w%3==0):
    print(0)
else:
    k=s(h,w)
    ans.append(k)
    r=s(w,h)
    ans.append(r)
    
# print(ans)
print(min(ans))
    


Fixed submission:
h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
    for i in range(a):
        s=a*b
        x=i*b
        y=((a-i)//2)*b
        z=s-x-y

        d=(a-i)*(b//2)
        e=s-x-d
        ma=max(x,y,z)
        mi=min(x,y,z)
        mc=max(x,e,d)
        mn=min(x,e,d)
        res=min((ma-mi),(mc-mn))
        ans.append(res)
    return min(ans)
        
f=s(h,w)
g=s(w,h)
print(min(f,g))
    
# print(ans)
# print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
ans=[]
# print(a)
for i in range(n):
    for k in range(a[i][1]):
        ans.append(a[i][0])
# print(ans)
# ans=[int(i) for i in ans]
# print(ans)
ans.sort()
print(ans[m-1])

Fixed submission:
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
a.sort()
import sys
# ans=dict(a)
# print(a)
cnt=0
for i in range(n):
    z=cnt+a[i][1]
    if z>=m:
        print(a[i][0])
        sys.exit()
    else:
        cnt=z

# print(a)
# for i in range(n):
#     for k in range(a[i][1]):
#         ans.append(a[i][0])
# print(ans)
# ans=[int(i) for i in ans]
# print(ans)
# print(ans[m-1])

Buggy python submission (verdict: Time Limit Exceeded):
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
ans=[]
# print(a)
for i in range(n):
    for k in range(a[i][1]):
        ans.append(a[i][0])
# print(ans)
ans=[int(i) for i in ans]
# print(ans)
ans.sort()
print(ans[m-1])

Fixed submission:
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
a.sort()
import sys
# ans=dict(a)
# print(a)
cnt=0
for i in range(n):
    z=cnt+a[i][1]
    if z>=m:
        print(a[i][0])
        sys.exit()
    else:
        cnt=z

# print(a)
# for i in range(n):
#     for k in range(a[i][1]):
#         ans.append(a[i][0])
# print(ans)
# ans=[int(i) for i in ans]
# print(ans)
# print(ans[m-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
sum=0
cnt=0
# 奇数+
for i in range(n):
    sum+=a[i]
    if i%2==0:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_sbst=cnt
# 奇数-
cnt=0
sum=0
for i in range(n):
    z+=a[i]
    if i%2==1:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_plus=cnt
ans=min(cnt_plus,cnt_sbst)
print(ans)




Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sum=0
cnt=0
# 奇数+
for i in range(n):
    sum+=a[i]
    if i%2==0:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_sbst=cnt
# 奇数-
cnt=0
sum=0
for i in range(n):
    sum+=a[i]
    if i%2==1:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_plus=cnt
ans=min(cnt_plus,cnt_sbst)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
import sys
sum=0
cnt=0
# 奇数+
for i in range(n):
    z+=a[i]
    if i%2==0:
        if z<0:
            sum=z
        else:
            cnt+=(z+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_sbst=cnt
# 奇数-
for i in range(n):
    z+=a[i]
    if i%2==1:
        if sum>=0:
            cnt+=(z+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-z)
            sum=1
cnt_plus=cnt
ans=min(cnt_plus,cnt_sbst)
print(ans)




Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sum=0
cnt=0
# 奇数+
for i in range(n):
    sum+=a[i]
    if i%2==0:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_sbst=cnt
# 奇数-
cnt=0
sum=0
for i in range(n):
    sum+=a[i]
    if i%2==1:
        if sum>=0:
            cnt+=(sum+1)
            sum=-1
    else:
        if sum<=0:
            cnt+=(1-sum)
            sum=1
cnt_plus=cnt
ans=min(cnt_plus,cnt_sbst)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
ans=[]
if N==1:
    print(1)
    sys.exit()
for i in range(int(N**0.5)-1,N+1):
    if N%i==0:
        a=str(i)
        print(len(a))
        sys.exit()

Fixed submission:
import sys
N=int(input())
ans=[]
if N==1:
    print(1)
    sys.exit()

for i in range(int(N**0.5),0,-1):
    if N%i==0:
        a=str(N//i)
        print(len(a))
        sys.exit()

Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
ans=[]
for i in range(int(N**0.5)-1,N+1):
    if N%i==0:
        a=str(i)
        print(len(a))
        break

Fixed submission:
import sys
N=int(input())
ans=[]
if N==1:
    print(1)
    sys.exit()

for i in range(int(N**0.5),0,-1):
    if N%i==0:
        a=str(N//i)
        print(len(a))
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
time=0
long=0
for i in range(1,2*x):
    if long<x:
        long+=i
        time+=1
print(time)

Fixed submission:
import sys
x=int(input())
for i in range(1,x+1):
    long = (i*(i+1))/2
    if long>=x:
        print(i)
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
mod=(10**9)+7
ans=1
for i in range(1,n+1):
    ans*=i
print(ans%mod)


Fixed submission:
n=int(input())
mod=(10**9)+7
import math
a=math.factorial(n)
# ans=1
# for i in range(1,n+1):
#     ans*=i
print(a%mod)
Buggy python submission (verdict: Runtime Error):
n=int(input())
import math
mod=10**9+7
ans = math.factorial(n)
x=0
k = ans
for i in range(1,int(k**0.5)+1):
    if k%i==0:
        x+=1
        if i!=n//i:
            x+=1
print(x%mod)




Fixed submission:
n=int(input())
mod=10**9+7
arr = {}
def factorization(k):
    temp=k
    for i in range(2,int(-(-k**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            if i in arr:
                arr[i]+=cnt
            else:
                arr[i]=cnt
    if temp!=1:
        if temp in arr:
                arr[temp]+=1
        else:
            arr[temp]=1
    if arr==[]:
        if k in arr:
                arr[k]+=1
        else:
            arr[k]=1
for i in range(1,n+1):
    factorization(i)
ans=1

for value in arr.values():
    ans*=(value+1)
    
# print(arr)
print(ans%mod)




# x=0
# k = ans
# for i in range(1,int(k**0.5)+1):
#     if k%i==0:
#         x+=1
#         if i!=n//i:
#             x+=1
# print(x%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import math
mod=10**9+7
ans = math.factorial(n)
x=0
for i in range(1,ans+1):
    if ans%i==0:
        x+=1
print(x%mod)




Fixed submission:
n=int(input())
mod=10**9+7
arr = {}
def factorization(k):
    temp=k
    for i in range(2,int(-(-k**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            if i in arr:
                arr[i]+=cnt
            else:
                arr[i]=cnt
    if temp!=1:
        if temp in arr:
                arr[temp]+=1
        else:
            arr[temp]=1
    if arr==[]:
        if k in arr:
                arr[k]+=1
        else:
            arr[k]=1
for i in range(1,n+1):
    factorization(i)
ans=1

for value in arr.values():
    ans*=(value+1)
    
# print(arr)
print(ans%mod)




# x=0
# k = ans
# for i in range(1,int(k**0.5)+1):
#     if k%i==0:
#         x+=1
#         if i!=n//i:
#             x+=1
# print(x%mod)
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
a = int(a)
c = int(b)

if b == '+':
    print(a + c)
elif b == '-':
    print(a - c)
else:
    print('error')

Fixed submission:
x = input().split()
a = int(x[0])
c = int(x[2])
if x[1] == '+':
    print(a + c)
elif x[1] == '-':
    print(a - c)
else:
    print('error')
Buggy python submission (verdict: Runtime Error):
n=int(input())
b = list(map(int,input().split()))
b.append(1000000)
li = []
for i in range(n-1):
    if((b[i]>0) and b[i] <= b[i+1] ):
        li.append(b[i])

print(sum(li)+min(li))

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

a = [0]*n
b.append(1000000)

a[0] = b[0]
for i in range(1,n):
    a[i] = min(b[i],b[i-1])

print(sum(a))
Buggy python submission (verdict: Runtime Error):
def UnlikeNum(nums,price):
    for num in nums:
        if(str(num) in str(price)):
            return True
    
    return False

N, K = map(int,input().split())
D = [int(input()) for k in range(K)]
while(UnlikeNum(D,N)):
    N+=1
print(N)

Fixed submission:
def UnlikeNum(nums,price):
    for num in nums:
        if(str(num) in str(price)):
            return True
    
    return False

N, K = map(int,input().split())
D = list(map(int,input().split()))
while(UnlikeNum(D,N)):
    N+=1
print(N)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
print(max(a*c, b*c, b*d a*d))


Fixed submission:
a, b, c, d = map(int, input().split())
print(max(a*c, b*c, b*d, a*d))
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
f_uf = UnionFind(self, N)
for _ in range(M):
  a, b = map(int, input().split())
  f_uf.union(a-1, b-1)
answer = 1
for i in range(N):
  answer = max(answer, f_uf.size(i))
print(answer)

Fixed submission:
from collections import deque

N, M = map(int, input().split())
friends = [[] for _ in range(N+1)]
for __ in range(M):
  a, b = map(int, input().split())
  friends[a].append(b)
  friends[b].append(a)
checked = [0 for ___ in range(N+1)]
answer = 1
for i in range(1, N+1):
  friend = deque(friends[i])
  cnt = 0
  while(len(friend) > 0):
    f = friend.popleft()
    if checked[f] != 0:
      continue
    else:
      checked[f] = 1
      cnt += 1
      for ff in friends[f]:
        friend.append(ff)
  answer = max(answer, cnt)
print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
heights = list(map(int, input().split()))
before = 0
answer = 0

for h in heights:
  if h < before:
    answwer += before - h
  else:
    before = h
print(answer)

Fixed submission:
N = int(input())
heights = list(map(int, input().split()))
before = 0
answer = 0

for h in heights:
  if h < before:
    answer += before - h
  else:
    before = h
print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
sticks = list(map(int, input().split()))

answer = 0

if N < 3:
  print(answer)
  exit()

sticks = list(dict.fromkeys(sticks))

for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      if sticks[i] + sticks[j] > sticks[k]:
        answer += 1

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

answer = 0

if N < 3:
  print(answer)
  exit()

sticks.sort()

for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      if sticks[i] + sticks[j] > sticks[k] and sticks[i] != sticks[j] and sticks[j] != sticks[k]:
        answer += 1
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  count = 1
  base = 0
  while(1):
    base += 7*10**(count-1)
    if base%K == 0:
      print(count)
      break
    else:
      count += 1
    if count > K:
      print(-1)
      break

Fixed submission:
K = int(input())
base = 0

for count in range(1, K+1):
  num = base*10 + 7
  if (num%K == 0):
    print(count)
    exit()
  else:
    base = num%K
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  base = ''
  count = 1
  while(1):
    base += '7'
    if int(base)%K == 0:
      print(count)
      break
    else:
      count += 1
    if count > K:
      print(-1)
      break
  


Fixed submission:
K = int(input())
base = 0

for count in range(1, K+1):
  num = base*10 + 7
  if (num%K == 0):
    print(count)
    exit()
  else:
    base = num%K
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
if K%2 == 0 or K%5 == 0:
  print(-1)
else:
  base = ''
  count = 1
  while(1):
    base += '7'
    if int(base)%K == 0:
      print(count)
      break
    else:
      count += 1
  


Fixed submission:
K = int(input())
base = 0

for count in range(1, K+1):
  num = base*10 + 7
  if (num%K == 0):
    print(count)
    exit()
  else:
    base = num%K
print(-1)
Buggy python submission (verdict: Runtime Error):
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elif score == 'WA':
    WA += 1
  elif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

Fixed submission:
N=int(input())
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elif score == 'WA':
    WA += 1
  elif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

Buggy python submission (verdict: Runtime Error):
N=int(input())
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elseif score == 'WA':
    WA += 1
  elseif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

Fixed submission:
N=int(input())
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elif score == 'WA':
    WA += 1
  elif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))
Buggy python submission (verdict: Runtime Error):
import copy

H, W, K = map(int, input().split())
tiles = [list(input().split()) for _ in range(H)]
count  = 0

for num in range(2**(H+W)):
  copied_tiles = copy.deepcopy(tiles)
  for i in range(H+W):
    if num>>i&1:
      if i < H:
        for j in range(W):
          copied_tiles[i][j] = 'R'
      else:
        for j in range(H):
          copied_tiles[j][i-H] = 'R'
  black_c = 0
  for i in range(H):
    for j in range(W):
      if copied_tiles[i][j] == '#':
        black_c += 1
  if black_c == K:
    count += 1
print(count)

Fixed submission:
import copy
 
H, W, K = map(int, input().split())
tiles = [list(input()) for _ in range(H)]
count  = 0
 
for num in range(2**(H+W)):
  copied_tiles = copy.deepcopy(tiles)
  for i in range(H+W):
    if num>>i&1:
      if i < H:
        for j in range(W):
          copied_tiles[i][j] = 'R'
      else:
        for j in range(H):
          copied_tiles[j][i-H] = 'R'
  black_c = 0
  for i in range(H):
    for j in range(W):
      if copied_tiles[i][j] == '#':
        black_c += 1
  if black_c == K:
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
result = 0

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

for num in range(1, N+1):
	result += len(make_divisors(num)) * num
print(result)

Fixed submission:
N = int(input())
divisors = [1 for _ in range(N+1)]
result = 0

for n in range(2, N+1):
  for m in range(n, N+1, n):
    divisors[m] += 1
for i, d in enumerate(divisors):
  result += i * d
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
result = 0

def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)

    upper_divisors.reverse()
    return lower_divisors + upper_divisors

for num in range(1, N+1):
	result += len(make_divisors(num)) * num
print(result)

Fixed submission:
N = int(input())
divisors = [1 for _ in range(N+1)]
result = 0

for n in range(2, N+1):
  for m in range(n, N+1, n):
    divisors[m] += 1
for i, d in enumerate(divisors):
  result += i * d
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
result = 0

def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)

    upper_divisors.reverse()
    return lower_divisors + upper_divisors

for num in range(1, N+1):
	result += len(make_divisors(num)) * num
print(result)

Fixed submission:
N = int(input())
divisors = [1 for _ in range(N+1)]
result = 0

for n in range(2, N+1):
  for m in range(n, N+1, n):
    divisors[m] += 1
for i, d in enumerate(divisors):
  result += i * d
print(result)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
prices = list(map(int, input().split()))

prices.sort()
print(sum(prices[:K]))

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

prices.sort()
print(sum(prices[:K]))
Buggy python submission (verdict: Runtime Error):
X, Y ＝ map(int, input().split())
for crane in range(X+1):
  turtle = X - crane
  if crane * 2 + turtle * 4 == Y:
    print('Yes')
    exit()
print('No')


Fixed submission:
X, Y = map(int, input().split())
for crane in range(X+1):
  turtle = X - crane
  if crane * 2 + turtle * 4 == Y:
    print('Yes')
    exit()
print('No')

Buggy python submission (verdict: Runtime Error):
X, Y ＝ map(int, input().split())
for crane in X:
  turtle = X - crane
  if crane * 2 + turtle * 4 == Y:
    print('Yes')
    exit()
print('No')

Fixed submission:
X, Y = map(int, input().split())
for crane in range(X+1):
  turtle = X - crane
  if crane * 2 + turtle * 4 == Y:
    print('Yes')
    exit()
print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
nums = list(map(int, input().split()))

checked = [0 for _ in range(N)]
nums.sort()
answer = N
for i, num in enumerate(nums):
  if checked[i] == 1:
    continue
  else:
    if i == N-1:
      break
    same = False
    for j in range(i+1, N):
      if nums[j]%num == 0 and checked[j] == 0:
        checked[j] = 1
        answer -= 1
        if nums[j] == num:
          same = True
    if same:
      answer -= 1
print(answer)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
nums.sort()
checked = [0 for _ in range(nums[-1]+1)]
answer = 0
for i in range(N-1):
  if checked[nums[i]] == 1:
    continue
  else:
    if nums[i] != nums[i+1]:
      answer += 1
    count = 1
    temp = nums[i]
    while(temp <= nums[-1]):
      checked[temp] = 1
      count += 1
      temp= nums[i]*count
if checked[nums[-1]] == 0:
  answer += 1
print(answer)
Buggy python submission (verdict: Runtime Error):
A, B = input().split()
a = int(A)
b = float(B)
ib = int(B*100)

print(int((a*ib)/100))



Fixed submission:
from decimal import *
import math

A, B = input().split()
a = Decimal(A)
b = Decimal(B)
ib = Decimal(100*b)

print(math.floor((a*ib)/Decimal(100)))

Buggy python submission (verdict: Runtime Error):
A, B = input().split()
a = int(A)
fb = float(B)
ib = int(b)
print(a*ib + int(a*fb))

Fixed submission:
from decimal import *
import math

A, B = input().split()
a = Decimal(A)
b = Decimal(B)
ib = Decimal(100*b)

print(math.floor((a*ib)/Decimal(100)))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N, K = map(int, input().split())
towns = [0] + list(map(int, input().split()))
checked = [0 for _ in range(N+1)]
next = towns[1]
count = 1
while(True):
  if checked[next] != 0:
    loop = count - checked[next]
    pos = 0
    if K > count:
      pos = checked[next] + (K-checked[next])%loop
    else:
      pos = K
    for i in range(1, N+1):
      if checked[i] == pos:
        print(i)
        exit()
  else:
    checked[next] = count
    count += 1
    next = towns[next]

Fixed submission:
from collections import deque

N, K = map(int, input().split())
towns = [0] + list(map(int, input().split()))
checked = [-1 for _ in range(N+1)]
checked[1] = 0
next = towns[1]
count = 1
    
while(checked[next] < 0):
  checked[next] = count
  count += 1
  next = towns[next]
loop = count - checked[next]
pos = 0
if K >= count:
  pos = checked[next] + (K-checked[next])%loop
else:
  pos = K
for i in range(1, N+1):
  if checked[i] == pos:
    print(i)
    exit()