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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll n,m;
vector<ll>  x[200],d[200];

ll get_cost(int a,int b,int c, int d_){
    if(a == 0) return 0;
    if(c == n+1) return 0;
    return (d[a][b]+d[c][d_])*abs(x[a][b]-x[c][d_]);
}

ll dp[200][200][10];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
    cin >> n >> m;
    if(n == 0) break;
    
    for(int i = 0;i < 200;i++){
        x[i] = vector<ll>(0);        d[i] = vector<ll>(0);

    }

    x[0].push_back(0);
    x[n+1].push_back(0);

    for (int i = 1;i <= n;i++){
        ll k; cin >> k;
        for (int j = 0;j < k;j++){
            ll x_,d_; cin >> x_ >> d_;
            x[i].push_back(x_);
            d[i].push_back(d_);
        }
    }

    for (int i = 0;i < 200;i++){
        for (int j = 0;j < 200;j++){
            for (int k = 0;k < 10;k++){
                dp[i][j][k] = LLONG_MAX;
            }
        }
    }

    dp[0][m][0] = 0;

    for (int i = 0;i <= n;i++){
        for (int j = 0;j <= m;j++){
            for (int k = 0;k < x[i].size();k++){
                if(dp[i][j][k] == LLONG_MAX) continue;
                //cout << i << " " << j << " " << k << endl;
                if(i != n && j != 0){
                    for (int l = 0;l < x[i+2].size();l++){
                        dp[i+2][j-1][l] = min(dp[i+2][j-1][l],dp[i][j][k]+get_cost(i,k,i+2,l));
                    }
                }
                for (int l = 0;l < x[i+1].size();l++){
                    dp[i+1][j][l] = min(dp[i+1][j][l],dp[i][j][k]+get_cost(i,k,i+1,l));
                }
            }
        }
    }

    ll ans = LLONG_MAX;
    for (int i = 0;i <= m;i++){
        ans = min(dp[n+1][i][0],ans);
    }

    cout << ans << endl;
    }

    return 0;

}


Measured memory_bytes: 6352
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

ll dp[310][310][310]={0};

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

  std::string s;
  std::cin>>s;

  ll k;
  std::cin>>k;

  ll n=s.size();

  rep(i,0,n)rep(j,0,k+1)dp[i][i][j]=0;
  rep(i,0,n)rep(j,0,k+1)dp[i][i+1][j]=1;

  rep(len,2,n+1){
    rep(i,0,n-len+1){
      if(s[i]==s[i+len-1]){
        rep(j,0,k+1){
          dp[i][i+len][j]=dp[i+1][i+len-1][j]+2;
        }
      }else{
        rep(j,0,k+1){
          chmax(dp[i][i+len][j],dp[i+1][i+len][j]);
          chmax(dp[i][i+len][j],dp[i][i+len-1][j]);
          if(j==0){
            chmax(dp[i][i+len][j],dp[i+1][i+len-1][j]);      
          }else{
            chmax(dp[i][i+len][j],dp[i+1][i+len-1][j]);      
            chmax(dp[i][i+len][j],dp[i+1][i+len-1][j-1]+2);
          }
        }
      }
    }
  }

  std::cout<<dp[0][n][k]<<"\n";

  return 0;
}

