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

Fixed submission:
r = int(input())
print(r ** 2)

Buggy submission (verdict: Runtime Error):
r = input()
print(r*r)

Buggy submission (verdict: Runtime Error):
r = input()[0]
print(r**2)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r**2
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
n = int(input())
moji = input()
res = 'Yes'
if n % 2 == 1:
    res = 'No'
else:
    for i in range(int(n/2)):
        if moji[i] != moji[int(n/2)+1]:
            res = 'No'
            break
      
print(res)

Buggy submission (verdict: Runtime Error):
r = int(nput())
print(int(r**2))
Problem p02860 (python)

Fixed submission:
n = int(input())
moji = input()
res = 'Yes'
if n % 2 == 1:
    res = 'No'
else:
    for i in range(int(n/2)):
        if moji[i] != moji[int(n/2)+i]:
            res = 'No'
            break
      
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
moji = input()
res = 'Yes'
if n % 2 == 1:
    res = 'No'
else:
    for i in range(int(n/2)):
        if moji[i] != moji[int(n/2)+1]:
            res = 'No'
            break
      
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input)
moji = input()
res = 'Yes'
if n % 2 == 1:res = 'No'
else:
  for i in range(len(n/2)):
    if moji[i] != moji[n/2+1]:
      res = 'No'
      
