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

Fixed submission:
def woo(x, y):
    res = [0]*x
    z = list(map(int, input().split()))
    for i in range(1, x):
        res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))
    return res

if __name__ == '__main__':
    x, y = map(int, input().split())
    r = woo(x, y)
    f = len(r)-1
    print(r[f])

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = stdin.readline()
    n, K = n.split(' ')
    n = int(n)
    K = int(K)
    arr = stdin.readline()
    arr = [int(a) for a in arr.split(' ')]
    dp = [float('inf')]*n
    dp[0] = 0
    for i in range(n):
        for k in range(1, K+1):
            if i - k < 0:
                break
            dp[i] = min(dp[i], dp[i-k]+abs(arr[i]-arr[i-k]))
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = [int(item) for item in linha1.split()]
linha2 = input()
alturas = [int(item) for item in linha2.split()]
matriz = [[abs(alturas[0] - alturas[1])]]
if n > 2:
    for i in range(1,n-1):
        matriz.append([])
        for j in range(0,min(k, i+1, n-1)):
            if i-j == 0:
                custo_atual = abs(alturas[i+1] - alturas[0])
            else:
                custo_atual = abs(alturas[i+1] - alturas[i-j]) + min(matriz[i-j-1])
            matriz[i].append(custo_atual)
print(min(matriz[-1]))
Problem p03162 (python)

Fixed submission:
def main():
    N = int(input())
    A = []
    B = []
    C = []
    for _ in range(N):
        a, b, c = [int(x) for x in input().split()]
        A.append(a)
        B.append(b)
        C.append(c)
    
    dp = [[0 for i in range(3)] for i in range(N)]
    dp[0][0] = A[0]
    dp[0][1] = B[0]
    dp[0][2] = C[0]
    for i in range(1, N):
        dp[i][0] = A[i] + max(dp[i - 1][1], dp[i - 1][2])
        dp[i][1] = B[i] + max(dp[i - 1][0], dp[i - 1][2])
        dp[i][2] = C[i] + max(dp[i - 1][1], dp[i - 1][0])
    
    print(max(dp[N - 1]))
  
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[input() for i in range(h)]
mod=10**9+7
d=[[0]*w for i in range(h)]
d[0][0]=1
for i in range(h):
    for j in range(w):
        if i+1<h and a[i+1][j]==".":
            d[i+1][j]+=d[i][j]
            d[i+1][j]%=mod
        if j+1<w and a[i][j+1]==".":
            d[i][j+1]+=d[i][j]
            d[i][j+1]%=mod
print(d[-1][-1])
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
c=[]
mn=1001
for i in range(N):
    cost,time=map(int,input().split())
    if time<=T:
        c.append(cost)
for i in c:
    if i<=mn:
        mn=i
if len(c)==0:
    print('TLE')
else:
    print(mn)

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

x=[]

for i in range(n):
    c,t=map(int, input().split())
    if t<=T:
        x.append((i+1,c))
        
x.sort(key=lambda tup: tup[1])

print(x[0][0])

Buggy submission (verdict: Runtime Error):
N,T=input().split()
a=0
b=0
i=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        while b==0:
            a=c
            b+=1
        if int(c)<int (a):
            a=c
            i+=1
if i==0or a==0:
    print("TLE")
else :
    print(a)

Buggy submission (verdict: Runtime Error):
N,T=input().split()
a=0
b=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        if b==0:
            a=c
            b+=1
        if int(c)<int (a):
            a=c
            i+=1
if a==0:
    print("TLE")
else :
    print(a)
    ckdljfskldklsakldlksafkdshfhkfhsdkfkjdshfjkhskfkjsfkjlsalkjdhkjashdkhJKDHKAJHDKSHDSAHDIUAHFIUAHSFUAHFAULHFLKUASHFKULHSUAKLHDKUHFSUKHN,T=input().split()
a=0
b=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        if b==0:
            a=c
            b+=1
        if int(c)<int (a):
            a=c
            i+=1
if a==0:
    print("TLE")