Measured memory_bytes: 225536
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  reverse(h.begin(), h.end());
  int ans = 0;
  int val = 0;
  for ( int i = 1; i < n; i++) {
    if(h[i-1] <= h[i]) val++;
    else val = 0;
    ans = max(ans, val);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
r, g, b, n = map(int, input().split())
ans = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        b2 = (n - (i * r + j * g)) / b
        if b2 >= 0 and b2 % 1 == 0:
            ans += 1
print(ans)

Measured memory_bytes: 40940
#include <iostream>
using namespace std;
int main() {
  int x;
  cin >> x;
  
  int a,b;
  a = 0;
  b = 0;
  while (1) {
    a += (360 + b) / x;
    b = (360 + b) % x;
    if (b == 0) break;
  }
  cout << a;
  
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  int a,b;
  cin>>a>>b;
  if(a+b>=10){
    cout<<"error"<<endl;
  }else{
    cout<<a+b<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// TYPEDEFS
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F first
#define S second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    ull A, B, N;
    cin >> A >> B >> N;
    cout << (A*MIN((B-1), N))/B << endl;
}

// Main

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

    int T = 1, t;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 3644
N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

imosA = [0]*(N+1)
imosB = [0]*(N+1)


for i in range(1, N+1):
    imosA[i] = A[i] + imosA[i-1]
    imosB[i] = B[i] + imosB[i-1]

ans = 0
for i in range(1, N+1):
    ans = max(ans, imosA[i] + imosB[N] - imosB[i-1])
print(ans)


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << endl;
    return 0;
}


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

using namespace std;
int main () {
    int size, i;
    int sum = 0;
    cin >> size;

    vector<int> nums(size);
    for (i=0; i < size; i++){
        cin >> nums[i];
        while(nums[i] % 2 == 0) {
            sum++;
            nums[i] = nums[i] / 2;
        }
    }

    cout << sum << endl;

}

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

int main()
{
        int n;
        cin>> n;
        int arr[n+1];
        for(int i =0;i< n+1;i++)
        {
                arr[i]= 0;
        }
        for(int i =0;i < (n-1); i++)
        {       
                int a;
                cin >> a;
                arr[a]++;
        }
        for(int i = 1; i<n +1; i++)
        {
                cout << arr[i]<<endl;
        }
        
}


Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
int main(){
    set<char>c;
    set<char>::iterator itr;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        c.insert(s.at(i));
    }
    if(c.size()==2){
        int check1=0;
        for(itr=c.begin();itr!=c.end();itr++){
            char ch=*itr;
            int check=0;
            for(int i=0;i<s.size();i++){
                if(ch==s.at(i)){
                    check++;
                }
            }
            if(check==2){
                continue;
            }
            else{
                check1++;
                cout<<"No"<<endl;
                return 0;
            }
        }
    if(check1==0){
        cout<<"Yes"<<endl;
    }

    }
    else{
        cout<<"No"<<endl;
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;

const long long MOD = 1000000007;

int main()
{
    string S;
    cin >> S;

    int n = S.size(), D = 13;

    long long dp[100001][13] = {}, num, m = 1, rest;

    dp[0][0] = 1;

    for(int k = 0; k < n; ++k){
        for(int d = 0; d < D; ++ d){
            if(S[n - 1 - k] == '?'){
                for(num = 0; num < 10; ++num){
                    rest = (d + num * m) % D;
                    dp[k + 1][rest] += dp[k][d];
                    dp[k + 1][rest] %= MOD;
                }
            }
            else{
                num = S[n - 1 - k] - '0';
                rest = (d + num * m) % D;
                dp[k + 1][rest] += dp[k][d];
                dp[k + 1][rest] %= MOD;
            }
        }
        m *= 10;
        m %= D;
    }

    cout << dp[n][5] << endl;
}


Measured memory_bytes: 13908
n,m = map(int,input().split())
vector = []
for i in range(m):
    a,b = map(int,input().split())
    vector.append([a,b])
    vector.append([b,a])
global kotae
kotae = 0
route =  [1]

def idou(route,vector):
    global kotae
    if len(route) == n:
        kotae += 1
        return 0
    for vec in vector:
        if vec[0] == route[-1] and vec[1] not in route:
            route.append(vec[1])
            idou(route,vector)
            route.remove(vec[1])
    return 0
    

idou(route,vector)
 
          
print(kotae)

Measured memory_bytes: 3064
#include<bits/stdc++.h> 
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
	ll n,w,i,j,ans=0;
	cin>>n>>w;
	ll val[n],wt[n],max1=0;
	for(i=0;i<n;i++)
	{
		cin>>wt[i]>>val[i];
		max1=max(max1,val[i]);
	}
	ll dp[n+1][max1*n+1];
	//cout<<"hi";
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=max1*n;j++)
		{
			dp[i][j]=INT_MAX;
			if(j==0)
			dp[i][j]=0;
			else if(i==0||j==0)
			dp[i][j]=INT_MAX;
			else if(j>=val[i-1])
			{
				dp[i][j]=min(wt[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
				if(dp[i][j]<=w)
				ans=max(ans,j);
			}
			else
			{
				dp[i][j]=dp[i-1][j];
				if(dp[i][j]<=w)
				ans=max(ans,j);
			}
			//cout<<ans<<endl;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

int main() {
    ll N, ans = 1;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
        if (A.at(i) == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i = 0; i < N; i++){
        if (1000000000000000000 / ans < A.at(i)){
            cout << -1 << endl;
            return 0;
        }
        else {
            ans *= A.at(i);
        }
        if (ans == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3980
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		Map<Integer, Integer> map = new HashMap<>();
		
		int min = Integer.MAX_VALUE;
		
		int chk = 0;
		int idx = 0;
		
		for(int i = 0; i < n; i++) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			
			if(chk < a) {
				chk = a;
				idx = b;
			}
			
			
			map.put(a,b);
			
		}
		
		System.out.println(chk+idx);
		
	}

}


Measured memory_bytes: 100008
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Program {

    static void Main(string[] args) {
        var n = int.Parse(Console.ReadLine());
        var h = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var dp = new long[100010];
        for (var i = 0; i < 100010; i++) {
            dp[i] = long.MaxValue;
        }
        dp[0] = 0;
        for (var i = 1; i < n; i++) {
            dp[i] = Math.Min(dp[i], dp[i - 1] + Math.Abs(h[i] - h[i - 1]));
            if (i > 1) dp[i] = Math.Min(dp[i], dp[i - 2] + Math.Abs(h[i] - h[i - 2]));
        }
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Console.WriteLine(dp[n - 1]);
        Console.Out.Flush();
    }
}

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

int main() {

	string A,B,C;
	cin>>A>>B>>C;
  A.push_back('w');  B.push_back('w');  C.push_back('w');
  char turn ='a';
	int a=0,b=0,c=0;
 while(true){
  if(turn=='a'){
    if(A.at(a)=='w'){cout<<'A'<<endl;break;}
    turn = A.at(a); a++; }
   if(turn=='b'){
    if(B.at(b)=='w'){cout<<'B'<<endl;break;}
    turn = B.at(b); b++; }
   if(turn=='c'){
    if(C.at(c)=='w'){cout<<'C'<<endl;break;}
    turn = C.at(c); c++; }
 }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans,cnt,c[1<<17],d[1<<17];
vector<int>G[1<<17];
void dfs(int now,int prev){
	d[now]=c[++cnt];
	for(auto e:G[now])if(e!=prev)dfs(e,now);
}
int main(){
	scanf("%d",&n);
	for(int i=1,x,y;i<n;i++)scanf("%d%d",&x,&y),G[x].push_back(y),G[y].push_back(x);
	for(int i=1;i<=n;i++)scanf("%d",&c[i]);
	sort(c+1,c+n+1),reverse(c+1,c+n+1);
	for(int i=2;i<=n;i++)ans+=c[i];
	printf("%d\n",ans);
	dfs(1,0);
	for(int i=1;i<=n;i++)printf("%d ",d[i]);
}


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

int main(){
    long long a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;
    if(v - w > 0 && abs(a - b) / (long double)abs(v - w) <= t)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3636
<?php

fscanf(STDIN, "%s", $str);
$result = "";
for ($i=0; $i < strlen($str); $i++)
{ 
	if(substr($str, $i, 1) == 1)
	{
		$result = $result."9";
	}
	else
	{
		$result = $result."1";
	}
}

echo($result);

Measured memory_bytes: 4084
#![allow(unused)]

use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};
use std::{cmp, collections, fmt, io, iter, ops, str};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($args: tt)*) => { eprintln!($fmt, $($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt:expr) => {};
    ($fmt:expr, $($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let n = parse_word::<i64>();
    let k = parse_word::<i64>();

    let mut ans = 0;

    for b in 1..(n + 1) {
        // n = pb + r
        let p = n / b;
        let r = n % b;

        ans += p * cmp::max(0, b - k) + cmp::max(0, r - k + 1);

        // exclude a = 0
        if k == 0 {
            ans -= 1;
        }
    }

    println!("{}", ans);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  
  double n;
  scanf("%lf",&n);
  while(n >= 0){
    char c[20]={""};
    for(double i=128;i>=0.0625;i=i/2){
      if(n >= i){
	n -= i;
	strcat(c,"1");
      } else strcat(c,"0");
      if(i == 1) strcat(c,".");
    }
    
    if(n == 0.00000) printf("%s\n",c);
    else printf("NA\n");
    scanf("%lf",&n);
  }
  return (0);
}

Measured memory_bytes: 2724
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

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

	vector<int> costs;

	vector<int> previousHeights;

	int currentHeight = 0;

	// Fisrt stone is set to 0
	cin >> currentHeight;
	previousHeights.push_back(currentHeight);
	costs.push_back(0);

	for (int i = 1; i < N; i++) {
		cin >> currentHeight;
		int oneStepCost = abs(previousHeights[i - 1] - currentHeight) + costs[i - 1];
		costs.push_back(oneStepCost);
		for (int j = 1; j < K; j++) {
			if (i - j - 1 < 0) break;
			else {
				int heightDiff = abs(previousHeights[i - j - 1] - currentHeight);
				if (heightDiff + costs[i - j - 1] < costs[i]) costs[i] = heightDiff + costs[i - j - 1];
			}
		}

		previousHeights.push_back(currentHeight);
	}
	cout << costs[costs.size() - 1];
}

Measured memory_bytes: 1276
N,M=map(int,input().split())
A=set([int(input()) for __ in range(M)])
ans=[0]*(N+1)
ans[0] = 1

if 1 in A:
    ans[1]=0
else:
    ans[1]=1

for n in range(N+1):
    if n>1:
        if n-1 in A and n in A:
            print(0)
            break
        elif n in A:
            ans[n]=0
        else:
            ans[n]=(ans[n-1]+ans[n-2]) % 1000000007
else:
    print(ans[N])


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

class Program
{
    static void Main(string[] args)
    {
        var nd = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var n = nd[0];
        var d = nd[1];

        long ans = 0;

        for(int i = 0; i < n; i++)
        {
            var xy = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var dis = Math.Sqrt((xy[0] * xy[0]) + (xy[1] * xy[1]));
            if (dis <= d) ans++;
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 41224
#include <iostream>
 
u_int getDigit(u_int n){
    u_int digit = 0;
     
    while(n > 0){
        n /= 10;
        ++digit;
    }
     
    return digit;
}
   
int main(){
    u_int a, b;
     
    while(std::cin >> a >> b){
        std::cout << getDigit(a + b) << std::endl;
    }
     
    return 0;
}

Measured memory_bytes: 2952
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define mp make_pair
#define pb push_back
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
  	int N;cin>>N;
    vector<string>T;
    vector<string>E;
    bool rev=false;
    REP(i,N){
        string S;cin>>S;
        if(rev){
            T.pb(S);
            rev=false;
        }
        else{
            E.pb(S);
            rev=true;
        }
    }
    if(rev){
        reverse(E.begin(),E.end());
        REP(i,E.size())cout<<E[i]<<" ";
        REP(i,T.size())cout<<T[i]<<" ";
    }
    else{
        reverse(T.begin(),T.end());
        REP(i,T.size())cout<<T[i]<<" ";
        REP(i,E.size())cout<<E[i]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 15976
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long;
using namespace std;

int main() {
    int n;
    cin >> n;

    float ans = 0;
    rep(i, n) {
        float a;
        cin >> a;
        ans += 1 / a;
    }

    cout << 1 / ans << endl;
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.Tenka2018
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var valids = new List<int>();
            int val = 1;
            int d = 2;
            valids.Add(1);
            while (val <= n)
            {
                val += d;
                valids.Add(val);
                d++;
                //Console.WriteLine(valids[valids.Count - 1]);
            }
            int index = valids.BinarySearch(n);
            if (index < 0)
            {
                Console.WriteLine("No");
                return;
            }
            Console.WriteLine("Yes");
            if (index == 0)
            {
                Console.WriteLine(2);
                Console.WriteLine("1 1");
                Console.WriteLine("1 1");
            }
            else
            {
                Console.WriteLine(2 + index);
                List<List<int>> vals = new List<List<int>>();
                vals.Add(new List<int>());
                vals[0].Add(1);
                vals[0].Add(2);
                vals.Add(new List<int>());
                vals[1].Add(1);
                vals[1].Add(3);
                vals.Add(new List<int>());
                vals[2].Add(2);
                vals[2].Add(3);
                for(int i = 2; i <= index; i++)
                {
                    vals.Add(new List<int>());
                    //Console.WriteLine(vals.Count);
                    for(int j = valids[i - 1] + 1; j <= valids[i]; j++)
                    {
                        vals[j - valids[i - 1] -1].Add(j);
                        vals[vals.Count - 1].Add(j);
                    }
                }
                for(int i = 0; i < vals.Count; i++)
                {
                    Console.Write(vals[i].Count + " ");
                    for(int j = 0; j < vals[i].Count; j++)
                    {
                        Console.Write(vals[i][j] + " ");
                    }
                    Console.WriteLine();
                }
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 18384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);++i)
#define erep(i,j,n) for(int i=(j);i<=(n);++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n, m;
	cin >> n >> m;
	vs a(n), b(m);
	rep(i, 0, n) {
		cin >> a[i];
	}
	rep(i, 0, m) {
		cin >> b[i];
	}
	erep(i, 0, n - m) {
		erep(j, 0, n - m) {
			bool can = true;
			rep(k, 0, m) {
				rep(l, 0, m) {
					if (a[i + k][j + l] != b[k][l]) can = false;
				}
			}
			if (can) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int	main()
{
	int	N;
	int	A[200001];
	int	max, second;

	max = 0;
	second = 0;
	scanf("%d\n", &N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d\n", &A[i]);
		if (A[i] > max)
		{
			second = max;
			max = A[i];
		}
		else if (A[i] > second)
			second = A[i];
	}
	for (int i = 0; i < N; i++)
	{
		if (A[i] != max)
			printf("%d\n", max);
		else
			printf("%d\n", second);
	}
	return (0);
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vvchar vector<vector<char>>
#define vchar vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int k; cin >> k;
    int x=7%k;
    map<int,int> map;
    int cnt=1;
    for(;;){
        if(map[x]==1){
            cout<<-1<<endl;
            return 0;
        }
        if(x==0){
            cout<<cnt<<endl;
            return 0;
        }
        map[x]=1;
        x=(x*10+7)%k;
        cnt++;
    }
}

Measured memory_bytes: 66124
#include<bits/stdc++.h>
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define fi first
#define se second
#define inf 1000000000
#define mod 1000000007
using namespace std;
template <typename T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <typename T> void chmin(T &x,T y){x=x<y?x:y;return;}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;

int n,ans;

int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
		for(int j=1;i*j<n;j++)
		{
			ans++;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<string>
#define int long long
using namespace std;

signed main() {
	int a, b;
	while (cin >>b>>a, a | b) {
		vector<vector<int>>cost(a, vector<int>(a, 2147483647));
		vector<vector<int>>time(a, vector<int>(a, 2147483647)); 
		for (int c = 0; c < b; c++) {
			int d, e, f, g;
			cin >> d >> e >> f >> g;
			d--; e--;
			cost[d][e] = cost[e][d] = f;
			time[d][e] = time[e][d] = g;
		}
		for (int h = 0; h < a; h++) {
			for (int i = 0; i < a; i++) {
				for (int j = 0; j < a; j++) {
					if (i == j)cost[i][j] = time[i][j] = 0;
					else {
						cost[i][j] = (cost[i][j] < cost[i][h] + cost[h][j]) ? (cost[i][j]) : (cost[i][h] + cost[h][j]);
						time[i][j] = (time[i][j] < time[i][h] + time[h][j]) ? (time[i][j]) : (time[i][h] + time[h][j]);
					}
				}
			}
		}
		int l;
		cin >> l;
		for (int r = 0; r < l; r++) {
			int x, y, z;
			cin >> x >> y >> z;
			x--; y--;
			if (z) { cout << time[x][y] << endl; }
			else { cout << cost[x][y] << endl; }
		}
	}
}

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);


    int a,b,c;
    cin>>a>>b>>c;


    int k;
    cin>>k;

    while(b<=a and k>0)
    {
        k--;
        b*=2;
    }

    //cout<<k<< " ";

    while(c<=b and k>0)
    {
        k--;
        c*=2;
    }

    //cout<< a<< " "<<b<< " "<<c;

    if(a<b and b<c) cout<< "Yes";
    else cout<< "No";



    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
using namespace std;
 


int main(){
     
    int n,x=0,max=0;
    string str;
    
    cin>>n>>str;
    for(int i=0;i<n;i++){
        if(str[i]=='I'){
            x++;
            if(x>max)max=x;
        }
        else x--;
    }
    cout<<max<<endl;
     
    return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    int ans = 1e9;
    for (int bit = 0; bit < (1 << n); bit++) {
        vector<int> score(m, 0);
        int price = 0;
        for (int i = 0; i < n; i++) {
            if(bit & (1<<i)){
                for (int j = 0; j < m; j++){
                    score[j] += a[i][j];
                }
                price += c[i];
            }
        }
        bool can = true;
        rep(i, m) {
            if(score[i] < x){
                can = false;
            }
        }
        if(can){
            ans = min(ans, price);
        }
    }
    cout << (ans == 1e9 ? -1 : ans) << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main()
{   
    int n,t,a; cin >> n >> t >> a;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin >> h[i];
    double min = INF;
    int min_id = 0;
    for(int i=0;i<n;i++){
        double di = t - h[i]*0.006;
        if(min > abs(a - di)){
            min = abs(a - di);
            min_id = i+1;
        }
    }
    cout << min_id << endl;
}
    

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

int n, H, x[105], y[105], h[105];

int main(){
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> h[i];
    for (int i = 0; i <= 100; i++){
        for (int j = 0; j <= 100; j++){
            bool check = false;
            for (int k = 0; k < n; k++){
                if (h[k] != 0){
                    H = h[k] + abs(i - x[k]) + abs(j - y[k]);
                    check = true;
                }
            }
            if (check){
                bool c = true;
                for (int k = 0; k < n; k++){
                    if (h[k] != max(H - abs(i - x[k]) - abs(j - y[k]), 0)){
                        c = false;
                    }
                }
                if (c){
                    cout << i << " " << j << " " << H;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	ll n;
	cin>>n;
	cout<<(n+n%2)/2<<endl;
}/*『你强归你强，Siyuan比你强』*/





Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        String  s = sc.next();
        int length = s.length();
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i<s.length();i++){
            sb.append("x");
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 21972
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main  {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String tiles = input.readLine();
        System.out.println(Math.min(getCount(tiles, '0'), getCount(tiles, '1')));
    }

    public static int getCount(String tiles, char tile) {
        int count = 0;
        for (int i = 0; i < tiles.length(); i++) {
            if (tile != tiles.charAt(i))
                count++;
            tile = tile == '0' ? '1' : '0';
        }
        return count;
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define ll long long
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define ls rt << 1
#define rs rt << 1 | 1
#define sz(x) (int)(x).size()
#define ALL(x) (x).insgin(), (x).end()
#define vi vector<int>
using namespace std;
int n, K;
char s[310];
int f[305][305][305];

int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	scanf("%d", &K);
	rep(k, 0, K)
		rrep(i, n, 1) {
			f[i][i][k] = 1;
			rep(j, i + 1, n) {
			f[i][j][k] = max(f[i + 1][j][k], f[i][j - 1][k]);
			if(s[i] == s[j]) f[i][j][k] = max(f[i][j][k], f[i + 1][j - 1][k] + 2);
			if(k) f[i][j][k] = max(f[i][j][k], f[i + 1][j - 1][k - 1] + 2);
			}
		}
	cout << f[1][n][K];
	return 0;
}


Measured memory_bytes: 110464
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=(int)2*1e5+50;
struct Pos{
	int lf,rf,comfort;
	inline Pos(int l,int r){lf=l,rf=r;comfort=min(l,r);}
	inline bool operator <(const Pos &p) const{return comfort<p.comfort;}
};
priority_queue<Pos> q;
inline bool cmp(int x,int y){return x>y;}
int a[N],n;
inline int read(){
	int cnt=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-f;c=getchar();}
	while(isdigit(c)){cnt=(cnt<<1)+(cnt<<3)+(c^48);c=getchar();}
	return cnt*f;
}
signed main(){
	n=read();for(int i=0;i<n;++i){a[i]=read();}
	sort(a,a+n,cmp);
	q.push(Pos(a[0],a[1]));
	ll res=a[0];
	for(int i=2;i<n;++i){
		Pos p=q.top();
		if(q.size()>1){q.pop();}
		res+=p.comfort;
		q.push(Pos(a[i],p.lf));
		q.push(Pos(a[i],p.rf));
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 7036
#include <stdio.h>

int main ()
{
  int dataset[100];
  int length = 0;
  int i, j, count, tmp;


  while(scanf("%d", &length) && length) {

    for (i = 0; i < length; i++)
      scanf("%d", &dataset[i]);
    count = 0;

    for (i = length-1; i >= 0; i--) {
      for (j = 0; j < i; j++) {
	if (dataset[j] > dataset[j+1]) {
	  tmp = dataset[j];
	  dataset[j] = dataset[j+1];
	  dataset[j+1] = tmp;
	  count++;
	}
      }
    }

    printf("%d\n", count);
  }

  return 0;
}

Measured memory_bytes: 0
S = list(input())
num_first = 0
num_last = 0
for i in range(len(S)):
    if S[i] == 'A':
        num_first = i
        break
for j in range(num_first, len(S)):
    if S[j] == 'Z':
        num_last = j
print(num_last - num_first + 1)

Measured memory_bytes: 61552
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
int n,k;
set<int>st;
int ans=0;
signed main(){
    cin>>n>>k;
    rep(i,k){
        int d;cin>>d;
        rep(i,d){
            int a;
            cin>>a;
            st.insert(a);
        }
    }
    for(int i=1;i<=n;i++){
        if(st.find(i)==st.end())ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int gcd(int x, int y){
	if(y == 0) return x;
	return gcd(y, x % y);
}

int main(){
	int n, k, ans = 0;
	cin >> n >> k;
	vector<int> a(n);
	for(auto&& i: a){
		cin >> i;
	}
	int g = a[0];
	for(int i = 1; i < n; i++){
		g = gcd(g, a[i]);
	}
	int ma = *max_element(a.begin(), a.end());
	if(ma >= k && k % g == 0){
		cout << "POSSIBLE" << endl;
	}else{
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define mm (1e16)

ll Mod=(1e9+7);

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s,t; cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.size();i++) if(s[i]==t[i]) ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,m,a,L;
int fib(int x,int y){
    if(y==0)return x;
    return fib(y,x%y);
}
int main(void){
    cin>>n>>m;
    cin>>a;
    L=abs(m-a);
    for(int i=0;i<n-1;i++){
        cin>>a;
        L=fib(L,abs(m-a));
    }
    cout<<L<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
using namespace std;
using ll = long long;

int main()
{
    int abcd;
    cin >> abcd;
    int a = (abcd % 10000) / 1000;
    int b = (abcd % 1000) / 100;
    int c = (abcd % 100) / 10;
    int d = (abcd % 10) / 1;

    rep(i, 0, 8)
    {
        int cand = a;
        cand += (((i >> 2) & 1)? 1: -1) * b;
        cand += (((i >> 1) & 1)? 1: -1) * c;
        cand += (((i >> 0) & 1)? 1: -1) * d;

        if (cand == 7)
        {
            putchar('0' + a);
            putchar((((i >> 2) & 1)? '+': '-'));
            putchar('0' + b);
            putchar((((i >> 1) & 1)? '+': '-'));
            putchar('0' + c);
            putchar((((i >> 0) & 1)? '+': '-'));
            putchar('0' + d);
            cout << "=7" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int a,b;
  cin >> a >> b;
  if(a < 1){
    if(b > -1){
      cout << "Zero" << endl;
    } else {
      if((b-a+1) % 2 == 1){
        cout << "Negative" << endl;
      } else {
        cout << "Positive" << endl;
      }
    }
  } else {
    cout << "Positive" << endl;
  }
}

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

int main()
{
    long long int n,m,o,p,q,i,j,k,l,s,t,r;
    string a;
    cin>>n>>a;
    for(i=0; a[i]; i++)
    {
       k=((a[i]-'A')+n)%26;
       printf("%c",'A'+k);
    }
cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    
    cout << 800*N-(N/15)*200 << endl;


    return 0;
    

}

Measured memory_bytes: 3636
from itertools import combinations
import math
n,d=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for perm in list(combinations(range(n),2)):
    d=sum(map(lambda x: (x[0]-x[1])**2,zip(X[perm[0]],X[perm[1]])))
    if d==int(math.sqrt(d))**2:
        cnt+=1
print(cnt)

Measured memory_bytes: 9200
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
    int k, s; cin >> k >> s;
    int cnt = 0;
    for (int i = 0; i <= k; ++i) {
        for (int j = 0; j <= k; ++j) {
            int z = s - i - j;
            if (0 <= z && z <= k) {
                cnt++;
                //cout << i << j << z << endl;
            }
        }
    }
    cout << cnt << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

ll LCM(ll a, ll b){
  if(a == 0) return b;
  return a/GCD(a,b) * b;
}
 
int main(){
  int N; cin >> N;
  vector<ll> T(N);
  vector<ll> L(N+1);
  rep(i,N){
    cin >> T[i];
    L[i+1]= LCM(L[i],T[i]);
  }
  cout << L[N] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <math.h>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

double f(double a, double b, double c) {
    if (c > M_PI / 2.0 - 0.0000001) {
        return 0.0;
    }
    if (a * tan(c) <= b) {
        return a * a * b - a * a * a * tan(c) / 2.0;
    } else {
        return b * b / tan(c) * a / 2.0;
    }
}

int main() {
    double a, b, x; cin >> a >> b >> x;

    double ok = M_PI / 2.0;
    double ng = 0.0;
    REP(0, i, 100000) {
        double mid = (ok + ng) / 2.0;
        if (f(a, b, mid) < x) ok = mid;
        else ng = mid;
    }

    printf("%.7f\n", ok * 90.0 / (M_PI / 2.0));

    return 0;
}


Measured memory_bytes: 768