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

Fixed submission:
n,y=map(int,input().split())
a=10000
b=5000
c=1000
sum_money=y
for i in range(0,n+1):
  for j in range(0,n+1-i):
    k=n-i-j
    if sum_money==a*i+b*j+c*k and k>=0:
      print(i,j,k)
      break
  else:
    continue
  break
else:
	print("-1","-1","-1")

Buggy submission (verdict: Runtime Error):
n,y=map(int,input().split())
a=10000
b=5000
c=1000
sum_money=y
for i in range(0,n+1):
  for j in range(0,n+1-i):
    k=n-i-j and k>=0
    if sum_money==a*i+b*j+c*k:
      print(i,j,k)
      break
  else:
    continue
  break
else:
	print("-1","-1","-1")
Problem p03477 (python)

Fixed submission:
aa = list(map(int,input().split()))
bb = ["Left","Right","Balanced"]
a,b,c,d = [i for i in aa]

if a + b > c +d:
    print(bb[0] )
if a + b < c +d:
    print(bb[1] )
if a + b == c +d:
    print(bb[2] )

Buggy submission (verdict: Runtime Error):
aa = list(map(int,input().split()))
bb = ["Left","Right","Balanced"]
a,b,c,d = [i for i in aa]

print(bb[0] if a + b > c +d)
print(bb[1] if a + b < c +d)
print(bb[2] if a + b == c +d)
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
print(int((a+b+1)/2))

Buggy submission (verdict: Runtime Error):
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)
if c < d:
	print("Yes")
elif c >= d:
	print("No")

Buggy submission (verdict: Runtime Error):
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

if c < d:
	print("Yes")
elif c >= d:
	print("No")

Buggy submission (verdict: Runtime Error):
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

if c < d:
	print("Yes")
elif c >= d:
	print("No")

Buggy submission (verdict: Runtime Error):
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

if c < d:
	print("Yes")
elif c >= d:
	print("No")
Problem p03543 (python)

Fixed submission:
a=input()
print(["No","Yes"][a[0]==a[1]==a[2] or a[3]==a[1]==a[2]])

Buggy submission (verdict: Runtime Error):
a=input()
print(["No","Yes"][a[0]==a[1]==a[2]or[a[3]==a[1]==a[2]])

Buggy submission (verdict: Runtime Error):
a=input()
print(["No","Yes"][a[0]==a[1]==a[2]and[a[3]==a[1]==a[2]])
Problem p03548 (python)

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

Buggy submission (verdict: Runtime Error):
x,y,z=int(input().split())
print((x-z)//y)
Problem p03606 (python)

Fixed submission:
x,*y=map(int,open(0).read().split())
print(sum(y[1::2])-sum(y[0::2])+x)

Buggy submission (verdict: Runtime Error):
x,*y=map(int,open(0).split())
print(sum(y[1::2])-sum(y[0::2])+x)

Buggy submission (verdict: Runtime Error):
x,*y=map(int,open(0))
print(sum(y[1::2])-sum(y[0::2])+x)

Buggy submission (verdict: Runtime Error):
x,*y=map(int,open(0).read().split())
print(sum(y[0::2]-y[1::2])+x)
Problem p03632 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)

Buggy submission (verdict: Runtime Error):
a,b,c,d=int(input().split())
x=min(b,d)-max(a,c)
print(x if x>0 else 0)
Problem p03633 (python)

Fixed submission:
import fractions
n=int(input())
lst=list(int(input()) for _ in range(n))
ans = lst[0]
for i in range(1, n):
    ans = ans * lst[i] // fractions.gcd(ans, lst[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
lst=list(int(input()) for _ in range(int(input())))
ans = lst[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, lst[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
lst=list(int(input()) for _ in range(int(input())))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)
Problem p03636 (python)

Fixed submission:
kk = input()
print(kk[0]+str(len(kk)-2) + kk[len(kk)-1:len(kk)-2:-1])

Buggy submission (verdict: Runtime Error):
a,*b,c=input()
print(a+str(len(*b))+c)
Problem p03658 (python)

Fixed submission:
n,k=map(int,input().split())
l=sorted(map(int,input().split()) ,reverse=True)
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=sorted(int(input().split()) ,reverse=True)
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=sorted(int(input()) for _ in range(n),reverse=True)
print(sum(l[:k]))
Problem p03698 (python)

Fixed submission:
a=input()
b=set(a)
c=list(a)
print(["no","yes"][len(b)==len(c)])

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a ,b;
    b="yes";
    cin>>a;
    for (int i=0;i<a.size();i++){
        for (int j=i+1;j<a.size();j++){
            if(a.at(i)==a.at(j)){
                b="no";
                break;
            }
        }
    }
    cout<<b<<endl;
	return 0;
}
Problem p03729 (python)

Fixed submission:
a,b,c=input().split()
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]])

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[1]])
Problem p03760 (python)

