akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>
   
using namespace std;

string s;

vector<string> solve(string nows, map<char, bool> used, int i)
{
    // cout << nows << endl;
    vector<string> ans;
    vector<string> tmp;
    if(i == s.length()){
        ans.push_back(nows);
    } else if(used[s[i]]){
        // ?????§??????????????????(????????????)?????????????????????????????¨??????????????????????????????????????????
        // ???????????¨???????????????????????????????????????????????´???????????¨?????????????????????????????????
        // ?????????z????????????????????????
        tmp = solve(nows + s[i], used, i + 1);
        ans.insert(ans.end(), tmp.begin(), tmp.end());
        if(s[i] != 'z' && !used[s[i] + 1]){
            used[s[i] + 1] = true;
            tmp = solve(nows + (char)(s[i] + 1), used, i + 1);
            ans.insert(ans.end(), tmp.begin(), tmp.end());
        }
    } else {
        // ????????????????????????????????????????????´??????????????¨??????????????????????????????????????????????????¨???????????¨?????????????????????????????¨????????????
        // ?????????????????????????????????????????????
        // ?????????'a'?????????????????????????????????????????????
        // ?????????z????????????????????????
        if(s[i] == 'a'){
            tmp = solve(nows + s[i], used, i + 1);
            ans.insert(ans.end(), tmp.begin(), tmp.end());
            if(!used[s[i] + 1]){
                used[s[i] + 1] = true;
                tmp = solve(nows + (char)(s[i] + 1), used, i + 1);
                ans.insert(ans.end(), tmp.begin(), tmp.end());
            }
            return ans;
        } else if(s[i] != 'z' && !used[s[i] + 1]){
            used[s[i] + 1] = true;
            tmp = solve(nows + (char)(s[i] + 1), used, i + 1);
            ans.insert(ans.end(), tmp.begin(), tmp.end());
        } else {
            if(s[i] != 'z') ans.clear();
        }
    }
    return ans;
}

