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

Fixed submission:
s=input()
mod=10**9+7
dp = [[0]*15 for i in range(100005)]
dp[0][0]=1
for i in range(len(s)):
    keta = len(s)-i-1

    if s[i]=='?':
        nums = range(10)
    else:
        nums = [int(s[i])]
    
    tmp = pow(10,keta,13)
    for num in nums:
        amari = num*tmp%13
        for j in range(13):
            dp[i+1][(j+amari)%13]+=dp[i][j]
            dp[i+1][(j+amari)%13]%=mod

print(dp[len(s)][5])

Buggy submission (verdict: Runtime Error):
s=input()
mod=10**9+7
ans=0
dp = [[0]*15 for i in range(15)]
dp[0][0]=1
for i in range(len(s)):
    keta = len(s)-i-1
    if s[i]=='?':
        for num in range(10):
            amari = num*10**keta
            amari%=13
            for j in range(13):
                dp[i+1][(j+amari)%13]+=dp[i][j]
    else:
        amari = int(s[i])*10**keta
        amari%=13
        for j in range(13):
            dp[i+1][(j+amari)%13]+=dp[i][j]

print(dp[len(s)][5])
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]

maxa = max(a[0],a[1])
mina = min(a[0],a[1])

for i in range(2,n):
    if a[i] >= maxa:
        mina = maxa
        maxa = a[i]
    elif a[i] >mina:
        mina = a[i]

for i in range(n):
    if a[i] == maxa:
        print(mina)
    else:
        print(maxa)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]

maxa = max(a[0],a[1])
mina = min(a[0],a[1])

for i in range(2,n):
    if a[i] >= maxa:
        mina = maxa
        maxa = a[i]
    elif a[i] >mina:
        mina = a[i]

for i in range(n):
    if a[i] == maxa:
        print(mina)
    else:
        print(maxa)
å
Problem p02975 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
if sum(a)==0:
    print('Yes')
    exit()
