akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

#define int long long
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF (1LL<<60)
#define MOD 1000000007

int N;
P X[200000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<int> a, b;
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    if (y < x) swap(x, y);
    X[i] = P(x, y);
    a.pb(x);
    b.pb(y);
  }
  sort(X, X+N);
  sort(all(a));
  sort(all(b));

  long long s = 1LL * (a.back() - a.front()) * (b.back() - b.front());
  int lim = X[N-1]._1, m = INF, nm = INF;
  vector<P> v;
  rep(i, N) {
    if (X[i]._2 <= lim) {
      m = min(m, X[i]._2);
      nm = min(nm, X[i]._2);
    }
    else {
      m = min(m, X[i]._1);
      v.pb(X[i]);
    }
  }
  int diff = lim - m;
  vector<int> mi(v.size()+1);
  mi[v.size()] = INF;
  for (int i=v.size()-1; i>=0; i--) {
    mi[i] = min(mi[i+1], v[i]._1);
  }
  for (int i=0; i<v.size(); i++) {
    P p = v[i];
    lim = max(lim, p._2);
    nm = min(nm, mi[i+1]);
    if (lim<nm) break;
    diff = min(diff, lim-nm);
  }

  s = min(s, 1LL*diff*(b.back() - a.front()));
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 12644
n,t=map(int,input().split())
arr=list(map(int,input().split()))
tmin=10**10
tdiff=0
ans=0
for i in range(n):
  if arr[i]<tmin:
    tmin=arr[i]
  else:
    diff=arr[i]-tmin
    if diff<tdiff:
      continue
    elif tdiff==diff:
      ans+=1
    else:
      tdiff=diff
      ans=1
print(ans)

Measured memory_bytes: 14292
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
 
int main()
{
    FOR(i, 1, 10){
        FOR(j, 1, 10){
            printf("%dx%d=%d\n", i, j ,i*j);
        }
    }
    return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    string s, t;
    cin >> s >> t;
    t.pop_back();
    if (s == t) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ポイントカード
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            int[] nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = new int[nm[1]];
            int[] note = new int[2];
            for (int i = 0; i < nm[1]; i++)
            {
                note = Console.ReadLine().Split().Select(int.Parse).ToArray();
                a[i] = note[0];
            }
            Array.Sort(a);
            for (int i = 1; i < nm[1]; i++)
            {
                if (a[i] < nm[0]) { ans += nm[0] - a[i]; }
            }
            Console.WriteLine(ans);
        }
    }
}



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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

struct hoge{int from, to, cost;};

int n,m,memo[100][100],ans;
vector<hoge> v;