else :
    print(a)
    ckdljfskldklsakldlksafkdshfhkfhsdkfkjdshfjkhskfkjsfkjlsalkjdhkjashdkhJKDHKAJHDKSHDSAHDIUAHFIUAHSFUAHFAULHFLKUASHFKULHSUAKLHDKUHFSUKH

Buggy submission (verdict: Runtime Error):
N , T = map(int, input().split())
mini = T
x = 0
y = 0
for i in range(N):
    c , t = input().split()
for j in range(N-1):
    if int(t[j])<mini:
        mini = int(t[j])
        x = j
if mini<T:
    print(c[j-1])
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
N , T = map(int, input().split())
mini = T
for i in range(N):
    c , t = input().split()
for i in  range(N):
    if int(t[i])<mini:
        mini = int(t[i])
if mini<T:
    print(c[i])
else:
    print("TLE")
Problem p03261 (python)

Fixed submission:
n = int(input())
words = []
won = True
for i in range(n):
    new_word = input()
    if i > 0 and won:
        if new_word in words or new_word[0] != words[i-1][len(words[i-1])-1]:
            won = False
    words.append(new_word)

if won:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
n = int (input())
words = []
No=" "
for i in range (n) :
    words.append(input())
for x in range(len(words)-1):
    if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:
        No="No"
        print (No)
        sys.exit() 
