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

Fixed submission:
import collections

n = int(input())
data_list = [input() for i in range(n)]
data_list.sort()

count_dict = collections.Counter(data_list)

max_val = max(count_dict.values())
max_keys = [key for key in count_dict if count_dict[key] == max_val]

max_keys.sort()

for i in range(len(max_keys)):
    print(max_keys[i])

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

count_dict = collections.Counter(data_list)

max_val = max(count_dict.values())
max_keys = [key for key in count_dict if count_dict[key] == max_val]

for i in range(len(max_keys)):
    print(max_keys[i])
Problem p02777 (python)

Fixed submission:
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + str(a[1]))
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + a[1])
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + a[1])
if __name__ == '__main__':
    input = sys.stdin.readline
    main()
Problem p02831 (python)

Fixed submission:
import fractions


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


ab = input()
a = int(ab.split(" ")[0])
b = int(ab.split(" ")[1])

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


ab = input()
a = int(ab.split(" ")[0])
b = int(ab.split(" ")[1])

print(lcm(a, b))
Problem p02793 (python)

Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 
  
def lcm(a,b): 
    return (a*b) // gcd(a,b) 
  
n = int(input())
arr = input()   # takes the whole line of n numbers
a = list(map(int,arr.split(' ')))
l = a[0]
ans = 0
for i in range(n):
    l = lcm(l, a[i])
for i in range(n):
    ans = ans + l//a[i]
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 
  
def lcm(a,b): 
    return (a*b) // gcd(a,b) 

mod = 1000000007
n = int(input())
arr = input()
a = list(map(int, arr.split(' ')))
lc = a[0]
res = 0
for i in range(n):
    lc = lcm(lc, a[i])
for i in range(n):
    res = res + 1//a[i]
print(ans % mod)
Problem p02897 (python)

Fixed submission:
n = int(input())

if n % 2 == 0:
  print(1/2)
else:
  print((n+1)/(2 * n))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
A, B = map(int,input().split())
C = gcd(A,B)
C0 = C

p = {}
for i in range(2,10**6):
    if C % i == 0:
        p[i] = 0
        while C % i == 0:
            C //= i
            p[i] += 1
    if i * i > C0:
        break
if C != 0:
  p[C] = 1

print(len(p) + 1)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

step = [0]*(n+10)
step[0] =1
step[1] =1
step[2] =2
for i in range(3,n+10):
    step[i] = step[i-1] + step[i-2]
if m != 0:
    l = [a[0]-1]
    for i in range(1,m):
        l.append(a[i]-a[i-1]-2)
    l.append(n-a[m-1]-1)

    ans = 1

    for i in range(m+1):
        if l[i] < 0:
            ans = 0
            break
        ans = ans*step[l[i]]
        if ans >= INF:
            ans = ans % INF
if m == 0:
    ans = step[n] % INF
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

step = [0]*100000
step[0] =1
step[1] =1
step[2] =2
for i in range(3,100000):
    step[i] = step[i-1] + step[i-2]

l = [a[0]-1]
for i in range(1,m):
    l.append(a[i]-a[i-1]-2)
l.append(n-a[m-1]-1)

ans = 1

for i in range(m+1):
    if step[l[i]] < 0:
        ans = 0
        break
    ans = ans*step[l[i]]
    if ans >= INF:
        ans = ans % INF

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

def step(x):
    if x < 0:
        return 0
    if x == 0:
        return 1
    if x == 1:
        return 1
    if x == 2:
        return 2
    if x >= 3:
        return step(x-1)+step(x-2)

l = [a[0]-1]
for i in range(1,m):
    l.append(a[i]-a[i-1]-2)
l.append(n-a[m-1]-1)

ans = 1

for i in range(m+1):
    ans = ans*step(l[i])
    if ans >= INF:
        ans = ans % INF

print(ans)

Buggy submission (verdict: Runtime Error):
INF = 1000000007
n,m= map(int,input().split())
a = [0]*m
for i in range(m):
    a[i] = int(input())

def step(x):
    if x < 0:
        return 0
    if x == 0:
        return 1
    if x == 1:
        return 1
    if x == 2:
        return 2
    if x >= 3:
        return step(x-1)+step(x-2)

l = [a[0]-1]
for i in range(1,m):
    l.append(a[i]-a[i-1]-2)
l.append(n-a[m-1]-1)

ans = 1

for i in range(m+1):
    ans = (ans*step(l[i]))%INF
print(ans)
Problem p03041 (python)