print(res)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r = int(intput())
print(r**2)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
if (s[0:n//2]==s[n//2:]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def solve():
    n, data = [x for x in input().split(" ")]
    n = int(n)
    if data[:n//2] == data[n//2:]:
        return "Yes"
    return "No"

if __name__ == "__main__":
    # test = int(input())
    # for _ in test:
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    n, data = [x for x in input().split(" ")]
    n = int(n)
    if data[:n//2] == data[n//2:-1]:
        return "Yes"
    return "No"

if __name__ == "__main__":
    # test = int(input())
    # for _ in test:
    solve()
Problem p02879 (python)

Fixed submission:
a, b = input().split(" ")

if(int(a)>9 or int(b)>9):
    print("-1")
else:
    print(int(a)* int(b))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int solve()
{
    int a, b;
    string str;
    cin >> a >> b;
    if (a > 9 || b > 9)
        return -1;
    return a * b;
}
int main()
{
    cout << solve() << endl;
}
Problem p02880 (python)

Fixed submission:
a = int(input())
if(a > 81 or a==0):
    print("No")
elif(0<a<10):
    print("Yes")
else:
    for i in range(9, 0, -1):
        if(a%i==0):
            a = a//i
            break
    if(a>9):
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
string solve()
{
    int N;
    cin>>N;
    int last = 1;
    for(int i=2; i*i<=N; i++){
        if(N%i==0){
            last = i;
        }
    }
    N = N/last;
    if(N>9 || last>9)return "No";
    return "Yes";
}
int main()
{
    cout << solve() << endl;
}

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
string solve()
{
    int N;
    cin>>N;
    int last = 1;
    for(int i=2; i*i<=N; i++){
        if(N%i==0){
            last = i;
        }
    }
    N = N/last;
    if(N>9 || last>9)return "No";
    return "Yes";
}
int main()
{
    cout << solve() << endl;
}
Problem p02881 (python)

Fixed submission:
# coding: utf-8
# Your code here!

n = int(input());
#n = [int(i) for i in input().split()];
#S = [str(s) for s in in_S]

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

    # divisors.sort()
    return divisors
    
m = make_divisors(n)
#print(m);

count = 0;
for i in range(0,len(m),2):
    #print(i);
    #if i==len(m)-1:
        #break;
    tmp =  (m[i]-1) + (m[i+1]-1);
    #print(tmp);
    if tmp < count or count == 0:
        count = tmp;
    #if n%i == 0 and n/i <= 9:
        #jud ='Yes';
print(count);

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

n = int(input());
#n = [int(i) for i in input().split()];
#S = [str(s) for s in in_S]

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

    # divisors.sort()
    return divisors
    
m = make_divisors(n)
#print(m);

count = 0;
for i in range(0,len(m),2):
    #print(i);
    tmp =  (m[i]-1) + (m[i+1]-1);
    #print(tmp);
    if tmp < count or count == 0:
        count = tmp;
    #if n%i == 0 and n/i <= 9:
        #jud ='Yes';
print(count);
Problem p02879 (python)

Fixed submission:
A,B=map(int,input() .split())
if A<=9 and B<=9:
    print(A*B)
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A<=9 and B<=9:
    print(A*B)
else:
    print("-1")
Problem p02879 (python)

Fixed submission:
AB = input().split()
A = int(AB[0])
B = int(AB[1])

if 1 <= A <= 9 and 1 <= B <= 9 :
    print(A * B)

else :
    print(-1)

Buggy submission (verdict: Runtime Error):
AB = input().split()
A = intAB[0]
B = intAB[1]

if 1 <= A <= 9 and 1 <= B <= 9 :
    print(A * B)

else :
    print(-1)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if 1 <= A <= 20 and 1 <= B <= 20 :
    print(A * B)

else :
    print(-1)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()

if 1 <= A <= 20 & 1 <= B <= 20 :
    print(A * B)

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

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a < 3200:
    print(s)
elif a >= 3200:
    print('red')

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a < 3200:
    print(s)
elif a >= 3200:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a < 3200:
    print(s)
elif a >= 3200:
    print(red)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

num = int(input())
x = []
y = []
for i in range(num):
  x_N, y_N = map(int, input().split())
  x.append(x_N)
  y.append(y_N)

index = [str(i) for i in range(num)]
index_permut = list(itertools.permutations(index))

distance_all = 0
for l in index_permut:
  distance = 0
  index = list(map(int, l))

  for pos in range(num-1):
    x_diff = (x[index[pos+1]] - x[index[pos]]) ** 2
    y_diff = (y[index[pos+1]] - y[index[pos]]) ** 2
    distance += np.sqrt(x_diff + y_diff)

  distance_all += distance
res = distance_all / len(index_permut)
print(res)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()

if n%2==0:
  s1 = s[:int(n/2)]
  s2 = s[int(n/2):]
  if s1==s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

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

if n%2==0:
  s1 = s[:n/2]
  s2 = s[n/2:]
  if s1 == s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Problem p03135 (python)

Fixed submission:
a = list(map(int,input().split()))
T,X = a[0],a[1]
print(T/X)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
T,X = a[0],a[1]
return(T/X)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
r = int(input)
print(r**2)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = str(input())

if S[:int(N/2)] == S[int(N/2):]:
    print("Yes")
else:
    print("No")

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

if n%2 != 0:
  print('No')
elif s == s[:n/2]*2:
  print('Yes')
else:
  print('No')

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

if s%2 != 0:
  print('No')
elif s == s[:n/2]*2:
  print('Yes')
else:
  print('No')
Problem p02970 (python)

Fixed submission:
import math
n, d = map(int, input().split())
se = d * 2 + 1
print(math.ceil(n/se))

Buggy submission (verdict: Runtime Error):
import math
n, d = map(input().split())
se = d * 2 + 1
print(math.ceil(n/se))

Buggy submission (verdict: Runtime Error):
import math
n, d = map(input().split())
se = d * 2 + 1
print(math.ceil(n/d))

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
a = n // (2d + 1) + 1
print(a)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
a = n // (2d + 1) + 1
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
a = n/d + 1
print(a)
Problem p02987 (python)

Fixed submission:
s = input()
a = set()
for i in range(len(s)):
  a.add(s[i])
if len(a) == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(1, n-1):
  A = [P[i-1], P[i], P[i+1]]
  sort = sorted(A)
  if sort[1] = A[1]:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
P = [int(input()) for _ in range(n)]
count = 0
for i in range(1, n-1):
  A = [P[i-1], P[i], P[i+1]]
  sort = sorted(A)
  if sort[1] = A[1]:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
s = input()
a = set()
for i in len(s):
  a.add(s[i])
if len(a) == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
a = set()
for i in len(s):
  a.add(i)
if len(a) == 2:
  print('Yes')
else:
  print('No')
Problem p02859 (python)

Fixed submission:
a = int(input())
print(a*a)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
  int a = input()
  print(a*a)
Problem p02933 (python)

Fixed submission:
num = int(input())
color = input()
 
if num >= 3200:
  print(color)
else:
  print('red')

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



if color >= 3200:
  print(str(color))
else:
  print('red')

Buggy submission (verdict: Runtime Error):
color = input()
if color > 3199:
  print(str(color))
else:
  print('red')

Buggy submission (verdict: Runtime Error):
int(color) = input()
if color > 3200:
  print(color)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
color = input()
if color >= 3200:
  print(color)
  else:
  print('red')

Buggy submission (verdict: Runtime Error):
color = input()
if color >= 3200:
  print(color)
  else
  print('red')
Problem p02897 (python)

Fixed submission:
import math
n = int(input())
print(math.ceil(n/2)/n)

Buggy submission (verdict: Runtime Error):
#n,k分ける
n,k=map(int, input().split())
#Aで数えるなら
A=list(map(int, input().split()))
count=0
#ｎ人いてて、ｋより高い人を抽出
for i in range(n):
    if A[i]>=k:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
inport math
n = int(input())
print (math.ceil(n/2)/n)

Buggy submission (verdict: Runtime Error):
inport math
n = int(input())
print(math.ceil(n/2)/n)

Buggy submission (verdict: Runtime Error):
inport math
n = int(input())
b = math.ceil(n/2)
print(b/n)

Buggy submission (verdict: Runtime Error):
n = int(input())
print('math.ceil(n/2)/n）

Buggy submission (verdict: Runtime Error):
n = int(input())
# bを奇数の数と仮定して
ｂ = 'math.ceil(n/2)'
#　奇数/全体ってやればいいのかな？
print(b/ｎ)

Buggy submission (verdict: Runtime Error):
n = int(input())
# bを奇数の数と仮定して
b = 'math.ceil(n/2)'
#　奇数/全体ってやればいいのかな？
N　= b/ｎ

Buggy submission (verdict: Runtime Error):
n = int(input())
# bを奇数の数と仮定して
ｂ = math.ceil(n/2)
#　奇数/全体ってやればいいのかな？
N　= b/ｎ
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
N=int(input())
pass=N ** 3
print(pass)

Buggy submission (verdict: Runtime Error):
n = input()
print(n**3)
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")

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

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

if a => 3200:
    print("s")
else:
    print("red")

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

if a =< 3200:
    print(s)
else:
    print(red)

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

if a =< 3200:
    print(s)
else:
    print(red)
Problem p02951 (python)

Fixed submission:
A,B,C=map(int,input().split())
if B+C <= A:
    print(0)
else:
    print(C+B-A)

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if B+C=<A:
    print(0)
else:
    print(C+B-A)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
#B＋CがAより少ないなら０
if B+C =< A:
    print(0)
else:
    print(C+B-A)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
#場合分けが必要なのか？？

#B＋CがAより少ないなら０
if B+C =< A:
    print(0)
else:
    print(C-(A-B))

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
#場合分けが必要なのか？？

#B＋CがAより少ないなら０
if　B+C <= A:
#<=の順番すぐ間違えるやん！！
    print(0)
else:
    print(C-(A-B))

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
#場合分けが必要なのか？？

#B＋CがAより少ないなら０
if　B+C =< A:
    print(0)
else:
    print(C-(A-B))

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())

print(C-(A-B))
Problem p02879 (python)

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

if a < 10 and b < 10:
  print (a*b)

else:
  print (-1)

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

if a < 10 and b < 10
  print (a*b)

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

Fixed submission:
N = int(input())
S = input()
harf = int(N/2)
if N % 2 != 0:
    print("No")
else:
    if S[0:harf] == S[harf:]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
if N % 2 != 0:
    print("No")
else:
    if S[0:N/2] == S[N/2:]:
        print("Yes")
    else:
        print("No")
Problem p03011 (python)

Fixed submission:
p, q, r = map(int, input().split())

print(min(p+q, q+r, r+p))

Buggy submission (verdict: Runtime Error):
p, q, r = map(int, input())

print(min(p+q, q+r, r+p)
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())

c = 0

for x in range(k+1):
  for y in range(k+1):
    if 0 <= (s - x - y) <= k:
      c += 1
print(c)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())

c = 0

if s == 3*k:
  c = 1
elif s >= 2*k:
  c = (5 - s % k) * 3
elif s >= k:
  c = pass
else:
  c = 3 * k
  
print(c)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r * r)

Buggy submission (verdict: Runtime Error):
r = input()
print(r * r)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
     
if s[:n//2] == s[n//2:]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
     
if s[:n/2] == s[n/2:]:
	print("Yes")
else:
	print("No")

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

if s[:n/2] == s[n/2:]:
	print("Yes")
else:
    print("No")

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

if n % 2 != 0 or s[:n/2] != s[n/2:]:
  print("No")
else:
  print("Yes")
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()

if N % 2 == 1:
    print('No')
    exit()

if S[ : N // 2] == S[N // 2 : ]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<string>

using namespace std;

string S;
int N;

void input(){
  cin >> N;
  cin >> S;
}

void solve(){
  input();
  string tmp = "No";
  int K = N/2;
  if(N%2==0 && S.substr(0,K)==S.substr(K,K)) tmp="Yes";
  cout << tmp <<endl;
  return;
}

int main(){
  solve();
  return 0;
}
Problem p02897 (python)

Fixed submission:
import sys
import math

n = input()
n = float(n)
ans = (n - n / 2)
ans = math.ceil(ans)
ans = float(ans / n)
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
ans = (N-N/2)/N
print(ans)
Problem p02859 (python)

Fixed submission:
r=int(input())

print(r*r)

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

flag=True

if(n%2):
  flag=False
elif(not s[0:int(n/2)-1]==s[int(n/2):]):
  flag=False

if(flag):
  print("Yes")
else:
  print("No")
Problem p02859 (python)

Fixed submission:
r = int(input())

print(r*r)

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

print(r*r)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
l = [a for a in s]
if len(l)%2 == 1:
    print("No")
    exit()
n2 = int(n/2)
if "".join(l[:n2]) == "".join(l[n2:]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
s = [a for a in s]
if len(s) == 1:
    print("No")
    exit()
if s[:n/2] == s[n/2:]:
    print("Yes")
else:
    print("No")
Problem p03327 (python)

Fixed submission:
a=int(input())
if a < 1000:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
a=input()
if a < 1000:
  print("ABC")
else:
  print("ABD")
Problem p03631 (python)

Fixed submission:
n=input()
m=n[::-1]
if n==m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()
m=n[::-1]
if n=m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()
print(reverse[::-1])

Buggy submission (verdict: Runtime Error):
n=input()
print(reverse(n))
Problem p02948 (python)

Fixed submission:
import bisect


N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1], reverse=True)
memo = [x for x in range(N)]
ans = 0
for a, b in AB:
    if M < a:
        continue
    Ma = M - a
    i = bisect.bisect_right(memo, Ma)
    if i > 0:
        del memo[i - 1]
        ans += b
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
memo = [0] * M
for _ in range(N):
    a, b = map(int, input().split())
    if M < a:
        continue
    memo[a] = max(b, memo[a])
ans = sum(memo)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1], reverse=True)
memo = [0] * min(N, M)
ans = 0
for a, b in AB:
    Ma = max(M - a + 1, 0)
    for i in range(Ma, 0, -1):
        if memo[i - 1] == 0:
            memo[i - 1] = 1
            ans += b
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1], reverse=True)
memo = [0] * N
ans = 0
for a, b in AB:
    Ma = M - a + 1
    if 0 in memo[:Ma]:
        i = bisect.bisect_right(memo[:Ma], 0) - 1
        memo[i] = 1
        ans += b