If No != "No":
     print ("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
Y=input()
y=list(Y)
last=y[len(y)-1]
m=[]
for i in range(n-1):
    x=input()
    if x in m:
        v=0
    m.append(x)
    z=list(x)
    if last!=z[0]:
        v=0
    last = z[len(y) - 1]
if v==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
W=[]
same=[]
for i in range(N):
    W.append(input())

for i in range(len(W)):
    for x in range(i+1,len(W)):
        if W[i]==W[x]:
            same.append(W[i])
  
for i in range(len(W)-1):
    if len(same)!=0:
        print("NO")
        break
    
    if W[i][-1]==W[i+1][0]:
        print("YES")
        break
        
    else:
        print("NO")
        break
Problem p03264 (python)

Fixed submission:
n=int(input())
e=int(n/2)
if n%2:
	o=int(n/2+1)
else:
	o=int(n/2)
	
print (o*e)

Buggy submission (verdict: Runtime Error):
n=input (int()) 
x=0
if n%2==0:
    x=(n/2)*((n/2)+1)
else:
    x=((n//2)+1)**2
print(x)

Buggy submission (verdict: Runtime Error):
x=input (int ()) 
c=0
if x%2==0:
    c=(x/2)*((x/2)+1)
else:
    c=((x//2)+1)*2
print(c)

Buggy submission (verdict: Runtime Error):
N=int(input("enter number")) 
even=0
odd=0
if N%2==0:
    even=N/2
    odd=N/2
else:
    even=N//2
    odd=(N//2) +1
Print(even*odd)

Buggy submission (verdict: Runtime Error):
N=int(input("enter number")) 
Counter1=0
Counter2=0
for i in range(N) :
    if i%2==0:
        Counter1+=1 
    if i%2==1:
        Counter2+=1 
Print(Counter1*Counter2)

Buggy submission (verdict: Runtime Error):
team=input()
x=team[0]
flag=0
d=0
for i in range(len(team))
   if team[i]==x:
       flag+=1
   else:
        x=team[i]
        flag=0
   if flag==7:
       print("yes")
       d=1
       break
if d=0:
    print("no")

Buggy submission (verdict: Runtime Error):
k=int(input())  
odd=1
even=0
for i in range(2,k+1) 
     if i%2==0:
        even+=1
     else:
           odd+=1
print(odd*even)

Buggy submission (verdict: Runtime Error):
K = map(int, input())
if K%2 ==0:
    print((K/2) ** 2)
else:
    print((K**2 - 1)/4)
Problem p03289 (python)

Fixed submission:
s = input()
f = False
f2 = True
c = 0
if s[0] =="A":
    f = True
for x in s[2:len(s)-1]:
    if x == "C":
        c +=1
    else:
        if x.isupper() or s[-1].isupper():
            f2 = False
if not s[1].islower():
    f2 = False
if f and c == 1 and f2:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
s = input()
    res = "AC"
    for i in s:
        if (i!="A" and i!="C" and i.isupper() == True):
            res = "WA"
            break;

    if (res == "AC" and s[0]=="A" and s.count("C")==1 and  s.index("C")>1 and s.index("C")<len(s)-1 ):
        print("AC")
    else:
        print("WA")
Problem p03316 (python)

Fixed submission:
n = input()
len_n = len(n)
sum_n = 0;
for i in range (len_n):
    sum_n += int(n[i])
if(int(n) % sum_n == 0):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def sum(x):
  y = x;
  sum = 0
  while y > 0:
    sum = sum + (y % 10)
    y = y // 10

  return sum

i = int ( input () )
print( "Yes" if (x % sum(x) == 0) else "No")
Problem p03331 (python)

Fixed submission:
n=int(raw_input())
ret=[]
for y in range(n/2):
	a=y+1
	b=n-a
	r1 = 0
	r2 = 0
	for i in str(a):
		r1 += int(i)
	for x in str(b):
		r2 += int(x)
	r=r1+r2
	ret.append(r)
print min(ret)

Buggy submission (verdict: Runtime Error):
def soma(a):
    res=0
    for i in range(0, len(a)):
        res+=int(a[i])

    if(res>=10):
        return soma(str(res))

    return res

def main():
    n = int(input())
    menor = soma("1")+soma(str(n-1))
    
    for i in range(1,10):
        if(soma(str(i))+soma(str(n-i))<menor):
            menor = soma(str(i))+soma(str(n-i))

    print(menor)
    
main()
Problem p03337 (python)

Fixed submission:
num = input()
a = int(num.split(' ')[0])
b = int(num.split(' ')[1])


c = [a+b,a-b,a*b]

print(max(c))

Buggy submission (verdict: Runtime Error):
line = input()
A,B = [int(u) for u in line.split()]
def func(a,b)
    return min(a+b,a-b,a*b)
print(func(A,B))

Buggy submission (verdict: Runtime Error):
a, b = map(int, sys.stdin.readline().strip())
sys.stdout.write(max(a+b, a-b, a*b) + '\n')
Problem p03360 (python)

Fixed submission:
line = input()
numbers = [int(n) for n in line.split()]
numbers.sort()
K = int(input())
N = numbers[-1]
for _ in range(K):
    N*=2
for num in numbers[:2]:
    N+=num
print(N)

Buggy submission (verdict: Runtime Error):
line = input()
num_a, num_b, num_c = [int(n) for n in line.split()]
 num_k =  [int(n) for n in line.split()][0]
numbers = [num_a, num_b, num_c]
numbers.sort(reverse=True)
numbers[0] *= 2**num_k
print(sum(numbers))

Buggy submission (verdict: Runtime Error):
line = input()
num_a, num_b, num_c, num_k = [int(n) for n in line.split()]
numbers = [num_a, num_b, num_c]
numbers.sort(reverse=True)
numbers[0] *= 2**num_k
print(sum(numbers))

Buggy submission (verdict: Runtime Error):
A= input()
B= input()
C= input()
K= input()
u = max(A,B,C)
print(A+B+C+(2**K-1)*u)

Buggy submission (verdict: Runtime Error):
line = input()
A, B, C, K = [int(u) for u in line.split()]
u = max(A,B,C)
print(A+B+C+(2**K-1)*u)

Buggy submission (verdict: Runtime Error):
line = input()
A, B, C,K = [int(u) for u in line.split()]
u=[A,B,C]
j = max(u)
u.remove(j)
u.append(j*2**K)
print(sum(u))
Problem p03377 (python)

Fixed submission:
a, b, x = map(int, input().split())
if a + b >= x:
    if a <= x:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
line = input()
known_cat_num, unknow_num, expected_cat_num = [int(n) for n in line.split()][0]
if (expected_cat_num < known_cat_num
        or expected_cat_num - known_cat_num > unknow_num):
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
gatos = int(input())
animais = int(input())
X = int(input())
if (X > animais):
    print("NO")
elif (X <= animais and animais > gatos):
    print("SIM")
elif (animais < gatos):
    print("NO")
Problem p03417 (python)

Fixed submission:
from sys import stdin

N, M = map(int, stdin.readline().split())

print(abs(N * M - 2 * (N + M) + 4))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if (N==1 and M==1):
    print(0)
if (N==1):
    print(M-2)
if (M==1):
    print(N-2)
else:
    print((N-2)(M-2))
Problem p03548 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print((X-Z)//(Y+Z))

Buggy submission (verdict: Runtime Error):
x=int(input(""))
y=int(input(""))
z=int(input(""))
answer= (x-z)//(z+y)
print(answer)

Buggy submission (verdict: Runtime Error):
x=int(input(""))
y=int(input(""))
z=int(input(""))

print(x//(z+y))

Buggy submission (verdict: Runtime Error):
x=int(input(""))
y=int(input(""))
z=int(input(""))

print(x//(z+y))

Buggy submission (verdict: Runtime Error):
x=int(input())
y=int(input())
z=int(input())

print(x//(z+y))
Problem p03555 (python)

Fixed submission:
x = input()
y = input()
z = x[::-1]
if y==z:
        print("YES")
else:
        print("NO")

Buggy submission (verdict: Runtime Error):
m = input().splilt()

a = m[0]

if a[::-1] == m[1]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a=list(map(input(). split() ) )
b=list(map(input(). split() ) )
if(a[0]==b[2]&&a[1] ==b[1] & & a[2] ==b[0] ):
       print ("Yes" )
else:
      print("No" )

Buggy submission (verdict: Runtime Error):
a=list(map(input(). split() ) )
if(a[0]==a[5]&&a[1] ==a[4] & & a[2] ==a[3] ):
       print ("Yes" )
else:
print("No" )

Buggy submission (verdict: Runtime Error):
#include<string>
#include<iostream>
using namespace std;

int main () {
	string r1,r2;
	cin >> r1;
	cin >> r2;
	// A B C
	// D E F
	// Rotate 180 Degrees
	// FED, CBA?
	if (r2[2] == r1[0] && r2[1] == r1[1] && r2[0] == r1[2])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}
Problem p03633 (python)

Fixed submission:
import sys
import collections
import math
import fractions

def lcm(a,b):
	return a*b/fractions.gcd(int(a),int(b))

def main():
	count = int(input())
	i = 0
	tmp = 1
	while(i < count):
		i += 1
		num = int(input())
		tmp = lcm(tmp,num)
	print(int(tmp))
if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import collections
import math
# code start
def lcm(a,b):
	return a*b/math.gcd(int(a),int(b))

def main():
	count = int(input())
	i = 0
	temp = 1
	while(i<count):
		i+=1
		num = int(input())
		temp = lcm(temp,num)
	print(int(temp))


main()

# code end
Problem p03635 (python)

Fixed submission:
from sys import stdin,stdout

def main():
    line=stdin.readline()
    parts=line.split()
    a=int(parts[0])
    b=int(parts[1])

    stdout.write(str((a-1)*(b-1)))
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
def main():
    line = stdin.readLine()
    parts = line.split()
    a = int(parts[1])
    b = int(parts[2])
    stdout.write((a-1)*(b-1))
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
def main():
    line = stdin.readLine()
    parts = line.split()
    a = int(parts[1])
    b = int(parts[2])
    stdout.write(a*b)
main()
Problem p03644 (python)

Fixed submission:
n = int(input())

x, a = 1, None
for i in range(8):
    if x <= n:
        a = x
        x *= 2
    else:
        break

print(a)

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

x = 1
while(x*2 <= n):
    x *= 2

print(a)
Problem p03647 (python)

Fixed submission:
n,m = input().split()
n = int(n)
m = int(m)
l = [[] for i in range(n)]
for i in range(m):
    a,b = input().split()
    a = int(a)
    b = int(b)
    l[a-1].append(b-1)
    l[b-1].append(a-1)

f = False
for i in l[0]:
    for j in l[i]:
        if j == n-1:
            f = True
            break
if f:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

ends = []
starts = []
possible = False
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        starts.append([a, b])
    elif b == n:
        ends.append([a, b])

starts.sort(key=lambda x: x[1])
ends.sort(key=lambda x: x[0])

i = 0
j = 0
while i != len(starts) and j != len(ends):
    to = starts[i][1]
    fr = ends[j][0]

    if to == fr:
        possible = True
        break

    if to > fr:
        i += 1
    elif fr > to:
        j += 1

while j != len(ends):
    fr = ends[j][0]
    if to == fr:
        possible = True
        break

    j += 1

while i != len(starts):

    to = starts[i][1]
    if to == fr:
        possible = True
        break

    i += 1

print("POSSIBLE") if possible else print("IMPOSSIBLE")
Problem p03721 (python)

Fixed submission:
nk = input().split(' ')
n = int(nk[0])
k = int(nk[1])

arr = []

for i in range(0, n):
	ab = input().split(' ')
	arr.append((int(ab[0]), int(ab[1])))

arr = sorted(arr)

pos = 0
while True:
	if k > arr[pos][1]:
		k -= arr[pos][1]
	else:
		print(arr[pos][0])
		break
	pos += 1

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <queue>
#include <cstring>
#include <iterator>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;

    map<int, int> freq;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        if(!freq.count(a))
            freq[a] = 0;
        freq[a] += b;
    }

    map<int, int>::iterator it;
    int k = 1;
    for (it = freq.begin(); k <= K && it != freq.end(); it++) {
        k += it->second;
    }
    it--;
    cout << it->first << endl;
}

Buggy submission (verdict: Runtime Error):
inp = input().split(" ")
N = int(inp[0])
K = int(inp[1])

arr = []
indicies = [0]

for i in range(N):
	inp = input().split(" ")
	a = int(inp[0])
	b = int(inp[1])
	if len(arr) == 0 or a >= arr[-1]:
		arr += [a] * b
		indicies.append(len(arr))
	elif a <= arr[0]:
		arr = ([a] * b) + arr
	else:
		for i in indicies:
			if a > arr[i-1] and a < arr[i]:
				arr = arr[0:i] + ([a] * b) + arr[i:]
	print(arr)

print(arr[K])
Problem p03844 (python)

Fixed submission:
#!/usr/bin/env python
num_str = raw_input()
plus = True if '+' in num_str.split() else False
if plus:
	print(int(num_str.split()[0]) + int(num_str.split()[2]))
else:
	print(int(num_str.split()[0]) - int(num_str.split()[2]))

Buggy submission (verdict: Runtime Error):
a,op,b = input().strip()
if(op=='+'):
    print(int(a)+int(b))
else:
    print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
add="+"
sub="-"
op=str(input())
if (op==add):
    print(a+b)
elif(op==sub):
    print(a-b)
Problem p03963 (python)

Fixed submission:
n, k = map(int, input().split())
print(k*pow(k-1, n-1), end="")

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;


int main()
{
	long long int n,k;
	cin>>n>>k;
	long long int ans = (long long int) (k*pow(k-1,n-1));
        cout<<ans;
	return 0;
}
Problem p03999 (python)

Fixed submission:
s = input()

result = []

def spstr(made, left):
    for x in range(1, len(left)+1):
        new_made = made.copy()
        new_made.append(int(left[0:x]))
        new_left = left[x:]
        if new_left == "":
            result.append(new_made)
        else:
            spstr(new_made, new_left)
spstr([], s)

count = 0
for r in result:
    for n in r:
        count += n
print(count)

Buggy submission (verdict: Runtime Error):
def lis(n):
    if n == 2:
        return [[10,1], [1,1]]
    else:
        l = lis(n-1)
        for i in range(len(l)):
            for j in range(len(l[i])):
                l[i][j] *= 10
                l[i].append(1)
        l.append([1 for i in range(len(l[0]))])
        return l
s = input()
li = lis(len(s))
sum = 0
for i in range(len(li)):
    for j in range(len(li[i])):
        sum += int(s[i])*li[i][j]
print(sum)
Problem p04019 (python)

Fixed submission:
def back_home():
    S=input()
    if((('S'in S) and ('N' in S)) and not (('E' in S) or  ('W' in S))):
        print('Yes')
    elif(not (('S' in S) or ('N'  in S)) and (('E' in S) and ('W' in S))):
        print("Yes")
    elif((('S'in S) and ('N' in S)) and (('E' in S) and ('W' in S))):
        print("Yes")
    else:
        print("No")
          
back_home()

Buggy submission (verdict: Runtime Error):
def back_home():
    r=input()
    t=r.count('S') +1
    y=r.count('N') +1
    u=r.count('W') +1
    i=r.count('E')+1
    if (t>1 and y>1 and u==1 and i==1):
        print("YES")
    elif((t==1 and y==1 and u>1 and i>1):
       print("YES")
    elif ((t>1 and y>1 and u>1 and i>1):
        print("YES")
    else:
        print("NO")
        
back_home()

Buggy submission (verdict: Runtime Error):
def back_home(r):
    l = dict()
    for i in r:
        if i in l:
            l[i]=int(l[i])+1
        else:
            l[i]=1
    if (len(l)==1):
        return('NO')
    elif(len(l)==2):
        if (len(l['S'])>0 and len(l['N']>0)):
            return ("yes")
        elif(len(l['E'])>0 and len(l['W']>0)):
            return("yes")
        else:
            return("NO")
    elif(len(l)==3):
        return("NO")
    else:
        return("YES")
        
back_home(S):
Problem p04043 (python)

Fixed submission:
same = tuple(sorted(map(int, input().split()))) == (5, 5, 7)
print("YES" if same else "NO")

Buggy submission (verdict: Runtime Error):
A=int(input("Enter A:"))
B=int(input("Enter B:"))
C=int(input("Enter C:"))
if((A==5 and B==5 and C==7) or (A==5 and C==5 and B==7) or (B==5 and C ==5 and  A==7)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().split()
if a==5 and b==5 and c==7 or a==5 and b==7 and c==5 or a==7 and b==5 and c==5:
    print('YES')
else:
    print('NO'
Problem p04047 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(0,2*n,2):
    ans+=a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
ans=0
for i in range(0,2*n,2):
    ans+=a[i+1]
print(ans)
Problem p02631 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
num = 0
for a in A:
  num ^= a

l = []

for a in A:
  ans = a^num
  l.append(ans)
print(*l)

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

l = [0]*(2**max(A))
ll = []
for a in A:
  pattern = bin(a)[2:].zfill(N)
  for i in range(len(pattern)):
    if pattern[i] == '1':
      l[i] += 1

for a in A:
  ans = ''
  pattern = bin(a)[2:].zfill(N)
  for i in range(len(pattern)):
    if pattern[i] == '1' and int(l[i])%2 == 0:
      ans += '1'
    elif pattern[i] == '0' and int(l[i])%2 != 0:
      ans += '1'
    else:
      ans += '0'
  ll.append(int(ans,2))
print(*ll)
Problem p02642 (python)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split())) + [10**6+1]
A.sort()
B = np.zeros(10**6+1)
count = 0
for i in range(N):
  if B[A[i]] == 0:
    B[::A[i]] = 1
    if A[i] != A[i+1]:
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
n = lcm_list(A)
F = factorization(n)
count = 0
for i,j in F:
  for k in range(j):
    i += i
    if i in A:
      count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
n = lcm_list(A)
F = factorization(n)
count = 0
for i,j in F:
  for k in range(j):
    i += i
    if i in A:
      count += 1

print(count)

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

count = N

for i in range(N):
  if i == 0:
    if A[i] == A[i+1]:
      count -= 1
  else:
    for j in range(1,i+1):
      if A[i]%A[i-j] == 0:
        count -= 1
        print(A[i])
        break
print(count)