Fixed submission:
a=input()
b=input()
d=zip(a,b)
e="".join(i[0]+i[1] for i in d)
if len(a)==len(b):
	print(e)
elif len(a)>len(b):
  	print(e+a[-1])
elif len(a)<len(b):
  	print(e+b[-1])

Buggy submission (verdict: Runtime Error):
a=lst(input())
b=input()
i=0
for j in b:
	a[i:i]=j
    i+=1
print(*a)
Problem p03795 (python)

Fixed submission:
s=int(input())
print(s*800-(s//15)*200)

Buggy submission (verdict: Runtime Error):
s=int(input())
print(i*800-(i//15)*200)
Problem p03844 (python)

Fixed submission:
a,b,c=input().split()
a=int(a)
c=int(c)
if b=="+":
  print(a+c)
else:print(a-c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
a=int(a)
b=int(b)
if b=="+":
  print(a+b)
else:print(a-b)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if b=="+":
  print(a+b)
else:print(a-b)
Problem p03861 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(int((b//c)-(a-1)//c))

Buggy submission (verdict: Runtime Error):
i,j,n=map(int,input().split())
i_num=i/n
j_num=j/n
cnt=j_num-i_num
if i_num % j==0:
  cnt+=1
print(cnt)
Problem p04043 (python)

Fixed submission:
l=input().split()
print(["NO","YES"][l.count("7")==1 and l.count("5")==2])

Buggy submission (verdict: Runtime Error):
n=list(map(input().split()))
print("YES" if n==["5","7","5"] or n==["7","5","5"] or n==["5","5","7"] else "NO")
Problem p02534 (python)

Fixed submission:
n = int(input())
acl = 'ACL'
tmp = ''
for i in range(n):
  tmp = tmp + acl
print(tmp)

Buggy submission (verdict: Runtime Error):
tmp  = input()
tmp=tmp.split(' ')
tmp2 = [float(s) for s in tmp]
isint = [s.is_integer() for s in tmp2]
 
a = tmp2[0]
b = tmp2[1]
c = tmp2[2]
d = tmp2[3]
     
if all(isint):
    if (0 <= a) and (a <= b) and (b <= 10**18) and (0 <= c) and (c <= d) and (d <= 10**18):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
tmp  = input()
tmp = tmp.split(' ')
tmp = [int(s) for s in tmp]

a = tmp[0]
b = tmp[1]
c = tmp[2]
d = tmp[3]

isint = list()
for t in tmp:
     isint.append(type(t)==int)
    
if all(isint):
    if (0 <= a) and (a <= b) and (b <= 10**18) and (0 <= c) and (c <= d) and (d <= 10**18):
        print('Yes')
    else:
        print('No')
else:
    print('No')
Problem p02536 (python)

Fixed submission:
#!/usr/bin/env python

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

class UnionFind():
    def __init__(self, n): 
        self.n = n 
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.sizes = [1 for _ in range(n)]

    def root(self, x): 
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 圧縮経路
            return self.par[x]
            # return root(par[x]) # 圧縮しない場合

    def same(self, x, y): 
        return self.root(x) == self.root(y)

    def unite(self, x, y): 
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry: 
            return

        # par[rx] = ry # naiveな連結

        # 低い木を高い方にくっつける。
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.sizes[ry] += self.sizes[rx]
        else:
            self.par[ry] = rx
            self.sizes[rx] += self.sizes[ry]

        # rx木とry木の高さが同じならば、rx木を深くする。
        if self.rank[rx] == self.rank[ry]:
            self.rank[rx] += 1

    def size(self, x): 
        '''
        xが属するグループのサイズを返す
        (連結成分の大きさ)
        '''
        return self.sizes[self.root(x)]

    def connected(self):
        '''
        連結成分の数
        '''
        return len(set(self.par))

uf = UnionFind(n)
for i in range(m):
    uf.unite(a[i], b[i])
for i in range(n):
    _ = uf.root(i)

ans = uf.connected()-1
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

n, m = map(int, input().split())
a = [0 for _ in range(m)]
b = [0 for _ in range(m)]
for i in range(m):
    a[i], b[i] = map(int, input().split())

class UnionFind():
    def __init__(self, n): 
        self.n = n 
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.sizes = [1 for _ in range(n)]

    def root(self, x): 
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 圧縮経路
            return self.par[x]
            # return root(par[x]) # 圧縮しない場合

    def same(self, x, y): 
        return self.root(x) == self.root(y)

    def unite(self, x, y): 
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry: 
            return

        # par[rx] = ry # naiveな連結

        # 低い木を高い方にくっつける。
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.sizes[ry] += self.sizes[rx]
        else:
            self.par[ry] = rx
            self.sizes[rx] += self.sizes[ry]

        # rx木とry木の高さが同じならば、rx木を深くする。
        if self.rank[rx] == self.rank[ry]:
            self.rank[rx] += 1

    def size(self, x): 
        '''
        xが属するグループのサイズを返す
        (連結成分の大きさ)
        '''
        return self.sizes[self.root(x)]

    def connected(self):
        '''
        連結成分の数
        '''
        return len(set(self.par))

uf = UnionFind(n)
for i in range(m):
    uf.unite(a[i], b[i])

ans = n-uf.connected()
print(ans)
Problem p02601 (python)

Fixed submission:
#!/usr/bin/env python

ta, tb, tc = map(int, input().split())
k = int(input())

def dfs(s):
    a = ta
    b = tb
    c = tc
    if len(s) == k:
        #print(s)
        for i in range(k):
            if 'A' == s[i]:
                a *= 2
            elif 'B' == s[i]:
                b *= 2
            elif 'C' == s[i]:
                c *= 2
        if c > b > a:
            print('Yes')
            exit(0)
        return
    dfs(s+'A')
    dfs(s+'B')
    dfs(s+'C')

dfs('')

print('No')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

a, b, c = map(int, input().split())
k = int(input())

whle k>0:
    if a>=b:
        b *= 2
    elif b>=c:
        c *= 2
    else:
        print('Yes')
        exit(0)
    k -= 1
print('No')
Problem p02608 (python)

Fixed submission:
#!/usr/bin/env python
import math

n = int(input())
m = int(math.sqrt(n))+1
x = y = z = 0 

def p(x, y, z): 
    return x*x + y*y + z*z + x*y + y*z + z*x 

anss = [0 for _ in range(n)]

for x in range(1, m): 
    for y in range(1, m): 
        for z in range(1, m): 
            if p(x, y, z)-1 <= n-1:
                anss[p(x, y, z)-1] += 1

for i in range(n):
    print(anss[i])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
import math

n = int(input())
m = int(math.sqrt(n))+1
x = y = z = 0 

def p(x, y, z): 
    return x*x + y*y + z*z + x*y + y*z + z*x 

anss = [0 for _ in range(n)]
visited = []

def dfs(x, y, z): 
    if x+y+z > m or (x, y, z) in visited:
        return
    anss[p(x, y, z)-1] += 1
    visited.append((x, y, z)) 
    dfs(x+1, y, z)
    dfs(x, y+1, z)
    dfs(x, y, z+1)

# output
dfs(1,1,1)
for i in range(n):
    print(anss[i])
Problem p02641 (python)

Fixed submission:
#!/usr/bin/env python3

x, n = map(int, input().split())
p = list(map(int, input().split()))

d = [0 for _ in range(201)]
for i in range(-100, 101):
    d[i+100] = i+1 

for i in p:
    d.remove(i)

d2 = [0 for _ in range(len(d))]
for i in range(len(d)):
    d2[i] = abs(d[i]-x)

m = 10000
for i in reversed(range(len(d2))):
    if d2[i] <= m:
        m = d2[i]
        tmpi = i 

print(d[tmpi])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

x, n = map(int, input().split())
p = list(map(int, input().split()))

d = [0 for _ in range(100)]
for i in range(100):
    d[i] = i+1 

for i in p:
    d.remove(i)

d2 = [0 for _ in range(len(d))]
for i in range(len(d)):
    d2[i] = abs(d[i]-x)

m = 1000

for i in reversed(range(len(d2))):
    if d2[i] <= m:
        m = d2[i]
        tmpi = i 

print(d[tmpi])
Problem p02718 (python)

Fixed submission:
#!/usr/bin/env python3
import numpy as np

n ,m = map(int, input().split())
a = np.array(list(map(int, input().split())))
t = a >= a.sum() * 1/(4*m)
if t.sum() >= m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import pandas as pd

n ,m = map(int, input().split())
a = pd.Series(list(map(int, input().split())))
t = a >= a.sum() * 1/(4*m)
if t.sum() >= m:
    print('Yes')
else:
    print('No')
Problem p02724 (python)

Fixed submission:
#!/usr/bin/env python3

x = int(input())
a = x//500
x -= a*500
b = x//5
print(a*1000+b*5)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

x = int(input())
a = x//500
x -= a*500
b = x//5
print(a*1000+b*5)
~
Problem p02755 (python)

Fixed submission:
#!/usr/bin/env python3
import math

a, b = map(int, input().split())
x = math.floor((a-1)/0.08)
y = math.floor((a+1)/0.08)
z = math.floor((b-1)/0.1)
w = math.floor((b+1)/0.1)

if y<z:
    print(-1)
    exit(0)

ans = []
for i in range(min(x,z), min(y,w)):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        ans.append(i)

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import math

a, b = map(int, input().split())
x = math.floor((a-1)/0.08)
y = math.floor((a+1)/0.08)
z = math.floor((b-1)/0.1)
w = math.floor((b+1)/0.1)

if y<z:
    print(-1)
    exit(0)

ans = []
for i in range(min(x,z), min(y,w)):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        ans.append(i)

if len(ans) == 0:
    print(-1):
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import math

a, b = map(int, input().split())
x = math.floor((a-1)/0.08)
y = math.floor((a+1)/0.08)
z = math.floor((b-1)/0.1)
w = math.floor((b+1)/0.1)

if y<z:
    print(-1)
    exit(0)

ans = []
for i in range(min(x,z), min(y,w)):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        ans.append(i)

print(min(ans))
Problem p02761 (python)

Fixed submission:
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    x = str(x)
    if len(x) != n:
        continue
    ok = True
#    print('x =', x)
    for i in range(m):
#        print('s[i] =', s[i])
#        print('x[s[i]-1] =', x[s[i]-1])
#        print('c[i] =', c[i])
        if x[s[i]-1] != str(c[i]):
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    keta = 1 
    nx = x/10
    d = []
    while nx: 
        keta += 1
        d.append(nx%10)
        nx /= 10
    if keta != n:
        continue
    ok = True
    d = d[::-1]
    for i in range(m):
        if d[s[i]-1] != c[i]:
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# input
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

# calc
# 重複があり、かつ、値が異なれば🙅
d = {}
for index, key in enumerate(s):
    if key not in d.keys():
        d[key] = c[index]
    else:
        if d[key] != c[index]:
            print(-1)
            exit(0)

# 0始まりは🙅
mi = min(list(d.keys()))
if d[mi] == 0:
    print(-1)
    exit(0)

# output
ans = ''
#import pdb; pdb.set_trace()
ma = max(list(d.keys()))
for i in range(1, n+1):
    if i in d.keys():
        ans += str(d[i])
    else:
        ans += '0' 
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

# input
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

# calc

# 重複があり、かつ、値が異なれば🙅
d = {}
for index, key in enumerate(s):
    if key not in d.keys():
        d[key] = c[index]
    else:
        if d[key] != c[index]:
            print(-1)
            exit(0)

# 0始まりは🙅
mi = min(list(d.keys()))
if d[mi] == 0:
    print(-1)
    exit(0)

# output
ans = ''
#import pdb; pdb.set_trace()
ma = max(list(d.keys()))
for i in range(1, ma+1):
    if i in d.keys():
        ans += str(d[i])
    else:
        ans += '0'
print(ans)
Problem p02780 (python)

Fixed submission:
#!/usr/bin/env python3

import numpy as np

n, k = map(int, input().split())
p = list(map(int, input().split()))
exps = []

for i in range(n):
    #exps.append(sum(list(range(1, p[i]+1)))/p[i])
    exps.append((1+p[i])/2)

exps = np.array(exps)
cumexps = exps.cumsum()
cumexps = np.insert(cumexps, 0, 0)

#print(exps)
#print(cumexps)

ans = -1
for i in range(n-k+1):
    tmp = -cumexps[i] + cumexps[i+k]
    if ans <= tmp:
        ans = tmp 

print(ans)

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

int main(void){

  int n,k;
  vector<int> p(n);
  cin >> n >> k;
  for(int i=0; i<n ; ++i){
    cin >> p.at(i);
  }
  vector<double> exps;
  vector<double> sums;

  for(int i=0; i<n ; ++i){
    double tmp = 0.0;
    for(int j=1 ; j <= p[i] ; ++j){
      tmp += j;
    }   
    tmp /= p[i];
    exps.push_back(tmp);
  }

  for(int i=0; i<n-(k-1) ; ++i){
    double tmp = 0;
    for(int j=0; j<k ; ++j){
      tmp += exps.at(i+j);
    }   
    sums.push_back(tmp);
  }

  sort(sums.begin(), sums.end(), greater<double>());

  // for debug
//  cout << "exps" << endl;
//  for(auto a: exps){
//    cout << a << ", " ;
//  }
//  cout << endl;
//  cout << "sums" << endl;
//  for(auto a: sums){
//    cout << a << ", " ;
//  }
//  cout << endl;

  cout << sums.at(0) << endl;

  return 0;
}
Problem p02843 (python)

Fixed submission:
#!/usr/bin/env python

x = int(input())

n = x//100

for i in range(n+1):
    tmp = x 
    tmp -= i*100
    if 5*i >= tmp:
        print(1)
        exit()
print(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# DP解

x = int(input())
dp = [False for _ in range(x+1)]
dp[0] = True
for i in range(1, 100):
    dp[i] = False
for i in range(100, x+1):
    tmp = False
    for j in range(6):
        if i-(100+j) >= 0:
            tmp = (tmp or dp[i-(100+j)])
    if tmp:
        dp[i] = True
    else:
        dp[i] = False

if dp[x]:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# DP解

x = int(input())
dp = [False for _ in range(x+1)]
dp[0] = True
for i in range(1, 100):
    dp[i] = False
for i in range(100, x+1):
    if dp[i-100] or dp[i-101] or dp[i-102] or dp[i-103] or dp[i-104] or dp[i-105]:
        dp[i] = True
    else:
        dp[i] = False

if dp[x]:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

x = int(input())

ok = False

def dfs(n, flg):
    global ok
    if flg:
        return 
    if n == x:
        ok = True
        return
    if n > x:
        ok = False
        return
    dfs(n+100, ok) 
    dfs(n+101, ok) 
    dfs(n+102, ok) 
    dfs(n+103, ok) 
    dfs(n+104, ok) 
    dfs(n+105, ok) 

dfs(0, False)
if ok: print(1)
else: print(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

x = int(input())

ok = False

def dfs(n, flg):
    global ok
    if ok: 
        return 
    if n == x:
        ok = True
        return
    if n > x:
        ok = False
        return
    dfs(n+100, ok) 
    dfs(n+101, ok) 
    dfs(n+102, ok) 
    dfs(n+103, ok) 
    dfs(n+104, ok) 
    dfs(n+105, ok) 

dfs(0, False)
if ok: print(1)
else: print(0)
Problem p03031 (python)

Fixed submission:
#!/usr/bin/env python

# input
n, m = map(int, input().split())
t = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
k = [t[i][0] for i in range(m)]
s = [t[i][1:] for i in range(m)]

# calc
# bit full search
ans = 0 
for i in range(2**n):
    tmp = i 
    sw = []
    if i == 0:
        sw = [0] 
    while tmp > 0:
        sw.append(tmp&1)
        tmp = tmp>>1
    while len(sw) < n:
        sw.append(0)

    #print('sw =', sw)
    
    # check whether current sw satisfies the condision.
    ok = True
    # light bulb j
    for j in range(m):
        tmp = 0 
        for a in range(k[j]):
            tmp += sw[s[j][a]-1]
        if tmp%2 != p[j]:
            ok = False
            break
    if ok: 
        # print('sw =', sw)
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

# input
n, m = map(int, input().split())
t = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
k = [t[i][0] for i in range(m)]
s = [t[i][1:] for i in range(m)]

# calc
# bit full search
ans = 0 
for i in range(2**n):
    tmp = i 
    sw = []
    if i == 0:
        sw = [0] 
    while tmp > 0:
        sw.append(tmp&1)
        tmp = tmp>>1
    while len(sw) < n:
        sw.append(0)

    #print('sw =', sw)
    
    # check whether current sw satisfies the condision.
    ok = True
    # light bulb j
    for j in range(m):
        tmp = 0 
        for a in range(k[j]):
            tmp += sw[a+1]
        if tmp%2 != p[j]%2:
            ok = False
            break
    if ok: 
        # print('sw =', sw)
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

# input
n, m = map(int, input().split())
t = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
k = [t[i][0] for i in range(m)]
s = [t[i][1:] for i in range(m)]

# calc
# bit full search
ans = 0 
for i in range(2**n):
    tmp = i 
    sw = []
    if i == 0:
        sw = [0] 
    while tmp > 0:
        sw.append(tmp&1)
        tmp = tmp>>1
    while len(sw) < n:
        sw.append(0)

    #print('sw =', sw)
    
    # check whether current sw satisfies the condision.
    ok = True
    # light bulb j
    for j in range(m):
        tmp = 0 
        for a in range(k[j]):
            tmp += sw[a+1]
        if tmp%2 != p[j]%2:
            ok = False
            break
    if ok: 
        print('sw =', sw) 
        ans += 1

print(ans)