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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  if i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=O
for i in range(n):
  p+=b[a[i]-1]
  if i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  
  if　i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  
  if　i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  if　i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i-1]]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int(input().split())))
b=list(map(int(input().split())))
c=list(map(int(input().split())))
p=0
for i in range(n):
  p+=b[a[i]]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(int(input()))
b=list(int(input()))
c=list(int(input()))
p=0
for i in range(n):
  p+=b[a[i]]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)
Problem p02577 (python)

Fixed submission:
n = input()
cnt = 0
for i in range(len(n)):
    cnt += int(n[i])
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = 0
for i in range(200005):
    if n < 10:
        cnt += n
        break
    cnt += (n % 10)
    n = int(n / 10)
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')
Problem p02596 (python)

Fixed submission:
import sys
k = int(input())
seven = 7
ans = -1
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    sys.exit()
for cnt in range(1, 10**6):
    if seven % k == 0:
        ans = cnt
        break
    seven *= 10
    seven = (seven + 7) % k
print(ans)

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
int a[1000001];
int main(){
    int K;
    scanf("%d",&K);
    a[1]=7%K;
    for(int i=2;i<=K;i++)a[i]=(a[i-1]*10+7)%K;
 
    for(int i=1;i<=K;i++)if(a[i]==0){
        printf("%d\n",i);
        return 0;
    }
    printf("-1\n");
}
Problem p02578 (python)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
ans = 0
for i in range(N-1):
    if A[i]>A[i+1]:
        ans += A[i]-A[i+1]
        A[i+1] = A[i]
print(ans)

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

ans = 0
for i in range(n-1):
  if a[i] > i[i+1]:
    x += (a[i] - a[i+1])
    a[i+1] = a[i]

print(ans)

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

ans = 0
for i in range(n-1):
    if a[i] > i[i+1]:
        x += a[i] - a[i+1]
        a[i+1] = a[i]

print(ans)

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

ans = 0
for i in range(n-1):
  if a[i] > i[i+1]:
    x += a[i] - a[i+1]
    a[i+1] = a[i]

print(x)

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

x = 0
for i in range(n-1):
  if a[i] > i[i+1]:
    x += a[i] - a[i+1]
    a[i+1] = a[i]

print(x)

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

x = 0
for i in range(n-1):
  if a[i] > i[i+1]:
    x += a[i] - a[i+1]
    a[i+1] = a[i]

print(x)

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

x = 0
for i in range(n):
  while True:
    if a[i] > a[i + 1]:
      a[i + 1] += 1
      x += 1
    if a[i] <= a[i + 1]:
      break

print(x)

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

x = 0
for i in range(n):
  while True:
    if a[i] > a[i + 1]:
      a[i + 1] += 1
      x += 1
    if a[i] <= a[i + 1]:
      break

print(x)

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

x = 0
for i in range(n):
  while Ture:
    if a[i] > a[i + 1]:
      a[i + 1] += 1
      x += 1
    if a[i] <= a[i + 1]:
      break

print(x)

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

x = 0
while True:
  data = map(lambda a: a + x, a)
  data1 = data.sort()
  if len(data1) == len(set(data1)):
    break:
  else:
    x += 1

print(x * n)
Problem p02595 (python)

Fixed submission:
import math

n, d = map(int, input().split())

count = 0

for i in range(n):
  x, y = map(int, input().split())
  if math.sqrt((x)**2 + (y)**2) <= d:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import math

n, d = map(int, input().split())

count = 0

for i in range(n):
  x, y = map(int, input().split())
  if math.sprt((abs(x)**2) + (abs(y)**2)) <= d:
    count += 1
Problem p02633 (python)

Fixed submission:
x = int(input())
b = 1
while (360*b%x) != 0:
    b += 1