print(ans)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = []
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    if M > 0:
        a += [int(input())]
    for i in range(M - 1):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
    a.append([-1])
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    memo[1] = 1
    try:
        if a[0] == 1:
            a.pop(0)
            memo[1] = 0
    except:
        pass
    j = 0
    for i in range(N - 1):
        if i + 2 == a[j]:
            j += 1
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [-10]
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    for i in range(M):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
a.pop(0)
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    memo[1] = 1
    try:
        if a[0] == 1:
            a.pop(0)
            memo[1] = 0
    except:
        pass
    j = 0
    for i in range(N - 1):
        if i + 2 == a[j]:
            if j < len(a) - 1:
                j += 1
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [-10]
ans = -1
MOD = 10 ** 9 + 7
for i in range(M):
    a += [int(input())]
    if a[i + 1] - a[i] == 1:
        ans = 0
        break
if ans != 0:
    memo = [0] * (N + 1)
    memo[0] = 1
    if 1 in a:
        memo[1] = 0
    else:
        memo[1] = 1
    for i in range(N - 1):
        if i + 2 in a:
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: - x[1])
tmp = []
for B, C in BC:
    tmp += [C] * B
    if len(tmp) >= N:
        break
if len(tmp) < N:
    n = len(tmp)
else:
    n = N
