akhauriyash/Code-Regression huggingface dataset:
from collections import Counter

N = int(input())

xys = []
for _ in range(N):
    xys.append(tuple(map(int, input().split())))

sub = []
for x1, y1 in xys:
    for x2, y2 in xys:
        if x1 != x2 or y1 != y2:
            sub.append((x1 - x2, y1 - y2))

if not sub:
    print(1)
    exit(0)

c = Counter(sub)
m = max(c.values())

print(N - m)


Measured memory_bytes: 40048
a, b, c = map(int, input().split())
k = int(input())
while a >= b and k > 0:
  b = b*2
  k = k-1
while b >= c and k > 0:
  c = c*2
  k = k-1
if a < b < c:
  print('Yes')
else:
  print('No')

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

using namespace std;

struct oper
{
    int x1, y1, x2, y2;
};

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector< vector<int> > a(n, vector<int>(m));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cin >> a[i][j];
    vector<oper> odp;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m - 1; ++j)
        {
            if (a[i][j] % 2 == 1)
            {
                odp.push_back({i, j, i, j + 1});
                --a[i][j];
                ++a[i][j + 1];
            }
        }
    }
    for (int i = 0; i < n - 1; ++i)
    {
        int j = m - 1;
        if (a[i][j] % 2 == 1)
        {
            odp.push_back({i, j, i + 1, j});
            --a[i][j];
            ++a[i + 1][j];
        }
    }
    cout << odp.size() << endl;
    for (int i = 0; i < odp.size(); ++i)
        cout << odp[i].x1 + 1 << " " << odp[i].y1 + 1 << " " << odp[i].x2 + 1 << " " << odp[i].y2 + 1 << endl;
    return 0;
}


Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;

const int N = 200200;
long long p2[N];
long long gcd(long long a, long long b)
{
	return b ? gcd(b, a % b) : a;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	p2[0] = 1; 
	for (int i=1; i<N; i++){
		p2[i] = (p2[i-1]*2)%mod;
	} 
	int n;
	cin>>n;
	
	map<pair<long long, long long>, pair<int, int>> m;
	int zeros = 0;
	
	for (int i=0; i<n; i++){
		long long a, b;
		cin>>a>>b;
		if (a==0 && b==0) {
			zeros++;
			continue;
		}
		
		long long g = gcd(abs(a), abs(b));
		a /= g;
		b /= g;
		
		if (a>0 and b>=0){
			m[{b, a}].first++;
		}
		else if (a<0 and b<=0){
			m[{-b,-a}].first++;
		}
		else if(a>=0 and b<0){
			m[{a,-b}].second++;
		}
		else if (a<=0 and b>0){
			m[{-a, b}].second++;
		}	
	}

	long long ans = 1;
	for (auto e: m){
		pair<int, int> cnt = e.second;
		ans = ans * (p2[cnt.first] + p2[cnt.second] - 1) % mod;
	}
	ans = (ans+zeros-1+mod)%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 17588
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)


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

