akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> s(3);
  for (ll i = 0; i < 3; ++i) {
    cin >> s[i];
  }

  string t;
  cin >> t;

  vector<bool> used;
  vector<vector<ll>> dp(n, vector<ll>(3, -1));
  dp[0][0] = (t[0] == 's') ? s[0] : 0;
  dp[0][1] = (t[0] == 'p') ? s[1] : 0;
  dp[0][2] = (t[0] == 'r') ? s[2] : 0;
  used.push_back(true);
  for (ll i = 1; i < k; ++i) {
    if (t[i] == 's') {
      dp[i][0] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[0];
    } else if (t[i] == 'p') {
      dp[i][1] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[1];
    } else if (t[i] == 'r') {
      dp[i][2] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[2];
    }
    dp[i][0] = max(dp[i][0], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    dp[i][1] = max(dp[i][1], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    dp[i][2] = max(dp[i][2], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    used.push_back(true);
  }

  for (ll i = k; i < n; ++i) {
    if (t[i] == t[i-k] && used[i-k]) {
      dp[i][0] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]});
      dp[i][1] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]});
      dp[i][2] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]});
      used.push_back(false);
      continue;
    }

    if (t[i] == 's') {
      dp[i][0] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[0];
    } else if (t[i] == 'p') {
      dp[i][1] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[1];
    } else if (t[i] == 'r') {
      dp[i][2] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + s[2];
    }
    dp[i][0] = max(dp[i][0], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    dp[i][1] = max(dp[i][1], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    dp[i][2] = max(dp[i][2], max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}));
    used.push_back(true);
  }
  
  cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;
  
  return 0;
}

Measured memory_bytes: 5888
N=int(input())
alist=[0]+list(map(int,input().split()))
#print(alist)

blist=[0]*(N+1)
for i in reversed(range(1,N+1)):
  blist[i]=alist[i]
  for j in range(2*i,N+1,i):
    blist[i]+=blist[j]
  blist[i]%=2
  
#print(blist[1:])
answer_list=[i for i in range(1,N+1) if blist[i]==1]
print(len(answer_list))
print(*answer_list)

Measured memory_bytes: 14132
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