Fixed submission:
T,K = (i for i in input().split())
N = input()
K = int(K)
X = list(N)
if X[K-1] == 'A':
    X[K-1] = 'a'
if X[K-1] == 'B':
    X[K-1] = 'b'
if X[K-1] == 'C':
    X[K-1] = 'c'
print(''.join(X))

Buggy submission (verdict: Runtime Error):
N,K = (i for i in input().split())
K = int(K)
X = list(N)
if X[K-1] == 'A':
    X[K-1] = 'a'
if X[K-1] == 'B':
    X[K-1] = 'b'
if X[K-1] == 'C':
    X[K-1] = 'c'
print(''.join(X))
Problem p03073 (python)

Fixed submission:
s = input()
x = [s[j] for j in range(0,len(s))]
x.insert(0,'2')
count = 0
for j in range(1,len(x)):
    if x[j] == '0' and x[j] == x[j-1]:
        x[j] = '1'
        count = count + 1
    elif x[j] == '1' and x[j] == x[j-1]:
        x[j] = '0' 
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
x = [s[j] for j in range(0,len(s10))]
x.insert(0,'2')
count = 0
for j in range(1,len(x)):
    if x[j] == '0' and x[j] == x[j-1]:
        x[j] = '1'
        count = count + 1
    elif x[j] == '1' and x[j] == x[j-1]:
        x[j] = '0' 
        count = count + 1
print(count)
Problem p03265 (python)

Fixed submission:
u,v,x,y = map(int,input().split())
[p,q] = [x-(y-v),y+(x-u)]
[r,s] = [p-(q-y),q+(p-x)]
print(p,q,r,s)

Buggy submission (verdict: Runtime Error):
import numpy as np
x1,y1,x2,y2 = map(int,input().split())
v = np.array([x1,y1])
w = np.array([x2,y2])
u = w - v
T = np.array([[0,-1],[1,0]])
v1 = np.matmul(T,u) + w
v2 = np.matmul(T,v1 - w) + v1
print(v1[0],v1[1],v2[0],v2[1])
Problem p03286 (python)

Fixed submission:
N = int(input())
if N == 0:
    print(0)
else:
    li = []
    ind = 0
    while N != 0:
        if N % 2**(ind + 1) == 0:
            li.insert(0,0)
            ind += 1
        else:
            li.insert(0,1)
            N -= (-2)**(ind)
            ind += 1            
    x = ''.join([str(li[i]) for i in range(len(li))])
    print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 0:
    print(0)
else:
    li = []
    ind = 0
    while N != 0:
        if N % 2**(ind + 1) == 0:
            li.insert(0,0)
            ind += 1
        else:
            li.insert(0,1)
            N -= (-2)**(ind)
            ind += 1            
x = ''.join([str(li[i]) for i in range(len(li))])
print(x)
Problem p03834 (python)

Fixed submission:
s=input()
print(s[0:5]+' '+s[6:13]+' '+s[14:19])

Buggy submission (verdict: Runtime Error):
s=input()
s[5]=' '
s[13]=' '
print(s)
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
res=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j and s-i-j<=k:res+=1
print(res)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
res=0
for i in range(k+1):
  for j in range(K+1):
    if 0<=s-i-j and s-i-j<=k:res+=1
