akhauriyash/Code-Regression huggingface dataset:
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nk = readInts()
    var sunukes = [Int](repeating: 0, count: nk[0])
    
    for _ in 1...nk[1]{
        let _ = Int(readLine()!)!
        let a = readInts()
        for i in a{
            sunukes[i-1] += 1
        }
    }
    print(sunukes.filter {$0 == 0}.count)
}

main()


Measured memory_bytes: 13580
#include<bits/stdc++.h>
#define ll long long
#define N 200010
#define mo 1000000007
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
ll b,w,gb,gw,jie[N],nj[N];
long double dp[1010][1010];
ll c(ll x,ll y){if (x<y) return 0;return (jie[x]*nj[y]%mo)*nj[x-y]%mo;}
ll po(ll x,ll y){ll z=1;while (y){if (y%2)z=x*z%mo;x=x*x%mo;y/=2;}return z;}
int main(){
	read(b);read(w);
	gb=0;gw=0;
	jie[0]=1;
	for (int i=1;i<=b+w;i++) jie[i]=jie[i-1]*i%mo;
	nj[b+w]=po(jie[b+w],mo-2);for (int i=b+w-1;i>=0;i--) nj[i]=nj[i+1]*(i+1)%mo;
	for (int i=1;i<=b+w;i++){
		printf("%d\n",(gw+(1-gb-gw+mo+mo)*po(2,mo-2))%mo);
		gb=(gb+c(i-1,b-1)*po(2,1ll*i*(mo-2)))%mo;
		gw=(gw+c(i-1,w-1)*po(2,1ll*i*(mo-2)))%mo;
	}
	return 0;
}

Measured memory_bytes: 6912
function main()
    n = parse(Int, readline())
    s = readline()
    count = 0
    counts = [Int[], Int[], Int[]] #RGB
    x,y,z = 0,0,0
    hoge = 0
    @simd for i in 1:n
        aa = min(i-1, n-i)
        for j in 1:aa
            if s[i] != s[i-j] != s[i+j] != s[i]
                # println(s[i], s[i-j], s[i+j])
                hoge += 1
            end
        end
        c = s[i]
        if c == 'R'
            x += 1
        elseif c == 'G'
            y += 1
        else
            z += 1
        end
    end
    println(x*y*z-hoge)
end

main()

Measured memory_bytes: 168340
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

// auto mod int
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(2000009);

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int mx=max(a,b);
  vector<mint>fact1(mx+1);
  fact1[0]=1;
  rep2(i,1,mx+1){
    fact1[i]=fact1[i-1]*(n-i+1);
  }
  vector<mint>fact2(mx+1);
  fact2[0]=1;
  rep2(i,1,mx+1){
    fact2[i]=fact2[i-1]*i;
  }
  cout<<(mint(2).pow(n)-fact1[a]/fact2[a]-fact1[b]/fact2[b]-1).x<<endl;
  return(0);
}

Measured memory_bytes: 34688
#include <iostream>
#include <vector>
#include <climits>
#include <functional>
using namespace std;

class UnionFind{
private:
    vector<int> p,s;
	int cnt;
public:
	UnionFind(){}
	UnionFind(int N){
		cnt = N;
		p = s = vector<int>(N,0);
		for(int i=0;i<N;i++){
			p[i] = i; s[i] = 1;
		}
	}
	int find(int x){
		if(p[x]==x) return x;
		else return p[x] = find(p[x]);
	}
	void unite(int x,int y){
		x = find(x); y = find(y);
		if(x==y) return;
		if(s[x]>s[y]){
			p[y] = x;
			s[x] += s[y];
		}else{
			p[x] = y;
			s[y] += s[x];
		}
		cnt--;
	}
	bool is_same_set(int x,int y) {return find(x)==find(y);}
	int size(int x) {return s[find(x)];}
	int compnents_number(){return cnt;}
};