signed main() {
    rep(i,100) rep(j,100) memo[i][j] = INF/10;
    cin >> n >> m;
    rep(i,m) {
        int a,b,c;
        cin >> a >> b >> c;
        a--, b--;
        memo[a][b] = memo[b][a] = c;
        hoge tmp{a,b,c};
        v.pb(tmp);
    }
    rep(k,n) rep(i,n) rep(j,n) memo[i][j] = min(memo[i][j], memo[i][k] + memo[k][j]);
    rep(i,m) {
        int from = v[i].from, to = v[i].to, cost = v[i].cost;
        if (memo[from][to] != cost) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
n,m = list(map(int, input().split()))
a=[]
a.append(-1)
for x in range(m):
  tmp=int(input())
  a.append(tmp)
a.append(n+1)
diff = []
for x in range(len(a)-1):
  diff.append(a[x+1]-a[x])
              
large = 0
small = 123456789012345
for x in diff:
  large=max(large,x)
  small=min(small,x)

num=[0,0,1]
for _ in range(large):
  num.append((num[-1]+num[-2])%1000000007)
    
answer=1
for x in diff:
  #print(x,num[x])
  answer *=num[x]
  answer%=1000000007
print(answer)

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

using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;

int main() {
    int n, k;
    while(cin >> n >> k, n) {
        vector<string> d(n);
        for(int i = 0; i < n; ++i) {
            cin >> d[i];
        }
        sort(d.begin(), d.end());
        set<string> s;
        for(int S = 0; S < (1 << n); ++S) {
            if(__builtin_popcount(S) == k) {
                vector<string> t;
                for(int j = 0; j < n; ++j) {
                    if(S & (1 << j)) {
                        t.push_back(d[j]);
                    }
                }
                do {
                    string tmp;
                    for(int j = 0; j < k; ++j) {
                        tmp += t[j];
                    }
                    s.insert(tmp);
                } while(next_permutation(begin(t), end(t)));
            }
        }
        cout << s.size() << endl;
    }
}


Measured memory_bytes: 3280
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int n, cnt;
int A[500000];

#define MAX 1000000001;

void merge(int l, int m, int r) {
    int n1 = m - l;
    int n2 = r - m;

    int L[n1 + 1];
    int R[n2 + 1];

    for (int i = 0; i < n1; i++) {
        L[i] = A[l + i];
    }
    L[n1] = MAX;

    for (int i = 0; i < n2; i++) {
        R[i] = A[m + i];
    }
    R[n2] = MAX;
    
    int l_i = 0;
    int r_i = 0;
    for (int i = l; i < r; i++) {
        cnt++;
        if (L[l_i] < R[r_i]) {
            A[i] = L[l_i];
            l_i++;
        } else {
            A[i] = R[r_i];
            r_i++;
        }
    }
}

void mergeSort(int l, int r) {
    if (l + 1 < r) {
        int m = (l + r) / 2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}

void printA() {
    for (int i = 0; i < n; i++) {
        if (i != n - 1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }
}

int main(){
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    cnt = 0;

    mergeSort(0, n);
    printA();
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 6892
import io.{StdIn => in}

object Main extends App {
  val Array(n, m) = in.readLine.split(" ").map(_.toLong)
  val ans =
    if(n >= m / 2) m / 2
    else {
      val k = m - n * 2
      n + k / 4
    }
  println(ans)
}

Measured memory_bytes: 27584
#include"iostream"
#include"string"
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	bool ans = false;
	for (int i = 0; i < 100; i++)
	{
		if (s == t)
		{
			ans = true;
			break;
		}
		s = s.back() + s.substr(0, s.size() - 1);
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int sum=0;
  ll x[m+1],y[m+1];
  for(int i=0;i<m+1;i++){
    x[i]=0;
    y[i]=0;
  }
  for(int i=0;i<m;i++){
    scanf("%lld",&x[i]);
  }
  if(n>m){
    printf("0\n");
    return 0;
  }
  sortup(x,m);
  for(int i=1;i<m;i++){
    y[i]=x[i]-x[i-1];
    sum+=y[i];
  }
  sortup(y,m);
  for(int i=m-1;i>m-n;i--){
    sum-=y[i];
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 4044
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void)
{
    string targetStr = "keyence";
    string s;
    cin >> s;

    bool solve = false;

    for(int i = 0; i < s.size(); i++){
        for(int j = i; j <= s.size() ; j++){
            string tmp = s;
            tmp.erase(tmp.begin() +i , tmp.begin()+j);
            //printf("%s\n", tmp.c_str());
            if(tmp == targetStr){
                solve = true;
                break;
            }
        }
    }

    if(solve){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define M 1000000007
typedef long long LL;

LL ksm(LL x, int y)
{
	if(!y) return 1;
	LL t = ksm(x, y >> 1);
	t = t * t % M;
	if(y & 1) t = t * x % M;
	return t;
}

int main()
{	 
	int n;
	LL t, x;
		
	scanf("%d", &n);
	t = ksm((LL)10, n);
	x = ksm((LL)9, n) << 1;
	if(x >= M) x -= M;
	x -= ksm((LL)8, n);
	if(x < 0) x += M;
	t -= x;
	if(t < 0) t += M;
	printf("%lld\n", t);		
		
	return 0;
}

Measured memory_bytes: 1732
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

//* 便利な変数
namespace {
	int dx4[] = { 1, -1, 0, 0 };
	int dy4[] = { 0, 0, 1, -1 };

	int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
	int dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

	int mDays[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	ll A, B, C, D, E, F, G, H, I, J, K, L, M,
		N, O, P, Q, R, S, T, U, V, W, X, Y, Z;
}
template <typename T>
vector<T> INP(ll n)
{
	vector<T> x;
	REP(i, n) {
		T tmp; cin >> tmp;
		x.push_back(tmp);
	}
	return move(x);
}
//* n文字1行の文字列を入力，一文字ごとの配列を返す
vector<char> SPRIT_STRING(ll n)
{
	string str; cin >> str;
	vector<char> cs(n);
	REP(i, n) cs[i] = str[i];
	return move(cs);
}
//* 文字列中から文字列を検索して別の文字列に置換する
void strReplace(std::string& str, const std::string& from, const std::string& to) {
	std::string::size_type pos = 0;
	while (pos = str.find(from, pos), pos != std::string::npos) {
		str.replace(pos, from.length(), to);
		pos += to.length();
	}
}
//* 素数判定 is_prime<unsigned>(N)
template<typename T, std::enable_if_t<std::is_unsigned<T>::value, std::nullptr_t> = nullptr>
bool is_prime(const T n) {
	if (n < 4) return n == 2 || n == 3;
	if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
	for (T i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
	return true;
}
//* 組み合わせ計算
inline unsigned long long NChooseK(const unsigned long long& n,
	const unsigned long long& k)
{
	if (n  < k) return 0;
	if (0 == n) return 0;
	if (0 == k) return 1;
	if (n == k) return 1;
	if (1 == k) return n;
	typedef unsigned long long value_type;
	value_type* table = new value_type[static_cast<std::size_t>(n * n)];
	std::fill_n(table, n * n, 0);
	class n_choose_k_impl
	{
	public:

		n_choose_k_impl(value_type* table, const value_type& dimension)
			: table_(table),
			dimension_(dimension)
		{}

		inline value_type& lookup(const value_type& n, const value_type& k)
		{
			return table_[dimension_ * n + k];
		}

		inline value_type compute(const value_type& n, const value_type& k)
		{
			if ((0 == k) || (k == n))
				return 1;
			value_type v1 = lookup(n - 1, k - 1);
			if (0 == v1)
				v1 = lookup(n - 1, k - 1) = compute(n - 1, k - 1);
			value_type v2 = lookup(n - 1, k);
			if (0 == v2)
				v2 = lookup(n - 1, k) = compute(n - 1, k);
			return v1 + v2;
		}

		value_type* table_;
		value_type dimension_;
	};
	value_type result = n_choose_k_impl(table, n).compute(n, k);
	delete[] table;
	return result;
}
//* 座標nx, nyがWidth,Heightの領域内にあるかどうかのチェック
inline bool rangeCheck2D(int nx, int ny, int Width, int Height)
{
	return nx >= 0 and nx < Width and ny >= 0 and ny < Height;
}
//* bit全探索
/*
for (int i = 0; i < 1<<N; i++) {
	REP(j, N)
		if ((1 & i >> j) == 1) {;}
}
*/

namespace abc080a {
	void abc080a()
	{
		cin >> N >> A >> B;
		cout << min(B, N*A) << endl;
	}
}

namespace abc080b {
	void abc080b()
	{

	}
}

namespace abc080c {
	void abc080c()
	{

	}
}

namespace abc080d {
	void abc080d()
	{

	}
}

int main()
{
	abc080a::abc080a();
	//arc013b::arc013b();
	return 0;
}

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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pali pair<long long, int>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair 
#define COUT(v) for(int64_t i=0;i<(v).size();i++){ cout << v.at(i) << endl;}
#define REP(i, n) for(int64_t i=0;i<n;i++)
#define REPk(i, k, n) for(int64_t i=k;i<n;i++)

#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pavec;
typedef vector<pali> palivec;
typedef vector<pal>palvec;


typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector< vector<long long> > lmat;

typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;
const int MOD = 1000000007;


ll gcd(ll x, ll y){
    ll r = x%y;
    if(r == 0) return y;
    else return gcd(y, r);
} 

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

lvec mfactor(ll n){
    bvec ip(n, true);
    lvec mf(n, -1);
    ip[0]=false; ip[1]=false; mf[0]=0; mf[1]=1;
    REP(i, n){
        if(ip[i]){
            mf[i] = i;
            for(ll j=i*i; j<n; j+=i){
                ip[j] = false;
                if(mf[j] == -1) mf[j]=i;
            }
        }
    }
    return mf;
}

palivec get_prime(ll n, const lvec &mf){
    palivec plist;
    while(n != 1){
        int cnt=0;
        ll m=mf[n];
        while(mf[n] == m){
            cnt++;
            n/=m;
        }
        plist.pb(pali(m, cnt));
    }
    return plist;
}

void COMinit(int m, lvec &fac, lvec &finv){
    lvec inv(m);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < m; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(int n, int k, const lvec& fac, const lvec &finv){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll powmod(ll x, ll n){
    ll res=1;
    while(n>0){
        if(n&1) res = res*x%MOD;
        x = x*x%MOD;
        n>>=1;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, y;
    cin >> n >> y;
    y /= 1000;
    ivec ans(3, 0);
    REP(i, n+1){
        ans[0] = i;
        REP(j, n+1){
            if(i+j > n) break;
            ans[1] = j;
            ans[2] = n - i - j;
            if(y == 10*ans[0]+ 5*ans[1]+ ans[2]){
                cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << endl;
                return 0;
            }
        }
    }

    cout << -1 << ' ' << -1 << ' ' << -1 << endl;

    return 0;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
P = [0] * M
S = [""] * M

check_AC = [False] * N
for i in range(M):
    p, s = map(str, input().split())
    p = int(p)
    if s == "AC":
        check_AC[p-1] = True
    P[i] = p
    S[i] = s

ans_AC = 0
ans_WA = 0
for i in range(M):
    if check_AC[P[i]-1]:
        if S[i] == "AC":
            ans_AC += 1
            check_AC[P[i] - 1] = False
        else:
            ans_WA += 1
    else:
        continue
print(ans_AC, ans_WA)

Measured memory_bytes: 14104
def main():
    A = []
    for _ in range(3):
        A.append(list(map(int, input().split())))
    N = int(input())
    B = []
    for _ in range(N):
        B.append(int(input()))
    for b in B:
        for a in A:
            if b in a:
                a[a.index(b)] = 0
    for a in A:
        if a == [0, 0, 0]:
            return True
    for i in range(3):
        if A[0][i] == A[1][i] == A[2][i] == 0:
            return True
    return (A[0][0] == A[1][1] == A[2][2] == 0) or (A[0][2] == A[1][1] == A[2][0] == 0)

print('Yes' if main() else 'No')


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  int x, t; cin >> x >> t;
  cout << (x - t < 0 ? 0 : x - t) << endl;
  return;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 100001
#define ll long long
using namespace std;

ll gcd(ll x, ll y){
    if (y>x){
       swap(x,y); 
    }
    while (y!=0){
        ll r=x%y;
        x=y;
        y=r;
    }
    return x;
}

int main(){
    ll n,x;
    cin>>n>>x;
    
    vector<ll> data;
    
    data.push_back(x);
    
    for (ll i=0; i<n; i++){
        ll p;
        cin>>p;
        data.push_back(p);
    }
    
    sort(data.begin(),data.end());
    
    vector<ll> num;
    
    for (ll i=0; i<n; i++){
        ll p=data[i+1]-data[i];
        num.push_back(p);
    }
    
    ll p=num[0];
    for (ll i=0; i<num.size(); i++){
        p=gcd(p,num[i]);
    }
    
    cout<<p<<endl;
}

Measured memory_bytes: 2548
N = int(input())
used = list()
flag = True
for i in range(N):
    w = input()
    if i == 0:
        used.append(w)
        shiri = w
    else:
        if shiri[-1] != w[0]:
            flag = False
            
        else:
            if w in used:
                flag = False
            else:
                used.append(w)
                shiri = w
                
print('Yes' if flag ==True else "No")

Measured memory_bytes: 38384
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextIntList()
    val colors = IntArray(8)
    var others = 0
    for (a in A) {
        when {
            a < 400 -> colors[0]++
            a < 800 -> colors[1]++
            a < 1200 -> colors[2]++
            a < 1600 -> colors[3]++
            a < 2000 -> colors[4]++
            a < 2400 -> colors[5]++
            a < 2800 -> colors[6]++
            a < 3200 -> colors[7]++
            else -> others++
        }
    }
    val c = colors.count { it != 0 }
    val min = if (c != 0) c else 1
    val max = c + others
    println("$min $max")
}

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

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

  long ans;
  if(a)  ans = b/x - (a-1)/x;
  else  ans = b/x + 1;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>

#define INF 1e9
#define nmax 500010
#define fst first
#define snd second
#define pb push_back
#define SZ(x) ((int)(x.size()))

#define MOD 998244353

#define MOD1 998244353
#define MOD2 666013
#define P1 255
#define P2 2059

using namespace std;

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

int n, q;
int aib[26][nmax];
char s[nmax];

int lsb(int x) { return x & (-x); }

void update(char c, int pos, int val) 
{ 
    int ch = c - 97;

    for (int i = pos; i <= n; i += lsb(i))
        aib[ch][i] += val;
}

int query(int ch, int pos)
{
    int val = 0;

    for (int i = pos; i >= 1; i -= lsb(i)) val = val + aib[ch][i];

    return val;
}

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

    scanf("%s", s + 1);

    for (int i = 1; i <= n; i++) update(s[i], i, 1);

    scanf("%d", &q);

    while (q--)
    {
        int type;

        scanf("%d", &type);

        if (type == 1) {

            int pos; char c;

            scanf("%d %c", &pos, &c);

            update(s[pos], pos, -1);

            s[pos] = c;

            update(s[pos], pos, 1);
        }
        else
        {
            int answer = 0;
            int l, r;

            scanf("%d %d", &l, &r);

            for (int i = 0; i < 26; i++) {

                int cur = query(i, r) - query(i, l - 1);

                answer = answer + (cur > 0);
            }

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

    // IMPORTANT!!!!!
    // Are you missing something????
    // check limits, int or ll

    return 0;
}

Measured memory_bytes: 51584
// #include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
 
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
     
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution

int32_t main()
{
    IOS
    
        
    int n;
    cin>>n;
    cout<<(n/500)*1000+((n-(n/500)*500)/5)*5<<endl;
}       


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

#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

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

constexpr int inf = (int)1e9;
constexpr double INF = 1e12, EPS = 1e-9;
constexpr int MX = 2010;
constexpr int mod = inf + 7;

int n, m, q;
int L[MX][MX], R[MX][MX];
int memo[MX][MX];

int main() {
  cin >> n;
  int h[n];

  rep(i, n) { cin >> h[i]; }

  ll re{0};

  while(true) {
    bool found{false};
    bool mizu{false};

    rep(i, n) {
      if (h[i] == 0) {
        mizu = false;
      } else {
        if (!mizu) ++re;
        mizu = true;
        found = true;
        h[i] -= 1;
      }
    }

    if (!found) break;
  }

  end:

//  cout << (re ? "Yes" : "No") << endl;
  cout << re << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean bo = true;
		int cnt = 0;
		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			arr[i] = tmp;
			if(tmp % 2 != 0) bo = false;
		}
		while(bo) {
			cnt++;
			for(int i = 0; i < n; i++) {
				arr[i] /= 2;
				if(arr[i] % 2 != 0) {
					bo = false;
					break;
				}
			}
		}
		System.out.println(cnt);
	}

}


Measured memory_bytes: 21972
#include <stdio.h>

int main() {
  int n, i, j, k, count;
  scanf("%d", &n);
  if (n < 3) {
    printf("0");
    return(0);
  }
  int l[n];
  
  for (i = 0; i < n; i++) {
    scanf("%d", &l[i]);
  }
  
  count = 0;
  for(i=0;i<=n-3;i++){
      for(j=i+1;j<=n-2;j++){
         for(k=j+1;k<=n-1;k++){
            if (l[i] != l[j] && l[i] != l[k] && l[j] != l[k]) {
              if (l[i]+l[j] > l[k] && l[i]+l[k] > l[j] && l[j]+l[k] > l[i])
                count++;
            }
         }
      }
   }
  
  printf("%d", count);
  return(0);
}

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

typedef long long ll;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    FAST;
    char ch;
    cin>>ch;
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
    {
        cout<<"vowel"<<endl;
    }
    else
    {
        cout<<"consonant"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  
  int Sn = 0;
  int tmp = N;
  while (tmp > 0) {
    Sn += tmp % 10;
    tmp /= 10;
  }
  
  cout << (N % Sn == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 479001599;
const int maxn = 3e6 + 111;
        
using namespace std;          

int n, a[maxn], ans = inf;

void solve(){             
	int sum = 0;

	cin >> n;

	for (int i = 1; i <= n; i++){
		cin >> a[i];	
		sum += a[i];
	}

	sum /= n;

	for (int j = -10; j <= 10; j++){
		int mx = 0;
		for (int i = 1; i <= n; i++)
			mx += (sum + j - a[i]) * (sum + j - a[i]);
		ans = min(ans, mx);
	}

	cout << ans;
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 256
n,k=map(int,input().split())
h=sorted([int(input()) for _ in '1'*n])
intervals=[]
for i in range(n-k+1):
	h_min=h[i]
	h_max=h[i+k-1]
	intervals.append(h_max-h_min)
print(min(intervals))


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

using namespace std;
using ll = long long;

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

const ll INF = 1LL << 60;

ll dp[110][100010];

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

    vector<pair<ll, ll>> g(N);
    for (int i = 0; i < N; i++) {
        ll w, v;
        cin >> w >> v;
        g[i] = {w, v};
    }

    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 100010; j++) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    for (int i = 0; i < N; i++) {
        for (int v = 0; v < 100010; v++) {
            if (v >= g[i].second) chmin(dp[i + 1][v], dp[i][v - g[i].second] + g[i].first);
            chmin(dp[i + 1][v], dp[i][v]);
        }
    }

    ll res = 0;
    for (int i = 0; i < 100010; i++) {
        if (dp[N][i] <= W) res = i;
    }
    cout << res << endl;
}

Measured memory_bytes: 89608
import java.util.*;
public class Main {
       public static void main(String[] args){
         Scanner sc = new Scanner(System.in);
         String s = sc.next();
         //Aが現れるのは何文字目？
         int a;
         for (a=0;a<s.length();a++) {
           if(s.charAt(a)=='A'){
             break;
           }
         }
         //Zが現れるのは何文字目？
         int z;
         for (z=s.length()-1;z>0;z--){
           if(s.charAt(z)=='Z'){
             break;
           }
         }
         System.out.println(z-a+1);
    }
}

Measured memory_bytes: 40304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

class DisjointSet{
    public:
        vector<int> rank, p;//rank:木の高さ p:親の頂点番号
        DisjointSet(){}
        DisjointSet(int size){//頂点の数
            rank.resize(size, 0);
            p.resize(size, 0);
            rep(i, size) makeSet(i);
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }
        //同じ木にあるか判定（今回使わない）
        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }
        // 木どうしをくっつける
        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }
        //木の高さを考慮して木どうしをくっつける
        void link(int x, int y){
            if(rank[x] > rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x] == rank[y]) rank[y]++;
            }
        }
        //親を探す（ルートまで）
        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

int n, k, l;
int main(void){
    cin >> n >> k >> l;
    DisjointSet uf1(n), uf2(n);
    rep(i, k){
        int p, q; cin >> p >> q;
        p--; q--;
        uf1.unite(p, q);
    }
    rep(i, l){
        int r, s; cin >> r >> s;
        r--; s--;
        uf2.unite(r, s);
    }
    map<pair<int, int>, int> mapp;
    rep(i, n){
        int d1 = uf1.findSet(i), d2 = uf2.findSet(i);
        if(mapp.find(pair<int, int>(d1, d2)) != mapp.end()){
            mapp[pair<int, int>(d1, d2)]++;
        }else{
            mapp[pair<int, int>(d1, d2)] = 1;
        }
    }
    rep(i, n){
        int d1 = uf1.findSet(i), d2 = uf2.findSet(i);
        auto ret = mapp[pair<int, int>(d1, d2)];
        printf("%d\n", ret);
    }
    return 0;
}


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

int main() {
  int N, a;
  cin >> N;
  vector<int> A;
  for (int i=0; i<N; i++) {
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(), A.end());
  bool c[A[N-1]+1];
  fill(c, c+A[N-1]+1, true);
  for (int i=2*A[0]; i<=A[N-1]; i+=A[0])
    c[i] = false;
  for (int i=1; i<N; i++) {
    if (A[i-1] == A[i])
      c[A[i]] = false;
    else {
      if (!c[A[i]])
        continue;
      for (int j=2*A[i]; j<=A[N-1]; j+=A[i])
        c[j] = false;
    }
  }
  int ans = 0;
  for (int i=0; i<N; i++)
    if (c[A[i]])
      ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5104
let rec power ( * ) one m = function
  | 0 -> one
  | n when n mod 2 = 0 ->
      power ( * ) one (m * m) (n / 2)
  | n ->
      m * power ( * ) one m (n - 1)

let () = Printf.printf "%d\n" @@ Scanf.scanf "%d %d" @@ fun n k ->
  power ( * ) 1 (k - 1) (n - 1) * k

Measured memory_bytes: 2432
import scala.annotation.tailrec
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"

  val input: Array[Array[Int]] = Array.ofDim(6, 6000000)
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
//  val a, b, k = sc.nextInt
  val s = sc.next
//  val d = List.fill(7)(sc.nextInt)
//  val j = List.fill(7)(sc.nextInt)

  val first = s.indexOf('A')
  val last = s.length - s.reverse.indexOf('Z')

  println(last - first)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }

  // https://stackoverflow.com/questions/10199171/matcherror-when-match-receives-an-indexedseq-but-not-a-linearseq/10199441#10199441
  object +: {
    def unapply[T](s: Seq[T]) =
      s.headOption.map(head => (head, s.tail))
  }

  @tailrec
  def foldLeftWithNext[A, B](seq: Seq[A])(z: B)(op: (B, A, A) => B)(tailOp: (B, A) => B): B = {
    seq match {
      case Nil => z
      case a +: Nil => tailOp(z, a)
      case a +: next +: tail => foldLeftWithNext(next +: tail)(op(z, a, next))(op)(tailOp)
    }
  }
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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 ll mod = 1000000007;
const ll inf = 1LL << 60;


int main(){
  ll n;
  cin >> n;
  ll ans = mod;
  for(ll i = 1; i * i <= n; i++){
    if(n % i == 0){
      chmin(ans, (ll)max(to_string(i).size(), to_string(n / i).size()));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n,k;
 cin>>n>>k;
 vector<bool> a(n,false);
 vector<ll> d(k);
 for(ll i=0;i<k;i++){
  ll d;
  cin>>d;
  for(ll j=0;j<d;j++){
   ll id;
   cin>>id;
   a[id-1] = true;
  }
 }
 ll cnt = 0;
 for(ll i=0;i<n;i++)if( !a[i] ) cnt++;
 cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3604
using System;

namespace IT1_3_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, count;
            string[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            c = int.Parse(str[2]);

            count = 0;
            for (int i = a; i <= b;i++ )
            {
                if ((c % i) == 0)
                    count += 1;
            }

            Console.WriteLine("{0}", count);
        }
    }
}

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

int solve(int n){
    int ans=0;
    queue<long long> que;
    que.push(3);
    que.push(5);
    que.push(7);
    while(!que.empty()){
        long long q=que.front();que.pop();
        //cout << num << endl;
        if(q<=n){
            bool f1=false,f2=false,f3=false;
            string str=to_string(q);
            for(int i=0;i<str.size();i++){
                if(str[i]=='3') f1=true;
                if(str[i]=='5') f2=true;
                if(str[i]=='7') f3=true;
            }
            if(f1&&f2&&f3) ans++;
            que.push(10*q+3);
            que.push(10*q+5);
            que.push(10*q+7);
        }
    }
    return ans;
}

int main(){
    int N;
    cin >> N;
    cout << solve(N) << endl;
}

Measured memory_bytes: 768
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		String S = scanner.next();
		if ( S.charAt(S.length()-1) == 's' ) {
			System.out.println(S + "es");
		} else {
			System.out.println(S + "s");
		}
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

int main(){
    string s;
    cin >> s;
    for(int i = 1;i < s.size();i ++){
        if(s[i]==s[i-1]) {s.erase(s.begin()+i);i--;}
    }
    cout << s.size()-1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
#define int long long int 
#define F first
#define S second
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL);
const int MOD = 998244353;
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp>  
//using namespace __gnu_pbds; 
//stringstream ss; string temp; ss<<str(original string) ss>>temp;


int32_t main()
{	
	
  	
  	int r; cin>>r;
  	cout<< 3*pow(r,2)<<endl;
	return 0;
} 


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

using namespace std;

int balik(int n){
	int res = 0;
	int rem ;
	while(n!=0){
		rem = n % 10;
		res = res * 10 + rem;
		n /= 10; 
	}
	return res;
}

int main(){
	int a,b;
	int c=0;
	scanf("%d%d", &a,&b);
	for(int i=a;i<=b;i++){
		int w = balik(i);
		if(i == w) c++;
	}
	printf("%d\n", c);
	return 0;
}

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

int N,M;
vector<int> wacnt;
vector<bool> accnt;

int main() {
    cin>>N>>M;
    wacnt.resize(N); accnt.resize(N);
    for (int i=0; i<M; i++) {
        int p; cin>>p; p-=1;
        string s; cin>>s;
        if (s=="WA"&&accnt[p]!=1) wacnt[p]++;
        if (s=="AC"&&accnt[p]!=1) accnt[p]=1;
    }
    int waans=0,acans=0;
    for (int i=0; i<N; i++) {
        acans+=accnt[i];
        if (accnt[i]==1) waans+=wacnt[i];
    }
    cout<<acans<<' '<<waans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    unsigned long long table[5000];
    table[0] = 100;
    for(int i = 0; i < 5000 - 1; i++){
        table[i+1] = (unsigned long long)floor((double)table[i] * 1.01);
    }
    unsigned long long X;
    cin >> X;
    for(int i = 0; i < 5000; i++){
        if(table[i] >= X){
            cout << i << endl;
            break;
        }
    }
}


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

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> pic(h+2);
  for (int i; i<h+2; i++){
    if(i==0 or i==h+1){
      string raw = string(w+2,'#');
      pic.at(i) = raw ;
    }
    else{
      string tmp;
      cin >>tmp;
      string raw = "#" + tmp + "#";
      pic.at(i) = raw;
    }
  }
  for (auto raw:pic){
    cout << raw <<endl;
  }
}
      

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

using namespace std;

int main(void){

	int block[7][3*2]={
		{ 1, 0,  0, 1,  1, 1},
		{ 0, 1,  0, 2,  0, 3},
		{ 1, 0,  2, 0,  3, 0},
		{ 0, 1, -1, 1, -1, 2},
		{ 1, 0,  1, 1,  2, 1},
		{ 0, 1,  1, 1,  1, 2},
		{ 1, 0,  0, 1, -1, 1},
	};
	int field[8][8];
	int ycnt=0,xcnt=0;
	int swit=0,flag;
	int xsta,ysta;
	char inp;

	while(cin>>inp){

		if(inp=='0'){
			field[ycnt][xcnt]=0;
			xcnt++;
		}

		if(inp=='1'){
			field[ycnt][xcnt]=1;
			if(swit==0){
				xsta=xcnt;
				ysta=ycnt;
				swit=1;
			}
			xcnt++;
		}

		if(xcnt==8){
			xcnt=0;
			ycnt++;
		}

		if(ycnt==8){
			xcnt=0;
			ycnt=0;
			swit=0;
			for(int i=0;i<7;i++){
				flag=1;
				for(int j=0;j<6;j+=2){
					if(ysta+block[i][j+1]>=0&&ysta+block[i][j+1]<8&&xsta+block[i][j]>=0&&xsta+block[i][j]<8){
						if(field[ysta+block[i][j+1]][xsta+block[i][j]]!=1){
							flag=0;
						}
					}
					else{
						flag=0;
					}
				}
				if(flag==1){
					cout<<(char)('A'+i)<<endl;
					break;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1132
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,m;
vector<int> graf[60];
pair<int,int> c[30];
map<pair<int,int>,int> grane;
ll c2[30];
bool mark[60];
stack<int> stek;
bool gotov;
ll sol;

void dfs(int cvor, int kraj)
{
    mark[cvor]=true;
    stek.push(cvor);
    if(cvor==kraj)
    {
        gotov=true;
        return;
    }
    for(int i=0;i<graf[cvor].size();i++)
        if(!mark[graf[cvor][i]] && !gotov)
            dfs(graf[cvor][i],kraj);
    if(gotov)
        return;
    stek.pop();
}

void napravi(int index)
{
    ll br=0;
    int pret=stek.top();
    stek.pop();
    while(!stek.empty())
    {
        int tek=stek.top();
        stek.pop();
        br+=(((ll)1)<<(ll)grane[{pret,tek}]);
        pret=tek;
    }
    c2[index]=br;
    //cout<<"*"<<br<<endl;
}

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

	cin>>n;
	int a,b;
	int f=0;
	for(int i=0;i<n-1;i++)
    {
        cin>>a>>b;
        graf[a].push_back(b);
        graf[b].push_back(a);
        grane[make_pair(a,b)]=f;
        grane[make_pair(b,a)]=f;
        f++;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>a>>b;
        c[i]=make_pair(a,b);
        for(int i=1;i<=n;i++)
            mark[i]=false;
        gotov=false;
        dfs(a,b);
        napravi(i);
        //cout<<c2[i]<<endl;
    }
    sol=1;
    for(int i=0;i<n-1;i++)
        sol*=2;
    //cout<<"-"<<sol<<endl;
    int maxi=1<<m;
    ll tmp=(((ll)1)<<n)-1;
    for(int i=1;i<maxi;i++)
    {
        tmp=0;//(((ll)1)<<(n-1))-1;
        for(int j=0;j<m;j++)
        {
            int mask=1<<j;
            if((mask&i)>0)
                tmp=(tmp|c2[j]);//, cout<<"USO"<<i<<" "<<j<<" "<<c2[j]<<" "<<tmp<<endl;
        }
        ll teksol=1;
        int ostalo=n-1-__builtin_popcountll(tmp);
        //cout<<ostalo<<" "<<tmp<<" "<<__builtin_popcount(tmp);
        for(int i=0;i<ostalo;i++)
            teksol*=2;
        //cout<<"*"<<teksol<<endl;
        /*bitset<5> x(i);
        cout<<x<<" "<<ostalo<<endl;*/
        if(__builtin_popcountll(i)%2==1)
            sol-=teksol;
        else
            sol+=teksol;
    }
    cout<<sol;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


vector<vector<int> >adj;
int sz[100005];
int parent[100005];
int dis[100005];
void dfs(int ver,int pr,int x)
{
    dis[ver]=x;
    sz[ver]++;
    parent[ver]=pr;
    for(auto i:adj[ver])
    {
        if(i!=pr)
        {
            dfs(i,ver,x+1);
            sz[ver]+=sz[i];
        }
    }
}

signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    adj.resize(n+1);
    int x,y;
    for(int i=0;i<n-1;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs(1,0,0);
    int z=(dis[n]-1)/2;
    int ini=n;
    while (z--)
    {
        ini=parent[ini];
    }
    x=n-sz[ini];
    y=sz[ini];

    if(x>y)
    {
        cout<<"Fennec";
    }
    else
    {
        cout<<"Snuke";
    }
    
        
} 



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

int minCost(int *arr,int n,int k){
   
   vector<int> dp(n+1);
   dp[1] = 0;

   for(int i=2;i<=n;i++){
       dp[i] = INT_MAX;
       for(int j=i-1; j>=1 && (i-j)<=k ; j--){
           dp[i] = min(dp[i], abs(arr[i-1]-arr[j-1])+ dp[j]);
       }
   }
   return dp[n];
}

int main() {
    
    int n,k;
    cin>>n>>k;
    
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];

    cout<<minCost(arr,n,k);
}


Measured memory_bytes: 3976