print(res)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b = map(int, input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b = map(int, input().split())
#print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int, input().strip().split())
print((a*b)//int(math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b = map(int, input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b = map(int, input().split())
print((a*b)//gcd(a,b))
Problem p02847 (python)

Fixed submission:
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    s=input()
    if s=='SUN':
        print(7)
    if s=="MON":
        print(6)
    if s=="TUE":
        print(5)
    if s=="WED":
        print(4)
    if s=="THU":
        print(3)
    if s=="FRI":
        print(2)
    if s=="SAT":
        print(1)
    return


# B
def B():
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    A()
    return


# Solve
if __name__ == "__main__":
    A()

Buggy submission (verdict: Runtime Error):
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    s = input()
    if s == 'SUN':
        print(7)
    if s == "MON":
        print(6)
    if s == "TUE":
        print(5)
    if s == "WED":
        print(4)
    if s == "THU":
        print(3)
    if s == "FRI":
        print(2)
    if s == "SAT":
        print(1)
    return


# B
def B():
    al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    n = I()
    s = S()
    for i in range(len(s)):
        ni = (al.index(s[i]) + n) % 26
        s[i] = al[ni]
    print(''.join(s))
    return


# C
def C():
    a, b, x = LI()
    l = [a * (10 ** (i - 1)) + b * i for i in range(1, 11)]
    p = 0
    for i in range(10):
        if x < l[i] and i == 0:
            print(0)
            return
        if l[i] <= x and i == 9:
            print(10 ** 9)
            return
        elif l[i] <= x < l[i + 1]:
            p = i + 1
            break
    if (x - b * p) // a >= 10 ** p:
        print(10 ** p - 1)
    else:
        print((x - b * p) // a)
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    C()

    return


# Solve
if __name__ == "__main__":
    C()
Problem p02880 (python)

Fixed submission:
a = []
for i in range(1, 10):
    for j in range(i, 10):
        a.append(i * j)
n = int(input())
if n in a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
    a=[]
    for i in range(1, 10):
        for j in range(i+1, 10):
            a.append(i*j)
    n=int(input())
    if n in a:
        print("Yes")
    else:
        print("No")
Problem p02831 (python)

Fixed submission:
import fractions
a,b=map(int,input().split())
x=fractions.gcd(a,b)
print(a*b//x)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
x=math.gcd(a,b)
print(a*b//x)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
n,u,v=map(int,input().split())
u=u-1
v=v-1
root=[[] for i in range(n)]

for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)

dp=[[-1]*n for i in range(2)]
dp[0][u]=0
dp[1][v]=0
def dfs(node,depth,par,flag):
    for vertex in root[node]:
        if vertex == par or dp[flag][vertex]!=-1:
            continue
        dp[flag][vertex]=depth+1
        dfs(vertex,depth+1,node,flag)
    return
dfs(u,0,u,0)
dfs(v,0,v,1)
buf=-1
buf1=0
#print(dp1,dp2,root)
for i in range(n):
    if dp[0][i]<dp[1][i] and dp[1][i]>buf:
        buf=dp[1][i]
        buf1=dp[0][i]
print(buf-1)

Buggy submission (verdict: Runtime Error):
n,u,v=map(int,input().split())
u=u-1
v=v-1
edge=[]
for i in range(n-1):
    a,b=map(int,input().split())
    edge.append((a-1,b-1))
dp1=[-1]*n
dp1[u]=0
dp2=[-1]*n
dp2[v]=0

root=[[] for i in range(n)]
for a,b in edge:
    root[a].append(b)
    root[b].append(a)

def dfs(node,depth,par,dp):
    for vertex in root[node]:
        if vertex == par:
            continue
        dp[vertex]=depth+1
        dfs(vertex,depth+1,node,dp)
dfs(u,0,u,dp1)
dfs(v,0,v,dp2)
buf=-1
buf1=0
#print(dp1,dp2,root)
for i in range(n):
    if dp1[i]<dp2[i] and dp2[i]>buf:
        buf=dp2[i]
        buf1=dp1[i]
print(buf-1)
Problem p02862 (python)

Fixed submission:
import sys
x,y=map(int,input().split())
if (x+y)%3!=0:
    print(0)
    sys.exit()
dx=x-(x+y)//3
dy=y-(x+y)//3
if dx<0 or dy<0:
    print(0)
    sys.exit()
fact=[1]*(dx+dy+1)
MOD=10**9+7
def inv_mod(a):
  return pow(a,MOD-2,MOD)

for i in range(1,dx+dy+1):
  fact[i] = (i*fact[i-1])%MOD
fact_inv = [1] * (dx+dy+1)
fact_inv[-1] = inv_mod(fact[-1])
for i in range(dx+dy,0,-1):
  fact_inv[i-1] = (i*fact_inv[i])%MOD

def comb(n,k):
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x
print(comb(dx+dy,dx))

Buggy submission (verdict: Runtime Error):
import sys
x,y=map(int,input().split())
if (x+y)%3!=0:
    print(0)
    sys.exit()
dx=x-(x+y)//3
dy=y-(x+y)//3
fact=[1]*(dx+dy+1)
MOD=10**9+7
def inv_mod(a):
  return pow(a,MOD-2,MOD)

for i in range(1,dx+dy+1):
  fact[i] = (i*fact[i-1])%MOD
fact_inv = [1] * (dx+dy+1)
fact_inv[-1] = inv_mod(fact[-1])
for i in range(dx+dy,0,-1):
  fact_inv[i-1] = (i*fact_inv[i])%MOD

def comb(n,k):
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x
print(comb(dx+dy,dx))
Problem p02925 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
n=int(input())
a=[]
for i in range(n):
    a.append(tuple(map(int,input().split())))
#print(a)

root=[[] for i in range(n*(n-1)//2)]
buf=0
for i in range(n):
    buf=0
    for j in range(n-1):
        if j==0:
            x=min(i,a[i][j]-1)
            y=max(i,a[i][j]-1)
            buf=x*(2*n-2-x+1)//2+(y-x)-1
            #print(x,y,buf)
            continue
        x=min(i,a[i][j]-1)
        y=max(i,a[i][j]-1)
        node=x*(2*n-2-x+1)//2+(y-x)-1
        #print(x,y,node)
        root[buf].append(node)
        buf=node
flag=[True]

#閉路☑
def dfs(node,par): 
    dp[node]=0
    for item in root[node]:
        if item==par:
            continue
        if dp[item]==0:
            flag[0]=False
            return
        if dp[item]==-1: 
            dfs(item,node)
    dp[node]=1#finish
dp=[-1]*(n*(n-1)//2)
for i in range(n*(n-1)//2):
    if dp[i]==-1:
        dfs(i,i)
        if flag[0]==False:
            break
if flag[0]==False:
    print(-1)
    sys.exit()
dp=[-1]*(n*(n-1)//2)
def dfs1(node,par): 
    buf=0
    for item in root[node]:
        if item==par:
            continue
        if dp[item]!=-1:
            buf=max(buf,dp[item])
            continue
        if dp[item]==-1: 
            buf=max([buf,dfs1(item,node)])
    dp[node]=buf+1#finish
    return buf+1

for i in range(n*(n-1)//2):
    if dp[i]==-1:
        dp[i]=dfs1(i,i)
print(max(dp))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
hd=[0]*n
for i in range(n):
    a.append(tuple(map(int,input().split())))
loop=0
flag=0
while(flag<n):
    stk=[]
    for i in range(n):
        idx=a[i][hd[i]]-1
        if a[idx][hd[idx]]==i+1:
            stk.append(i)
    if not stk:
        loop=-2
        break
    for j in stk:
        hd[j]+=1
        if hd[j]==n-2:
            flag+=1
    loop+=1
print(loop+1)
Problem p02984 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)//2
d=0
for i in range(n//2+1):
    d+=a[2*i]
x1=d-s
print(2*x1,end=' ')
buf=x1
for i in range(0,n-1):
    buf=a[i]-buf
    print(2*buf,end=' ')
print()

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
y=np.array(a)
A=np.eye(n)
for i in range(n):
    A[i-1][i]=1
#print(A)
x=np.linalg.solve(A,y)
for i in range(n):
    print(int(x[i])*2,end=' ')
print()
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
    x=int(input())
    if a:
        if x!=a[-1]:
            a.append(x)
    else:
        a.append(x)
count=[0]*(n+2)
count[1]=2
count[0]=1
i=0
s=0
if a:
    s=a.pop(0)
if s==1:
    count[1]=1
    count[0]=0
    if a:
        s=a.pop(0)
if s==2:
    count[1]=0
    if a:
        s=a.pop(0)

while i<n:        
    if (i+2==s-1):
        i=i+1
        if a:
            s=a.pop(0)
    else:
        count[i+2]=(count[i]+count[i+1])%1000000007
        i=i+1
#print(count)
print(count[n-1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
    x=int(input())
    if a:
        if x!=a[-1]:
            a.append(x)
    else:
        a.append(x)
count=[0]*(n+2)
count[1]=2
count[0]=1
i=0
s=a.pop(0)
if s==1:
    count[1]=1
    count[0]=0
    if a:
        s=a.pop(0)
if s==2:
    count[1]=0
    if a:
        s=a.pop(0)

while i<n:        
    if (i+2==s-1):
        i=i+1
        if a:
            s=a.pop(0)
    else:
        count[i+2]=(count[i]+count[i+1])%1000000007
        i=i+1
#print(count)
print(count[n-1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
count=[0]*(n+2)
count[1]=2
count[0]=1
i=0
s=a.pop(0)
if s==1:
    count[1]=1
    count[0]=0
    if a:
        s=a.pop(0)
if s==2:
    count[1]=0
    if a:
        s=a.pop(0)

while i<n:        
    if (i+2==s-1):
        i=i+1
        if a:
            s=a.pop(0)
    else:
        count[i+2]=(count[i]+count[i+1])%1000000007
        i=i+1
#print(count)
print(count[n-1])
Problem p03045 (python)

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

class union:
    def __init__(self,num):
        self.par=[-1]*num
    def get_par(self,node):
        if self.par[node]==-1:
            return node
        else:
            x=self.get_par(self.par[node])
            return x
    def merge(self,x,y):
        X=self.get_par(x)
        Y=self.get_par(y)
        if X!=Y:
            self.par[Y]=X
    def output(self):
        print(self.par)
    def count(self):
        print(self.par.count(-1))
def get_parent(node):
    if par[node]==-1:
        return node
    else:
        par[node]=get_parent(par[node])
        return par[node]
    
def merge(x,y):
    i=get_parent(x)
    j=get_parent(y)
    if i!=j:
        par[i]=j
    return
par=[-1]*n
for i in range(m):
    merge(a[i][0],a[i][1])
print(par.count(-1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(m):
    x,y,z=map(int,input().split())
    a.append((x-1,y-1,z))

class union:
    def __init__(self,num):
        self.par=[-1]*num
    def get_par(self,node):
        if self.par[node]==-1:
            return node
        else:
            return self.get_par(self.par[node])
    def merge(self,x,y):
        X=self.get_par(x)
        Y=self.get_par(y)
        if X!=Y:
            self.par[Y]=X
    def output(self):
        print(self.par)
    def count(self):
        print(self.par.count(-1))
u=union(n)
for i in range(m):
    u.merge(a[i][0],a[i][1])
u.count()
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split(" "))
c = a + b
if n % c == 0:
    print((n // c) * a)

else:
    q = n % c
    q = a if q > a else q
    print((n // c) * a + q)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split(" "))

s = ''

while(len(s)<=n):

    s+= 'A' * a
    s+= 'B' * b

print(list(s)[:n].count('A'))
Problem p02792 (python)

Fixed submission:

n = int(input())

number = [[0]*10 for _ in range(10)]

for _ in range(1, n+1):

    s=str(_)
    i=int(s[0])
    j=int(s[-1])

    number[i][j] += 1

count = 0
for i in range(10):

    for j in range(10):
        count += number[i][j]*number[j][i]

print(count)

Buggy submission (verdict: Runtime Error):

n = int(input())

number = [[0]*10 for _ in range(10)]

for _ in range(1, n+1):

    s=str(i)
    i=int(s[0])
    j=int(s[-1])

    number[i][j] += 1

count = 0
for i in range(10):

    for j in range(10):
        count += number[i][j]*number[j][i]

print(count)
Problem p02819 (python)

Fixed submission:
import math
N = int(input().strip())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

while(True):

    if is_prime(N):
        print(N)
        break

    else:
        N += 1

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
X = int(input().strip())
print(nextprime(X-1, 1))
Problem p02832 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
count = 1
k = 0       #break time
 
for i in range(n):
    if a[i] == count:
        count += 1
    else:
        k += 1
 
if k == n:
    k = -1
 
print(k)

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

if 1 not in bricks:
    print(-1)

else:
    K = 0
    value = 1
    while(value in bricks):
        index = bricks.index(value)
        bricks[value-1:index]=[]
        K += (index+1-value)
        value += 1
print(K)
Problem p02785 (python)

Fixed submission:
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])[::-1]
if K >= len(H):
    print('0')
else:
    print(sum(H[K:]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()], inverse=True)
if K >= len(H):
    print('0')
else:
    print(sum(H[K:]))
Problem p02754 (python)

Fixed submission:
n,A,B=map(int,input().split())
z=A+B
if n%z<=A:
    print(int(n/z)*A+n%z)
elif A<=n%z<=z:
    print(int(n/z)*A+A)

Buggy submission (verdict: Runtime Error):
n=input()
A=input()
B=input()
z=A+B
if n%z<=A:
    print(int(n/z)*A+n%z)
elif A<=n%z<=z:
    print(int(n/z)*A)
Problem p03077 (python)

Fixed submission:
import numpy as np
N = int(input())
transport = [int(input()) for _ in range(5)]
print(int(np.ceil(N / np.min(transport))) + 4)

Buggy submission (verdict: Runtime Error):
N = int(input())
transport = [int(input()) for _ in range(5)]
print(int(N / np.min(transport) + 5))
Problem p03834 (python)

Fixed submission:
s = input()
print(*s.split(","))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.split(',')
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)

print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

2 ans = N // (A + B) * A

3 rem = N % (A + B)

4 ans += min(rem, A)

5 print(ans)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
a = int(input())
s = input()
if a >= 3200:
  print("s")
  else:
    print("red")
Problem p03072 (python)

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

cnt = 1

for i in range(1, N):
    if H[i] >= max(H[:i]):
        cnt += 1

print(cnt)

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

cnt = 1

for i in range(1, N):
    if H[i] >= max(H[:i]:
        cnt += 1

print(cnt)