int main() {
  string s;
  cin >> s;
  if (s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll = long long int;

int main(void) {
    int a, b, c; cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {
	
	string s, t, r;
	
	cin >> s >> t >> r;
	
	cout << "A" << t[0] << "C" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }

int main()
{
  int N,M;
  cin >> N >> M;
  vint L(M);
  vint R(M);
  REP(i,M){
    cin >> L[i] >> R[i];
  }
  int l = L[0];
  int r = R[0];
  
  REP(i,M-1){
    l = max(l,L[i+1]);
    r = min(r,R[i+1]);
  }
  
  int ans = 0;
  if(l <= r){
    REP(i,N){
      if(l <= (i+1) && (i+1) <= r){
        ans++;
      }
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(void){
    int a;
    cin>>a;
    int sum=0;
    int r[200000],l[200000];
    for(int i=0;i<a;i++){
        cin>>r[i]>>l[i];
        sum+=l[i]-r[i]+1;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(ab[0]*ab[1]%2==0?"Even":"Odd");
        }
    }
}


Measured memory_bytes: 13268
function main()
    s = pread(String)
    cmax = 0
    c = 0
    for i in 1:3
        if s[i] == 'R'
            c += 1
        else
            c = 0
        end
        if c > cmax 
            cmax = c
        end
    end
    println(cmax)
end

import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str
isdelim(x::UInt8, xs::Set{UInt8}) = x in xs
const delimset = Set([0x0a, 0x20])

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        !isdelim(c, delims) && break
    end
    push!(out, c)
    eof(s) && return out
    while !eof(s)
        c = read(s, UInt8)
        isdelim(c, delims) && break
        push!(out, c)
    end
    return out
end

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

function readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}
    rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)
    for i in 1:len
        for j in 1:length(tys)
            @inbounds rv[j][i] = pread(tys[j])
        end
    end
    rv
end

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i in 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

main()

Measured memory_bytes: 184380
#include <iostream>
#include <vector>

using namespace std;
bool IsPrime[1300000];
vector<int> Prime;
vector<int> Sum;

void CalcPrime()
{
	for(int i = 0; i < 1300000; ++i)
	{
		IsPrime[i] = true;
	}
	IsPrime[0] = IsPrime[1] = false;
	for(int i = 2; i < 1300000; ++i)
	{
		if(IsPrime[i])
		{
			Prime.push_back(i);
			for(int j = 2 * i; j < 1300000; j += i)
			{
				IsPrime[j] = false;
			}
		}
	}
	int n = Prime.size();
	Sum.resize(n);
	Sum[0] = Prime[0];
	for(int i = 1; i < n; ++i)
	{
		Sum[i] = Prime[i] + Sum[i - 1];
	}
}

void solve()
{
	CalcPrime();
	int n;
	while(cin >> n, n)
	{
		cout << Sum[n - 1] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n;
long sum;
long k;
long a[505];
std::priority_queue<long> que;

int main(){
    scanf("%ld%ld", &n, &k);
    for(int i = 0; i < n; i++){
        scanf("%ld", a+i);
        sum += a[i];
    }
    for(long i = 1; i * i <= sum; i++){
        if(sum % i == 0){
            if(i*i == sum){
                que.push(i);
            }else{
                que.push(i);
                que.push(sum/i);
            }
        }
    }
    while(!que.empty()){
        long used = 0;
        std::vector<long> rem;
        long div = que.top();
        que.pop();
        //printf("Case:%ld\n", div);
        for(int i = 0; i < n; i++){
            rem.push_back(a[i] % div);
            used += a[i] / div;
        }
        std::sort(rem.begin(), rem.end());
        /*
        for(int i = 0; i < n; i++){
            printf("  %ld", rem[i]);
        }
        printf("\n");
        //*/
        long res = 0;
        for(int i = 0; i < n; i++){
            if(i < n-(sum/div - used)){
                res += rem[i];
            }else{
                res += div - rem[i];
            }
        }
        if(res <= k*2){
            printf("%ld\n", div);
            return 0;
        }
    }
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int P, Q, R; cin >> P >> Q >> R;
    cout << P + Q + R - max({P, Q, R}) << endl;
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
a=list(map(int,input().split()))
ans=0
tmp=0
sa=[0]*(N+1)
A=[0]*(N+1)
for i in range(N):
  sa[i+1]=sa[i]+a[i]
  if a[i]>0:
    A[i+1]=A[i]+a[i]
  else:
    A[i+1]=A[i]
for i in range(N-K+1):
  tmp=sa[i+K]-sa[i]
  tmp2=A[i]+(A[-1]-A[i+K])
  #print(max(0,tmp),tmp2)
  if max(0,tmp)+tmp2>ans:
    ans=max(0,tmp)+tmp2
print(ans)

Measured memory_bytes: 23664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int K = scan.nextInt();
		int X = scan.nextInt();
		for (int i = X - K + 1; i <= X + K - 1; i++) {
			System.out.print(i + " ");
		}
	}
}


Measured memory_bytes: 23636
Q, H, S, D = list(map(int, input().split()))
N = int(input())

# N が整数なので、整数リットルずつしか買えない。
# 0.25リットルと0.5リットルを1リットルあたりの価格に換算して、最小のものを S とする
S = min(4*Q, 2*H, S)

if D >= 2*S:
    ans = N * S
else:
    ans = N//2 * D + N%2 * S

print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

typedef long long int ll;
typedef unsigned long long int ull;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;

int main()
{_
    ll n,x=0,y=0;cin >> n;ll a[n];
    for(ll i = 0 ; i < n ; i++) cin >> a[i];
    sort(a,a+n);
    for(ll i = n - 1 ; i >=  0 ; i--)
        if(i%2 != n%2) x+=a[i];
        else y+=a[i];
	return cout << abs(x-y) , 0;
}
///SAliB


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int numberOfPerson = Integer.parseInt(scanner.nextLine());
        List<String> boss = Arrays.asList(scanner.nextLine().split(" "));
        Map<String, Integer> map = boss.stream().collect(
                Collectors.groupingBy(
                        Function.identity(),
                        Collectors.summingInt(s -> 1)
                )
        );
        for (int i = 1; i < numberOfPerson + 1; i++){
            if (map.containsKey(String.valueOf(i))) {
                System.out.println(map.get(String.valueOf(i)));
            }else {
                System.out.println(0);
            }
        }

    }
}

Measured memory_bytes: 89544
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n, c=0;
    cin >> n;

	int* arr1 = new int [n];
	int* arr2 = new int [n];

	for (int i=0; i<n; i++) {
		cin >> arr1 [i];
		arr2 [i] = arr1 [i];
	}

	sort (arr2, arr2+n);

	for (int i=0; i<n; i++) {
        if (arr1[i] != arr2[i]) {
            c++;
        }
	}

	if (c==0 || c==2) {
        cout << "YES" << endl;
	}
	else {
        cout << "NO" << endl;
	}

    return 0;
}


Measured memory_bytes: 3624
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
x=51
r=range(0,x**3,x)
for u,v,a,b in t[:m]:
 for i in r:D+=i+a*x+u,i+v,b,i+a*x+v,i+u,b
i=0
for c,d in t[m:]:
 i+=1
 for j in r:D+=j+i,j+c*x+i,d
d=csgraph.dijkstra(csr_matrix((D[2::3],(D[::3],D[1::3])),[j*2]*2),1,min(x*x,s)*x+1)
for i in range(2,n+1):print(int(min(d[i::x])))

Measured memory_bytes: 126788
def init_load(ipt):
    return "".join(sorted([x for x in ipt]))

# load
n = int(input())
s = [init_load(input()) for _ in range(n)]


dictS = {}
for new_st in s:
    if new_st in dictS:
        dictS[new_st] += 1
    else:
        dictS[new_st] = 1

ans = sum([int(x * (x - 1) / 2) for x in dictS.values()])
print(ans)

Measured memory_bytes: 72920
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define all x.begin(),x.end()
#define MAX 200005

bool vis[25][25];
ll dis[25][25];
ll n, m;
char mat[25][25];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};