int main() {
  int N;
  
  cin >> N;
  
  string S,T,ans;
  vector<string>s(N);
  vector<string>t(N);  
  
  cin >> S >> T;
  
  //cout << S + T<<endl;
  
  for(int i = 0 ; i < N ; i++){
		s.at(i)=S.at(i);
    	t.at(i)=T.at(i);
  }
  for(int i = 0 ; i < N ; i++){
 	ans += s.at(i) + t.at(i) ;
  }
  
  cout << ans << endl;
	
}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br =  BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (h, w, k) = readIntegerList()
    val grid = Array(h) { br.readLine()!! }
    val numOfBlack = grid.fold(0) { acc, line -> acc + line.count { it == '#' } }

    var ans = 0
    for (state in 0 until (1 shl h)) {
        for (state2 in 0 until (1 shl w)) {
            var tmp = numOfBlack
            for (i in 0 until h) {
                for (j in 0 until w) {
                    if (((((state shr i) and 1) == 1) || ((state2 shr j) and 1) == 1)
                        && grid[i][j] == '#') {
                        tmp--
                    }
                }
            }

            if (tmp == k) ans++
        }
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) const int size = (vec).size(); REP(i,size) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    int H, W; cin >> H >> W;
    vector<string> a(H);
    CINVEC(a);
    vector<string> ans(H + 2);
    string s;
    REP(i, W + 2)s += '#';
    ans[0] = s;
    ans[H + 1] = s;
    FOR(i, 1, H + 1) {
        s = '#';
        REP(j, W) {
            s += a[i - 1][j];
        }
        s += '#';
        ans[i] = s;
    }

    REP(i, H + 2) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    if(n<=999) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct SqrtDecomposition {
	int n, sqrt_n, bucket_size;
	vector<int> data;
	vector<int> bucket;
	SqrtDecomposition(int n, int val = 0) :n(n), sqrt_n(sqrt(n)) {
		assert(n);
		bucket_size = 1 + (n - 1) / sqrt_n;
		data.assign(bucket_size * sqrt_n, val);
		bucket.assign(bucket_size, val);
	}
	void add(int x, int val) {
		int k = x / sqrt_n;
		data[x] += val;
		bucket[k] += val;
	}
	int get_sum(int l, int r) {
		int ret = 0;
		for (int k = 0; k < bucket_size; k++) {
			int bl = k * sqrt_n, br = (k + 1) * sqrt_n;
			if (r <= bl || br <= l)
				continue;
			if (l <= bl && br <= r) {
				ret += bucket[k];
			}
			else {
				for (int i = max(l, bl); i < min(r, br); i++) {
					ret += data[i];
				}
			}
		}
		return ret;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	SqrtDecomposition sd(n);
	rep(i, 0, q) {
		int com, x, y; cin >> com >> x >> y;
		x--;
		if (com == 0) {
			sd.add(x, y);
		}
		else {
			cout << sd.get_sum(x, y) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3260
#include<iostream>

bool sieve[100000];
void makesieve();

int main()
{
	makesieve();
	while(1)
	{
		int n,s,l;
		std::cin>>n;
		if(std::cin.eof())break;
		for(s=n-1;sieve[s]!=true;s--);
		for(l=n+1;sieve[l]!=true;l++);
		std::cout<<s<<' '<<l<<std::endl;
	}
	return 0;
}

void makesieve()
{
	for(int i=0;i<100000;i++){sieve[i]=true;}
	sieve[0]=false;sieve[1]=false;
	for(int i=2;i<100000;i++)
	{
		for(int j=i*2;j<100000;j+=i)
		{
			sieve[j]=false;
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>

using namespace std;
using ll=long long;

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

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int a,b,h;
  cin>>a>>b>>h;
  cout<<(a+b)*h/2<<endl;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

template<typename D> class BinarySearch {
    D left;
    D right;
    function<bool(D)> func;

    public:
        BinarySearch(D l, D r, function<bool(D)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc() {
            while (abs(right - left) > 1) {
                D m = (left + right) / 2;
                if (func(m)) {
                    left = m;
                } else {
                    right = m;
                }
            }
            return left;
        }
};

template<typename D> class BinarySearchR {
    D left;
    D right;
    function<bool(D)> func;

    public:
        BinarySearchR(D l, D r, function<bool(D)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc() {
            while (abs(right - left) > 1) {
                D m = (left + right) / 2;
                if (func(m)) {
                    right = m;
                } else {
                    left = m;
                }
            }
            return right;
        }
};

void solve() {
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<char> t(q);
    vector<char> d(q);
    REP(i, q) cin >> t[i] >> d[i];

    auto check = [&](int m) {
        int p = m;
        REP(i, q) {
            if (s[p] == t[i]) {
                if (d[i] == 'L') p--;
                else p++;
                if (p < 0) return true;
            }
        }
        return false;
    };

    auto check_r = [&](int m) {
        int p = m;
        REP(i, q) {
            if (s[p] == t[i]) {
                if (d[i] == 'L') p--;
                else p++;
                if (p >= n) return true;
            }
        }
        return false;
    };

    BinarySearch<int> bs(-1, n, check);
    int l = bs.calc();

    BinarySearchR<int> bs_r(-1, n, check_r);
    int r = bs_r.calc();
    cout << n - (l + 1 + n - r) << EOL;
}


Measured memory_bytes: 976
#define _CRT_SECURE_NO_WARNINGS
#ifndef _MSC_VER
#include <bits/stdc++.h>
#else
#include <__msvc_all_public_headers.hpp>
#endif
using namespace std;

#define for0(i, n)      for (int i = 0; i < (int)(n); ++i)
#define for1(i, n)      for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r)   for (int i = (int)(l); i <= (int)(r); ++i)
#define forr0(i, n)	    for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n)     for (int i = (int)(n); i >= 1; --i)
#define wh(t)           while (t--)
	
#define endl "\n"

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

map<ll,int> f(ll n) {
	map<ll,int> s;
	ll k = 2;
	while (n > 1 && k * k <= n) {
		while (n % k == 0) {
			s[k]++;
			n /= k;
		}
		k++;
	}
	if (n > 1) s[n]++;
	return s;
}

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

	ll n;
	cin >> n;
	auto s = f(n);
	int cnt = 0;
	for (auto a : s) {
		int i = 1;
		while ((i*(i+1)/2) <= a.second) 
			i++;
		cnt += i - 1;
	}
	cout << cnt << endl;
}


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

int main()
{
        int D;
        cin >> D;
        if (D == 25) {
                cout << "Christmas" << endl;
        }
        else if (D == 24) {
                cout << "Christmas Eve" << endl;
        }
        else if (D == 23) {
                cout << "Christmas Eve Eve" << endl;
        }
        else if (D == 22) {
                cout << "Christmas Eve Eve Eve" << endl;
        }

}


Measured memory_bytes: 256
#include <stdio.h>


int cul(int);

int main(){
  int a,n,i,flag = 0;
  
  scanf("%d",&n);
  if(n < 1 || n > 10000)return 0;
  
  for(i = 0; i < n; i++){
    
    scanf("%d",&a);
    if(a < 2 || a > 100000000)return 0;
    
    if(cul(a)== 1)flag++;
  }

  printf("%d\n",flag);
  return 0;
}

int cul(int a){ 
  int i,j = 3;
 
    if(a == 2)return 1;
    else if(a%2 == 0)return 0;
    else{
      
      while(j <= sqrt(a)){
	if(a%j == 0)return 0;
	 j += 2;
      }
    }

  return 1;
}



Measured memory_bytes: 2144
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define SZ(v) ((int)(v).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int main(){
	int n,m;
	cin>>n>>m;
	if(n==m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
class aoj
{
    static void Main()
    {
        double[,] f = new double[50,2];
        int i=0;
        for (;;)
        {
            string a = Console.ReadLine();
            if (string.IsNullOrEmpty(a)) { break; }

            string [] b = a.Split(' ');
            
            double c = double.Parse(b[0]), d = double.Parse(b[1]);
            double h = c * d;
            for (;;)
            {
                if (c <= d)
                {
                    double e = c,g = c;
                    c = d % c;
                    d = e;
                    if (c == 0)
                    {
                        f[i,0] = g;
                        f[i, 1] =  h / g;
                        i++;
                        break;
                    }
                }
                if (d <c)
                {
                    double e = d, g = d;
                    d = c % d;
                    c = e;
                    if (d == 0)
                    {
                        f[i,0] = g;
                        f[i, 1] = h / g;
                        i++;
                        break;
                    }
                }
                
            }

        }
        for(int j = 0; j < i; j++)
        {
            Console.WriteLine("{0} {1}",f[j,0],f[j,1]);
        }
    }
}

Measured memory_bytes: 9092
#include "bits/stdc++.h"

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);

string UNRESTORABLE = "UNRESTORABLE";

int main() {

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

    bool is_found_answer = false;

    for(int i=s.size() - t.size(); i>=0; i--) {
        if(s[i] == t[0] || s[i] == '?') {
            bool is_blank = true;
            for(int j=i; j<i+t.size(); j++) {
                if(s[j] != t[j-i] && s[j] != '?') is_blank = false; 
            }
            if(is_blank) {
                for(int j=i; j<i+t.size(); j++) {
                    s[j] = t[j-i];
                }
                is_found_answer = true;
                break;
            }
        }
    }

    if(is_found_answer) {
        for(int i=0; i<s.size(); i++) {
            if(s[i]=='?') s[i] = 'a';
        }
        cout << s << endl;
    } else {
        cout << UNRESTORABLE << endl;
    }
    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

// integerの各桁を足す
int sum_digits(int num) {
    int rtn = 0;
    string num_str = to_string(num);
    for(int i=0; i<num_str.size(); i++) {
        rtn += num_str[i] - '0';
    }   
    return rtn;
}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}



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

vector<int> g[100005];
int n, m, h[100005], ans;

int main() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    while(m--) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for(int i = 1; i <= n; i++) {
        bool good = true;
        for(auto next: g[i])
            if(h[next] >= h[i])
                good = false;
        if(good) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	ll N;
	cin >> N;
	cout << 3 * N*N << endl;




	return 0;
}

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


int a(int n){
    return n / 2;
}

int b(int n){
    return 3 * n + 1;
}

int main()
{
    int S, tmp;
    vector<double> m(1000000);
    cin >> S;
    m.at(S) = 1;

    for (int i = 0; i < 10000;i++){
        if (S % 2 == 0)
        {
            S = a(S);
            if(m.at(S)==1){
                cout << i+2 << endl;
                break;
            }
            else
            {
                m.at(S) = 1;
            }
            
        }
        else{
            S=b(S);
            if (m.at(S) == 1)
            {
                cout << i+2 << endl;
                break;
            }
            else
            {
                m.at(S) = 1;
            }
        }
        //cout << S << endl;
    }


    //cout << tmp << endl;
}

Measured memory_bytes: 8064
#include <iostream>
using namespace std;
int main()
{
  string S;
  cin >> S;
  int a[26] = {};
  for (int i = 0; i < S.length(); i++)
    a[S[i] - 'a']++;
  for (int i = 0; i < 26; i++)
  {
    if (2 <= a[i])
    {
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"

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

  int NN;
  std::cin >> NN;

  int a1, a2,a3;
  a1 = NN %10;
  a2 = ((NN - a1)/10 )% 10;
  a3 = ((NN - a1 - a2 * 10) / 100) % 10;

  std::cout << (10 - a1) + (10 - a2) * 10 + (10 - a3) * 100 << '\n';

  return 0;
}


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


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

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

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

int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> Hs(N);
    REP(n, N) cin >> Hs[n];
    
    int ans = 0;
    while(true) {
        int mx = -10;
        int l = -10;
        int r = -10;
        REP(n, N) {
            int h = Hs[n];
            if (h > mx) {
                l = r = n;
                mx = h;
            }
            else if (h == mx) {
                if (r == n - 1) {
                    r = n;
                } else {
                    l = r = n;
                }
            }
        }
        // cout << "mx, l, r = " << mx << "," << l << "," << r << endl;
        if (mx == 0) break;
        ++ans;
        FOR(n, l, r + 1) Hs[n]--;
    }
    cout << ans << endl;
    return 0;
}


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

        num_one = N%500;

        if(num_one <= A){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23892
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
int main(){
ll k,s;
cin >>k >>s;
ll count=0;
for(ll x=0;x<=k;x++){
for(ll y=0;y<=k;y++){
if(s-(x+y)<=k&&0<=s-(x+y)){
count++;
}
}
}
cout <<count;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
int main(){
char S[11]={};
char T[11]={};
int n=0;
scanf("%s",S);
scanf("%s",T);
n = strlen(S);
// if(n==0){
//     printf("No\n");
// }else{
    if(strncmp(S,T,n)==0){
        if(T[n]==0){
            printf("No\n");
        }else{
                if(T[n+1]==0){
                    printf("Yes\n");
                }else{
                    printf("No\n");
                }
                
            
        } 
    }else{
    printf("No\n");
    }
// }

return 0;

}

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

int n,t[105];
int m,p,x;
int Sum;

int main(){
    scanf("%d",&n);
    for(int i = 1; i <= n; i++) scanf("%d",&t[i]),Sum += t[i];
    scanf("%d",&m);
    for(int i = 1 ; i <= m; i++){
        scanf("%d%d",&p,&x);
        printf("%d\n",Sum - t[p] + x);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

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

	vector<int> b(N, 0);
	for (int i = 0; i < N; i++)
	{
		cin >> b[i];
	}

	vector<int> c(N, 0);
	for (int i = 0; i < N; i++)
	{
		c[i] = i + 1;
	}

	int ath = -1;
	int bth = -1;

	int idx = 1;
	do
	{
		bool check_a = true;
		for (int i = 0; i < N; i++)
		{
			if (c[i] != a[i])
			{
				check_a = false;
				break;
			}
		}

		if (check_a)
		{
			ath = idx;
		}

		bool check_b = true;
		for (int i = 0; i < N; i++)
		{
			if (c[i] != b[i])
			{
				check_b = false;
				break;
			}
		}

		if (check_b)
		{
			bth = idx;
		}

		if (ath != -1 && bth != -1) break;

		idx++;

	} while (next_permutation(c.begin(), c.end()));

	cout << abs(ath - bth);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
}


Measured memory_bytes: 21844
import java.util.*;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		
		System.out.println(A + B + C == 17 ? "YES" : "NO");
	}
}


Measured memory_bytes: 21844
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

ll ok[1010101];
ll ng[1010101];

int main(){

    string s;
    cin >> s;
    s = "0" + s + "0";
    ll ans = 0;
    reverse(s.begin(), s.end());
    rep(i, 1010101)ok[i] = INF;
    rep(i, 1010101)ng[i] = INF;
    ok[0] = 0;
    rep(i, s.size() - 1){
        ll x = s[i + 1] - '0';
        chmin(ok[i + 1], ok[i] + x);
        chmin(ng[i + 1], ok[i] + (10 - x));
        if(x > 0)chmin(ng[i + 1], ng[i] + (10 - x - 1));
        if(x < 9)chmin(ok[i + 1], ng[i] + x + 1);
    }
    cout << ok[s.size() - 1] << endl;


    return 0;
}

Measured memory_bytes: 17072
<?php 
  list($h, $w) = explode(" ", trim(fgets(STDIN)));
 
  $math = [];
  for($i=0; $i<$h; $i++){
    $math[$i] = str_split(trim(fgets(STDIN)));
    // 壁
    $math[$i][$w] = "#";
  }
  // 壁
  $math[$h] = array_fill(0, $w, "#");

  $yoko = [];
  for($i=0; $i<$h; $i++){
    $point = 0;
    $pos = 0;
    $yoko[$i] = [];
    for($j=0; $j<=$w; $j++){
      if($math[$i][$j] == "#"){
        for($k=$pos; $k<$j; $k++){
          $yoko[$i][$k] = $point;
        }
        $yoko[$i][$j] = 0;
        $point = 0;
        $pos = $j+1;
      }
      else{
        $point++;
      }
    }
  }
 
//  $tate = [];
  $max = 0;
  for($i=0; $i<$w; $i++){
    $point = 0;
    $pos = 0;
//    $tate[$i] = [];
    for($j=0; $j<=$h; $j++){
      if($math[$j][$i] == "#"){
        for($k=$pos; $k<$j; $k++){
//          $tate[$i][$k] = $point;
          $max = max($max, $yoko[$k][$i]+$point);
        }
//        $tate[$i][$j] = 0;
        $point = 0;
        $pos = $j+1;
      }
      else{
        $point++;
      }
    }
  }
  echo $max-1;

Measured memory_bytes: 401912
#include <iostream>
#include <string>
#include <cmath>


int main()
{
	int a, b;
	int result = 1;
	

	std::cin >> a >> b;
	
	switch (a)
	{
	case 0:
		if (b == 100)
		{
			result = 101;
			break;
		}
		result = b;
		break;
	case 1:
		result = 100 * b;
		if (b == 100)
		{
			result += 100;
		}
		break;
	case 2:
		result = 10000 * b;
		if (b == 100)
		{
			result += 10000;
		}
		break;
	}

	std::cout << result << std::endl;

	return 0;

}







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

int main()
{
  int n;
  int64_t ans = 0;
  cin >> n;
  string s;
  map<string, int64_t> S;
  for (int i = 0; i < n; i++)
  {
    cin >> s;
    sort(s.begin(), s.end());
    if (S.count(s))
    {
      ans += S[s];
      S[s]++;
    }
    else
      S[s] = 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long int n,k;
	long long int zero = 0;
	cin >> n >> k;
	long long int a = 0;
	if(k == 0){
		cout << (n * n) << endl;
		return 0;
	}
	for(long long int i = k + 1;i <= n;i++){
		a += (n / i) * (i - k) + max(n % i + 1 - k, zero);
	}
	cout << a << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,a[3],b[3],c[3][3],sum=0,flag=1;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      scanf("%d",&c[i][j]);
    }
  }
  if(c[0][0]-c[0][1]==c[1][0]-c[1][1]&&c[0][0]-c[0][1]==c[2][0]-c[2][1]&&c[0][0]-c[0][2]==c[1][0]-c[1][2]&&c[0][0]-c[0][2]==c[2][0]-c[2][2]&&c[0][2]-c[0][1]==c[1][2]-c[1][1]&&c[0][2]-c[0][1]==c[2][2]-c[2][1]&&c[0][0]-c[1][0]==c[0][1]-c[1][1]&&c[0][0]-c[1][0]==c[0][2]-c[1][2]&&c[0][0]-c[2][0]==c[0][1]-c[2][1]&&c[0][0]-c[2][0]==c[0][2]-c[2][2]&&c[2][0]-c[1][0]==c[2][1]-c[1][1]&&c[2][0]-c[1][0]==c[2][2]-c[1][2]) flag=1;
  else flag=0;




  if(flag) printf("Yes\n");
  else printf("No\n");
}

Measured memory_bytes: 128
def sc(l,r):
    return max(0,r-l+1)

N = int(input())

al1 = 0
al2 = 0
ar1 = 0
ar2 = 0
nmax = 0

LR = []
for i in range(N):
    nL,nR = map(int,input().split())
    LR.append([nL,nR])

LR.sort()

for i in range(N):

    L = LR[i][0]
    R = LR[i][1]

    if i == 0:
        al1 = L
        ar1 = R

    elif i == 1:
        al2 = L
        ar2 = R

    else:

        nmax = 0
        nmax = max(nmax, sc(max(al1,al2),min(ar1,ar2)) + sc(L,R) )
        nmax = max(nmax, sc(max(al1,L),min(ar1,R)) + sc(al2,ar2) )
        nmax = max(nmax, sc(max(al2,L),min(ar2,R)) + sc(al1,ar1) )
        #print (nmax)

        if nmax == (sc(max(al1,al2),min(ar1,ar2)) + sc(L,R)):

            nal1 = max(al1,al2)
            nar1 = min(ar1,ar2)
            nal2 = L
            nar2 = R
            #print ("a")

        elif nmax == (sc(max(al1,L),min(ar1,R)) + sc(al2,ar2) ):

            nal1 = max(al1,L)
            nar1 = min(ar1,R)
            nal2 = al2
            nar2 = ar2
            #print ("b")

        else:

            nal1 = max(al2,L)
            nar1 = min(ar2,R)
            nal2 = al1
            nar2 = ar1
            #print ("c")

        al1 = nal1
        al2 = nal2
        ar1 = nar1
        ar2 = nar2

    #print (al1,ar1,al2,ar2)

print (sc(al1,ar1) + sc(al2,ar2))
            


Measured memory_bytes: 77016
alp="abcdefghijklmnopqrstuvwxyz"

n=int(input())
s=list(input())
q=int(input())

#####segfunc#####
def segfunc(x, y):
    return x+y
#################

#####ide_ele#####
ide_ele = 0
#################



class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

app=[[0 for i in range(n)] for i in range(26)]
for i in range(n):
    app[alp.index(s[i])][i]=1

appapp=[None for i in range(26)]
for i in range(26):
    appapp[i]=SegTree(app[i], segfunc, ide_ele)

for i in range(q):
    que=input().split()
    if que[0]=="1":
        for tre in appapp:
            tre.update(int(que[1])-1,0)
        nex=alp.index(que[2])
        appapp[nex].update(int(que[1])-1,1)
    else:
        tab=0
        for tre in appapp:
            if tre.query(int(que[1])-1,int(que[2]))>0:
                tab+=1
        print(tab)
        
            

Measured memory_bytes: 458096
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int r; cin >> r;
	cout << pow(r, 2) << endl;
	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 505;
 
int n, k, sum = 0;
int a[N];
 
int check(int x)
{
	int reqd = 0;
	vector<int> v;
	for(int i = 1; i <= n; i++)
	{
		int cur = a[i] % x;
		v.push_back(cur);
	}
	sort(v.begin(), v.end());
	int l = 0, r = v.size() - 1;
	int rem = 0;
	while(l <= r)
	{
		if(rem <= 0)
		{
			rem += v[l];
			reqd += v[l];
			l++;
		}
		else
		{
			rem -= (x - v[r]);
			reqd += (x - v[r]);
			r--;
		}
	}
	if(reqd > 2 * k)
		return 0;
	if(rem != 0)
		return 0;
	return 1;
}
 
int32_t main()
{
	IOS;
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	int ans = 1;
	for(int i = 1; i * i <= sum; i++)
	{
		if(sum % i == 0)
		{
			if(check(i))
				ans = max(ans, i);
			if(check(sum / i))
				ans = max(ans, sum / i);
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    int n;cin>>n;
    
    int temp = n;
    int count=0;
    while(temp!=0){
        count+=temp%10;;
        temp/=10;
    }
    if(n%count==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}





Measured memory_bytes: 256
N, M = map(int, input().split())
A  = [-1] * N
for i in range(M):
  t = list(map(int, input().split()))
  if A[t[0] - 1] == -1:
    A[t[0] - 1] = t[1]
  elif A[t[0] - 1] != t[1]:
    print(-1)
    exit()
if N != 1 and A[0] == 0:
  print(-1)
  exit()
elif A.count(-1) == N and N != 1:
  print(1 * 10 ** (N - 1))
  exit()
elif A[0] == -1:
  if N == 1:
    A[0] = 0
  else:
    A[0] = 1
B = [A[j] * 10 ** (N - 1 - j) for j in range(N) if A[j] > 0]
print(sum(B))

Measured memory_bytes: 3064
N, M = map( int, input().split() )


MOD = 1000000007
if N < M: N, M = M, N  #  常に N >= M とする

ans = 0
if N - M <= 1: 
    if N == M: ans = ( N + M ) * N
    else: ans = N * M
    
    while N > 1 and M > 1:
            ans *= ( N - 1 ) * ( M - 1 ) % MOD
            ans %= MOD
            N -= 1
            M -= 1

print( ans )

Measured memory_bytes: 3064
//Diagonal String
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<vector<char>>vec(3,vector<char>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>vec.at(i).at(j);
        }
    }

    /*for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cout<<vec.at(i).at(j);
        }
        cout<<endl;
    }*/
    for(int i=0;i<3;i++){
        cout<<vec.at(i).at(i);
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k  = sc.nextInt();
        int n  =sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        int max  = 0;
        for (int i = 0 ; i < n  - 1; i++) {
            max = Math.max(max, a[i + 1] - a[i]);
        }
        max = Math.max(max, k - a[n-1] + a[0]);
        System.out.println(k - max);
    }

}

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

def factrize(n):
    res = [0]*1001
    i = 2
    while i*i <= n:
        while n%i == 0:
             n /= i
             res[i] += 1
	i += 1
    if n > 1: res[n] += 1
    return res

N = int(raw_input())

ans = 1
cnt = [0]*1001
for i in xrange(1, N + 1):
    tmp = factrize(i)
    for j in xrange(2, 1001):
        cnt[j] += tmp[j]

for i in xrange(2, N + 1):
    ans = ans * (cnt[i] + 1) % mod 
print ans


Measured memory_bytes: 2692
// 4:22/05/30

#include <bits/stdc++.h>
using namespace std;
//using ll = long long;
#define MAX 30
#define NIL -1 //not exist
struct Node {
  int p, l, r;
};
vector<Node> T(MAX); //information about every node(p, l, r)
vector<int> D(MAX); // depth of nodes
vector<int> H(MAX); // height of nodes

void setDepth(int u, int p ) { //u == node p == depth
  if (u == NIL) ;
  else {
    D.at(u) = p;
  if (T.at(u).r != NIL) setDepth(T.at(u).r, p+1);
  if (T.at(u).l != NIL) setDepth(T.at(u).l, p+1);
  }
}
int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if (T.at(u).r != NIL)
    h1 = setHeight(T.at(u).r) + 1;
  if(T.at(u).l != NIL)
    h2 = setHeight(T.at(u).l) + 1;

  return H.at(u) = max(h1, h2);
}
int getSibling(int u) {
  if (T.at(u).p == NIL) return NIL;
  if (T.at(T.at(u).p).l != u && T.at(T.at(u).p).l != NIL)
    return T.at(T.at(u).p).l;
  if (T.at(T.at(u).p).r != u && T.at(T.at(u).p).r != NIL)
    return T.at(T.at(u).p).r;
  return NIL;
}
void print(int u) {
  //node id: parent = p, sibling = s, degree = deg, depth = dep, height = h, type
  cout << "node " << u << ": " << "parent = " << T.at(u).p << ", sibling = " << getSibling(u) << ", degree = ";
  int deg = 0;
  if (T.at(u).l != NIL) deg++;
  if (T.at(u).r != NIL) deg++;
  cout << deg << ", depth = " << D.at(u) << ", height = " << H.at(u) << ", ";
  string type;
  if (T.at(u).p == NIL) type = "root";
  else if (T.at(u).l == NIL && T.at(u).r == NIL) type = "leaf";
  else type = "internal node";
  cout << type << endl;
}

int main(void) {
  int r;
  int n; //the number of node 
  cin >> n;  
  for (int i = 0; i < n; i++) T.at(i).p  = T.at(i).l = T.at(i).r = NIL; //initialization
  for (int i = 0; i < n; i++) {
    int id, left, right;
    cin >> id >> left >> right;
    if (left != NIL) { T.at(left).p = id; T.at(id).l = left; }
    if (right != NIL) { T.at(right).p = id; T.at(id).r = right; }
  }
  for (int i = 0; i < n; i++) 
    if (T.at(i).p == NIL) r = i; //root
  
  setDepth(r, 0); //depth
  for (int i = 0; i < n; i++) {
    setHeight(i);
    getSibling(i);
  }
  for (int i = 0; i < n; i++) print(i);

}


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

int main() {
	int n, m; cin >> n >> m;
	vector<int>x(n, 0); stack<int>s;
	vector <vector<pair<int, int>>>l(n), r(n);
	for (int i = 0, L, R, d; i < m; i++) {
		cin >> L >> R >> d; L--; R--;
		l[R].push_back({ L,d }); r[L].push_back({ R,d });
	}
	for (int i = 0; i < n; i++) {
		if (l[i].size() == 0) {
			x[i] = 1; s.push(i);
		}
	}
	bool ok = true;
	while (!s.empty()) {
		int node = s.top(); s.pop();
		for (int i = 0; i < r[node].size(); i++) {
			int next = r[node][i].first, xd = x[node] + r[node][i].second;
			if (x[next] == 0) {
				x[next] = xd;
				s.push(next);
			}
			else if (x[next] != xd) {
				ok = false; break;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (x[i] == 0)ok = false;
	}
	cout << (ok ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 12288
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		if(n % k == 0) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}

}

Measured memory_bytes: 23124
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

bool pick2(const vector<int> &hand,vector<int> &xhand,int a)
{
	int cnt=count(hand.begin(),hand.end(),a);
	if(cnt<2)	return false;

	cnt-=2;
	for(int i=0,j=0;i<hand.size();i++){
		if(hand[i]!=a || cnt>0)	xhand[j++]=hand[i];
		if(hand[i]==a)	cnt--;
	}
	return true;
}

#define	num		first
#define	type	second
#define	SAME	0
#define	CONS	1
bool pick3x4(const vector<int> &xhand)
{
	int buc[10]={0};
	for(int i=0;i<12;i++)	buc[xhand[i]]++;

	vector< pair<int,int> > candi;
	for(int i=1;i<=9;i++){
		if(buc[i]>=3)						candi.push_back(make_pair(i,SAME));
		if(i<8&&buc[i]&&buc[i+1]&&buc[i+2])	candi.push_back(make_pair(i,CONS));
	}

	int n=candi.size();
	vector<int> test(12);
	for(int i=0;i<n;i++)for(int j=i;j<n;j++)for(int k=j;k<n;k++)for(int l=k;l<n;l++){
		test[0]=candi[i].num;
		test[1]=candi[i].num+(candi[i].type==SAME?0:1);
		test[2]=candi[i].num+(candi[i].type==SAME?0:2);
		test[3]=candi[j].num;
		test[4]=candi[j].num+(candi[j].type==SAME?0:1);
		test[5]=candi[j].num+(candi[j].type==SAME?0:2);
		test[6]=candi[k].num;
		test[7]=candi[k].num+(candi[k].type==SAME?0:1);
		test[8]=candi[k].num+(candi[k].type==SAME?0:2);
		test[9]=candi[l].num;
		test[10]=candi[l].num+(candi[l].type==SAME?0:1);
		test[11]=candi[l].num+(candi[l].type==SAME?0:2);
		sort(test.begin(),test.end());
		if(test==xhand)	return true;
	}
	return false;
}

bool isvalid(vector<int> hand)
{
	sort(hand.begin(),hand.end());

	// check consecutive 5 numbers
	bool ok=true;
	for(int i=0,bef=0,cnt=1;i<14;i++){
		if(hand[i]==bef){
			cnt++;
			if(cnt==5)	ok=false;
		}
		else	cnt=1,bef=hand[i];
	}
	if(!ok)	return false;

	for(int i=1;i<=9;i++){
		vector<int> xhand(12);
		if(pick2(hand,xhand,i) && pick3x4(xhand))
			return true;
	}
	return false;
}

int main()
{
	for(char s[32];~scanf("%s",s);){
		vector<int> hand(14);
		for(int i=0;i<13;i++)	hand[i]=s[i]-'0';

		vector<int> ans;
		for(int i=1;i<=9;i++){
			hand[13]=i;
			if(isvalid(hand))	ans.push_back(i);
		}

		if(ans.size()==0)	ans.push_back(0);
		for(int i=0;i<ans.size();i++)
			printf("%s%d",i?" ":"",ans[i]);
		puts("");
	}

	return 0;
}

Measured memory_bytes: 0
"""
Writer: SPD_9X2
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_A&lang=ja
dpだろうなぁ

dp[i][j] = min(dp[i-1][j-1],dp[i][j-1],dp[i-1][j]) = そこを右下にしてできる最大の正方形
っぽい？
"""

H,W = map(int,input().split())

c = []

for i in range(H):
    C = list(map(int,input().split()))
    c.append(C)

dp = [ [float("inf")] * W for i in range(H) ]
ans = 0

for i in range(H):

    for j in range(W):

        if c[i][j] == 1:
            dp[i][j] = 0
            continue

        if i == 0 or j == 0:
            dp[i][j] = 1
        else:
            dp[i][j] = min(dp[i-1][j-1],dp[i][j-1],dp[i-1][j]) + 1

        ans = max(ans , dp[i][j]**2)

print (ans)



Measured memory_bytes: 55200
// Created by ...
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

#define vll vector< ll >
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<ll,ll> 
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;
using ll = long long;
ll md=MD;

ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(ll a,ll b){if(a<b)return a; return b;}
ll Max(ll a,ll b){if(a>b)return a; return b;}
int32_t main() {
    IOS;

        ll n;
        cin>>n;
        if(n>=30)cout<<"Yes";
        else cout<<"No";
        



        cout<<'\n';
    return 0;
}

Measured memory_bytes: 3648