for i in range(n):
    if A[i] < tmp[i]:
        A[i] = tmp[i]
    else:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: - x[1])
tmp = []
for B, C in BC:
    tmp += [C] * B
    if len(tmp) >= N:
        break
for i in range(N):
    if A[i] < tmp[i]:
        A[i] = tmp[i]
    else:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: -x[1])
i = 0
for B, C in BC:
    for _ in range(B):
        if C >= A[i]:
            A[i] = C
            i += 1
            if i == N - 1:
                break
    if i == N - 1:
        break
print(sum(A))
Problem p03075 (python)

Fixed submission:
s = []
for i in range(5):
    s.append(int(input()))
k = int(input())
flag = True
for x in s:
    for y in s:
        if x != y:
            z = x - y
            if z <= k:
                pass
            else:
                flag = False
if flag:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
t = []
for i in set(range(x)):
    for j in set(range(y)):
        for l in set(range(z)):
            if (i+1) * (j+1) * (l+1) <= k:
                t.append(a[i]+b[j]+c[l])
            else:
                break
t.sort(reverse=True)
for i in range(k):
    print(t[i])

Buggy submission (verdict: Runtime Error):
x,y,z,K=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
for i in range(x):
  for j in range(y):
    for k in range(z):
      if (i+1)*(j+1)*(k+1)<=K:
        ans.append(a[i]+b[j]+c[k])
      else:
        break
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])