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

Fixed submission:
class UnionFind():
    def __init__(self,n):
        self.n = n
        self.par = [-1]*(n+1)
    
    def find(self,x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.par[x] > self.par[y]:
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x

N, M = map(int,input().split())
uf = UnionFind(N)

for i in range(M):
    a, b = map(int,input().split())
    uf.union(a,b)

ans = -min(uf.par)
print(ans)

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

for i in range(M):
    s, t = map(int,input().split())
    for st in sets:
        if s in st or t in st:
            st.add(s)
            st.add(t)
            break
    sets.append({s,t})

ans = max([len(st) for st in sets])
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 01:08:52 2020

@author: liang
"""
N, M = map(int,input().split())
sets = list()

for i in range(M):
    s, t = map(int,input().split())
    for st in sets:
        if s in st or t in st:
            st.add(s)
            st.add(t)
            break
    sets.append({s,t})

ans = max([len(st) for st in sets])
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 01:08:52 2020

@author: liang
"""
N, M = map(int,input().split())
sets = list()

for i in range(M):
    s, t = map(int,input().split())
    for st in sets:
        if s in st or t in st:
            st.add(s)
            st.add(t)
            break
    sets.append({s,t})

ans = max([len(st) for st in sets])
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 01:08:52 2020

@author: liang
"""
N, M = map(int,input().split())
sets = list()

for i in range(M):
    s, t = map(int,input().split())
    for st in sets:
        if s in st or t in st:
            st.add(s)
            st.add(t)
            break
    sets.append({s,t})

ans = max([len(st) for st in sets])
print(ans)

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

for i in range(M):
    s, t = map(int,input().split())
    for st in sets:
        if s in st or t in st:
            st.add(s)
            st.add(t)
            break
    sets.append({s,t})

ans = max([len(st) for st in sets])
print(ans)
Problem p02574 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 07:10:00 2020

@author: liang
"""


# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 00:26:07 2020

@author: liang
"""

"""
コーナーケース１:
    重複があるとき　not coprime
    ただし、1の重複は除く
"""
import math
C = 10**6
N = int(input())
judge = [False]*(C+1)
A = [int(x) for x in input().split()]

f = True
for a in A:
    if judge[a] == True and a != 1:
        f = False
    judge[int(a)]=True


#print(judge[:10])
def solve(f):
    
    ans = A[0]
    #線形探索 O(N)
    for i in range(N):
        ans = math.gcd(ans,A[i])
    #print("ans",a)
    if ans != 1:
        return "not coprime"
    
    flag = True
    #エラトステネスの篩 O(N log N)
    for i in range(2,C+1):
        count = 0
       #if d[i] == True:
        for j in range(i,C+1,i):
            if judge[j] == True:
                count += 1
            if count == 2:
                flag = False
                break
        #        d[j] = False
        if not flag:
            break
    
    if flag == True and f == True:
        return "pairwise coprime"
    
    return "setwise coprime"

print(solve(f))
#print(len(A))

Buggy submission (verdict: Runtime Error):

@author: liang
"""

"""
コーナーケース１:
    重複があるとき　not coprime(※これが誤り)
    ただし、1の重複は除く

コーナーケース:
    重複があるとき　pairwise coprime ではない
    setwise coprimeの可能性はある
    ただし、１の重複は
"""
import math
C = 10**6
#T = int(math.sqrt(C)*10**3)+1
N = int(input())
judge = [0]+[False]*C
A =list()
f = True
for a in input().split():
    if judge[int(a)] == True and int(a) != 1:
        f = False
    judge[int(a)]=True
    A.append(int(a))
d = [False]+[True]*C

#print(judge[:10])
def solve(f):
    flag = True
    #エラトステネスの篩 O(N log N)
    for i in range(2,C+1):
        count = 0
        if d[i] == True:
            for j in range(i,C+1,i):
                if judge[j] == True:
                    count += 1
                if count == 2:
                    flag = False
                    break
                d[j] = False
        if not flag:
            break
    
    if flag == True and f == True:
        return "pairwise coprime"
    ans = A[0]
    #線形探索 O(N)
    for i in range(N):
        ans = math.gcd(ans,A[i])
    #print("ans",a)
    if ans == 1:
        return "setwise coprime"
    return "not coprime"

print(solve(f))
#print(len(A))
Problem p02658 (python)

Fixed submission:

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

t = 1
ans = 1
count = 0

if 0 in A:
    ans = 0
else:  
    for a in A:
        ans *= a
        t *= a
        while t >= 10:
            t /= 10
            count += 1
            if count >= 19:
                ans = -1 
                break

if ans > 10**18:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(float,input().split())
A = int(A)
B = int(B*1000)
ans = A*B//1000
print (ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 21:01:07 2020

@author: liang
"""

import math

N = int(input())
A = list(map(int,input().split()))
B  = [math.log10(x) for x in A]

ans = 1
if sum(B) > 18:
    ans = -1
else:
    for a in A:
        ans *= a

if ans > 10**18:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int,input().split()))
B  = [math.log10(x) for x in A]

ans = 1
if sum(B) > 18:
    ans = -1
else:
    for a in A:
        ans *= a

if ans > 10**18:
    print(-1)
else:
    print(ans)
Problem p02660 (python)

Fixed submission:
N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
ans = 0

if(N>1):
    Q = factorization(N)
    A = [ b for [a,b] in Q]
    for a in A:
        i = 1
        while(a >= i):
            a -= i
            i += 1
            ans += 1
    print(ans)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
ans = 0

if(N>1):
    Q = factorization(N)
    "print(Q)"
    A = [ b for [a,b] in Q]
    for a in A:
        i = 1
        while(a >= i):
            a -= i
            i += 1
            ans += 1
    print(ans)

else:
    print(0)
Problem p02690 (python)

Fixed submission:
X = int(input())
fact = [(i,i**5) for i in range(-10**3,10**3)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)

Buggy submission (verdict: Runtime Error):
X = int(input())
fact = [(i,i**5) for i in range(-10**2,10**2)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)

Buggy submission (verdict: Runtime Error):
X = int(input())
fact = [(i,i**5) for i in range(-10**3,10**3)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B

Buggy submission (verdict: Runtime Error):
X = int(input())
fact = [(i,i**5) for i in range(-10**2,10**2)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)
Problem p02814 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 14:33:00 2020

@author: liang
"""
from math import gcd

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

flag = False
res = 1
for a in A:
    a //= 2
    res *= a//gcd(res,a)
    if res > M:
        flag = True
        break
    #print(res)
"""
存在チェック
２で割り切れる個数同じ？
"""

for a in A:
    if int(res/a) == res/a:
        flag = True
        
if flag:
    ans = 0
    print(ans)
else:
    #ans = (M - res(A)//2)//res + 1
    #ans = (M-1)//res//2 + 1
    ans= (M//res + 1)//2
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 14:33:00 2020

@author: liang
"""
from math import gcd

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

flag = False
res = 1
for a in A:
    a /= 2
    res *= a//gcd(res,a)
    if res > M:
        flag = True
        break
    #print(res)
"""
存在チェック
２で割り切れる個数同じ？
"""

for a in A:
    if int(res/a) == res/a:
        flag = True
        
if flag:
    ans = 0
    print(ans)
else:
    #ans = (M - res(A)//2)//res + 1
    #ans = (M-1)//res//2 + 1
    ans= (M//res + 1)//2
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 14:33:00 2020

@author: liang
"""
from math import gcd

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

res = 1
for i in range(N):
    res *= A[i]//2//gcd(res,A[i]//2)
    #print(res)
"""
存在チェック
２で割り切れる個数同じ？
"""
flag = False
for a in A:
    if int(res/a) == res/a:
        flag = True
        
if flag:
    ans = 0
else:
    #ans = (M - res(A)//2)//res + 1
    #ans = (M-1)//res//2 + 1
    ans= (M//res + 1)//2
    print(ans)
Problem p02911 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 15:18:03 2020

@author: liang
"""
N, K, Q = map(int, input().split())
A = [0]*N
for i in range(Q):
    t = int(input())
    A[t-1] += 1

#print(A)
for i in range(N):
   # print(Q-A[i])
    if Q - A[i] <  K:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 15:18:03 2020

@author: liang
"""
N, K, Q = map(int, input().split())
A = [0]*N
for i in range(Q):
    t = int(input())
    A[t-1] += 1

for i in range(Q):
    if Q - A[i] > K:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0]*N
for i in range(Q):
    t = int(input())
    A[t] += 1

for i in range(Q):
    if Q - A[i] > K:
        print("Yes")
    else:
        print("No")
Problem p03371 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020

@author: liang
"""

A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    if X > Y :
        if A < 2 * C:
            ans = Y * C * 2 + abs(X-Y) * A
        else:
            ans = X * C * 2
    else:
        if B < 2 * C:
            ans = X * C * 2 + abs(X-Y) * B
        else:
            ans = Y * C * 2
else:
    ans = X * A + Y * B 
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020

@author: liang
"""
###煩雑 => 列挙して最小値を出力
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    if X > Y :
        if A < 2 * C:
            ans = Y * C * 2 + abs(X-Y) * A
        else:
            ans = X * C * 2  ##
    else:
        if B < 2 * C:
            ans = X * C * 2 + abs(X-Y) * B
        else:
            ans = Y * C * 2 ##
else:
    ans = X * A + Y * B 
print(ans)
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    ans1 = max(X,Y) * C * 2  #条件分岐が減る
    if X > Y :
        if A < 2 * C:
            ans2 = Y * C * 2 + abs(X-Y) * A           
    else:
        if B < 2 * C:
            ans2 = X * C * 2 + abs(X-Y) * B  
    print(min(ans1,ans2)) #print()が分岐する
else:   
    ans = X * A + Y * B 
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020

@author: liang
"""
###煩雑 => 列挙して最小値を出力
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    if X > Y :
        if A < 2 * C:
            ans = Y * C * 2 + abs(X-Y) * A
        else:
            ans = X * C * 2  ##
    else:
        if B < 2 * C:
            ans = X * C * 2 + abs(X-Y) * B
        else:
            ans = Y * C * 2 ##
else:
    ans = X * A + Y * B 
print(ans)
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    ans1 = max(X,Y) * C * 2  #条件分岐が減る
    if X > Y :
        if A < 2 * C:
            ans2 = Y * C * 2 + abs(X-Y) * A           
    else:
        if B < 2 * C:
            ans2 = X * C * 2 + abs(X-Y) * B  
    print(min(ans1,ans2)) #print()が分岐する
else:   
    ans = X * A + Y * B 
    print(ans)
Problem p03761 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 14:54:30 2020

@author: liang
"""

n = int(input())
S = [input() for _ in range(n)]

ans = [100]*26

for i in range(n):
    tmp = [0]*26
    for s in S[i]:
        key = ord(s)-ord('a')
        if tmp[key] < ans[key]:
            tmp[key] += 1
    ans = tmp.copy()

res = ""
for i in range(26):
    res += chr(ord('a') + i)*tmp[i]
print(res)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 14:54:30 2020

@author: liang
"""

n = int(input())
S = [input() for _ in range(n)]

ans = [100]*26

for i in range(n):
    tmp = [0]*26
    for s in S[i]:
        key = ord(s)-ord('a')
        if tmp[key] < ans[key]:
            tmp[key] += 1
    ans = tmp.copy()

res = ""
for i in range(n):
    res += chr(ord('a') + i)*tmp[i]
print(res)
Problem p03086 (python)

Fixed submission:
s = input()
ans = 0
l = 0
for c in s:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    l += 1
  else:
    ans = max(ans, l)
    l = 0
ans = max(ans, l)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
l = 0
for c in s:
  if c == 'A' || c == 'C' || c == 'G' || c == 'T':
    l += 1
  else:
    ans = max(ans, l)
    l = 0
ans = max(ans, l)
print(ans)
Problem p03146 (python)

Fixed submission:
s = int(input())
a = [0 for i in range(1000001)]
a[s] = 1
ai = s
i = 2
while True:
  if ai % 2 == 0:
    ai //= 2
  else:
    ai = 3 * ai + 1
  if a[ai] > 0:
    print(i)
    break
  else:
    a[ai] = 1
    i += 1

Buggy submission (verdict: Runtime Error):
s = int(input())
a = [0 for i in range(1000001)]
a[s] = 1
ai = s
i = 2
while True:
  if ai % 2 == 0:
    ai /= 2
  else:
    ai = 3 * ai + 1
  if a[ai] > 0:
    print(i)
    break
  else:
    a[ai] = 1
    i += 1
Problem p03245 (python)

Fixed submission:
import sys
import itertools
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
c = ['R', 'U', 'L', 'D']
n = int(input())
x = []
y = []
for i in range(n):
  xi, yi = map(int, input().split())
  x.append(xi)
  y.append(yi)
parity = None
for i in range(n):
  if i == 0:
    parity = (x[i] + y[i]) % 2
  elif (x[i] + y[i]) % 2 != parity:
    print(-1)
    sys.exit()
print(40)
d = []
for i in range(20):
  d.append(3**i)
  d.append(3**i)
d[1] += parity
print(*d)
d = [1] * 40
d[1] += parity
for i in range(n):
  for m in range(20):
    for j, k in itertools.product(range(4), range(4)):
      xnew = x[i] - (d[2*m] * dx[j] + d[2*m+1] * dx[k])
      ynew = y[i] - (d[2*m] * dy[j] + d[2*m+1] * dy[k])
      if xnew % 3 == 0 and ynew % 3 == 0:
        x[i] = xnew // 3
        y[i] = ynew // 3
        print(c[j] + c[k], end='')
        break
  print('')

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
x = []
y = []
for i in range(n):
  xi, yi = map(int, input().split())
  x.append(xi)
  y.append(yi)
parity = None
for i in range(n):
  if i == 0:
    parity = (x[i] + y[i]) % 2
  elif (x[i] + y[i]) % 2 != parity:
    print(-1)
    sys.exit()
print(20 - parity)
print(*[1] * (20 - parity))
for i in range(n):
  s = ''
  if x[i] > 0:
    s += 'R' * x[i]
  else:
    s += 'L' * (-x[i])
  if y[i] > 0:
    s += 'U' * y[i]
  else:
    s += 'D' * (-y[i])
  s += (20 - parity - abs(x[i]) - abs(y[i])) // 2 * 'LR'
  print(s)
Problem p03263 (python)

Fixed submission:
import itertools
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
s = []
for i, j in itertools.product(range(h), range(w - 1)):
  if a[i][j] % 2 == 1:
    s.append((i + 1, j + 1, i + 1, j + 2))
    a[i][j] -= 1
    a[i][j + 1] += 1
for i in range(h - 1):
  if a[i][w - 1] % 2 == 1:
    s.append((i + 1, w, i + 2, w))
    a[i][w - 1] -= 1
    a[i + 1][w - 1] += 1
print(len(s))
for l in s:
  print(*l)

Buggy submission (verdict: Runtime Error):
import itertools
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
s = []
for i, j in itertools.product(range(h), range(w - 1)):
  if a[i][j] % 2 == 1:
    s.append((i + 1, j + 1, i + 1, j + 2))
    a[i][j] -= 1
    a[i][j + 1] += 1
for i in range(h - 1):
  if a[i][j] % 2 == 1:
    s.append((i + 1, j + 1, i + 2, j + 1))
    a[i][j] -= 1
    a[i + 1][j] += 1
print(len(s))
for l in s:
  print(*l)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
for i in range(min(len(s), k)):
  if s[i] != '1':
    print(s[i])
    break
else:
  print(s[k - 1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i in range(min(len(s), k)):
  if s[i] != '1':
    print(c)
    break
else:
  print(s[k - 1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i in range(k):
  if s[i] != '1':
    print(c)
    break
else:
  print(s[k - 1])
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
for i in range(len(s)):
  if (i == a) != (s[i] == '-'):
    print('No')
    break
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
for i in len(s):
  if (i == a) != (s[i] == '-'):
    print('No')
    break
else:
  print('Yes')
Problem p03637 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a0, a1, a2 = 0, 0, 0
for i in a:
  if i % 2 == 1:
    a0 += 1
  elif i % 4 == 2:
    a1 = 1
  else:
    a2 += 1
if a0 + a1 <= a2 + 1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a0, a1, a2 = 0, 0, 0
for i in a:
  if a % 2 == 1:
    a0 += 1
  elif a % 4 == 2:
    a1 = 1
  else:
    a2 += 1
if a0 + a1 <= a2 + 1:
  print('Yes')
else:
  print('No')
Problem p03729 (python)

Fixed submission:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')
Problem p03730 (python)

Fixed submission:
import fractions
a, b, c = map(int, input().split())
if c % fractions.gcd(a, b) == 0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
import math
a, b, c = map(int, input().split())
if c % math.gcd(a, b) == 0:
  print('YES')
else:
  print('NO')
Problem p04048 (python)

Fixed submission:
import math
n, x = map(int, input().split())
print(3 * (n - math.gcd(n, x)))

Buggy submission (verdict: Runtime Error):
import math
n, x = map(int, input().split())
print(3 * (n - gcd(n, x)))
Problem p02600 (python)

Fixed submission:
rate = int(input())

print(10 - rate // 200)

Buggy submission (verdict: Runtime Error):
rate = imput()

di = rate // 200

print(10 - di)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a**2 + a**3)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(a + a**2 + a***3)
Problem p03323 (python)

Fixed submission:
a, b = list(map(int, input().split()))
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a b = list(map(int, input().split()))
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Problem p03796 (python)

Fixed submission:
N = int(input())
C = 10**9+7
ans = 1
for i in range(1, N + 1):
    ans *= i
    ans %= C
print(ans)

Buggy submission (verdict: Runtime Error):
def nn(n):
    if n==0:
        return 1
    else:
        return n*nn(n-1)

n=int(input())
ans=nn(n)%100000007
print(ans)
Problem p02601 (python)

Fixed submission:
A,B,C=map(int,input().split())
K=int(input())

for i in range(0,K+1):
    for j in range(0,K+1-i):
        for k in range(0,K+1-i-j):
            #print('{},{},{}'.format(i,j,k))
            if(A*(2**i) < B*(2**j) and B*(2**j) < C*(2**k)):

                print('Yes')
                exit()

print('No')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
K=int(input())
if()
for i in range(0,K+1):
    for j in range(0,K+1-i):
        for k in range(0,K+1-i-j):
            #print('{},{},{}'.format(i,j,k))
            if(A*(2**i) < B*(2**j) and B*(2**j) < C*(2**k)):
                if(i==j==k==0):
                    pass
                else:
                    print('Yes')
                    exit()

print('No')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
K=int(input())
if()
for i in range(0,K+1):
    for j in range(0,K+1-i):
        for k in range(0,K+1-i-j):
            #print('{},{},{}'.format(i,j,k))
            if(A*(2**i) < B*(2**j) and B*(2**j) < C*(2**k)):
                if(i==j==k==0):
                    pass
                else
                    print('Yes')
                    exit()

print('No')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
K=int(input())
if()
for i in range(0,K+1):
    for j in range(0,K+1-i):
        for k in range(0,K+1-i-j):
            #print('{},{},{}'.format(i,j,k))
            if(A*(2**i) < B*(2**j) and B*(2**j) < C*(2**k)):
                if(i==j==k==0):
                    break
                else
                    print('Yes')
                    exit()

print('No')
Problem p02603 (python)

Fixed submission:
N=int(input())
A=[0]*N
A=list(map(int,input().split()))
money=1000
money_temp=1000
kazu=0
ma=0
mi=float('inf')
stop=0
for i in range(0,N-1):
    money=money+A[i]*kazu
    kazu=0
    if(A[i]<A[i+1]):
        kazu=money//A[i]
        money=money-A[i]*kazu

    elif(A[i+1]<=A[i]):
        pass

money=money+A[N-1]*kazu
print(money)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[0]*N
A=list(map(int,input().split()))
money=1000
money_temp=1000
kazu=0
for i in range(N-1):
    if(A[i]<A[i+1]):
        money=money+kazu*ma
        kazu=money//A[i]
        money_temp=max(money_temp,money-A[i]*kazu)
        money=money-A[i]*kazu
        #print('ue')
        #print(A[i])
        #print(A[i+1])
    elif(A[i]==A[i+1]):
        pass
    elif(A[i+1]<A[i]):
        stop=1
        ma=max(A[i],ma)

money=money+kazu*A[N-1]

print(max(money,money_temp))
Problem p02607 (python)

Fixed submission:
N=int(input())

a=[0]*N
a=list(map(int,input().split()))
ans=0
for i in range(1,N+5,2):
    if(N<i):
        break
    if(a[i-1]%2==1):
        ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=input()
xx=int(X)
xxx=str(xx)
sa=N-len(xxx)
X_len=len(X)
a=0
for i in range(sa,N):
    a=int(X[i])*(2**(N-i-1))+a





fx=[-1]*(2*(10**5))
for i in range(X_len):
    ans=0
    if(X[i]=='0'):
        b=a+2**(X_len-i-1)
    else:
        b=a-2**(X_len-i-1)

    while(b!=0):

        fx=b%str(format(b,'b')).count('1')
        ans=ans+1
        b=fx

    print(ans)