template<typename Monoid>
class SegmentTree{
private:
    using F = function<Monoid(Monoid,Monoid)>;
    int sz;
    vector<Monoid> seg;
    const F op;//演算
    const Monoid e;//単位元
public:
    SegmentTree(int n,const F op,const Monoid &e):op(op),e(e){
        sz = 1;
        while(sz<n) sz <<= 1;
        seg.assign(2*sz,e);
    }
    //代入
    void set(int k, const Monoid &x){
        seg[k+sz] = x;
    }
    //前計算(?)
    void build(){
        for(int i=sz-1;i>0;i--){
            seg[i] = op(seg[2*i],seg[2*i+1]);
        }
    }
    void update(int k,const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k>>=1){
            seg[k] = op(seg[2*k],seg[2*k+1]);
        }
    }
    Monoid query(int l,int r){
        Monoid L = e,R = e;
        for(l+=sz,r+=sz;l<r;l>>=1,r>>=1){
            if(l&1) L = op(L,seg[l++]);
            if(r&1) R = op(seg[--r],R);
        }
        return op(L,R);
    }
    Monoid operator[](const int &k)const{
        return seg[k+sz];
    }
};

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> P(N+1,0);
    SegmentTree<int> seg_min(N,[](int a,int b){return min(a,b);},N+1);
    SegmentTree<int> seg_max(N,[](int a,int b){return max(a,b);},0);
    for(int i=0;i<N;i++){
        cin >> P[i];
        seg_min.set(i,P[i]);
        seg_max.set(i,P[i]);
    }
    seg_min.build();
    seg_max.build();
    vector<int> dp(N+1,0);
    dp[N] = 0;
    for(int i=N-1;i>=0;i--){
        if(P[i]<P[i+1]) dp[i] = dp[i+1]+1;
        else dp[i] = 1;
    }
    UnionFind uf(N-K+1);
    int id = -1;
    for(int i=0;i<N-K+1;i++){
        if(dp[i]>=K){
            if(id==-1) id = i;
            else uf.unite(i,id);
        }else{
            int mi = seg_min.query(i,i+K+1);
            int ma = seg_max.query(i,i+K+1);
            if(mi==seg_min[i] && ma==seg_max[i+K]) uf.unite(i,i+1);
        }
    }
    cout << uf.compnents_number() << endl;
}

Measured memory_bytes: 7424
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int n, m;
string s;



int main() {
	cin >> n;
	vector<int> vec(n);
	int max = 0;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> vec[i];
		if (max<vec[i])
		{
			max = vec[i];
		}
		if (vec[i] >= max) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
long long a,b,c,d,x,y,ans;
long long gcd(long long a,long long b){
	return b==0?a:gcd(b,a%b);
}
int main(){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	x=gcd(c,d);
	y=c*d/x;
	a=a-1;
	ans=b-a;
	ans=ans-(b/c-a/c)-(b/d-a/d)+(b/y-a/y);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  queue<pair<int,int>> Q;
  pair<int,int> P;
  vector<vector<char>> vec(H,vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> vec.at(i).at(j);
      if(vec.at(i).at(j) == '#'){
        P = make_pair(i,j);
        Q.push(P);
      }
    }
  }
  
  vector<int> dx = {0,1,0,-1};
  vector<int> dy = {1,0,-1,0};
  
  int ans = 0;
  int X = Q.size();
  int cnt = 0;
  while(Q.size()){
    P = Q.front();
    Q.pop();
    for(int i=0; i<4; i++){
      int nx = P.first + dx.at(i); 
      int ny = P.second + dy.at(i);
      if(nx >= 0 && nx < H && ny >= 0 && ny < W){
        if(vec.at(nx).at(ny) != '#'){
          vec.at(nx).at(ny) = '#';
          pair<int,int> p = make_pair(nx,ny);
          Q.push(p);
        }
      }
    }
    cnt++;
    if(cnt == X){
      ans++;
      cnt = 0;
      X = Q.size();
    }
  }
  cout << ans-1 << endl;  
}
      

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

vector<LL> lunlun;

void generate(LL current, int depth) {
    lunlun.push_back(current);

    if (depth == DEPTH)
        return;

    int last = current%10;

    generate(10 * current + last, depth + 1);
    if (last > 0) generate(10 * current + last - 1, depth + 1);
    if (last < 9) generate(10 * current + last + 1, depth + 1);
}