x=[0]*3
x[0] = a.count(a[0])
x[1] = a.count(a[n//2])
x[2] = a.count(a[-1])
x.sort()

if a[0]^a[n//2] == a[-1] and x[0] == x[1] == x[2] == n//3:
    print('Yes')
elif a[0] == 0 and x[0] == n//3 and x[1] == x[2] == n*2//3:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
if sum(a)==0:
    print('Yes')
    exit()
x=[]
x[0] = a.count(a[0])
x[1] = a.count(a[n//2])
x[2] = a.count(a[-1])
x.sort()

if x[0] == x[1] == x[2] == n//3 or (a[0] == 0 and x[0]==n//3 and x[1]==x[2]==2*n//3):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
n = len(s)
same = True
for i in range(1,len(s)):
    if s[i]!=s[i-1]:
        same = False
if same:
    print(len(s)*k//2)
    exit()

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        before = i-1
        break
for i in range(len(s)-1,-1,-1):
    if s[i] != s[i-1]:
        after = i
        break

ans = (before+1)//2 
ans += (len(s)-after)//2
if s[0] == s[-1]:
    ans += (before + 1 + len(s) - after)//2 * (k-1)
else:
    ans += ((before+1)//2  + (len(s)-after)//2)*(k-1)
cnt = 1
for i in range(before+2, after):
    if s[i] != s[i-1]:
        ans += cnt //2 *k
        cnt = 1
    else:
        cnt +=1
ans += cnt //2 * k
print(ans)
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
ans=0
while(d<=x):
    ans+=1
    if ans == n+1:
        break
    d=d+l[ans-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
ans=0
while(d<=x):
    ans+=1
    d=d+l[ans-1]
print(ans)
Problem p03006 (python)

Fixed submission:
n=int(input())
xys=[list(map(int,input().split())) for _ in range(n)]
vec = []
pqs = []
for i in range(n):
    for j in range(i+1,n):
        pqs.append([(xys[i][0]-xys[j][0]),(xys[i][1]-xys[j][1])])
        pqs.append([-(xys[i][0]-xys[j][0]),-(xys[i][1]-xys[j][1])])
pqs.sort()
import collections

cnt = 1
cntMax = 0
for i in range(1,len(pqs)+1):
    if i == len(pqs):
        cntMax = max(cntMax,cnt)
    elif pqs[i] == pqs[i-1]:
        cnt += 1
    else:
        cntMax = max(cntMax,cnt)
        cnt = 1
print(n-cntMax)

Buggy submission (verdict: Runtime Error):
n=int(input())
xys=[list(map(int,input().split())) for _ in range(n)]
vec = []

for i in range(n):
    for j in range(i+1,n):
        diffx = xys[i][0] - xys[j][0]
        diffy = xys[i][1] - xys[j][1]
        if diffx == 0:
            vec.append([12345678901234,i,j])
        else:
            vec.append([diffy/diffx,i,j])
vec.sort()
cnt =1
cntMax = 0
val=-1
for i in range(1,len(vec)):
    if vec[i][0] != vec[i-1][0]:
        if cnt > cntMax:
            val = vec[i-1][0]
            cntMax = cnt
        cnt = 1
    else:
        cnt += 1
if cnt > cntMax:
    val = vec[-1][0]
    cntMax = max(cntMax,cnt)

check = [1]*(n+1)
check[0]=0

for i in range(len(vec)):
    if vec[i][0] == val:
        check[vec[i][2]] = 0
print(sum(check))
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
cnt=[]
for i in range(1,101):
  if a%i==0 and b%i==0:
    cnt.append(i)
print(cnt[-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
cnt=[]
for i in range(1,101):
  if a%i==0 and b%i==0:
    cnt.append(i)
print(cnt[-1-k])
Problem p03138 (python)

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

c=[[0 for _ in range(2)] for _ in range(64)]

for i in range(n):
    for j in range(60):
        c[j][a[i]>>j&1] += 1
x=0
for i in range(59,-1,-1):
    if(c[i][0] > c[i][1] and x|(1<<i) <= k):
        x |= 1<<i

sum = 0
for i in range(n):
    sum += a[i]^x
print(sum)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bit = [0]*60
zouryou = [0]*60
tmpX = 0
if k == 0:
    print(sum(a))
    exit()

t=k
keta=0
while(t):
    keta += 1
    t >>= 1

for num in a:
    for b in range(keta):
        if num>>b & 1:
            bit[b] += 1

for i in range(keta):
    if bit[i] < n-bit[i]:
        zouryou[i] = (n-2*bit[i])*(1<<i)
        tmpX += 1<<i
  
while(tmpX > k):
    mini = 123456789012345
    minidx = -1
    for i in range(keta):
        if zouryou[i] > 0 and zouryou[i] < mini:
            mini = zouryou[i]
            minidx = i
    zouryou[minidx] = 0
    tmpX -= 1<<minidx
print(sum(zouryou) + sum(a))
Problem p03161 (python)

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,n):
    for j in range(i-1,max(i-1-k,-1),-1):
        ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]))
    
print(ans[n-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,k+1):
    ans[i]=abs(h[i]-h[0])

for i in range(k+1,n):
    mini=1234567890123
    for j in range(1,k+1):
        mini=min(mini,ans[i-j]+abs(h[i]-h[i-j]))
    ans[i] = mini
print(ans[n-1])
Problem p03168 (python)

Fixed submission:
n=int(input())
p = list(map(float,input().split()))
dp = [[0 for _ in range(n+1)] for __ in range(n+1)]
dp[0][0] = 1
for i in range(n+1):
    for j in range(n+1):
        cnt = i + j
        if cnt == 0 or cnt > n:
            continue
        if j == 0:
            dp[i][j] = dp[i-1][0] * p[cnt-1]
        elif i == 0:
            dp[i][j] = dp[i][j-1] * (1 - p[cnt-1])
        else:
            dp[i][j] = dp[i-1][j]*p[cnt-1] + dp[i][j-1]*(1-p[cnt-1])
        
ans = 0
for i in range((n+1)//2, n+1):
    ans += dp[i][n-i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(float,input().split()))
result = [[-1.]*n for _ in range(n)]

# i番目のコインまででj枚が表のときの、全体として表が裏より多くなる確率
def dp(i,j):
    if i == n:
        if j > i-j:
            return 1
        else:
            return 0
    if result[i][j] != -1:
        return result[i][j]
    
    res1 = dp(i+1,j+1) * p[i]
    res2 = dp(i+1,j) *(1-p[i])
    result[i][j] = res1+res2
    return result[i][j]

print(dp(0,0))
Problem p03169 (python)

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

dp = [[[0 for _ in range(301)]for __ in range(301)]for ___ in range(301)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            cnt = i + j + k
            if cnt == 0 or cnt > n :continue
            if i == 0 and j ==0 and k ==1:
                dp[i][j][k] = 1
                continue
            if k > 0:
                dp[i][j][k] += (1+dp[i][j][k-1] * cnt/(cnt-1))*k/cnt
            if j > 0:
                dp[i][j][k] += (1+dp[i][j-1][k+1])*j/cnt
            if i > 0:
                dp[i][j][k] += (1+dp[i-1][j+1][k])*i/cnt 
            
print(dp[a.count(3)][a.count(2)][a.count(1)])

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
double memo[305][305][305];
int n;

double dp(int i, int j, int k)
{
    if (i==0 && j==0 && k ==0) return 0.0;
    if (memo[i][j][k]!=-1) return memo[i][j][k];

    double res = 0;
    if (i>0) res += dp(i-1,j+1,k)*i;
    if (j>0) res += dp(i,j-1,k+1)*j;
    if (k>0) res += dp(i,j,k-1)*k;
    res += n;
    res *= 1.0/(i+j+k);
    return memo[i][j][k] = res;
}
signed main() {
    cin >>n;
    int cnt[5];
    for(int i = 0; i < n; i++)
    {
        int a;cin >>a;
        cnt[a]++;
    }
    for(int i = 0; i < 303; i++)
    {
        for(int j = 0; j < 303; j++)
        {
            for(int k = 0; k < 303; k++)
            {
                memo[i][j][k] = -1.0;
            }
            
        }
        
    }
    
    cout << fixed;
    cout << std::setprecision(10) << dp(cnt[3],cnt[2],cnt[1])<<endl;
    
    return 0;
}

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
double memo[305][305][305];
int n;

double dp(int i, int j, int k)
{
    if (i==0 && j==0 && k ==0) return 0.0;
    if (memo[i][j][k]!=-1) return memo[i][j][k];

    double res = 0;
    if (i>0) res += dp(i-1,j+1,k)*i;
    if (j>0) res += dp(i,j-1,k+1)*j;
    if (k>0) res += dp(i,j,k-1)*k;
    res += n;
    res *= 1.0/(i+j+k);
    return res;
}
signed main() {
    cin >>n;
    int cnt[5];
    for(int i = 0; i < n; i++)
    {
        int a;cin >>a;
        cnt[a]++;
    }
    for(int i = 0; i < 303; i++)
    {
        for(int j = 0; j < 303; j++)
        {
            for(int k = 0; k < 303; k++)
            {
                memo[i][j][k] = -1.;
            }
            
        }
        
    }
    
    cout << fixed;
    cout << std::setprecision(10) << dp(cnt[3],cnt[2],cnt[1])<<endl;
    
    return 0;
}
Problem p03170 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True
            break

print('First' if ans[k] else 'Second')

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(k+1+1234)

for i in range(0,k+1):
    if dp[i] == 0:
        for x in a:
            dp[i+x] =1

print("First" if dp[k] else "Second")
Problem p03172 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
for i in range(k+1):
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(-1)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])
Problem p03219 (python)

Fixed submission:
x,y = map(int,input().split())
print(int(x+y/2))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
printint((x+y/2))
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
minimu = 1234567890

for i in range(n):
        if( minimu > abs(t-h[i]*0.006-a)):
                minimu=abs(t-h[i]*0.006-a)
                ans = i+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
minimu = 1234567890
for i in range(n):
  if( minimu > abs(h[i]*0.006-t):
     minimu=abs(h[i]*0.006-t)
     ans = i+1
print(ans)
Problem p03238 (python)

Fixed submission:
n =int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = 
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = 
if n==1:
    print("Hello World")
else:
    int(input())
    int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = input()
if n==1:
    print("Hello World")
else:
    a=input()
    b=input()
    print(a+b)
Problem p03239 (python)

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

ans = 1234567
for i in range(n):
    c,tt = map(int,input().split())
    if tt <= t:
        ans = min(ans,c)

if ans == 1234567:
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = int(input())
ans = 1234567
for i in range(n):
    c = int(input())
    if int(input) <= t:
        ans = max(ans,c)

if ans == 1234567:
    print("LTE")
else:
    print(ans)
Problem p03550 (python)

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n == 1:
    print(abs(a[0]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

Buggy submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n = 1:
    print(abs(a[0]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))
Problem p03611 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
pl = [0]*100005

for i in range(n):
    num = a[i]
    pl[num-1 + 2] += 1
    pl[num+2 + 2] -= 1

for i in range(1,100004):
    pl[i] += pl[i-1]

print(max(pl))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)

for i in range(n):
    num = a[i]
    pl[num-1] += 1
    pl[num+2] -= 1

for i in range(1,n):
    pl[i] += pl[i-1]

print(max(pl))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)

for i in range(n):
    num = a[i]
    pl[num-1] += 1
    pl[num+2] -= 1

for i in range(1,n+4):
    pl[i] += pl[i-1]

print(max(pl))
Problem p02576 (python)

Fixed submission:
n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print((int(n//x)+1)*t)

Buggy submission (verdict: Runtime Error):
n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print(int(n//x)+1)*t)
Problem p02995 (python)

Fixed submission:
import fractions
x = input().split()
a,b,c,d = int(x[0]),int(x[1]),int(x[2]),int(x[3])

cd = int(c*d/fractions.gcd(c,d))

cn = b // c - (a-1) // c
dn = b // d - (a-1) // d
cdn = b // cd - (a-1) // cd

print((b-a+1)-(cn+dn-cdn))

Buggy submission (verdict: Runtime Error):
import math
x = input().split()
a,b,c,d = int(x[0]),int(x[1]),int(x[2]),int(x[3])

cn=0
if a%c==0:
    cn+=1
cn+=int(b/c)-int(a/c)
dn=0
if a%d==0:
    dn+=1
dn+=int(b/d)-int(a/d)

cdn=0
cd = c*d/math.gcd(c,d)
if a%cd==0:
    cdn+=1
cdn+=int(b/cd)-int(a/cd)

print((b-a+1)-(cn+dn-cdn))
Problem p02713 (python)

Fixed submission:
from math import gcd
from collections import defaultdict

k = int(input())

memo = defaultdict(defaultdict)

rg = range(1, k + 1)
for i in rg:
    for j in rg:
        memo[i][j] = memo[j][i] = gcd(i, j)

ret = 0
for i in rg:
    for j in rg:
        tmp = memo[i][j]
        for k in rg:
            res = memo[k][tmp]
            ret += res

print(ret)

Buggy submission (verdict: Runtime Error):
k = int(input())

def extract_gcd(limit):
    ran = range(1, limit + 1)
    for i in ran:
        for j in ran:
            for k in ran:
                yield math.gcd(math.gcd(i, j), k)
total = 0
for n in extract_gcd(k):
    total += n
    
print(total)
Problem p02818 (python)

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

if k <= a:
    a, b = a - k, b
elif k <= a + b:
    a, b = 0, b - (k - a)
else:
    a, b = 0, 0
        
print a, b

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, raw_input().split())

if k >= a + b:
    a, b = 0, 0
else:
    for i in range(k):
        if a > 0:
            a -= 1
            continue   
        if a == 0 and b > 0:
            b -= 1
            continue
        break
print a, b
Problem p02945 (python)

Fixed submission:
a, b = map(int, raw_input().split())
print max(
    a + b,
    a - b,
    a * b
)

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
print max(
  a + b,
  a - b,
  a * c
)
Problem p02811 (python)

Fixed submission:
# 100 points
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
k, x = map(int, input().split())
if k*500 >= x:
    # 出力
    print('Yes')
else:
    # 出力
    print('No')# 100 points

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
	n = len(numbers)
	#print(numbers)
    #lcm_tmp = (numbers[0] * numbers[1]) // fractions.gcd(numbers[0], numbers[1])
	lcm_tmp = lcm_base(numbers[0],numbers[1])
	for i in range(2,n):
		lcm_tmp = lcm_base(numbers[i],lcm_tmp)
	return lcm_tmp

n,m = map(int,input().split())
t = list(map(int,input().split()))
#print(t)
#lcm = (a * b) // fractions.gcd(a, b)
lcm = lcm_list(t)
x = m // (lcm /2 )
y = m // (lcm)
print(int(x-y))

Buggy submission (verdict: Runtime Error):
hoge = input()
c,s = hoge.sprit()

if x * 500 >= s:
  res = "Yes"
else:
  res = "No"
  
print(res)
Problem p02813 (python)

Fixed submission:
import itertools
#import math

n = int(input())
#n = 2
#p = tuple(map(int,input().split(" ")))
#q = tuple(map(int,input().split(" ")))

p = input()
q = input()
#print(n)
#print(p)
i = 0
#a = 0 
#b = 0

for x in itertools.permutations(range(1,n+1), n):
	#print(x)
	x = " ".join(map(str,x))
	#print(x)
	i += 1
	if x == p:
		a = i
		#print(i)
	if x == q:
		b = i
		#print(i)

print(abs(a-b))

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

n = input()
p = input()
q = input()
i==0
for x in itertools.permutations(range(1,n+1), n):
	i += 1
	if p == x:
      a = i
    elif q == x:
      b = i
print(math.abs(a-b))

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

n = input()
p = input()
q = input()

counter = 1
base = list(range(1,n+1))

i = 0
for x in itertools.permutations(range(n), n):
	i += 1
    if p == x:
    	a = i
    elif q == x:
    	b = i
print(math.abs(a-b))
Problem p03129 (python)

Fixed submission:
def Test(n,k):
    if n > 2 * k:
        res = "YES"
    else:
        count = 0
        res = "NO"
        for i in range(1,n + 1,2):
            count += 1
            if count == k:
                res = "YES"
    print(res)
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    try:
        Test(N,K)
    except:
        print("Error")

Buggy submission (verdict: Runtime Error):
def Test(n,k):
    if n > 2 * k:
        res = "YES"
    else:
        count = 0
        res = "NO"
        for i in range(1,n + 1,2):
            count += 1
            if count == k:
                res = "YES"
    print(res)
    
if __name__ == '__main__':
    _N = input()
    _K = input()
    try:
        N = int(_N)
        K = int(_K)
        Test(N,K)
    except:
        print("Error")

Buggy submission (verdict: Runtime Error):
def Test(n,k):
    if n > 2 * k:
        res = "YES"
    else:
        count = 0
        res = "NO"
        for i in range(1,n + 1,2):
            count += 1
            if count == k:
                res = "YES"
    print(res)
    
if __name__ == '__main__':
    _N = input()
    _K = input()
    try:
        N = int(_N)
        K = int(_K)
        Test(N,K)
    except:
        print("Error")

Buggy submission (verdict: Runtime Error):
def Test(n,k):
    if n > 2 * k:
        res = "YES"
    else:
        count = 0
        res = "NO"
        for i in range(1,n + 1,2):
            count += 1
            if count == k:
                res = "YES"
    print(res)
    
if __name__ == '__main__':
    _N = input()
    _K = input()
    try:
        N = int(_N)
        K = int(_K)
        Test(N,K)
    except:
        print("Error")
Problem p02582 (python)

Fixed submission:
s=input()
c=0
for i in range(3):
  if s[i]=='R':
    c+=1
if s=='RSR' :
  print(1)
else:
  print(c)

Buggy submission (verdict: Runtime Error):
x,k,d=map(int,input().split())
if d>=x:
  print(x)
  exit()
else:
  if x//d>=k:
    print(x-k*d)
    exit()
  else:
    if (x//d)%2==k%2:
      print(x%d)
      exit()
    else:
      print(d-x%d)
      exit()
Problem p02642 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
dp=[0]*(10**6+1)
for i in A:
  dp[i]+=1
for i in range(1,10**6+1):
  if dp[i]>0:
    for j in range(2*i,10**6+1,i):
      dp[j]=0
print(dp.count(1))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
c=0
for i in range(n):
  if i==n-1:
    if max(a)>a[n-1]:
      c+=1
      break
  for j in range(n-i-1):
    d=0
    if i==n-1-j:
      continue
    elif a[i]%a[n-1-j]==0:
      d+=1
      break
  if d==0:
     c+=1
print(c)
Problem p02660 (python)

Fixed submission:
import math
N=int(input())
def hantei(u):
  if u==1:
    return 1
  for i in range(1,u+1):
    if (1/2)*i**2+(1/2)*i>u:
      return int(i-1)
    else:
      continue
   
a=[0]*int(math.sqrt(N))
for i in range(2,int(math.sqrt(N))+1):
  while N%i==0:
    N=N//i
    a[i-1]=a[i-1]+1
c=0
if N!=1:
  c+=1
for t in range(len(a)):
  if a[t]!=0:
    c+=hantei(a[t])
print(c)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
def hantei(u):
  if u==1:
    return 1
  for i in range(1,u+1):
    if (1/2)*i**2+(1/2)*i>u:
      return int(i-1)
    else:
      continue
   
a=[0]*int(N)
for i in range(2,N+1):
  while N%i==0:
    N=N//i
    a[i-1]=a[i-1]+1
c=0
for t in range(len(a)):
  if a[t]!=0:
    c+=hantei(a[t])
print(c)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
def hantei(u):
  if u==1:
    return 1
  for i in range(1,u+1):
    if (1/2)*i**2+(1/2)*i>u:
      return int(i-1)
    else:
      continue
   
a=[0]*int(N)
for i in range(2,N+1):
  while N%i==0:
    N=N//i
    a[i-1]=a[i-1]+1
c=0
for t in range(len(a)):
  if a[t]!=0:
    c+=hantei(a[t])
print(c)