ll bfs(ll x, ll y)
{
	memset(vis,0,sizeof vis);
	memset(dis,0,sizeof dis);

	ll ans=0;

	vis[x][y]=1;
	queue<pair<ll,ll>> q;
	q.push({x,y});
	dis[x][y]=0;

	while(!q.empty())
	{
		ll px= q.front().first;
		ll py= q.front().second;
		q.pop();

		for(int i=0;i<4;i++)
		{
			ll nx= px+dx[i];
			ll ny= py+dy[i];

//			cout << "from " << x <<  " - " << y <<  " = " << dis[nx][ny] << endl;

			if(nx>=0 && ny>=0 && nx<n && ny<m)
			{
				if(!vis[nx][ny] && mat[nx][ny]!='#')
				{
					vis[nx][ny]=1;
					dis[nx][ny]=1+dis[px][py];
					ans=max(ans,dis[nx][ny]);
					q.push({nx,ny});
				}
			}
		}
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(NULL);
	cin.tie(0); cout.tie(0);

	cin >> n >> m;

	for(int i=0;i<n;i++)
	{
		cin >> mat[i];
	}

	ll ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(mat[i][j]=='.')
			ans=max(ans,bfs(i,j));
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N=int(input())
state=[]
for j in range(N):
    A=int(input())
    temp=[]
    for i in range(A):
        temp.append(tuple(map(int, input().split())))
    state.append(temp)


OK=[]
for i in range(2**N):
    conflict=0
    for person in range(N): #各人の発言を評価
        for one_state in state[person]:
            if ((i >> (one_state[0]-1)) & 1): #正直者に対して
                if (i >> person) & 1 and one_state[1] == 0:
                    conflict=1
            else: #不親切に対して
                if (i >> person) & 1 and one_state[1]==1:
                    conflict=1
    if conflict==0:
        OK.append(i)
#print(OK)

num=[]
for el in OK:
    count=0
    for j in range(N):
        if (el >> j) & 1:
            count+=1
    num.append(count)
#print(num)
print(max(num))



Measured memory_bytes: 43500
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
#define forn(a, n) for(int a = 0; a<(int) (n); ++a)
#define rforn(a, n) for(int a = (n)-1; a>=0; --a)
using namespace std;
const int N = 6e5+20;

int main()
{
    int n, m;
    cin>>n>>m;
    
    if(n<2 || m<2) cout<<0<<endl;
    else
    {
        cout<<(n-1)*(m-1)<<endl;
    }
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  int cnt = 0;
  rep(i, n) if(a[i] >= (sum + 4 * m - 1) / (4 * m)) cnt++;
  if(cnt >= m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>

int main()
{
	int n, m, x;
	std::cin >> n >> m >> x;
	
	int left, right;
	left = right = 0;
	int a;
	for (int i = 0; i < m; i++) {
		std::cin >> a;
		(*(x < a ? &left : &right))++;
	}
	
	std::cout << std::min(left, right) << std::endl;
	
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;


int main() {
    int n; cin >> n;
    ll k; cin >> k;
    V<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    ll ans = 0;
    ll tmp = (k * (k - 1) / 2) % MOD;
    for(int i = 0; i < n; i++){
        int f = 0, b = 0;
        for(int j = 0; j < i; j++){
            if(a[i] > a[j]) f++;
        }
        for(int j = i + 1; j < n; j++){
            if(a[i] > a[j]) b++;
        }
        ans = (ans + (b * k) + ((b + f) * tmp)) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;

//Marathon Match
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int L = sc.nextInt();
		long[][] comb = new long[51][51];
		comb[0][0] = comb[1][0] = comb[1][1] = 1;
		for(int i=2;i<=50;i++){
			comb[i][0] = comb[i][i] = 1;
			for(int j=1;j<i;j++)comb[i][j] = comb[i-1][j-1]+comb[i-1][j];
		}
		double[] p = new double[n];
		int[] t = new int[n];
		double[] v = new double[n];
		for(int i=0;i<n;i++){
			p[i] = sc.nextDouble()/100.0;
			t[i] = sc.nextInt();
			v[i] = sc.nextDouble();
		}
		double[][] time = new double[n][m+1];
		double[][] pp = new double[n][m+1];
		for(int i=0;i<n;i++){
			double r = L/v[i];
			for(int j=0;j<=m;j++){
				time[i][j] = j*t[i] + r;
				pp[i][j] = comb[m][j]*Math.pow(p[i], j)*Math.pow(1-p[i], m-j);
			}
		}
		for(int i=0;i<n;i++){
			double exp = 0;
			for(int j=0;j<=m;j++){
				double e = pp[i][j];
				for(int k=0;k<n;k++){
					if(i==k)continue;
					double ee = 0;
					for(int l=0;l<=m;l++){
						if(time[i][j]+1e-8<time[k][l])ee += pp[k][l];
					}
					e *= ee;
				}
				exp += e;
			}
			System.out.printf("%.6f\n", exp);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
n, k = map(int, input().split())
ans = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        ans[a[j]-1] += 1
counter = 0
for i in ans:
    if i == 0:
        counter += 1
print(counter)


Measured memory_bytes: 67580
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	cin >> N;
	vl A(N);
	vl B(N + 1);	
	for (i = 0; i < N; i++) {
		cin >> A[i];
		if (i > 0)	B[i] = B[i - 1] + A[i];
		else B[0] = A[0];
	}
	//debug(B);
	//最初が正パターン
	ll sum = 0;
	ll pre1 = 0;
	for (i = 0; i < N; i++) {
		if(i%2==0 && B[i]+sum<=0){
			pre1 += 1 - (B[i] + sum);
			sum += 1 - (B[i] + sum);
		}
		else if(i % 2 == 1 && B[i] + sum >= 0){
			pre1 += (B[i] + sum) + 1;
			sum -= (B[i] + sum) + 1;
		}
	}
	sum = 0;
	ll pre2 = 0;
	for (i = 0; i < N; i++) {
		if (i % 2 == 1 && B[i] + sum <= 0) {
			pre2 += 1 - (B[i] + sum);
			sum += 1 - (B[i] + sum);
		}
		else if (i % 2 == 0 && B[i] + sum >= 0) {
			pre2 += (B[i] + sum) + 1;
			sum -= (B[i] + sum) + 1;
		}
	}
	cout << min(pre1, pre2);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i)
#define ALL(c) (c).begin() , (c).end()
#define LL long long
#define int LL
#define inf  (1LL << 60)
#define mod 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
#define lower lower_bound
#define upper upper_bound
#define ZERO(c,n) memset(&c[0],0,sizeof(int)*n)
#define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n
#define pl(a) cout << ""#a": " << a << endl;
#ifdef _DEBUG
#define debug_io fstream cin("input.txt");ofstream cout("output.txt");
#else
#define debug_io ;
#endif
#define debug_input debug_io
#define DOWN(T) std::greater<T>()
template<class T>void scan(vector<T>& a, int n, istream& cin)
{
	T c; REP(i, n) { cin >> c; a.push_back(c); }
}
using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>;
using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>;
using vpii = vector<pii>;
template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; }
int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 };
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------



signed main()
{
	QUICK_CIN;
	debug_input;

	int x, y;
	cin >> x >> y;

	if (abs(x - y) <= 1) {
		cout << "Brown" << endl;
	}
	else {
		cout << "Alice" << endl;
	}

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	void submit() {
		HashMap<Integer, Integer> set = new HashMap<>();
		int n = nextInt();
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			set.merge(x, 1, Integer::sum);
		}
		
		int m = nextInt();
		for (int i = 0; i < m; i++) {
			int x = nextInt();
			int prev = set.getOrDefault(x, 0);
			if (prev == 0) {
				out.println("NO");
				return;
			}
			set.put(x, prev - 1);
		}
		out.println("YES");
	}

	void preCalc() {

	}

	void stress() {

	}

	void test() {

	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}


Measured memory_bytes: 81024
n=gets.to_i
s=gets.split.map &:to_i
h1=Hash.new(0);h2=Hash.new(0)
for i in 0...n
 i.even? ? h1[s[i]]+=1:h2[s[i]]+=1
end
ans1=h1.sort_by{|k,v|-v}.shift(2)
ans2=h2.sort_by{|k,v|-v}.shift(2)
ans1 << [0,0]
ans2 << [0,0]
if ans1[0][0]==ans2[0][0]
  puts n-([ans1[0][1]+ans1[1][1],ans2[0][1]+ans2[1][1]].max)
else
  puts n-ans1[0][1]-ans2[0][1]
end


Measured memory_bytes: 26800
#include <bits/stdc++.h>  

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    set<int> se;
    rep(i, n) {
        int d;
        cin >> d;
        se.insert(d);
    }
    cout << se.size() << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(){
  int n, t_res=0, h_res=0, i, j;
  char tcard[128], hcard[128];

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s%s", tcard, hcard);

    if(strcmp(tcard,hcard)==0){
      t_res++;
      h_res++;
    }else if(strcmp(tcard,hcard)>0){
      t_res+=3;
    }else{
      h_res+=3;
    }
  }
  
  printf("%d %d\n", t_res, h_res);
  
  return 0;
}

Measured memory_bytes: 604
//   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
// ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
//■■■■■■■■■■■■■---■■■■■■■■■■------■■■■■■■■■■■■■
//■■■■■■■■■■■■ ■■■ ■■■■■■■■ ■■■■■■ ■■■■■■■■■■■■
//■■■■■■■■■■■ ■■■■■ ■■■■■■ ■■■■■■■■■■■■■■■■■■■■
//■■■■■■■■■■---------■■■■■ ■■■■■■■■■■■■■■■■■■■■
//■■■■■■■■■■ ■■■■■■■ ■■■■■ ■■■■■■■■■■■■■■■■■■■■
//■■■■■■■■■■ ■■■■■■■ ■■■■■■ ■■■■■■ ■■■■■■■■■■■■
//■■■■■■■■■■ ■■■■■■■ ■■■■■■■------■■■■■■■■■■■■■
// ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
//   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a;
	cin>>a;

	if(a<=999)cout<<"ABC";
	else cout<<"ABD";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
	int n, d, min = 101, c = 0;
	vector<int> v;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d;
		v.push_back(d);
	}
	sort(v.begin(), v.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		if (v[i] < min) {
			min = v[i];
			c++;
		}
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

//今日のコンテストはまたゴミクズだったなぁ

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();

	int kotae = 0;
	int kari = 0;
	int mae = 0;
	rep(i, N) {
		int h = getint();
		if (mae >= h) kari++;
		else kari = 0;

		kotae = max(kotae, kari);
		mae = h;
	}

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
k = int(input())
import sys
i = 1
amari = 7%k
ama = 7%k
while True:
    if amari%k ==0:
        print(i)
        sys.exit()
    else:
        ama = (ama*10)%k
        amari += ama
        i +=1
    if i == k+1:
        break
print(-1)
    


Measured memory_bytes: 9168
k=int(input())
ans=7
ans2=10
prev=7
hbe=False
if ans%k==0:
    print(1)
    hbe=True
else:
    for i in range(0, k + 1, 1):
        ans=(7*ans2+prev)%k
        if ans%k==0:
            print(i+2)
            hbe=True
            break
        prev=ans
        ans2=(ans2*10)%k
if hbe==False:
    print(-1)



Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll ZERO = 0;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int main() {
    ll A,B;
    cin >> A >> B;
    A--;
    ll P = 2;
    ll ret = 0;
    for(int i = 0;i < 60;i++) {
        ll Z = 0;
        ll a, b;
        if(B % P == 0) {
            b = (B / P) * (P / 2);
        }
        else {
            b = (B / P) * (P / 2) + max(B % P - P / 2 + 1, Z);
        }
        if(A % P == 0) {
            a = (A / P) * (P / 2);
        }
        else {
            a = (A / P) * (P / 2) + max(A % P - P / 2 + 1, Z);
        }
        ret += (b - a) % 2 * (P / 2);
        P *= 2;
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[100005][2],a[100005];
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	if(a[1]!=0) dp[1][1]=(a[1]-1ll)/2ll;
	else dp[1][1]=-1e9;
	dp[1][0]=a[1]/2ll;
	for(int i=2;i<=n;i++){
		if(a[i]==0ll) dp[i][1]=-1e9,dp[i][0]=dp[i-1][0];
		else{
			dp[i][1]=(a[i]-1ll)/2ll+dp[i-1][0];
			if(a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll);
			dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll);
		}
	}
	cout<<dp[n][0]<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
struct node
{
    char a[10];
    int b;
}array[2];

int main()
{
    char e[10];
    scanf("%s",array[0].a);
    scanf("%s",array[1].a);
    scanf("%d",&array[0].b);
    scanf("%d",&array[1].b);
    scanf("%s",e);
    if(strcmp(array[0].a,e)==0)
    {
        array[0].b-=1;
    }
    else
    {
        array[1].b-=1;
    }
    printf("%d %d",array[0].b,array[1].b);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int N; cin >> N;

	string s,t; cin >> s >> t;

	string ans = "";
	for (int i = 0; i < N; i++) {
		ans += s[i];
		ans += t[i];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

int main() {
	int a,b;
	cin >> a >> b;
	if(a>=13) cout << b;
	else if(6 <= a && a<=12) cout << b/2;
	else cout << '0';
	return(0);
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
import java.util.List;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
        int K = sc.nextInt();
        String[] D = new String[K];

        for(int i=0; i<K; i++){
            D[i] = sc.next();
        }

        for(int i=N; i<=N*10; i++){
            String[] s = String.valueOf(i).split("");
            for(int j=0; j<K; j++){
                if(Arrays.asList(s).contains(D[j])){
                    break;
                }
                if(j==K-1){
                    String a = "";
                    for(int k=0; k<s.length; k++){
                        a += s[k];
                    }
                    System.out.println(a);
                    return;
                }
            }
            
        }
        
    }
}

Measured memory_bytes: 54488
#include<bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

int n, a[N];

int main(void) {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) scanf("%d", &a[i]);
	
	int ans = 0;
	sort(a + 1, a + 1 + n); reverse(a + 1, a + 1 + n);
	for (int i = 1; i <= n; ++ i) {
		if (i >= a[i + 1]) {
			for (int j = i + 1; a[j] == i; ++ j) ans ^= 1;
			ans |= (a[i] - i) & 1;
			puts(ans ? "First" : "Second");
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter

    n, a = map(int, readline().split())
    x = list(map(int, readline().split()))

    ans = 0
    counter = Counter()

    counter[0] += 1
    for i in range(n):
        cur = a - x[i]
        counter_next = Counter()
        for key, val in counter.items():
            counter_next[key] += val
            counter_next[cur + key] += val
        counter = counter_next

    print(counter[0] - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  int d=0;
  for(int i=0;i<=50000;i++){
    int y=(int)(i*1.08);
    if(y==n){
      cout<<i<<endl;
      d++;
      break;
    }
  }
  if(d==0) cout<<":("<<endl;
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,ma=1;

int moe(int a,int b)
{
    if (b==0) return 1;
    if (b%2==0) return moe(a*a,b/2);
    return a*moe(a*a,b/2);
}

void process()
{
    int k=log2(n),x=2;
    while (k>=2)
    {
        while (moe(x,k)>n)
            k--;
        ma=max(ma,moe(x,k));
        x++;
    }
    cout<<ma;
}

int main()
{
    scanf("%d",&n);
    process();
    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007LL
#define endl '\n'
using namespace std;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	ll n,a,b,ans=0;
	cin>>n>>a>>b;
	for(ll i=1;i<=n;i++){
		string str=to_string(i);
		ll cnt=0;
		for(char j:str)	cnt+=j-'0';
		if(a<=cnt&&cnt<=b)	ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int liner(int A[],int b, int c){
	A[b]=c;
	int i=0;
	while(A[i] != c) i++;
	return i != b ;
}

int main(){
	int n,c,A[10000+1],b,sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	scanf("%d",&b);
		for(int i=0;i<b;i++){
				scanf("%d",&c);

			if (liner(A,n,c)) sum +=1;
			}

	printf("%d\n",sum);

	return 0;
}

Measured memory_bytes: 2752
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++) cin >> a[i];

  int ans = 1;
  for(int i = 0; i < N; i++) ans *= 3;
  int c = 1; //全部奇数の選び方
  for(int i = 0; i < N; i++){
    if(a[i] % 2 == 0){
      c *= 2;
    } else {
      c *= 1;
    }
  }

  cout << ans - c << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long n = scanner.nextLong();
        List<Long> list = new ArrayList<>();
        long sum = 0;
        Map<Long, Long> distmap = new HashMap<>();

        for (long i = 0; i < n; i++) {
            long a = scanner.nextLong();
            list.add(a);
            if (!distmap.containsKey(a)) {
                distmap.put(a, 0L);
            }
            distmap.put(a, distmap.get(a) + 1);
            sum += a;
        }

        long q = scanner.nextLong();

        for (long i = 0; i < q; i++) {
            long b = scanner.nextLong();
            long c = scanner.nextLong();
            long diff = c - b;

            long bfreq = distmap.getOrDefault(b, 0L);
            long cfreq = distmap.getOrDefault(c, 0L);

            if (bfreq == 0) {
                System.out.println(sum);
                continue;
            }
            distmap.put(b, 0L);
            distmap.put(c, cfreq + bfreq);
            sum = sum + (diff * bfreq);
            System.out.println(sum);
        }

    }
}

Measured memory_bytes: 68808
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int N,K;
inline void solve(){
  IN2(N,K);
  OUT(N%K?1:0);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int T;
    cin >>T;
    string str = "ACL";
    for(int i = 0; i<T;i++)
    {
        cout <<str;
    }
    
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string S, T;
	cin >> S >> T;
	N = S.size();
	int ans = 0;
	rep(i, N) if (S[i] != T[i]) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3924
leap = []
(1...3000).each do |n|
  case
    when n % 400 == 0;
    when n % 100 == 0; next
    when n % 4 != 0; next
  end
  leap << n
end

while gets
  a, b = $_.split.map(&:to_i)
  break if a == 0 && b == 0
  puts if $<.lineno > 1

  ret = leap.each_with_object([]) do |n, o|
    break o if n > b
    next if n < a
    o << n
  end

  puts (ret.length == 0 ? "NA" : ret)
end

Measured memory_bytes: 6124
#include<iostream>

using namespace std;

int power(int n){
  int c = 1;
  for(int i = 0; i < n; i++)
  { c *= 2;}
  return c;}
  

int main(){
  int N,M ; cin >> N >> M;
  
  int t = 1900*M + 100*(N - M);
  
  int s = power(M); cout << s * t << endl;
  
  return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    s = input().rstrip()
    ans = ""
    for i in range(len(s)):
        if s[i] in ["0", "1"]:
            ans += s[i]
        else:
            ans = ans[:-1]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
z[2002],*a=z,*b=z+999,j,m,k,t,i;main(n){for(;m=scanf("%d",&n)-++n;printf("%d\n",m))for(i=n;i--;j=a,a=b,b=j)for(j=n;j--;m<k?m=k:0)b[j]=k=n+~i&&getchar()>45?fmin(t=a[j],t<k?t:k)+1:0;}

Measured memory_bytes: 0
import java.util.*;
import java.lang.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();       
        
        int res = 0;
        res = res + Math.min(A,B);
        res = res + Math.min(C,D);
        System.out.println(res);
    }
}

Measured memory_bytes: 21844
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        //return process2(input);

        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var k = long.Parse(spl[1]);

        var aa = ToIntArray(input.ReadLine(), n);
        SetArray(aa, (v, i) => v - 1);

        int idx = 0;

        while (true) {
            var z = 1L;
            var bb = CloneArray(aa);

            while (true) {
                if (z * 2 > k) break;

                var cc = new int[n];
                for (int i = 0; i < n; i++) {
                    cc[i] = bb[bb[i]];
                }
                bb = cc;
                z *= 2;
            }

            idx = bb[idx];
            k -= z;
            //Console.WriteLine(k);

            if (k == 1) return aa[idx] + 1;
            if (k == 0) return idx + 1;
        }
    }

    static T[] CloneArray<T>(T[] source) {
        var ret = new T[source.Length];
        for (int i = 0; i < source.Length; i++)
            ret[i] = source[i];
        return ret;
    }
    static void SetArray<T>(T[] array, Func<T, int, T> f) {
        for (int i = 0; i < array.Length; i++)
            array[i] = f(array[i], i);
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }


    static object process2(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var k = long.Parse(spl[1]);

        var aa = ToIntArray(input.ReadLine(), n);

        var hash = new HashSet<int>();
        var list = new List<int>();

        int i = 0;

        while (true) {
            if (k == 0) {
                return i + 1;
            }
            if (hash.Contains(i)) {
                var ll = new List<int>();
                bool sw = false;
                for (int z = 0; z < list.Count; z++) {
                    var v = list[z];
                    if (v == i) {
                        sw = true;
                    }
                    if (sw) ll.Add(v);
                }

                return ll[(int)(k % (long)ll.Count)] + 1;
            }

            list.Add(i);
            hash.Add(i);
            k--;
            i = aa[i] - 1;
        }
    }
}


Measured memory_bytes: 102756