int main() {
    for (int i = 1; i <= 9; i++)
        generate(i, 1);

    sort(lunlun.begin(), lunlun.end());
    lunlun.resize(distance(lunlun.begin(), unique(lunlun.begin(), lunlun.end())));

    int K;
    scanf("%d", &K);
    printf("%lld\n", lunlun[K - 1]);
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s, t;
  cin >> s >> t;
  
  vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1));
  for (int i = 1; i <= s.size(); i++) {
    for (int j = 1; j <= t.size(); j++) {
      if (s.at(i - 1) == t.at(j - 1)) dp.at(i).at(j) = dp.at(i - 1).at(j - 1) + 1;
      else dp.at(i).at(j) = max(dp.at(i).at(j - 1), dp.at(i - 1).at(j));
    }
  }
  
  vector<char> ans;
  int it1 = s.size(), it2 = t.size();
  while (it1 > 0 && it2 > 0) {
    if (dp.at(it1).at(it2) == dp.at(it1).at(it2 - 1)) it2--;
    else if (dp.at(it1).at(it2) == dp.at(it1 - 1).at(it2)) it1--;
    else {
      ans.emplace_back(s.at(it1 - 1));
      it1--;
      it2--;
    }
  }
  
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans.at(i);
  }
  cout << '\n';
}

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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    int a , b , c , d;
    scanf("%d %d %d %d" , &a , &b , &c , &d);

    int turn = 0;
    while( true ) {
            turn ^= 1;

            if(turn) {
                    c -= b;
                    if(c <= 0) {
                            printf("Yes\n");
                            return;
                    }
            }
            else {
                    a -= d;
                    if(a <= 0) {
                            printf("No\n");
                            return;
                    }
            }
    }

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 3752
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<map>
using namespace std;

const int maxn=1e5+10;
int n,a[maxn],cnt,ans;
map<int,int> mp;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	for(int i=n;i;--i)
		mp[a[i]];
	for(map<int,int>::iterator i=mp.begin();i!=mp.end();++i)
		i->second=++cnt;
	for(int i=1;i<=n;++i)
		if((i^mp[a[i]])&1)
			++ans;
	printf("%d\n",ans/2);
	return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	if (n > k) dump(k * x + (n - k) * y) else dump(n*x)
}

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

