akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

long long modpow(long long a, long long b){ 
  long long r = 1LL;

  while(b){
    if(b & 1LL)r *= a;
    if(r >= MOD)r %= MOD;
    a *= a;
    if(a >= MOD)a %= MOD;
    b >>= 1LL;
  }
  return r;
}

long long nPr(long long n, long long r){ 
  long long ret = 1LL;

  for(int i = 1; i <= r; ++i){
    ret = (ret * ((n - i + 1) % MOD)) % MOD;
  }

  return ret;
}

long long nCr(long long n, long long r){ 
  long long ret = 1LL;

  for(int i = 1; i <= r; ++i){
    ret = (ret * ((n - i + 1) % MOD)) % MOD;
  }
  for(int i = 1; i <= r; ++i){
    ret = (ret * modpow(i, MOD - 2)) % MOD;
  }

  return ret;
}

int main() {
  ll a,b;
  cin>>a>>b;
  if(a>b)swap(a,b);
  if(abs(a-b)>1){
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  if(a==b){
    ll c = 1;
    rep(i,1,a+1){
      c*=i;
      c%=MOD;
    }
    rep(i,1,b+1){
      c*=i;
      c%=MOD;
    }
    c*=2;
    c%=MOD;
    ans = c;
  }
  else{
    ll c = 1;
    rep(i,1,a+1){
      c*=i;
      c%=MOD;
    }
    rep(i,1,b+1){
      c*=i;
      c%=MOD;
    }
    ans = c;    
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(void)
{
  int A,B;
  cin >> A >> B;
  if (A > B)
  {
    cout << A + A - 1;
  } else if ( A == B)
  {
  	cout << A * 2;
  } else
  {
  	cout << B + B - 1;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int mod=1e9+7;
int f[5005][2],g[5005],dp[5005][2];
signed main(){
	int sum=0,ans=1;
	int n,A,B;
	cin>>n>>A>>B;
	if(A>B) swap(A,B);
	f[0][0]=f[0][1]=1;g[0]=1;
	for(int i=1;i<=n;++i){
		for(int j=A;j<=i;++j)
			f[i][0]=(f[i][0]+f[i-j][1])%mod;
		for(int j=1;j<=i;++j)
			f[i][1]=(f[i][1]+f[i-j][0])%mod;
		g[i]=(f[i][0]+f[i][1])%mod;
	}
	for(int i=1;i<n;++i){
		if(i<A) dp[i][0]=1;
		if(i<B) dp[i][1]=f[i][1];
		for(int j=1;j<min(i,A);++j)
			dp[i][0]=(dp[i][0]+dp[i-j][1])%mod;
		for(int j=1;j<min(i,B);++j)
			dp[i][1]=(dp[i][1]+dp[i-j][0]*((j<2)?1:g[j-2])%mod)%mod;
		if(n-i<A) sum=(sum+dp[i][1])%mod; //后面全是0
		if(n-i<B) sum=(sum+dp[i][0]*g[n-i-1]%mod)%mod; //后面是方案，防止重复往后面加一个 1 的分隔符 
	}
	for(int i=1;i<=n;++i) ans=ans*2ll%mod;
	ans=(ans-sum+mod)%mod;
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 3824
N, K = map( int, input().split())
L = [0]*K
for n in range(1,N+1):
    L[n%K] += 1
ans = 0
for a in range(1,N+1):
    if (2*a)%K == 0:
        ans += L[(K-a)%K]**2
print(ans)

Measured memory_bytes: 4596
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int abcd;
    int a, b, c, d;
    cin >> abcd;
    // 各変数に値を代入する
    a = abcd / 1000;
    abcd -= 1000*a;
    b = abcd / 100;
    abcd -= 100*b;
    c = abcd / 10;
    abcd -= c*10;
    d = abcd;
    // cout << a << endl << b << endl << c << endl << d << endl;
    string op1, op2, op3;
    int ab, ab_c, abc_d;
    bool isSeven = false;;
    // 考えられる符号の８パターンを試行する
    for(int i=0; i<2; i++){
        for(int j=0; j<2; j++){
            for(int k=0; k<2; k++){
                if(i == 0) ab = a + b;
                else ab = a - b;
                if(j == 0) ab_c = ab + c;
                else ab_c = ab - c;
                if(k == 0) abc_d = ab_c + d;
                else abc_d = ab_c - d;
                if(abc_d == 7){
                    isSeven = true;
                    if(i == 0) op1 = "+";
                    else op1 = "-";
                    if(k == 0) op3 = "+";
                    else op3 = "-";
                    if(j == 0) op2 = "+";
                    else op2 = "-";
                }
            }
        }
    }
    if(isSeven) cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding:utf-8 -*-

N, x = map(int, input().split())
a = list(map(int, input().split()))

cnt = 0
for i in range(N-1):
    tmp = (a[i] + a[i+1]) - x
    if tmp < 0:
        continue
    cnt += tmp
    if a[i+1] >= tmp:
        a[i+1] -= tmp
    else:
        a[i] -= tmp - a[i+1]
        a[i+1] = 0

# print(a)
print(cnt)


Measured memory_bytes: 14156
N, K = map(int, input().split())
As = list(map(int, input().split()))
r = 0
for i in range(N):
  A = As[i]
  a = len(list(filter(lambda A2: A2 < A, As[:i])))
  b = len(list(filter(lambda A2: A2 < A, As[i+1:])))
  #print(a, b)
  r = (r+a*(K-1)*K//2)%1000000007
  r = (r+b*(K+1)*K//2)%1000000007
print(r)


Measured memory_bytes: 3188
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int n,k;
int ans;

void rec(int i,int j){
  if(j == n){
    chmin(ans,i);  
    return;
  }
  
  rec(i*2,j+1);
  rec(i+k,j+1);
}

int main(){
  
  cin >> n >> k;
  ans = 1 << 30;
  
  rec(1,0);
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
vector<ll> V;
int pre[maxn];
int main() {
    ll k,now=7;
    cin>>k;
    if(__gcd(10ll,k)!=1) {puts("-1");return 0;}
    for(int i=1;;i++) {
    	// if(i>=k)
    	if(now%k==0) {cout<<i<<endl;break;} 
    	now=(now*10+7)%k;
    }
    return 0;
}

Measured memory_bytes: 3632
N,K = map(int,input().split())

res1 = 0
for i in range(1,N+1):
    if i % K == 0:
        res1 += 1

if K % 2 != 0:
    print(res1**3)
    exit()

res2 = 0

for i in range(1,N+1):
    if i % K == int(K/2):
        res2 += 1


print(res1**3+res2**3)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int k;
  cin >> k;

  if (k % 2 == 0) cout << (k / 2) * (k / 2) << endl;
  else cout << (k / 2 + 1) * (k / 2) << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <array>
#include <algorithm>
#include <numeric>

using namespace std;

#define all(c) (c).begin(), (c).end()

template<class ForwardIt>
pair<ForwardIt, ForwardIt> sieve(ForwardIt begin, ForwardIt end){
    return make_pair(begin, (*begin) * (*begin) <= *(end - 1) ?
            sieve(begin + 1, remove_if(begin + 1, end, [=](int x){return x % *begin == 0;})).second : end);
}

int main(){
    constexpr size_t N = 123456 * 2;
    array<int, N> p; iota(all(p), 2);
    auto itr = sieve(all(p));
    int n;
    while(cin >> n, n)cout << upper_bound(itr.first, itr.second, n+n) - upper_bound(itr.first, itr.second, n) << '\n';
    return 0;
}

Measured memory_bytes: 2128
#include<iostream>
#include<string>
#include<algorithm> 
using namespace std;
int main(){
  char s[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>s[i][j];
    }
  }
  for(int i=0;i<3;i++){
    cout<<s[i][i];
  }
  return 0;
}

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

void dfs(vector<vector<vector<int>>> &e, vector<vector<vector<int>>> &v, vector<vector<int>> &used, vector<vector<int>> &ab, int aorb, int k, int val, int &f, vector<int> &mins){
	if(used[aorb][k] == 0){
		used[aorb][k] = 1;
		ab[aorb][k] = val;
		mins[aorb] = min(mins[aorb], val);
		for(int i = 0; i < e[aorb][k].size(); i++){
			dfs(e, v, used, ab, 1 - aorb, e[aorb][k][i], v[aorb][k][i] - val, f, mins);
		}
	}
	else{
		if(ab[aorb][k] != val){
			f = 1;
		}
	}
}

signed main(){
	int R, C, N, r, c, x, i, j;
	int M = 100000;
	scanf("%lld%lld%lld", &R, &C, &N);
	vector<vector<vector<int>>> e(2, vector<vector<int>>(M, vector<int>(0))), v(2, vector<vector<int>>(M, vector<int>(0)));
	for(i = 0; i < N; i++){
		scanf("%lld%lld%lld", &r, &c, &x);
		r--;
		c--;
		e[0][r].push_back(c);
		v[0][r].push_back(x);
		e[1][c].push_back(r);
		v[1][c].push_back(x);
	}
	vector<vector<int>> used(2, vector<int>(M, 0)), ab(2, vector<int>(M, 0));
	for(i = 0; i < M; i++){
		if(used[0][i] == 0){
			int f = 0;
			vector<int> mins(2, inf);
			dfs(e, v, used, ab, 0, i, 0, f, mins);
			if(f == 1 || (-mins[0] > mins[1])){
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 32216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

int main(void) {
    li d;
    cin >> d;

    if (d == 25) {
        cout << "Christmas";
    } else if (d == 24) {
        cout << "Christmas Eve";
    } else if (d == 23) {
        cout << "Christmas Eve Eve";
    } else if (d == 22) {
        cout << "Christmas Eve Eve Eve";
    }

    return 0;
}

Measured memory_bytes: 256
from collections import deque
import bisect

N = int(input())
A = [int(input()) for i in range(N)]

ans = deque()
ans.append(A[0])

for a in A[1:]:
  if a <= ans[0]:
    ans.appendleft(a)
  elif a > ans[-1]:
    ans[-1] = a
  else:
    i = bisect.bisect_left(ans, a)
    ans[i - 1] = a

print(len(ans))


Measured memory_bytes: 8824
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO.Ports;
namespace _0609
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int m = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            int[] Target = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i = 0; i < m; i++)
            {
                int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < n; j++)
                {
                    if (d[j] == Target[i]) { a[j]++; }
                    else { a[Target[i ]- 1]++; }
                }
            }
            for(int i = 0; i < n; i++) { Console.WriteLine(a[i]); }
        }
    }
}

Measured memory_bytes: 9596
#include <stdio.h>

int main(void)
{
	int a[4][13] = {0};
	int b,d,e;
	char c;
	
	scanf("%d",&b);
	
	for(d = 0;d < b*2;++d){
		scanf("%c %d",&c,&e);
		if(c == 'S'){
			a[0][e-1] = e;
		}
		else if(c =='H'){
			a[1][e-1] = e;
		}
		else if(c == 'C'){
			a[2][e-1] = e;
		}
		else if(c == 'D'){
			a[3][e-1] = e;
		}
	}
	for(d = 0;d < 4;++d){
		for(b = 0;b < 13;++b){
			if(a[d][b] == 0){
				if(d == 0){
					printf("S %d\n",b+1);
				}
				else if(d == 1){
					printf("H %d\n",b+1);
				}
				else if(d == 2){
					printf("C %d\n",b+1);
				}
				else if(d == 3){
					printf("D %d\n",b+1);
				}
			}
		}
	}
	
	return(0);
}

Measured memory_bytes: 2684
#include <algorithm>
#include <iostream>
#include <list>
#include <string>

using namespace std;

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

	int n;
	cin >> n;

	list<int> l;
	string s;
	int x;
	while (n--)
	{
		cin >> s;
		if (s == "deleteFirst") { l.pop_front(); continue; }
		else if (s == "deleteLast") { l.pop_back(); continue; }

		cin >> x;
		if (s == "insert") l.push_front(x);
		else if (s == "delete")
		{
			list<int>::iterator it = find(l.begin(), l.end(), x);
			if (it != l.end())
				l.erase(it);
		}
	}

	cout << l.front(), l.pop_front();
	for (auto it = l.begin(); it != l.end(); ++it)
		cout << " " << *it;
	cout << endl;

	return 0;
}

Measured memory_bytes: 34388
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    // A:直角, B:鋭角, C:鈍角
    int triA, triB, triC; 
    int[] l;
    int i;
    boolean ex;

    void run(){
	ex = true;
	triA = triB = triC = 0;
	while(sc.hasNext()){
	    l = new int[3];
	    for(i=0; i<3; i++)
		l[i] = sc.nextInt();
	    Arrays.sort(l);
	    if(ex)solve();	    
	}
	int sum = triA + triB + triC;
	System.out.println(sum+" "+triA+" "+triB+" "+triC);	  
    }

    void solve(){
	if(l[2]-l[1] < l[0] && l[0] < l[2]+l[1]){	
	    int s = l[0]*l[0] + l[1]*l[1];
	    int t = l[2]*l[2];
	    //System.out.println(s+" "+t);
	    if(s==t)
		triA++;
	    else if(s>t)
		triB++;
	    else if(s<t)
		triC++;
	}
	else 
	    ex = false;
    }
}

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr double EPS = 1e-10;
constexpr int INF = 1001001001;
//constexpr ll INF = 1001001001001001001ll;


struct Unionfind2 {
    vector<int> par, num, rank;
    //vector<bool> done;
    Unionfind2(int n): par(n), num(n, 1), rank(n,0) {
        iota(par.begin(), par.end(), 0);
        //done.assign(n,false);
    }
    int root(int v) {
        return (par[v] == v) ? v : (par[v] = root(par[v]));
    }
    bool same(int u, int v) {
        return root(u) == root(v);
    }
    void unite(int u, int v) {
        u = root(u), v = root(v);
        if (u == v)return;
        if (rank[u] < rank[v]) swap(u, v);
        if (rank[u] == rank[v]) ++rank[u];
        num[u] += num[v];
        par[v] = u;
        //done[u] = done[u] | done[v];
    }
    int size(int v) {
        return num[root(v)];
    }
};


int main() {
    ll N, M; cin >> N >> M;
    vll A(M), B(M);
    vll ans(M, 0);
    rep(i, M) {
        cin >> A[i] >> B[i];
        A[i]--, B[i]--;
    }

    Unionfind2 uf(N);

    ans[M - 1] = (N * (N - 1)) / 2;

    for (int i = M - 1; i >= 1; i--) {
        if (uf.same(A[i], B[i])) {
            ans[i - 1] = ans[i];
        }
        else {
            ans[i - 1] = ans[i] - (ll)uf.size(A[i]) * (ll)uf.size(B[i]);
            uf.unite(A[i], B[i]);
        }
    }

    rep(i, M) cout << ans[i] << endl;

}


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

int main(){
  int a,b,c; cin >> a >> b >> c;
  int cnt = 0;
  for(int i = a; i <= b; i++){
    if(c % i == 0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3096
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
long long Mod = 1000000007, D[10100][110];
int n, K, w[10100];
char p[10100];
int main(){
	scanf("%s", p);
	scanf("%d", &K);
	int i, j, k;
	for (i = 0; p[i]; i++);
	n = i;
	for (i = 0; i < n; i++)w[n - i - 1] = p[i] - '0';
	D[0][0] = 1;
	for (i = 1; i <= n; i++) {
		for (j = 0; j < K; j++) {
			for (k = 0; k < 10; k++) {
				D[i][(j + k) % K] = (D[i][(j + k) % K] + D[i - 1][j]) % Mod;
			}
		}
	}
	int s = 0;
	long long res = 0;
	for (i = n - 1; i >= 0; i--) {
		for (j = 0; j < w[i]; j++) {
			res = (res + D[i][(K - (s + j) % K) % K])%Mod;
		}
		s += w[i];
	}
	if (s%K == 0)res = (res + 1) % Mod;
	res = (res + Mod - 1) % Mod;
	printf("%lld\n", res);
}

Measured memory_bytes: 8832
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
    string w;
    cin>>w;
    int n=w.size();
    int cnt=0;
    rep(i,0,n){
        rep(j,0,n){
            if (w[i]==w[j]) cnt++;
        }
        if (cnt%2!=0) {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] l = new int[n];
		
		for(int i = 0; i < n; i++) {
			l[i] = scan.nextInt();
			
		}
		int ans = 0;
	
		for( int i= 0; i < l.length; i++) {
			for(int j = 0; j < l.length; j++) {
				for(int k = 0; k < l.length; k++) {
					
					if(i < j && j < k) {
						
						if((l[i] != l[j] && l[k] != l[j] && l[i] != l[k])) {
							if(Math.abs(l[i]-l[j]) < l[k] && l[k] < (l[i]+l[j])) {
								//System.out.println(l[i] + " " + l[j] + " " + l[k]);
								ans++;
							}
							
						}
							
					}
					
				}
			}
		}
		
		System.out.print(ans);
	}

}


Measured memory_bytes: 35836
#include <iostream>
#include <vector>
#include <stack>
#include <bitset>
#include <utility>
#include <algorithm>

using namespace std;

const int kNil = -1;
const int kMaxV = 100010;

enum class Color {
  kWhite,
  kGrey,
  kBlack,
};

template <class T>
struct Edge {
  using w_type = T;
  Edge(int u, int v, w_type w): u(u), v(v), w(w) { }
  int u, v;
  w_type w;
  bool operator<(const Edge<T> & rhs) const {
    if (w != rhs.w) { return w < rhs.w; }
    if (u != rhs.u) { return u < rhs.u; }
    return v < rhs.v;
  }
};

template <class Edge>
void ArticulationPointsVisit(
    const typename vector<Edge>::size_type node_now,
    typename vector<Edge>::size_type & time,
    const vector<vector<Edge>> & adjacency_list,
    vector<int> & d,
    vector<int> & low,
    vector<Color> & color,
    vector<int> & parent,
    bitset<kMaxV> & bs_aps) {
  color[node_now] = Color::kGrey;
  d[node_now] = time;
  low[node_now] = time++;
  unsigned child_num = 0;
  for (const auto & e: adjacency_list[node_now]) {
    if (color[e.v] == Color::kWhite) {
      ++child_num;
      parent[e.v] = e.u;
      ArticulationPointsVisit(e.v, time, adjacency_list, d, low, color, parent, bs_aps);
      low[e.u] = min(low[e.u], low[e.v]);

      if (parent[e.u] == kNil && child_num >= 2) {
        bs_aps.set(e.u);
      }
      if (parent[e.u] != kNil && d[e.u] <= low[e.v]) {
        bs_aps.set(e.u);
      }
    } else if (parent[e.u] != e.v) {
      low[e.u] = min(low[e.u], d[e.v]);
    }
  }
  color[node_now] = Color::kBlack;
}

template <class Edge>
bitset<kMaxV> ArticulationPoints(const vector<Edge> & edges,
                 typename vector<Edge>::size_type node_num) {
  using size_type = typename vector<Edge>::size_type;

  vector<vector<Edge>> adjacency_list(node_num, vector<Edge>());
  for (const auto & e: edges) {
    adjacency_list[e.u].push_back(e);
    adjacency_list[e.v].emplace_back(e.v, e.u, e.w);
  }

  size_type time = 0;
  vector<int> d(node_num);
  vector<int> low(node_num);
  vector<Color> color(node_num, Color::kWhite);
  vector<int> parent(node_num, kNil);
  bitset<kMaxV> bs_aps;

  for (unsigned i = 0; i < node_num; ++i) {
    if (color[i] == Color::kWhite) {
      ArticulationPointsVisit(i, time, adjacency_list, d, low, color, parent, bs_aps);
    }
  }

  return bs_aps;
}

int main(int argc, char const *argv[]) {
  using w_type = unsigned;

  vector<Edge<w_type>> edges;
  unsigned V, E;
  cin >> V >> E;
  for (unsigned i = 0; i < E; ++i) {
    unsigned u, v;
    w_type w;
    cin >> u >> v;
    edges.emplace_back(u, v, 1);
  }

  auto bs_aps = ArticulationPoints(edges, V);
  for (unsigned i = 0; i < V; ++i) {
    if (bs_aps.test(i)) {
      cout << i << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 6580
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

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

using namespace std;

int n;
int A[2000];

int solve(int i, int m){
    if(m == 0) return true;
    if(i >= n) return false;
    return solve(i+1,m) || solve(i+1, m - A[i]);
}


int main(){
    cin >> n;
    rep(i,n) cin >> A[i];

    int q; cin >> q;
    int m;
    for(int i=0; i<q; i++){
        cin >> m;
        if(solve(0,m)){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        } 
    }
    
    return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    cin>>k;
    int sum=0,i,j,p,sum1=0;
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=k;j++)
        {
            for(p=1;p<=k;p++)
            {

                sum+=(__gcd(i,__gcd(j,p)));
                //cout<<sum<<" ";
                 //sum1+=sum;
            }
            //cout<<endl;

        }

    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3592
s = input()
s += '!'

sn = 0

pvl = 0
psl = 1

ch = 0
if(s[0]=='>'):
    ch = 0
else:
    ch = 1

for i in range(len(s)):
    
    if(s[i]=='<'):
        if(s[i]==s[i+1]):
            psl += 1

        else:
            sn += psl*(psl-1)//2
            pvl = psl
            psl = 1
            ch = 1

    
    if(s[i]=='>'):
        if(s[i]==s[i+1]):
            psl += 1

        else:

            sn += psl*(psl+1)//2
            if(psl>=pvl):
                sn = sn
            else:
                sn += pvl-psl
            pvl = psl 
            psl = 1
            ch = 0
    
if(ch):
    sn += pvl

         
print(sn)

Measured memory_bytes: 44528
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
 int a,b;
 while( cin >> a >> b ){
  int x = a+b;
  int cnt = 0;
  while(x>0){
   x/=10; 
   cnt++;
  }
  cout << cnt << endl;
 }
 return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<ll>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  CIN(n);V a(n);V b(n);V c(n);
  VECCIN(a);VECCIN(b);VECCIN(c);
  sort(ALL(a));sort(ALL(b));sort(ALL(c));
  V cj(n,0);V bj(n,0);
  V bjj(n+1,0);

  REP(i,n){
     bj[i] = distance(a.begin(),upper_bound(ALL(a),b[i]-1));
     bjj[i+1]=bj[i];
     if(i!=0)bjj[i+1]+=bjj[i];
    // bj[i] = accumulate(a.begin(),upper_bound(ALL(a),b[i]-1),0);
  }
  REP(i,n){
    cj[i] = distance(b.begin(),upper_bound(ALL(b),c[i]-1));
    cj[i] = bjj[cj[i]];
    // cj[i] = accumulate(bj.begin(),bj.begin()+cj[i],0LL);
    // dump(cj[i]);
  }
  COUT(accumulate(ALL(cj),0LL));

  return 0;
}


Measured memory_bytes: 4992
import scala.io.StdIn.{readLine,readInt}

object Main extends App {


  def exec(w:String):Unit =  {
    val len = w.length

    if(w=="-") return else {
      val n = readInt
      var cnt = 0

      for(i <- 1 to n) cnt += readInt
      println((w drop (cnt%len)) + (w take (cnt%len)))
      exec(readLine)
    }
  }

  exec(readLine)
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> S(N+1, 0);
    for (int i = 0; i < M; ++i) {
        int l, r;
        cin >> l >> r;
        ++S[l], --S[r+1];
    }
    ll res = 0;
    for (int i = 0; i < N; ++i) {
        S[i+1] += S[i];
        if (S[i+1] == M) ++res;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4040
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b;
	cin>>a>>b;
	if(a<=b){
		cout<<a<<endl;
	}else{
		cout<<a-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string S;
    int m, h;
    while(1){
        cin >> S;
        if(S == "-") break;
        cin >> m;
        for(int i=0;i<m;i++){
            cin >> h;
            S = S.substr(h) + S.substr(0, h);
        }
        cout << S << endl;
    }
    return 0;
}

Measured memory_bytes: 3196
x, n = gets.split.map(&:to_i)
p = gets.split.map(&:to_i).uniq.sort

j = 0
min = 102
k = 0
102.times do |i|
  if p[j] == i
    j += 1
    next
  end

  v = (x - i).abs
  if min > v
    k = i
    min = v
  end
end

puts k


Measured memory_bytes: 14352
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int n ; cin >> n ;
	int mx = 0 ;
	int ans = 0 ;
	for(int i=0;i<n;i++){
		int a,b ;
		cin >> a >> b ;
		if(a>mx){
			mx = a ;
			ans = a+b ;
		}
	}
	cout << ans << endl ;
}


Measured memory_bytes: 384
// AOJ 2746: jfen
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <ctype.h>
#include <string.h>

char map[10][10];
char s[500];

int main()
{
	int w, h, r, c, k, r1, c1, r2, c2;
	char *p;

	while (scanf("%s", s) && *s != '#') {
		memset(map, 0, sizeof(map));
		p = s, r = c = 0;
		while (*p) {
			if (isdigit(*p)) c += *p - '0';
			else if (*p == 'b') map[r][c] = 'b', c++;
			else if (*p == '/') w = c, r++, c = 0;
			p++;
		}
		h = r+1;

		scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
		map[r1-1][c1-1] = 0, map[r2-1][c2-1] = 'b';
		for (r = 0; r < h; r++) { 
			if (r > 0) putchar('/');
			for (k = c = 0; c < w; c++) {
				if (map[r][c] == 'b') {
					if (k > 0) putchar(k+'0');
					putchar('b'), k = 0;
				} else k++;
			}
			if (k > 0) putchar(k+'0');
		}
		putchar('\n');
    }
    return 0;
}

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

int main()
{
    int n, d;
    cin >> n >> d;
    vector<vector<double>> x(n, vector<double>(d));
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < d; ++j) cin >> x[i][j];
    }

    int ans = 0;
    for(int i = 0; i < n - 1; ++i)
    {
        for(int k = i + 1; k < n; ++k)
        {
            double tmp = 0.0;
            for(int j = 0; j < d; ++j)
            {
                tmp += pow(x[i][j] - x[k][j], 2.0);
            }
            tmp = sqrt(tmp);
            if(tmp - (int)tmp == 0.0) ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

n, q = gets.chomp.split.map(&:to_i)

queue = []
n.times do
  queue << gets.chomp.split
end

time = 0
until queue.empty?
  process = queue.shift
  remain = process[1].to_i
  if remain - q <= 0
    time += remain
    puts "#{process[0]} #{time}"
  else
    time += q
    queue << [process[0], remain - q]
  end
end

Measured memory_bytes: 15128
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;
 
typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}


ll fac(ll n) {
    return n * (n+1) / 2;
}

int main() {
    int m;

    cin >> m;
    ll ans = 0;

    for(ll i=1; i <= m; ++i) {
        ans += i * fac(m/i);
    }

/*
    for(int i=1; i <= m; ++i) {
        for(int j=1; j <= m; ++j) {
            if(i%j == 0) ans += 1; 
        }
    }
*/
    cout << ans << endl;

}

Measured memory_bytes: 3652
import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);

    while(true){
      StringBuilder sb=new StringBuilder(scan.next());
      if(sb.toString().equals("-"))break;
      int m=Integer.parseInt(scan.next());
      for(int i=0;i<m;i++){
        int h=Integer.parseInt(scan.next());
        String buf=sb.substring(0,h);
        sb.delete(0,h);
        sb.append(buf);
      }
      System.out.println(sb);
    }
  }
}


Measured memory_bytes: 26408
fn main() {
    let v1 = read_vec::<u32>();
    let m1 = v1[0];
    let d1 = v1[1];
    let v2 = read_vec::<u32>();
    let m2 = v2[0];
    let d2 = v2[1];

    yn(m2 > m1);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("1");
    } else {
        println!("0");
    }
}


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

int main(){
  int N;cin>>N;
  int ans=0;
  if(N>=105) ans++;
  if(N>=135) ans++;
  if(N>=165) ans++;
  if(N>=189) ans++;
  if(N>=195) ans++;
  cout<<ans<<endl;
}
  


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // 入力
    int N;
    long long h[100010];

    // DP テーブル
    long long dp[100010];

    cin >> N;
    rep(i,N) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    rep(i,100010) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    rep(i,N) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    
    else:
        for i in range(H):
            for j in range(W):
                if i==0 or j==0 or i==H-1 or j==W-1:
                    print('#',end='')
                else:
                    print('.',end='')
            print()
        print()



Measured memory_bytes: 7000
#include <stdio.h>
int main(void)
{
	int n,x,a,b,c;
	while (1)
	{
		scanf("%d %d", &n,&x);
		if (n==0&&x==0)
		{
			break;
		}
		int y = 0;

		for (a = 1; a <= n; a++)
		{
			for (b = a+1; b <= n; b++)
			{
				for (c = b+1; c <= n; c++)
				{
					if ((a + b + c == x)&&(a!=b)&&(b!=c)&&(c!=a))
					{
						y = y + 1;
					}
				}
			}
		}
		printf("%d\n", y);	
	}
	return 0;
}

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

int N;
vector<int> h;

int Solve(int l, int r) {
  if (l < 0 || r < 0 || l > r) return 0;

  int sum = 0;
  bool flag = true;
  while (flag) {
    for (int i = l; i <= r; i++) {
      if (h[i] == 0) {
        flag = false;
        sum += Solve(l, i - 1);
        sum += Solve(i + 1, r);
        break;
      }
    }

    if (flag) {
      for (int i = l; i <= r; i++) h[i]--;
      sum++;
    }
  }

  return sum;
}

int main() {
  cin >> N;
  h.resize(N);
  for (int i = 0; i < N; i++) cin >> h[i];
  int ans = Solve(0, N - 1);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

// #define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << " "
#define dumpL(x) cout << #x << " : " << x << '\n'
#define LINE cout << "line : " << __LINE__ << " "
#define LINEL cout << "line : " << __LINE__ << '\n'
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << " "
#define dumpVL(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) 
#define dumpL(x) 
#define LINE 
#define LINEL 
#define dumpV(v) 
#define dumpVL(v) 
#define STOP assert(false)
#endif
#define mp make_pair
 
namespace std {
template<class S, class T>
ostream &operator <<(ostream& out, const pair<S, T>& a) {
    out << '(' << a.fi << ", " << a.se << ')';
    return out;
}
}

int main(){
   int n, k, Q;
   cin >> n >> k >> Q;
   vi a(n);
   rep(i, n) cin >> a[i];
   int ans = INF;
   rep(i, n) {
       // a[i] -> min
       priority_queue<int, vector<int>, greater<int> > que;
       auto calc = [&](int l, int r) {
           dump(i);
           dump(l);
           dumpL(r);
           if(r - l < k) return;
           priority_queue<int, vector<int>, greater<int> > tmp;
           REP(i, l, r) {
               tmp.push(a[i]);
           }
           while(tmp.size() >= k) {
               auto p = tmp.top();
               tmp.pop();
               que.push(p);
           }
       };
       int l = -1;
       rep(j, n) {
           if(a[j] >= a[i]) {
               if(l < 0) l = j;
           }
           else {
               if(l >= 0) {
                   calc(l, j);
                   l = -1;
               } 
           }
       }
       if(l >= 0) calc(l, n);
       dump(i);
       dumpL(que.size());
       if(que.size() >= Q) {
           int y = que.top();
           rep(j, Q-1) que.pop();
           int x = que.top();
           chmin(ans, x - y);
           dump(i);
           dump(x);
           dumpL(y);
       }
   }
   if(ans == INF) ans = -1;
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  int n;
  cin >> n;
  vector<pair<string,int>> a(n);
  rep(i,n){
    cin >> a[i].first >> a[i].second;
    a[i].second=100-a[i].second;
    a[i].second=1000*a[i].second+i+1;
  }
  sort(a.begin(),a.end());
  rep(i,n)cout << a[i].second%1000 << endl;
}

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

int main() {
    int n;
    cin >> n;
    map<string, int> cnt;
    vector<string> s(n);
    int i = 0;
    for (string x; n--; cnt[x]++) {
        cin >> x;
        s.at(i++) = x;
    }

    int m;
    cin >> m;
    for (string x; m--; cnt[x]--) cin >> x;

    int r = 0;
    for (int i = 0; i < s.size(); i++) {
        if (r < cnt[s.at(i)]) r = cnt[s.at(i)];
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	lint x,a,b;
	cin>>x>>a>>b;
	cout<<((b-a)<=0?"delicious":((b-a)<(x+1)?"safe":"dangerous"))<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("03")
#include <bits/stdc++.h>
typedef long long ll;
const int inf=INT_MAX;
const int mod=1e9+7;
using namespace std;
string s,s1="hello";
int ans,m,k;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>m>>k;

cout<<(m*m)-k<<endl;

    return 0;
}


Measured memory_bytes: 892
S = input()
N = len(S)

first_zero = 0
first_one = 0
for i in range(len(S)) :
    if i % 2 == 0 :
        if S[i] == "1" :
            first_zero += 1
        else :
            first_one += 1
    else :
        if S[i] == "0" :
            first_zero += 1
        else :
            first_one += 1
        
ans = min(first_zero,first_one)
print(ans)


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

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

		// input
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		// check
		int count = 0;
		while(true){
			if(count >= 1000000) {
				count = -1;
				break;
			}
			if(a % 2 != 0 | b % 2 != 0 | c % 2 != 0){
				break;
			}
			int tempA = a / 2;
			int tempB = b / 2;
			int tempC = c / 2;
			a = tempB + tempC;
			b = tempA + tempC;
			c = tempA + tempB;
			count++;
		}

		// answer
		System.out.println(count);

	}
}



Measured memory_bytes: 23892
#include <algorithm>　　　 //STL 通用算法
#include <bitset>　　　　　//STL 位集容器
#include <cctype>         //字符处理
#include <cerrno> 　　　　 //定义错误码
#include <cfloat>　　　　 //浮点数处理
#include <ciso646>         //对应各种运算符的宏
#include <climits> 　　　　//定义各种数据类型最值的常量
#include <clocale> 　　　　//定义本地化函数
#include <cmath> 　　　　　//定义数学函数
#include <complex>　　　　 //复数类
#include <csignal>         //信号机制支持
#include <csetjmp>         //异常处理支持
#include <cstdarg>         //不定参数列表支持
#include <cstddef>         //常用常量
#include <cstdio> 　　　　 //定义输入／输出函数
#include <cstdlib> 　　　　//定义杂项函数及内存分配函数
#include <cstring> 　　　　//字符串处理
#include <ctime> 　　　　　//定义关于时间的函数
#include <cwchar> 　　　　 //宽字符处理及输入／输出
#include <cwctype> 　　　　//宽字符分类
#include <deque>　　　　　 //STL 双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream> 　　　 //文件输入／输出
#include <functional>　　　//STL 定义运算函数（代替运算符）
#include <limits> 　　　　 //定义各种数据类型最值常量
#include <list>　　　　　　//STL 线性列表容器
#include <locale>         //本地化特定信息
#include <map>　　　　　　 //STL 映射容器
#include <memory>         //STL通过分配器进行的内存分配
#include<new>            //动态内存分配
#include <numeric>         //STL常用的数字操作
#include <iomanip> 　　　 //参数化输入／输出
#include <ios>　　　　　　 //基本输入／输出支持
#include <iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream> 　　　//数据流输入／输出
#include <istream>　　　　 //基本输入流
#include <iterator>        //STL迭代器
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL 队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　 //基于字符串的流
#include <stack>　　　　　 //STL 堆栈容器
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　 //底层输入／输出支持
#include <string>　　　　　//字符串类
#include <typeinfo>        //运行期间类型信息
#include <utility>　　　　 //STL 通用模板类
#include <valarray>        //对包含值的数组的操作
#include <vector>　　　　　//STL 动态数组容器
using namespace std;
int main () {
  int N;
  cin >> N;
  vector <int> l(N);
  for (int i = 0; i < N; i++) cin >> l.at(i);
  int count = 0;
  sort (l.begin(),l.end());
  for (int i = 0; i < N; i++){
    for (int j = 0; j < i; j++){
      for (int k = 0; k < j; k++){
       if ((l.at(k) != l.at(i)) && (l.at(k) != l.at(j))&&(l.at(i) != l.at(j)) && (l.at(i) < l.at(j)+l.at(k))) count ++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>

int N, K;
std::vector<int> a;

int dp[1000001];

int main() {
  std::memset(dp, -1, sizeof(dp));
  std::cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    int x; std::cin >> x;
    a.push_back(x);
  }
  std::sort(a.begin(), a.end());

  dp[0] = false;
  for (int i = 1; i <= K; ++i) {
    dp[i] = false;
    for (int x : a) {
      if (x > i) break;
      if (!dp[i - x]) dp[i] = true;
    }
  }
  std::cout << (dp[K]? "First\n" : "Second\n");
}


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

#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    n %= 10;
    if(n == 2 or n == 4 or n == 5 or n == 7 or n == 9)
    {
        cout<<"hon"<<endl;
    }
    else if(n == 0 or n == 1 or n == 6 or n == 8)
    cout<<"pon"<<endl;
    else
    cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3652
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
plst = list(map(int, input().split()))

if x not in plst:
    print(x)
    exit()
minus = x
plus = x
while 1:
    minus -= 1
    if minus not in plst:
        print(minus)
        exit()
    plus += 1
    if plus not in plst:
        print(plus)
        exit()



Measured memory_bytes: 9188
from collections import Counter

H, W, N, *AB = map(int, open(0).read().split())

move = [
    (-1, -1), (-1, 0), (-1, 1),
    (0, -1),  (0, 0),  (0, 1),
    (1, -1),  (1, 0),  (1, 1),
]

C = Counter()
for a, b in zip(*[iter(AB)] * 2):
    C.update(
        (a - i, b - j)
        for i, j in move
        if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1
    )

D = Counter(C.values())

print((H - 2) * (W - 2) - len(C))
for i in range(1, 10):
    print(D[i])


Measured memory_bytes: 178260
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int main() {
    set<int> se;
    for (int i = 0; i < 4; i++) {
        int a;
        cin >> a;
        se.insert(a);
    }
    if (!se.count(1) || !se.count(9) || !se.count(7) || !se.count(4)) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

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

using namespace std;

int main(){
    long long k;
    cin >> k;
    vector<long long> ans(50,k/50+49);
    for(long long i = 0;i < k%50;i++){
        for(long long j = 0;j < 50;j++){
            if(i == j){
                ans[j] += 50;
            } else {
                ans[j] -= 1;
            }
        }
    }
    cout << 50 << endl;
    for(int i = 0;i < 50;i++){
        cout << ans[i] << ' ';
    }cout << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define endl "\n"
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[111];

int main() {
	clr(d,-1);
	ll n;
	cin>>n;
	vector<ll> v;
	rep(i,0,n){
		ll a;
		cin>>a;
		a--;
		v.pb(a);
	}
	per(i,0,100){
		per(j,0,v.sz){
			if(v[j]==i){
				ll c = 0;
				rep(k,j+1,v.sz){
					if(v[k]<i)c++;
				}
				ll p = i;
				ll index = 0;
				while(1){
					if(p==v.sz){
						cout << -1 << endl;
						return 0;
					}
					if(d[p]==-1){
						if(index==c){
							d[p] = i;
							break;
						}
						else{
							index++;
						}
					}
					p++;
				}
			}
		}
	}
	rep(i,0,n){
		cout << d[i]+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        // N W S E
        int dir[] = new int[4];
        int len = s.length();
        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            switch (c) {
            case 'N':
                dir[0]++;
                break;
            case 'W':
                dir[1]++;
                break;
            case 'S':
                dir[2]++;
                break;
            case 'E':
                dir[3]++;
                break;
            default:
                break;
            }
        }
        boolean ok = true;
        if (dir[0] == 0) {
            if (dir[2] != 0) {
                ok = false;
            }
        }
        if (dir[1] == 0) {
            if (dir[3] != 0) {
                ok = false;
            }
        }
        if (dir[2] == 0) {
            if (dir[0] != 0) {
                ok = false;
            }
        }
        if (dir[3] == 0) {
            if (dir[1] != 0) {
                ok = false;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}


Measured memory_bytes: 23764