int main()
{
    while(1){
        cin >> s;
        if(s == "#") break;
        map<char, bool> alpha;
        for(int i = 0; i < 26; i++){
            alpha['a' + i] = false;
        }
        vector<string> result = solve("", alpha, 0);
        cout << result.size() << endl;
        if(result.size() < 10){
            for(int i = 0; i < result.size(); i++){
                cout << result[i] << endl;
            }
        } else {
            for(int i = 0; i < 5; i++){
                cout << result[i] << endl;
            }
            for(int i = 0; i < 5; i++){
                cout << result[result.size() - 5 + i] << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2872
#include <stdio.h>

int main(void) {
  int S;
  scanf("%d", &S);

  int h, m, s;
  s = (S % 60);
  m = (((S - s) / 60) % 60);
  h = (((((S - s) / 60) - m) / 60) % 60);

  printf("%d:%d:%d\n", h, m, s);
  return 0;
}



Measured memory_bytes: 2052
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

void answer(int a, int b) {
	cout << a << " " << b;
}

int main(void) {


	ll x;
	cin >> x;

	/*

	{
		auto v = pow(10,9);

		int valP = 0;
		int valM = 0;
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(i, 5) - pow(i - 1, 5);
			if (a >= v) {
				valP = i;
				break;
			}
		}
		for (int i = 1; i < 2000; ++i) {
			auto a = pow(-i, 5) - pow(-i - 1, 5);
			if (a >= v) {
				valM = -i;
				break;
			}
		}
		cout << valP << " " << valM;
		return 0;
	}
	→120,-119のため、答えは-119<=A|B<=120
	*/

	
	map<ll, int> ans;
	for (int i{ 1000 }; i--;) {
		ll val = 1;
		for (int j{}; j < 5; ++j) val *= i;

		if (ans[val + x]) {
			cout << ans[val + x]<< " " <<  i;
			break;
		}

		if (ans[-val + x]) {
			cout << ans[-val + x]<< " " <<  -i;
			break;
		}

		ans[val] = i;
	}
	/*map<ll, int> mp;
	for (int i{ 1000 }; i--;) {
		ll c{ 1 };
		for (int j{}; j < 5; ++j) c *= i;
		if (mp[c + x])
			return cout << mp[c + x] << " " << i << endl, 0;
		if (mp[x - c])
			return cout << mp[x - c] << " " << -i << endl, 0;
		mp[c] = i;
	}
*/

	//auto output = resultCount;
	//cout << output;

	return 0;
}


Measured memory_bytes: 3732
#include <iostream>

using namespace std;

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

int main(void)
{
	string s;
	cin >> s;
	int S = 0;
	int T = 0;
	int ans = 0;
	rep(i, s.length()) {
		if (s[i] == 'S') S++;
		else T++;
		if (T > S) {
			ans++;
			T--;
		} else {
			S -= T;
			T = 0;
		}
	}
	cout << ans + S << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

ll digit(string s){
	ll c = 0;
	for (int a = 0; a < s.size(); a++){
		c = 10 * c + (int)(s[a] - '0');
	}
	return c;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s; cin >> s;
	//if (s.size() == 1) return cout << s << endl, 0;
	ll ans = 0;
	int n = s.size() - 1;
	for (int i = 0; i < (1 << n); i++){
		int x = i + (1 << n);
		ll pi = 0;
		for (int j = 0; j <= n; j++){
			if (x & (1 << j)){
				ans += digit(s.substr(pi, j - pi + 1));
				pi = j + 1;
			}
		}
		//cout << i << " " << ans << endl;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <set>
#include <deque>
#include <list>
#include <cassert>
#include <iomanip>

using namespace std;

#define in cin
#define out cout
#define ll long long

void output(bool x) {
    if (x) out<<"Yes"<<endl;
    else out<<"No"<<endl;
}

ll maxn=1000000000;

int main() {

    ll n,m,h,w;in>>n>>m>>h>>w;

    if (h==1 and w==1) {output(0);return 0;}

    ll table[n][m];

    ll pos=(maxn-1)/(h*w-1);
    ll neg=-pos*(h*w-1)-1;

    ll res=0;

    for (int i=0;i<n;i++) {
        for (int j=0;j<m;j++) {
            if (i%h==h-1 and j%w==w-1) {
                table[i][j]=neg;
                res+=neg;
            }
            else {
                table[i][j]=pos;
                res+=pos;
            }
        }
    }

    if (res<=0) output(0);
    else {
        output(1);
        for (int i=0;i<n;i++) {
            for (int j=0;j<m;j++) {
                out<<table[i][j]<<" ";
            }
            out<<endl;
        }
    }



    return 0;


}








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

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

int main() {
    int N,Q;
    cin >> N >> Q;
    vector<long long> a(N),x(Q);
    rep(i, N) {
        cin >> a.at(i);
    }
    rep(i, Q) {
        cin >> x.at(i);
    }

    rep(i, Q) { // 各質問ごとに回していく
        long long res = 0; // 合計値

        int right = 0; // 考えている場所の右側の情報、使い回す
        long long sum = 0; // 考えている部分の合計値、使い回す
        for (int left = 0; left < N; ++left) {
            // 今考えているセルの次の値を入れても問題がなければすすむ
            while (right < N && sum + a[right] <= x[i]) {
                sum += a[right];
                ++right;
            }
            
            // while文をbreakしたところが条件を満たす最大のところ
            res += (right - left);

            if (right == left) {
                // leftはfor文で+1していくが、rightはしないので、
                // rightとleftが重なった場合は、ここで ++rightしてあげる必要がある
                ++right; 
            } else {
                // leftを +1するので、その分sumから引いておく
                sum -= a[left];
            }

        }
        
        cout << res << endl;
    }

    return 0;
}



Measured memory_bytes: 3552
import sys
input = sys.stdin.readline


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return table


def main():
    N = int(input())
    table = sieve(55555)
    P = []
    for p in table:
        if p%5==1:
            P.append(p)
    print(' '.join(map(str, P[:N])))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Union_Find_Tree{
	public:
	vi p,r,s;
	Union_Find_Tree(int n){
		p=r=vi(n);
		s=vi(n,1);
		for(int i=0;i<n;i++) p[i]=i;
	}
	int Par(int x){
		if(p[x]==x) return x;
		return p[x]=Par(p[x]);
	}
	int Size(int x){return s[Par(x)];}
	bool Unite(int x,int y){
		x=Par(x);
		y=Par(y);
		if(x==y) return 0;
		if(r[x]<r[y]){
			p[x]=y;
			s[y]+=s[x];
		}
		else{
			p[y]=x;
			s[x]+=s[y];
			if(r[x]==r[y]) r[x]++;
		}
		return 1;
	}
	bool Same(int x,int y){return Par(x)==Par(y);}
};

int n,m;
vi res,vis;
vp a;
vvp g;

int dfs(int v,int p){
	vis[v]++;
	int t=((v==0?0:a[v-1].second)!=(v==n?0:a[v].second));
	for(auto q:g[v]){
		int u=q.first;
		if(u!=p){
			if(dfs(u,v)){
				res.push_back(q.second+1);
				t++;
			}
		}
	}
	return t%2;
}

int main(){
	cin>>n>>m;
	a=vp(n);
	g=vvp(n+1);
	vis=vi(n+1);
	for(int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
	sort(a.begin(),a.end());
	vi b(n);
	for(int i=0;i<n;i++) b[i]=a[i].first;
	Union_Find_Tree uft(n+1);
	for(int i=0;i<m;i++){
		int l,r;
		cin>>l>>r;
		int u=lower_bound(b.begin(),b.end(),l)-b.begin();
		int v=upper_bound(b.begin(),b.end(),r)-b.begin();
//		cout<<u<<' '<<v<<endl;
		if(uft.Unite(u,v)){
			g[u].push_back({v,i});
			g[v].push_back({u,i});
		}
	}
	bool flag=1;
	for(int i=0;i<n;i++) if(!vis[i]){
		if(dfs(i,-1)) flag=0;
	}
	if(!flag) cout<<-1<<endl;
	else{
		int sz=res.size();
		cout<<sz<<endl;
		sort(res.begin(),res.end());
		for(int i=0;i<sz;i++) cout<<res[i]<<" \n"[i==sz-1];
	}
}

Measured memory_bytes: 9596
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>

#define _CRT_SECURE_NO_WARNINGS
#define _CRT_DISABLE_PERFCRIT_LOCKS
#define cdbg cerr << "Debug in " << __func__ << ", " << __LINE__ << ": "

#define q <<  '\n'
#define sp << ' '
#define pb emplace_back
#define ft first
#define sd second
#define ld long double
#define ll long long
#define ull unsigned long long
#define lll __int128
#define pii pair<int , int>
#define vi vector<ll>
using namespace std;
const ll INF = 1e8;
const ll N = 1000;

ll H, W, h, w;
main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> H >> W >> h >> w;
	cout << (H*W) - (h*W + w*(H-h)) q;





















































}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef unordered_map<int,int> m32;
typedef map<ll,ll> m64;
typedef unordered_map<ll,set<ll> > m648;
typedef pair<ll,p64 > pp64;
ll MOD = 1e9 + 7;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll N;
    cin >> N;
    ll s;
    if(N%2==0){
        s = (N+1);
    }
    else{
        s = N;
    }
    ll n=N;
    ll m=0;
    vp64 ans;
    forsn(i,1,n+1){
        forsn(j,i+1,n+1){
            if(i+j!=s){
                ans.pb(mp(i,j));
                m++;
            }
        }
    }
    cout << m << ln;
    forn(i,(ll)ans.size()){
        cout << ans[i].fi << " " << ans[i].se << ln;
    }
    return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	LL N; cin >> N;
	LL ans = 0;
	for(LL i = 1 ; i*i <= N ; ++i) if(N%i == 0){
		if(i < N/i-1) ans += N/i-1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scanner = new Scanner(System.in);
		
		String str = scanner.nextLine();
		scanner.close();
		
		if (str.length() != 4) {
			System.out.println("No");
			return;
		}
		
		char[] ar = str.toCharArray();
		Arrays.sort(ar);
		
		if (ar[0] == ar[1] && ar[2] == ar[3] && ar[0] != ar[2] ) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long ll;

vector<string> v;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M, D;
    cin >> N >> M >> D;

    for (int i = 0; i < N; ++i)
    {
        string s;
        cin >> s;
        v.push_back(s);
    }

    int cnt = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < M; ++j)
        {
            for (int k = 0; k < D; ++k)
            {
                if (j + k >= M || v[i][j + k] != '.')
                    break;
                if (k == D - 1)
                    cnt++;
            }
            for (int k = 0; k < D; ++k)
            {
                if (i + k >= N || v[i + k][j] != '.')
                    break;
                if (k == D - 1)
                    cnt++;
            }
        }
    }
    cout << cnt << endl;

    return 0;
}


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

//  #define DEBUG

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int const bsize = 2001;
    int n, m;
    cin >> n;
    int a;
    int b[n + 1][bsize] = {};
    b[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        for (int j = 0; j < bsize; j++)
        {
            b[i + 1][j] = max(b[i + 1][j], b[i][j]);
            if (j + a < bsize)
                b[i + 1][j + a] = b[i][j];
        }
    }

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        cout << ((b[n][a] == 1) ? "yes" : "no") << endl;
    }

    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tii;
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

int main(){
  ll N; cin >> N;
  ll ans = 0;
  for(int i=1;i<=N;i++){
    ll n = N/i;
    ans += n*(i+i*n)/2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		int Y = s.nextInt();


		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N - i; j++) {
				for (int k = 0; k <= N - i - j; k++) {
					if (i + j + k == N) {
						if (i * 1000 + j * 5000 + k * 10000 == Y) {
							System.out.println(k + " " + j + " " + i);
							return;
						}
					}
				}
			}
		}
		System.out.println("-1 -1 -1");

	}
}


Measured memory_bytes: 23892
n = int(input())
a = list(map(int, input().split()))

q = 1000000000000000000
b = 1
cek = True
zero = a.count(0)
if zero > 0 :
	print("0")
else :
	for i in range(n) :
		b = b*a[i]
		if b > q :
			cek = False
			break
	if cek :
		print(b)
	else :
		print("-1")


Measured memory_bytes: 21664
import java.util.*

fun Int.isEven():Boolean {
    return this % 2 == 0;
}

fun createRow(h: Int, w: Int): String =
    (1..w).map { if (h.isEven() == it.isEven()) "#" else "." }.joinToString("")


fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    while (true) {
        val H =scanner.nextInt()
        val W =scanner.nextInt()
        if (H == 0 && W == 0) {
            break
        }
        val rectangle = (1..H).map { createRow(it, W) }.joinToString("\n")
        println(rectangle)
        println()
    }
}



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

int number[100005];

int main() {
    int N, num, max_count = 0;
    cin >> N;
    for (int i = 0; i < 100005; i++) number[i] = 0;
    for (int i = 0; i < N; i++) {
        cin >> num;
        number[num]++; number[num + 1]++; number[num - 1]++;
    }
    for (int i = 0; i < 100005; i++) max_count = max(max_count, number[i]);
    cout << max_count << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<int,ll> P;
#define N (1000000000+7)
#define INF (ll)1e16
typedef long long ll;



int main(void){
    string s,t="";
    vector<char>alpha;
    cin>>s;
    if(s.length()>9){
        cout<<"NO"<<endl;
        return 0;
    }
    for(int i=0;i<s.length();i++){
        if(s[i]=='K'){
            alpha.push_back('0');
            alpha.push_back(s[i]);
        }
        else{
            if(s[i]=='B'){
                alpha.push_back('0');
                alpha.push_back(s[i]);
            }
            else{
                if(s[i]=='R'){
                    alpha.push_back('0');
                    alpha.push_back(s[i]);
                    alpha.push_back('0');
                }
                else alpha.push_back(s[i]);
            }
        }
    }
    for(int i=0;i<(int)alpha.size();i++){
        if(i!=0){
            if(alpha[i]=='0'){
                if(alpha[i-1]=='A')continue;
                else {
                    if(alpha[i+1]=='A')continue;
                    else t+='A';
                }
            }
            else t+=alpha[i];
        }
        else {
            if(alpha[i]=='0')t+='A';
            else t+=alpha[i];
        }
    }
    if(t=="AKIHABARA")cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
    Code written by Talant I.D.
*/

#include <bits/stdc++.h>

using namespace std;

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

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define sz(v) int(v.size())
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);

inline bool isvowel(char ch){
    ch = tolower(ch);
    return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}

const int INF = 0x3f3f3f3f;

inline bool isprime(int n){
    if(n < 2 || (n%2 == 0 && n != 2)) return false;
    for(int i = 3; i*i <= n; i += 2)
        if(n%i == 0) return false;
    return true;
}

const int mod = 2019;

int main(){
    do_not_disturb

    string s;
    vector <int> rem(mod);
    ll ans = 0;
    int num = 0, pw = 1;

    cin >> s;
    rem[0]++;

    for(int i = sz(s)-1; i >= 0; i--){
        num = (int(s[i]-'0')*pw+num)%mod;
        ans += rem[num]*1ll;
        rem[num]++;
        pw = (pw*10)%mod;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3676
#include <stdio.h>

int main(){
    int a, b, n, s;
    
    while(scanf("%d %d %d", &a, &b, &n) != EOF){
        s = 0;
            
        while(n--){
            a %= b;
            a *= 10;
            s += a / b;
        }
        
        printf("%d\n", s);
    }
    
    return 0;
}

Measured memory_bytes: 596
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>

int main(void)
{
  int ret;
  int N, K, i, n, j, p, itazura;
  char nusukes[100];
  char okashi[100*3+1];
  char num[3];
  
  memset(nusukes, 0, sizeof(nusukes));

  /* input N K */
  ret = scanf("%d %d", &N, &K);

  /* K分ループ */
  for (i = 0; i < K; i++)
  {
  	/* input お菓子持っている人数 */
    ret = scanf("%d", &n);
    
  	/* input お菓子持っている人 */
    for (j = 0; j < n; j++)
    {
	    ret = scanf("%d", &p);
      	nusukes[p-1] = 1;
    }
  }
  
  /* output 悪戯人数 */
  itazura = 0;
  for(i = 0; i < N; i++)
  {
    itazura += nusukes[i];
  }

  printf("%d", N - itazura);

  return 0;
}



Measured memory_bytes: 1736
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1 << 30)

int H, A[MAX + 1];

void maxHeapify(int i) {
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;
    
    if (l <= H && A[l] > A[i]) largest = l;
    else largest = i;
    if (r <= H && A[r] > A[largest]) largest = r;
    
    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract() {
    int maxv;
    if (H < 1) return -INFTY;
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key) {
    if (key < A[i]) return;
    A[i] = key;
    while (i > 1 && A[i / 2] < A[i]) {
        swap(A[i], A[i / 2]);
        i = i / 2;
    }
}

void insert(int key) {
    H++;
    A[H] = -INFTY;
    increaseKey(H, key);
}

int main() {
    int key;
    char com[10];
    
    while (1) {
        scanf("%s", com);
        if (com[0] == 'e' && com[1] == 'n') break;
        if (com[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        } else {
            printf("%d\n", extract());
        }
    }
    
    return 0;
}


Measured memory_bytes: 6632
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()



int main(void){

    string S;
    cin >> S;

    char a,b;
    string ans = "No";

    a = S[0];
    if(S[1] == a){
        if(S[2] != a){
            b = S[2];
            if(S[3] == b){
                ans = "Yes";
            }
        }
    }else{
        b = S[1];
        if(S[2] == a){
            if(S[3] == b){
                 ans = "Yes";
            }
        }else if(S[2] == b){
            if(S[3] == a){
                 ans = "Yes";
            }
        }
    }

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


Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <boost/graph/adjacency_list.hpp>
//#include <boost/graph/dijkstra_shortest_paths.hpp>
//#include <boost/graph/graph_utility.hpp>
#include <boost/sort/spreadsort/spreadsort.hpp>
  
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;

/*
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
*/


#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define bsort boost::sort::spreadsort::spreadsort
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}


signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n;
    cin >> n;

    string s;
    cin >> s;

    auto t = s;

    bsort(all(t));

    int cnt = 0;

    rep(i,n){
        cnt += (t[i] != s[i]);
    }

    cout << cnt / 2 << '\n';

    return 0;
}


Measured memory_bytes: 3828
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.text.Segment;

public class Main {

	public static void main(String[] args) throws IOException {
		try (Scanner sc = new Scanner(System.in)) {
			final char[] ins = sc.next().toCharArray();
			
			for(int i = 0; i < ins.length; i++){
				int j = i;
				while(j < ins.length){
					if(ins[i] != ins[j]){ break; }
					j++;
				}
				
				if(j - i >= 3){ 
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int v[10];
int main()
{
    int a,b,r=0,i=1,j=1;
    cin>>a>>b;
    while(b)
    {
        v[i]=b%10;
        b=b/10;
        i++;
    }
    reverse(v+1,v+i+1);
    while(j<=i)
    {
        a+=v[j];
        j++;
        a*=10;
    }
    a=a/10;
    r=sqrt(a);
    if(r*r==a)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <math.h>
#include <list>
#include <string>
using namespace std;
int N;
int graph[201][201];
int max_set = 0;
int visited[201];
bool isCycle;
map<int, int> v_to_set;

void bfs(int v) {
	queue<int> q;
	q.push(v);
	int set = 1;
	v_to_set[v] = set;
	max_set = max(max_set, set);
	visited[v] = true;
	while (!q.empty()) {
		int curr = q.front();
		q.pop();
		for (int i = 0; i < N; i++) {
			if (graph[curr][i] == 1 && !visited[i]) {
				visited[i] = true;
				v_to_set[i] = v_to_set[curr] + 1;
				max_set = max(max_set, v_to_set[curr] + 1);
				q.push(i);
			}
		}
	}
}

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

	for (int i = 0; i < N; i++) {
		string str;
		cin >> str;
		for (int j = 0; j < N; j++) {
			graph[i][j] = str[j]-'0';
		}
	}

	int ans = 0;
	bool isPossible = false;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			visited[j] = false;
		}
		bfs(i);

		bool tempIsPossible = true;
		for (int j = 0; j < N; j++) {
			int curr_set = v_to_set[j];

			for (int k = 0; k < N; k++) {
				if (graph[j][k] == 1) {
					if (curr_set == max_set) {
						if (v_to_set[k] != curr_set - 1) {
							tempIsPossible = false;
							break;
						}
					}
					else if (curr_set == 1) {
						if (v_to_set[k] != curr_set + 1) {
							tempIsPossible = false;
							break;
						}
					}
					else {
						if (!(v_to_set[k] == curr_set + 1 || v_to_set[k] == curr_set - 1)) {
							tempIsPossible = false;
							break;
						}
					}
				}
			}
			if (!tempIsPossible) break;
		}
		if (tempIsPossible) {
			ans = max(ans, max_set);
			isPossible = true;
		}
	}

	if (isPossible) {
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}
	
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long LL;
const LL P = 998244353;
const int N = 300010;

int n,cnt[3];
char c;
LL ans = 1;

int main(){
	scanf("%d\n",&n);
	rep(i,1,n) ans = ans * i % P;
	rep(i,1,3*n){
		scanf("%c",&c);
		int t = (c>'B') + (c>'G'), mn = 1e9;
		rep(j,0,2) if(cnt[j]>cnt[t]) mn = min(mn, cnt[j] - cnt[t]);
		if(mn<1e9) ans = ans * mn % P;
		++cnt[t];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] h = new int[n];
        for(int i=0; i<n; i++) {
            h[i] = in.nextInt();
        }
        int[] dp = new int[n];
        dp[n-1] = 0;
        for(int i=n-2; i>=0; i--) {
            int min = Integer.MAX_VALUE;
            for(int j=1; j<=Math.min(k, n-1-i); j++) {
                int val = Math.abs(h[i+j]-h[i])+dp[i+j];
                min = Math.min(min, val);
            }
            dp[i] = min;
        }
        System.out.println(dp[0]);
    }
}


Measured memory_bytes: 52324
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

struct PrimeFactorization {
    vector<pair<int, int>> factors;
    void factor(ll n) {
        int sqrt_n = (int)(sqrt(n) + 0.5);
        primes.clear();
        isPrime.assign(sqrt_n + 1, true);
        for (int k = 2; k <= sqrt_n; ++k) {
            if (!isPrime[k]) continue;
            primes.push_back(k);
            for (int m = k * 2; m <= sqrt_n; m += k) isPrime[m] = false;
        }
        factors.clear();
        for (int i = 0; i < (int)primes.size() && n > 1; ++i) {
            if (n % primes[i] != 0) continue;
            factors.emplace_back(primes[i], 0);
            for (; n % primes[i] == 0; n /= primes[i]) factors.back().second++;
        }
        if (n > 1) factors.emplace_back(n, 1);
        sort(factors.begin(), factors.end());
    }
    pair<int, int> operator [](int i) const { return factors[i]; }
    int size() const { return factors.size(); }
private:
    vector<int> primes;
    vector<bool> isPrime;
};

int main() {
    ll N;
    cin >> N;

    if (N == 1) {
        write(0);
        return 0;
    }

    PrimeFactorization pf;
    pf.factor(N);

    int ans = 0;
    rep(i, pf.size()) {
        int exp = pf[i].second;
        rep(e, 1, pf[i].second + 1) {
            if (e <= exp) {
                ans++;
                exp -= e;
            }
            else break;
        }
    }

    write(ans);
}


Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
    long q, type, f;
    char c;
    std::string s;
    bool flag = true;

    std::cin >> s;
    std::cin >> q;
    for (int i = 0; i < q; i++)
    {
        std::cin >> type;

        switch (type)
        {
        case 1:
            flag = !flag;
            break;
        case 2:
            std::cin >> f;
            std::cin >> c;
            if ((f == 1 && flag) || (f == 2 && !flag))
            {
                s.insert(s.begin(), c);
            }
            else
            {
                s.push_back(c);
            }
            break;
        }
    }
    if (!flag)
    {
        for (int i = 0; i < s.length(); i++)
        {
            std::cout << s[s.length() - 1 - i];
        }
        std::cout << std::endl;
    }
    else
    {
        std::cout << s << std::endl;
    }
}

Measured memory_bytes: 1028
/*

Coded and Decoded by : Yash Kapoor

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

// s.find_by_order(index);
// s.order_of_key(value);

#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll, ll>
#define vl vector<ll>
#define sl set<ll>
#define vll vector<pll>
#define ml map<ll, ll>
#define mll map<pll, ll>
#define all(a) a.begin(), a.end()
#define x first
#define y second
#define sz(x) (ll) x.size()
#define dl '\n'
#define why (ll)1000000007
//#define why         (ll)998244353
#define lp(i, a, b) for (ll i = a; i < b; ++i)
#define lpr(i, a, b) for (ll i = a; i >= b; i--)
#define lpd(i, x) for (auto i : x)
#define ios                                                                                                            \
  ios_base::sync_with_stdio(false);                                                                                    \
  cin.tie(0);                                                                                                          \
  cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base, ll power, ll mod)
{
  ll result = 1;
  while (power) {
    if (power % 2)
      result = (result * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return result;
}

ll inverse(ll base, ll mod) { return fast_power(base, mod - 2, mod); }
int test = 1;
void solve() 
{
  ll n; cin >> n;
  vl a(n),b(n),c(n);
  lp(i,0,n) cin >> a[i] >> b[i] >> c[i];
  ll dp[n][3];
  memset(dp, 0, sizeof dp);
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1; i < n; i++) {
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }
    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) <<endl;
}

int main()
{
  // #ifndef ONLINE_JUDGE 
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt", "w", stdout);
  // #endif
  ios 
  ll t = 1;
  //cin >> t;
  while (t--) 
  {
    //cout << "Case #" << test++ << ": ";
    solve();
  }
}

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

judge = 'Yes'

index_left = (N - 1) // 2
index_right = (N + 3) // 2

kaibunn_left = list(S[:index_left])
kaibunn_right = list(S[index_right - 1 :])


for i in range(N):
    s = list(S)
    s_begin = s[i]
    s_end = s[N - 1 - i]
    
    if (s_begin != s_end):
        judge = 'No'
        break


for i in range(index_left):
    n = len(kaibunn_left)
    s_begin = kaibunn_left[i]
    s_end = kaibunn_left[n - 1 - i]
    
    if (s_begin != s_end):
        judge = 'No'
        break


for i in range(len(kaibunn_right)):
    n = len(kaibunn_right)
    s_begin = kaibunn_right[i]
    s_end = kaibunn_right[n - 1 - i]
    
    if (s_begin != s_end):
        judge = 'No'
        break

print(judge)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    int win = 0;
    for (int i = 0; i < S.size(); ++i) {
        if(S[i] == 'o') win++;
    }
    win += 15 - S.size();
    if(win >= 8){
        cout << "YES" << "\n";
    } else{
        cout << "NO" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int k; cin >> k;
  vector<int> a={1,1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  cout << a[k-1] << endl;
  
}

Measured memory_bytes: 256
def atc_060a(input_value: str) -> str:
    A, B, C = map(str, input_value.split(" "))
    if A[-1] == B[0] and B[-1] == C[0]:
        return "YES"
    else:
        return "NO"

input_value = input()
print(atc_060a(input_value))

Measured memory_bytes: 9104
use proconio::input;

fn main() {
  input! {
      n: u32,
      m: u32,
      a: [u32; m],
  }
  
  let mut sum: u32 = 0;
  for x in a {
    sum += x;
  }
  let day = (n - sum)as i32;
  let ans: i32 = if day < 0 {-1} else {day};
  println!("{}", ans);

}


Measured memory_bytes: 2184
/**
 *   author: sahushivam
 *   created: 23 January 2019  10:33:14
**/
#include <bits/stdc++.h>
using namespace std;
typedef long ll;
typedef long double ld;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff

void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
    optimizeIO(); 
    int n,W;
    cin>>n>>W;
    int *weight=new int[n];
    ll *val=new ll[n];
    REP(i,0,n) cin>>weight[i]>>val[i];
    long K[n+1][W+1]; 
     for (int i = 0; i <= n; i++) 
   { 
       for (int w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (weight[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-weight[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
    cout<<K[n][W];
return 0;
}

Measured memory_bytes: 79232
package main

import (
	"fmt"
)

func main() {
	var c string
	fmt.Scan(&c)

	if c == "a" || c == "i" || c == "u" || c == "e" || c == "o" {
		fmt.Println("vowel")
	} else {
		fmt.Println("consonant")
	}
}


Measured memory_bytes: 512
def main():
    N, M = map(int, input().split())
    lst = list(map(int, input().split()))
    adj = [[] for i in range(N)]
    cnt = 0
    
    for _ in range(M):
        a, b = map(int, input().split())
        adj[a-1].append(b-1)
        adj[b-1].append(a-1)
    for index, ad in enumerate(adj):
        takasa = lst[index]
        good = True
        
        for tonari in ad:
            if takasa <= lst[tonari]:
                good = False
                break
        
        if good:
            cnt += 1
    print(cnt)
main()

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

// string -> int
int string2int(string s) {
   istringstream ss;
   ss = istringstream(s);
   int n;
   ss >> n;
   return n;
}


int main() {
   long long a;
   string b;
   string c;
   cin >> a >> b;
   c = b.substr(0,1) + b.substr(2.2);
   int d = string2int(c);
   cout << a*d / 100 << endl;
   return 0;
}

Measured memory_bytes: 3540
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias Mame = Tuple!(long, "point", long, "number");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, k, q;
    scan(n, k, q);
    auto point = new long[](n);
    foreach (i; iota(q))
    {
        auto a = lread();
        point[a - 1]++;
    }
    foreach (i; iota(n))
    {
        auto lost = (q - point[i]);
        if (lost >= k)
            writeln("No");
        else
            writeln("Yes");
    }
}


Measured memory_bytes: 3708
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let d = nextIntArray()
    let m = nextInt()
    let t = nextIntArray()
    let map = {}
    for(let i = 0; i< d.length; i++){
        if(!map[d[i]]) map[d[i]] = 1
        else map[d[i]]++
    }
    for(let i = 0; i<t.length; i++){
        if(!map[t[i]]){
            console.log("NO")
            return
        }
        map[t[i]]--
        if(map[t[i]] < 0){
            console.log("NO")
            return
        }
    }
    console.log("YES")

}
Main()



Measured memory_bytes: 81556
n = int(input())
l = list(map(int,input().split()))

l.sort(reverse=True)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] == l[j]:continue
            if l[k] == l[j]:continue
            if l[i] < l[j]+l[k]:
                ans += 1
print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
#include <queue>

typedef long long Long;
typedef std::pair<int, int> interval;

int fri[200000];

struct comparator
{
    bool operator()(const interval i1, const interval i2) const
    {
        return std::min(fri[i1.first], fri[i1.second]) < std::min(fri[i2.first], fri[i2.second]);
    }
};

int main()
{
    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; ++i)
        scanf("%d", fri + i);

    std::sort(fri, fri + n, std::greater<int>());
    std::priority_queue<interval, std::vector<interval>, comparator> intQ;
    intQ.push({0, 0});
    Long result = 0;

    for (int i = 1; i < n; ++i)
    {
        interval now = intQ.top();
        intQ.pop();

        result += std::min(fri[now.first], fri[now.second]);
        intQ.push({now.first, i});
        intQ.push({now.second, i});
    }

    std::cout << result;

    return 0;
}

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

int intersect_circle(double xa, double ya, double ra, double xb, double yb, double rb){
    double dsq = (xb - xa) * (xb - xa) + (yb - ya) * (yb - ya);
    double rs = (ra + rb) * (ra + rb);
    double rd = (ra - rb) * (ra - rb);
    if(dsq > rs)return 0;
    else if(dsq <= rs && dsq >= rd)return 1;
    else if(ra > rb)return 2;
    else return -2;
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        double xa, ya, ra, xb, yb, rb;
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        cout << intersect_circle(xa, ya, ra, xb, yb, rb) << endl;
    }

    return 0;
}


Measured memory_bytes: 3052