int n;
string a;
char c;
set<string> st;
int main() {
	cin >> n >> a;
	st.insert(a);
	c = a[a.size() - 1];
	while(--n) {
		cin >> a;
		if(st.count(a) || a[0]!=c) {puts("No"); return 0;}
		st.insert(a);
		c = a[a.size() - 1];
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
[N, M] = [ int(i) for i in raw_input().split() ]
INF = int(1e9)
G = [ [ 0 if i==j else INF for j in xrange(N)] for i in xrange(N) ]
E = []

for _ in xrange(M):
	[a,b,c] = [ int(i) for i in raw_input().split() ]
	G[a-1][b-1] = c
	G[b-1][a-1] = c
	E.append([a-1,b-1,c])
	
for k in xrange(N):
	for i in xrange(N):
		for j in xrange(N):
			G[i][j] = min(G[i][j], G[i][k] + G[k][j])

res = 0
for [i,j,c] in E:
	res += 1 if G[i][j]	< c else 0
	
print res


Measured memory_bytes: 2948
#include <stdio.h>

int main(void)
{
    int N,a,b,c,i,k;
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%d %d %d",&a,&b,&c);
    if(a>b)
    {
        k=a;
        a=b;
        b=k;
    }
    if(b>c)
    {
        k=b;
        b=c;
        c=k;
    }
    if(c*c==a*a+b*b)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    }
    return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string>
#include<limits.h>
#define ll long long
#define vl vector<ll> 
#define vb vector<bool> 
#define vvl vector<vector<ll> > 
#define vvb vector<vector<ll> > 
#define rep(i,n) for(int i=0;i<n;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i++)
#define mmrep(i,a) for(int i=a;i>0;i++)
#define INF 1123456789012345
using namespace std;

int main() {
	bool a, b;
	char ca, cb; cin >> ca >> cb;
	a = (ca == 'H');
	b = (cb == 'H');
	if (!a) b = !b;
	if (b) cout << "H" << endl;
	else cout << "D" << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(arr:Array<String>) {
    val itemCount = readLine()!!.toInt()
    val buttonMap = (1..itemCount).map { readLine()!!.toInt() - 1 }
    val flag:MutableList<Boolean> = (1..itemCount).map { false }.toMutableList()

    var current = 0
    var ans = 0
    while (current != 1) {
        if(flag[current]) {
            println(-1)
            return
        }
        ans++
        flag[current] = true
        current = buttonMap[current]
    }
    println(ans)
}


Measured memory_bytes: 39712
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;
long long a,b,c,d;

int main()
{
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	long long s1=a*c,s2=a*d,s3=b*c,s4=b*d;
	printf("%lld\n",max(s1,max(s2,max(s3,s4))));
	return 0;
}

Measured memory_bytes: 3808
#include <iostream>
using namespace std;
int main(){
   int x,y,k;
   while(1){
   cin>>x>>y;
   if(x==0&&y==0){
         break;
   }
   if(x>y){
     k=y;
     y=x;
     x=k;
   }
   
   cout<<x<<" "<<y<<endl;
}
   return 0;
}


Measured memory_bytes: 3008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
    	int N = ni();
    	out.println(N * (N + 1) / 2);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}


Measured memory_bytes: 8148
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int p[100010];
int Find(int x){
	return p[x] == x ? x : p[x] = Find(p[x]);
}

vector <int> E[100010];
void solve(){
	int n, m; scanf("%d%d", &n, &m);
	for(int i=1;i<=n;i++){
		int k; scanf("%d", &k);
		rep(j, k){
			int x; scanf("%d", &x);
			E[x].pb(i);
		}
	}
	for(int i=1;i<=n;i++)p[i] = i;
	for(int i=1;i<=m;i++){
		rep(j, sz(E[i])){
			int x = Find(E[i][0]), y = Find(E[i][j]);
			p[x] = y;
		}
	}
	int ok = 1;
	for(int i=1;i<=n;i++){
		if(Find(i) != Find(1))ok = 0;
	}
	printf("%s\n", ok ? "YES" : "NO");
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 4988
#include "iostream"
#include "vector"
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    
    string ans="APPROVED";
    
    for(int i=0;i<n;i++)
    {
        if(arr[i]%2==0)
        {
          if(arr[i]%3==0 || arr[i]%5==0)
        {
    
         }
            
            else
            {  ans="DENIED";
            break;
        }
        }
        
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int h,m,s,S;
    scanf("%d",&S);
    h=S/3600;
    S=S%3600;
    m=S/60;
    s=S%60;
    printf("%d:%d:%d\n",h,m,s);
      
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  string s;
  cin >> s;

  cout << s.substr(0, s.length() - 8) << endl;

  return 0;
}


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

int main(){
    long long n;
    string ans = "";
    cin >> n;
    while(true){
        long long t;
        t = n%26;
        char c;
        if(t==0)t=26;
        n -= t;
        c = 96+t;
        ans += c;
        if(n==0)break;
        n /= 26;
    }
    reverse(ans.begin(),ans.end());

    cout << ans << endl;

}

Measured memory_bytes: 3632
#include<cstdio>
long long x,y;
long long ww(long long a)
{
	if(a<0)a=-a;
	return a;
}
int main()
{
	scanf("%lld%lld",&x,&y);
	if(ww(x-y)<2)
		printf("Brown\n");
	else printf("Alice\n");
}

Measured memory_bytes: 128
mod=10**9+7

L=input()
l=len(L)
ans=3**(l-1)
a=L.count('1')
cnt=1

for i in range(1,l):
    if L[i]=='1':
        ans+=pow(2,cnt,mod)*pow(3,l-i-1,mod)
        cnt+=1
        
print((ans+pow(2,a,mod))%mod)

Measured memory_bytes: 3188
def modifiedSieve():
    L = 300001
    msPrimes = []
    isMSPrime = [ True for _ in range(L) ]
    for i in range(6):
        isMSPrime[i] = False
    for i in range(6, L):
        if isMSPrime[i]:
            if i % 7 == 1 or i % 7 == 6:
                msPrimes.append(i)
                for j in range(i * i, L, i):
                    isMSPrime[j] = False
            else:
                isMSPrime[i] = False
    return msPrimes

def getMSFactors(num, msPrimes):
    factors = set()
    for msp in msPrimes:
        if msp > num:
            break
        if num % msp == 0:
            factors.add(msp)
    if num in msPrimes:
        factors.add(num)
    return sorted(list(factors))

if __name__ == '__main__':
    msPrimes = modifiedSieve()
    while True:
        num = int(input())
        if num == 1:
            break
        
        factors = getMSFactors(num, msPrimes)
        print("{}: {}".format(num, " ".join(list(map(str, factors)))))


Measured memory_bytes: 9264
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int x;

int main() {
    read(x);
    printf("%d\n", x / 500 * 1000 + (x % 500) / 5 * 5);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long int
#define mod 1000000007
#define vec vector<long long int>
#define fi first
#define se second
#define pb push_back

int main()
{
    int a, b;
    cin >> a >> b;
    int c = (b - 2 * a);
    int d = (4 * a - b);

    if (c % 2 == 0 && d % 2 == 0 && c + d >= 2 && c >= 0 && d >= 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
#define NA 13

int main(void){
  int L;
  while(true){
    cin>>L;
    if(L==0){break;}
    int money=0;
    int retval=NA;
    int M,N;
    for(int month=1;month<=12;month++){
      cin>>M>>N;
      money+=M-N;
      if(money>=L){
        retval=min(retval,month);
      }
    }
    if(retval==NA){
      cout<<"NA"<<endl;
    }
    else{
      cout<<retval<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3000
import java.util.Scanner;

public class Main{
	
	void main() {
		 Scanner sc = new Scanner(System.in);
	     int N = sc.nextInt();
	     int M = sc.nextInt();
	     
	     int[] score = new int[N];
	     
	     int[] t = new int[M];
	     for(int i=0;i<M;i++) {
	    	 t[i] = sc.nextInt();
	     }
	     
	     for(int i=0;i<M;i++) {
	    	 for(int j=0;j<N;j++) {
	    		 int b = sc.nextInt();
	    		 if(b == t[i]) {
	    			 score[j]++;
	    		 }else {
	    			 score[t[i]-1]++;
	    		 }
	    	 }
	     }
	     
	     for(int i=0;i<N;i++) {
	    	 System.out.println(score[i]);
	     }
    }

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



}


Measured memory_bytes: 40292
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    cout << (n >= k * 2 - 1 ? "YES" : "NO") << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    cout << pow(N,3) << endl;
}


Measured memory_bytes: 512
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn mul_is_odd(a: u32, b: u32) -> bool {
    if (a * b) % 2 == 0 {
        return false;
    }
    return true
}

fn main() {
  // 一行読み込み、空白で分解してusize２つパースする
  let (a, b) = get!(u32, u32);
  if mul_is_odd(a, b) {
      println!("Odd");
  } else {
      println!("Even");
  }
}

Measured memory_bytes: 4352
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};


int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout); 
    ll n,m;
    sfl(n),sfl(m);
    ll ans = (n*(n-1))+(m*(m-1));
    ans = ans/2;
    pfl(ans);
    return 0;
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N;
  cin>>N;
  if(N%2==1)
    cout<<0<<endl;
  else{
  N/=2;
    int64_t ans=0;
    for(int i=0; ;i++){
    N/=5;
      if(N==0)
        break;
      else
        ans+=N;
    
    }cout<<ans<<endl;
  
  }
   return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	d := make([]int, n)
	for i := 0; i < n; i++ {
		d[i] = nextInt()
	}
	sort.Ints(d)

	// fmt.Println(d)

	fmt.Println(d[n/2] - d[n/2-1])
}


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

const int len = 1e5+5;
int arr[len];

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; i++)
        scanf("%d", &arr[i]);

    int ans = -1;
    for (int i = 1; i < n; i++)
        if (arr[i]+arr[i+1] >= k) ans = i;

    if (ans == -1) printf("Impossible\n");
    else{
        printf("Possible\n");
        for (int i = 1; i < ans; i++) printf("%d\n", i);
        for (int i = n-1; i > ans; i--) printf("%d\n", i);
        printf("%d\n", ans);
    }
    return 0;
}


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

using namespace std;

int f(int x){
	int ans = 0;
	while(x) ans += x % 10, x /= 10;
	return ans;
}

int main(){

	int n;

	scanf("%d", &n);

	int ans = 10000000;
	for(int a = 1; a < n; a++)
		ans = min(ans, f(a) + f(n-a));
	
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main (){
    int n,m;
    map<string,int> apper;
    string tmp;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        apper[tmp]++;
    }
    cin >> m;
    for (int i = 0; i < m; i++){
        cin >> tmp;
        apper[tmp]--;
    }
    int x = 0;
    for(auto it = apper.begin();it!=apper.end();it++){
//        cout << it->first << " " << it->second << "\n";
        if(it->second > x) x= it->second;
    }
    if(x<0) x=0;
    cout << x <<"\n";

}

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

int main(void){
	int i,n=0;
	long int ans=0;
	
	char s[200001];
	
	scanf("%s",s);
	
	for(i=0;i<strlen(s);i++){
		if(s[i]=='A'){
			n++;
		}else if(s[i]=='B'&&s[i+1]=='C'){
			ans+=n;
			i++;
		}else{
			n=0;
		}
	}
	
	printf("%ld\n",ans);
	
	return 0;
}

Measured memory_bytes: 384
// 入力例3の K = 20, A = [2 3 4 10 10 25]の場合を考える
//
// 4 は、他のカードの組み合わせで16, 17, 18, 19が作れてしまう場合、
// 必要。それ以外の場合、不必要。
//
// この判定を高速に行うためには以下を行う
// 1. 4 以外のカードの組み合わせで作成可能な数字のリストの作成。K <= 5000なのでこれは簡単。
// 2. 累積和やセグメントツリーを使い、
//    「A以上B以下の数字を作成可能か」をO(1)で答えられるようにする
//
// ここまででsmallは解けたはず。
// largeの解き方がわからなかったので解説PDFを見る。
//
// 4がno needな場合3, 2もno needという単調性を利用して二分探索。



#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

bool is_i_needed(ll N, ll K, vector<ll>& As, int i) {
    // 任意のカードの組み合わせで作成可能な数を列挙
    // ただしK未満
    bool flip = true;
    vector<vector<int>> possible(K, vector<int>(2));
    possible[0][flip] = 1;
    REP(j, N) {
        if (i == j) continue;
        flip = !flip;
        auto a = As[j];
        vector<int> added(K);
        REP(j, K) {
            if (possible[j][!flip]) {
                possible[j][flip] = 1;
            }
            if (possible[j][!flip] && (j + a) < K) {
                possible[j + a][flip] = 1;
            }
        }
    }

    FOR(j, max(0LL, K - As[i]), K) {
        if (possible[j][flip]) {
            return true;
        }
    }
    return false;
}


int main(void)
{
    cin.sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> As(N);
    REP(n, N) cin >> As[n];
    sort(ALL(As));

    // 単調性を利用
    // x: no need
    // o: need
    //
    // 1 3 4, K = 6
    // x o o
    //
    // 1 1 3 4 5, K = 400
    // x x x x x
    // この場合例外なので別途処理が必要
    //
    // 2 3 4 10 10 25, K = 6
    // x x x o  o  o
    //

    if (!is_i_needed(N, K, As, N - 1)) {
        cout << N << endl;
        return 0;
    }

    int lo = 0;
    int hi = N - 1;
    while (lo < hi) {
        auto k = (lo + hi) / 2;
        if (is_i_needed(N, K, As, k)) {
            hi = k;
        } else {
            lo = k + 1;
        }
    }

    cout << lo << endl;
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    
    int x = N % 10;
    if ( x == 3 ){
        cout << "bon" << endl;
    } else if ( x == 0 or x == 1 or x == 6 or x == 8 ){
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
    
    return 0;
}


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

int main() {
    int R;
    cin >>R;
    if(R<1200){
        cout<<"ABC"<<endl;
        return 0;
    }
    else if(R<2800){
        cout <<"ARC"<<endl;
        return 0;
    }
    else cout << "AGC"<<endl;
}

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

int solve(int m) {
  int lo = 0, hi = 65;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (mid * (mid + 1) / 2 > m) hi = mid - 1;
    else lo = mid + 1;
  }
  return lo - 1;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  long long n;
  cin >> n;
  int res = 0, exp = 0;
  while (n % 2 == 0) {
    n /= 2;
    ++exp;
  }
  res += solve(exp);
  for (long long i = 3; i * i <= n; i += 2) {
    int exp = 0;
    while (n % i == 0) {
      n /= i;
      ++exp;
    }
    res += solve(exp);
  }
  if (n >= 2) ++res;
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3652
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
pair<int,int>dp[2005][2005];
string s;
int k;
pair<int,int>get_dp(int l,int r){
	if(l>r)return make_pair(0,1);
	if(l==r)return dp[l][r]=make_pair(1,1);
	if(dp[l][r].first!=-1)return dp[l][r];
	pair<int,int>p1=get_dp(l+1,r);
	pair<int,int>p2=get_dp(l,r-1);
	pair<int,int>p3=get_dp(l+1,r-1);
	int best=min(p1.first+2,p2.first+2);
	if(s[l]==s[r])best=min(best,p3.first+2);
	pair<int,int>ret(best,0);
	if(p1.first+2==best){
		ret.second+=p1.second;
	}
	if(p2.first+2==best){
		ret.second+=p2.second;
	}
	if(s[l]==s[r]&&p3.first+2==best){
		ret.second=p3.second;
	}
	ret.second=min(ret.second,inf);
	return dp[l][r]=ret;
}
signed main(){
	cin>>s;s=" "+s;cin>>k;
	for(int i=1;i<=2000;i++)for(int j=1;j<=2000;j++)dp[i][j]=make_pair(-1,-1);
	for(int l=1;l<s.size();l++)for(int r=l;r<s.size();r++)get_dp(l,r);
	if(dp[1][(int)s.size()-1].second<k){
		puts("NONE");
		return 0;
	}
	int l=1,r=(int)s.size()-1;
	string out="";
	while(1){
//		cerr<<l<<" "<<r<<" "<<k<<endl;
		if(l>=r){
			cout<<out;if(l==r)cout<<s[l]; 
			reverse(out.begin(),out.end());
			cout<<out<<endl;
			return 0;
		}
		if(s[l]==s[r]){
			out.push_back(s[l]);
			l++;r--;continue;
		}
		//two froms
		pair<int,int>dp1=dp[l+1][r];
		pair<int,int>dp2=dp[l][r-1];
		if(dp1.first<dp2.first){
			out.push_back(s[l]);
			l++;continue;
		}
		if(dp1.first>dp2.first){
			out.push_back(s[r]);
			r--;continue;
		}
		if(s[l]<s[r]){
			if(k<=dp1.second){
				out.push_back(s[l]);l++;
			}else{
				out.push_back(s[r]);r--;
				k-=dp1.second;
			}
		}else{
			if(k<=dp2.second){
				out.push_back(s[r]);r--;
			}else{
				out.push_back(s[l]);l++;
				k-=dp2.second;
			}
		}
	}
	return 0;
} 


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

static const int DataMax = 200;	// Max value of elements

typedef struct _data_list
{
    int count;	// Number of elements
    std::vector<int> vec[DataMax];
} data_list_t;

static void InputData(data_list_t& data)
{
    int v1, v2;

    if (0x00 == &data) {
        std::cerr << "data is null" << std::endl;
        exit (1);
    }

    while (std::cin >> v1 >> v2) {
        data.vec[data.count].push_back(v1);
        data.vec[data.count].push_back(v2);
        data.count++;
    }
}

static int getDigitSumOfValues(data_list_t& data, int index)
{
    int digit = 0;
    int sum = 0;

    if (0x00 == &data) {
        std::cerr << "data is null" << std::endl;
        exit (1);
    }

    for (int i = 0; i < data.vec[index].size(); i++) {
            sum += data.vec[index].at(i);
    }

    while (sum >= 1) {
        digit++;
        sum /= 10;
    }

    return digit;
}

int main()
{
    data_list_t data = {0};

    InputData(data);
    for (int i = 0; i < data.count; i++) {
        std::cout << getDigitSumOfValues(data, i) << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3028
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
 
int main(void){
long long int h,w;
scanf("%lld %lld",&h,&w);
if(h==1||w==1){printf("1\n");}
else if(h*w%2!=0){printf("%lld\n",h*w/2+1);}
else{printf("%lld\n",h*w/2);}
}

Measured memory_bytes: 128
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s: Vec<i32> = read::<String>()
        .chars()
        .map(|x| (x as u8 - b'0') as i32)
        .collect();

    println!(
        "{}",
        s.windows(3)
            .map(|x| {
                let x = x.iter().fold(0, |a, x| a * 10 + x);
                (x - 753).abs()
            })
            .min()
            .unwrap()
    );
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26588
#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define mod 1000000007
#define PI 3.1415926535
using namespace std;
ll power(ll x, ll y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return power(x, y / 2) * power(x, y / 2);
	else
		return x * power(x, y / 2) * power(x, y / 2);
}
ll modExpo(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return modExpo((x*x)%mod,n/2);
    else                            
        return (x*modExpo((x*x)%mod,(n-1)/2))%mod;
 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	auto start_time = clock();
	cerr << setprecision(3) << fixed;
#endif
	ll x;
	cin>>x;
	cout<<1-x<<endl;
#ifdef LOCAL
	auto end_time = clock();
	cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
}

Measured memory_bytes: 3564
tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dictx ={}
dicty ={}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dictx[tmp[d]] = i
        dicty[tmp[d]] = d
cost ={}
def calcost(R):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        costs = abs(dictx[R]-dictx[str(int(R)-D)]) + abs(dicty[R]-dicty[str(int(R)-D)])
        cost[R] = costs + cost[str(int(R)-D)]
        return cost[R]

for n in range(1,H*W+1):
    calcost(str(n))
Q = int(input())
for j in range(Q):
    tmp = input().split()
    print(str(cost[tmp[1]]-cost[tmp[0]]))

Measured memory_bytes: 41488
#include <stdio.h>
 
long long int gcd(long long int x, long long int y)
{
  while(x > 0 && y > 0) {
    if(x > y) {
      x = x - y;
    }
    else {
      y = y - x;
    }
  }
 
  if(x == 0) {
    return y;
  }
  else {
    return x;
  }
}
 
long long int approximate_sqrt(long long int x)
{
  long long int root = x/4;
 
  if(x <= 3) {
    return 1;
  }
  
  while(1) {
    root = (root + (x / root)) / 2;
 
    if(root * root <= x && x <= (root+1) * (root+1)) {
      return root;
    }
  }
}
 
int number_of_factors(long long int x)
{
  long long int root_x = approximate_sqrt(x);
  long long int x_iter = x;
  int num = 0;
 
  if(x == 1) {
    return 0;
  }
 
  if(x_iter % 2 == 0) {
    num++;
  }
  while(x_iter % 2 == 0) {
    x_iter = x_iter / 2;
  }
 
  long long int i = 3;
  while(i <= root_x + 1) {
 
    if(x_iter % i == 0) {
      num++;
 
      do {
        x_iter = x_iter / i;
      } while(x_iter % i == 0);
    }
 
    i += 2;
  }
 
  if(x_iter > 1) {
    num++;
  }
 
  return num;
}
 
int main(void)
{
  long long int a, b;
  scanf("%lld%lld", &a, &b);
 
  printf("%d\n", 1 + number_of_factors(gcd(a,b)));
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int w[102], v[102], dp[102][100005];

int32_t main()
{
	IO_OP;
	
	int n, W;
	cin >> n >> W;
	for(int i=1;i<=n;i++)
		cin >> w[i] >> v[i];

	for(int i=1;i<=n;i++) {
		for(int j=1;j<=W;j++) {
			dp[i][j] = dp[i-1][j];
			if(w[i] <= j)
				dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]]+v[i]);
		}
	}
	cout << dp[n][W] << endl;
	
}



Measured memory_bytes: 78336
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

s,t = input().split()

print(t+s)

Measured memory_bytes: 38512
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    ll x,y;
    cin >> x >> y;
    int ans = 1;
    while(1){
        if(x*2<=y){
            x*=2;
            ans++;
        }else break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256