print(360*b//x)

Buggy submission (verdict: Runtime Error):
x = int(input())
import math
a = -(-360//x)
b = math.gcd(a-(360%a),360)
info = []
while True:
    tem = math.gcd((b-(360%b),360)
    info.append(tem)
    if tem == 0:
        break
ans = a*(360//b)
for i in info:
    ans *= i

print(ans)
Problem p02661 (python)

Fixed submission:
n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n // 2 - 1] + min_s[n // 2]) / 2
    max_med = (max_s[n // 2 - 1] + max_s[n // 2]) / 2
    print(int((max_med - min_med) * 2 + 1))

else:
    min_med = min_s[(n + 1) // 2 - 1]
    max_med = max_s[(n + 1) // 2 - 1]
    print(int((max_med - min_med)+1))

Buggy submission (verdict: Runtime Error):
n = int(input())
min_s = []
max_s = []
for i in range(n):
    a, b = map(int, input().split())
    min_s.append(a)
    max_s.append(b)

min_s.sort()
max_s.sort()
if n % 2 == 0:
    min_med = (min_s[n//2-1] + min_s[n//2-1])/2
    max_med = (max_s[n//2-1] + max_s[n//2-1])/2
    print(int(max_med-min_med)*2+1)))

else:
    min_med = min_s[(n+1)//2-1]
    max_med = max_s[(n+1)//2-1]
    print(int((max_med-min_med)+1))
Problem p02682 (python)

Fixed submission:
a,b,c,k = map(int, input().split())
if k<=a:
    print(k)
elif a<k and k<=a+b:
    print(a)
else:
    print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int, input().split())
cards = [1]*a + [0]*b + [-1]*c
print(sum(cards[:k]))
Problem p02781 (python)

Fixed submission:
n = input()
k = int(input())
digit = len(n)
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]

print(dp0[digit][k] + dp1[digit][k])

Buggy submission (verdict: Runtime Error):
n = input()
k = int(input())
import math
digit = math.floor(math.log10(int(n))) + 1
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]
Problem p02793 (python)

Fixed submission:
n = int(input())

import fractions
import collections
a = collections.deque(list(map(int, input().split())))
 
lcm = a.popleft()
a.append(lcm)
for i in range(1, n):
    tem = a.popleft()
    lcm = lcm * tem // fractions.gcd(lcm, tem)
    a.append(tem)
 
ans = 0
for i in range(n):
    tem = a.popleft()
    ans += lcm // tem
 
print(ans % (10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import fractions

lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])

b = [0]*n
for i in range(n):
    b[i] = lcm/a[i]

print(int(sum(b)) % (10**9+7))
Problem p03038 (python)

Fixed submission:
n,m = map(int,input().split())
a_n = list(map(int,input().split()))
b_and_c = []
for i in range(m):
    b_and_c.append(list(map(int,input().split())))

a_n.sort()

b_and_c.sort(key = lambda x : x[1], reverse = True)
index = 0
for i in range(m):
    if index >= n:
        break
    elif a_n[index] >= b_and_c[i][1]:
        break
    for j in range(index, n):
        if a_n[j] < b_and_c[i][1]:
            for k in range(j, min(j + b_and_c[i][0], n)):
                if a_n[k] < b_and_c[i][1]:
                    a_n[k] = b_and_c[i][1]
                else:
                    break
            index = k + 1
            break

print(sum(a_n))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_n = list(map(int,input().split()))
b_and_c = []
for i in range(m):
    b_and_c.append(list(map(int,input().split())))

a_n.sort()

b_and_c.sort(key = lambda x : x[1], reverse = True)
index = 0
for i in range(m):
    if a_n[index] >= b_and_c[i][1] or index >= n:
        break
    for j in range(index, n):
        if a_n[j] < b_and_c[i][1]:
            for k in range(j, min(j + b_and_c[i][0], n)):
                if a_n[k] < b_and_c[i][1]:
                    a_n[k] = b_and_c[i][1]
                else:
                    break
            index = k + 1
            break

print(sum(a_n))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_n = list(map(int,input().split()))
b_and_c = []
for i in range(m):
    b_and_c.append(list(map(int,input().split())))

a_n.sort()

b_and_c.sort(key = lambda x : x[1], reverse = True)
index = 0
for i in range(m):
    if a_n[index] >= b_and_c[i][1] or index >= n:
        break
    for j in range(index, n):
        if a_n[j] < b_and_c[i][1]:
            for k in range(j, j + b_and_c[i][0]):
                if k == n:
                    break
                else:
                    if a_n[k] < b_and_c[i][1]:
                        a_n[k] = b_and_c[i][1]
                    else:
                        break
            index = k + 1
            break

print(sum(a_n))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_n = list(map(int,input().split()))
b_and_c = []
for i in range(m):
    b_and_c.append(list(map(int,input().split())))

a_n.sort()
a_n.reverse()

b_and_c.sort(lambda x : x[1])
changed = 0
for i in range(m):
    if a_n[n-1] >= b_and_c[i][1]:
        break
    for j in range(changed, b_and_c[i][0]):
        if j == n:
            break
        else:
            if a_n[j] < b_and_c[i][1]:
                a_n[j] = b_and_c[i][1]
                changed = j
            else:
                break

print(sum(a_n))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_n = list(map(int,input(.split())))
b_and_c = []
for i in range(m):
    b_and_c.append(list(map(int,input().split())))

for i in range(b_and_c):
    sort(a_n)
    for j in range(b_and_c[i][0]):
        if a_n[j] < b_and_c[i][1]:
            a_n[j] = b_and_c[i][1]
        else:
            break

print(sum(a_n)
Problem p02711 (python)

Fixed submission:
n=input()

ans='No'

if '7' in n:
    ans='Yes'
print(ans)

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

ans='No'

if n//100==7 or n//10==7 or n%10==7 (n//10)%10==7:
    ans='Yes'
else :
    ans='No'
print(ans)

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

ans='No'

if n//100==7 or n//10==7 or n%10==7:
    ans='Yes'
elif :
    ans='No'
print(ans)
Problem p02759 (python)

Fixed submission:
#A
n=int(input())

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

Buggy submission (verdict: Runtime Error):
if n%2==0:
    ans=n/2
else:
    ans=n//2+1
print(ans)
Problem p03137 (python)

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

if n>=m:
    print('0')
    exit()

x.sort()

y=[0]*(m-1)
for i in range(m-1):
    y[i]=x[i+1]-x[i]
if n==1:
    print(sum(y))
    exit()
y.sort(reverse=True)
for i in range(n-1):
    y[i]=0
print(sum(y))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
x= list(map(int,input().split()))

if n>=m:
    print('0')
    exit()

x.sort()

y=[0]*(m-1)
for i in range(m-1):
    y[i]=x[i+1]-x[i]
if n==1:
    print(sum(y))
    exit()
y.sort(reverse=True)
for i in range(n-1):
    del y[i]
print(sum(y))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
x= list(map(int,input().split()))

if n>=m:
    print('0')
    exit()
x.sort()

y=[0]*(m-1)
for i in range(m-1):
    y[i]=x[i+1]-x[i]

y.sort(reverse=True)
for i in range(n-1):
    del y[i]
print(sum(y))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
x= list(map(int,input().split()))

x.sort()

y=[0]*(m-1)
for i in range(m-1):
    y[i]=x[i+1]-x[i]

y.sort(reverse=True)
for i in range(n-1):
    del y[i]
print(sum(y))
Problem p02570 (python)

Fixed submission:
D,T,S = input().split()

D = int(D)
T = int(T)
S = int(S)


if S*T >=D:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D,T,S = input(int()),input(int()), input(int())

if S*T >=D:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D=input(int())
T=input(int())
S=input(int())

if S*T >=D:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D=input(int())
T=input(int())
S=input(int())

if S*T >=D:
  print('Yes')
else:
        print('No')

Buggy submission (verdict: Runtime Error):
D=input(int())
T=input(int())
S=input(int())

if S*T >=D:
  print('Yes)
else:
        print('No')
Problem p02577 (python)

Fixed submission:
N = int(input())

if N % 9 ==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()

N = str(N)

sum = 0
for i in range(0, len(N)):
  sum += N[i]

if sum % 9 ==0:
  print('Yes')
else:
  print('No')

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

N = str(N)

sum = 0
for i in len(N):
  sum += N[i]

if sum % 9 ==0:
  print('Yes')
else:
  print('No')
Problem p02546 (python)

Fixed submission:
N = input()

if N[len(N) - 1] == "s":
    N += "es"
else:
    N += "s"
print(N)

Buggy submission (verdict: Runtime Error):
N = input()

if N[len(N) - 1] == "s":
    N += "es"
else:
    N += "s"
print(N)
N = input()

if N[len(N) - 1] == "s":
    N += "es"
else:
    N += "s"
print(N)
Problem p02547 (python)

Fixed submission:
n = int(input())
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().split(' '))
    if a!=b:
        count = 0 
    else:
        count += 1
    if count == 3:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().split(' '))
    if a!=b:
        count = 0 
    else:
        count += 1
    if count == 3:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().strip().split(' '))
    if a!=b:
        count = 0 
    else:
        count += 1
    if count == 3:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().split(' '))
    if a!=b:
        count = 0 
    else:
        count += 1
    if count == 3:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().split(' '))
    if a!=b:
        count = 0 
    else:
        count += 1
    if count == 3:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for i in range(n):
    a , b = map(int,input().split(' '))
    if a!=b:
    	count = 0 
    else:
    	count += 1
    if count == 3:
    	ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for _ in range(n):
	a , b = map(int,input().split(' '))
    if a!=b:
    	count = 0 
    else:
    	count += 1
    if count == 3:
    	ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for _ in range(n):
	a,b = map(int,input().split(' '))
    if a!=b:
    	count = 0 
    else:
    	count+=1
    if count ==3:
    	ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for _ in range(n):
	a,b = map(int,input().split(' ')
    if a!=b:
    	count = 0 
    else:
    	count+=1
    if count ==3:
    	ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
ans = 'No'
for _ in range(n):
	a,b = map(int,input().split(' ')
    if a!=b:
    	ans = 0 
    else:
    	count+=1
    if count ==3:
    	ans = 'Yes'
print(ans)
Problem p02695 (python)

Fixed submission:
from collections import defaultdict, deque
from itertools import combinations

N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

D = defaultdict(dict)
for a, b, c, d in ABCD:
  D[b-1][(a-1, c)] = d

for j in range(N-1, 0, -1):
  for x, y in combinations(D[j], 2):
    if x[0] == y[0]:
      continue
    if x[0] > y[0]:
      x, y = y, x
    if x[1] > y[1]:
      if (x[0], x[1] - y[1]) not in D[y[0]]:
        D[y[0]][(x[0], x[1] - y[1])] = 0

for j in range(1, N):
  if (j-1, 0) not in D[j]:
    D[j][(j-1, 0)] = 0

que = deque([([1], 0)])
memo = set([(1,)])
ans = 0
while que:
  L, score = que.popleft()
  if len(L) == N:
    if score > ans:
      ans = score
  else:
    for a, c in D[len(L)]:
      l = L[a] + c
      if L[-1] <= l <= M:
        x = tuple(L + [l])
        if x not in memo:
          memo.add(x)
          que.append((L + [l], score + sum(d for v, d in D[len(L)].items() if l - L[v[0]] == v[1])))
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque
from itertools import combinations

N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

D = defaultdict(set)
for a, b, c, d in ABCD:
  D[b-1].add((a-1, c, d))

for j in range(N-1, 0, -1):
  for x, y in combinations(D[j], 2):
    if x[0] == y[0]:
      continue
    if x[0] > y[0]:
      x, y = y, x
    if x[1] > y[1]:
      for a, c, d in D[y[0]]:
        if a == x[0] and c == x[1] - y[1]:
          break
      else:
        D[y[0]].add((x[0], x[1] - y[1], 0))

for j in range(1, N):
  for a, c, d in D[y[0]]:
    if a == j-1 and c == 0:
      break
  else:
    D[j].add((j-1, 0, 0))

que = deque([([1], 0)])
ans = 0
while que:
  L, score = que.popleft()
  if len(L) == N:
    if score > ans:
      ans = score
  else:
    for a, c, d in D[len(L)]:
      l = L[a] + c
      if l <= M:
        que.append((L + [l], score + sum(d for a, c, d in D[len(L)] if l - L[a] == c)))
print(ans)
Problem p02726 (python)

Fixed submission:
from collections import Counter
from itertools import combinations

N, X, Y = map(int, input().split())

C = Counter(min(j - i, abs(X - 1 - i) + 1 + abs(Y - 1 - j)) for i, j in combinations(range(N), 2))

for i in range(1, N):
  print(C[i])

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

for k in range(1, N):
    count = 0
    for i, j in combinations(range(1, N+1), 2):
        if min(j - i, abs(X-i)+1+abs(Y-j)) == k:
            count += 1
    print(count)
Problem p03317 (python)

Fixed submission:
from math import ceil

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

print(ceil((N - 1) / (K - 1)))

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

print(ceil((N - 1) / (K - 1)))
Problem p02570 (python)

Fixed submission:
import sys
input = sys.stdin.readline

d, t, s = map(int, input().split())

run = t * s
if d <= run:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

num = int(input())
an = list(map(int, input().split()))

ans = 0

for i in range(len(an)):
  for j in range(len(an)):
    if i < j:
      kake = an[i] * an[j]
      kake %= ((10 ** 9) + 7)
      ans += kake
  
ans %= ((10 ** 9) + 7)

print(ans)
Problem p02627 (python)

Fixed submission:
word = input()
if word.islower() == True:
  print("a")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
num = input().split(" ")
num_all = int(num[0])
count = int(num[1])
cost = list(map(int, input().split()))
cost.sort()
last = 0
for i in range(count):
  last += cost[i]
print(last)
Problem p02596 (python)

Fixed submission:
K = int(input())

n = 0
for i in range(1,K+1):
    n = (n*10 + 7)%K
    if n == 0:
        print(i)
        break

else:
    print(-1)

Buggy submission (verdict: Runtime Error):
K = int(input())
mod = []
a[0] = 7%K
for i in range(1,K):
    a[i] = (a[i-1]*10 + 7)%K
 
for i in range(K):
    if a[i] == 0:
        print(a[i])
        break
 
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
K = int(input())
mod = []
a[0] = 7%K
if a[0] == 0:
    print(a[0])
    exit()
for i in range(1,K+1):
    a[i] = (a[i-1]*10 + 7)%K
    if a[i] == 0:
        print("%d",a[i])
        break

else:
    print(-1)

Buggy submission (verdict: Runtime Error):
K = int(input())
mod = []
a[0] = 7%K
if a[0] == 0:
    print(a[0])
    exit()
for i in range(1,K):
    a[i] = (a[i-1]*10 + 7)%K
    if a[i] == 0:
        print("%d",a[i])
        break

else:
    print(-1)

Buggy submission (verdict: Runtime Error):
K = int(input())
mod = []
a[0] = 7%K
for i in range(1,K):
    a[i] = (a[i-1]*10 + 7)%K

for i in range(K):
    if a[i] == 0:
        print("%d",a[i])
        break

else:
    print(-1)
Problem p02597 (python)

Fixed submission:
N = int(input())
c = list(input())

a=0
b=0

a = c.count("R")
ans = c.count("R")
for i in range(N):
    if c[i] == "R":
        a -= 1
    else:
        b += 1

    now = max(a,b)
    ans = min(ans, now)

print(ans)

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

a=0
b=0

a = c.count("R")
ans = c.count("R")
for i in range(N):
    if c[i] == 'R':
        a -= 1
    else:
        b += 1

    now = max(a,b)
    ans = min(ans, now)

print(ans)

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

a=0
b=0

a = c.count("R")

for i in range(N):
    if c[i] == 'R':
        a -= 1
    else:
        b += 1

    now = max(a,b)
    ans = min(ans, now)

print(ans)

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

a=0
b=0

a = c.count("R")

for i in range(N):
    if S[i] == 'R':
        a -= 1
    else:
        b += 1

    now = max(a,b)
    ans = min(ans, now)

print(ans)