akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int count = 0;
			while (n != 1) {
				n = n % 2 == 0 ? n / 2 : n * 3 + 1;
				count++;
			}
			System.out.println(count);
		}
	}
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  ll N;
  scanf("%lld", &N);

  ll ans = 0;

  for (ll i = 1; i <= N - 1; i++) {
    for (ll j = 1;; j++) {
      if (i * j < N) {
        ans++;
      } else {
        break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 998244353
#define inf 1000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

ll powa(ll a, ll b, ll c)
{
    a%=c;
    if(a<0)
	a+=c;
    ll res = 1;
    while(b>0)
    {
        if(b&1)
            res*=a, res%=c;
        a*=a, a%=c;
        b>>=1;
    }
    return res;
}
 
#define N 200005
 
ll fact[N];
ll ifact[N];
 
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll ans = fact[n];
    ans*=ifact[r];
    ans%=mod;
    ans*=ifact[n-r];
    ans%=mod;
    return ans;
}

int main()
{
   FAST/**/
   
   fact[0] = 1;
   for(ll i=1;i<N;i++)
        fact[i] = fact[i-1]*i, fact[i]%=mod;
   for(ll i=0;i<N;i++)
        ifact[i] = powa(fact[i],mod-2,mod);
   
   ll n,m,k;
   cin>>n>>m>>k;
   
   ll fans = 0;
   rep(k+1)
   {
       ll mul = powa(m-1,n-1-i,mod);
       mul*=ncr(n-1,i);
       mul%=mod;
       mul*=m;
       mul%=mod;
       fans+=mul;
       fans%=mod;
   }
   cout<<fans;
   
   return 0;        
}  
   

Measured memory_bytes: 6708
#include <iostream>
#include <string>

using namespace std;

int main(){
  int n;
  string s;
  cin >> n >> s;

  if( n%2 != 0 ){
    cout << "No" << endl;
    return 0;
  }

  bool okflag = true;
  for(int i=0; i<n/2; i++){
    if( s.at(i) != s.at(n/2+i) ){
      okflag = false;
    }
  }

  if(okflag) cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}


Measured memory_bytes: 888
/*
SIGMA(C(n-1, k)*m*(m-1)^(n-k-1), k=0 to K)
*/

#include <bits/stdc++.h>

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 998244353;
const ll INF = 1<<30;

ll x, y;

ll ext_euclid(ll a, ll b){
	if(b==0){
		x = 1;
		y = 0;
		return a;
	}
	ll g = ext_euclid(b, a%b);
	/*
		bx + (a-a/b*b)y = 1	
		ay + b(x-a/b*y) = 1
	*/
	ll tmp = x;
	x = y;
	y = tmp-a/b*y;
	return g;
}

ll modinverse(ll a){
	ll g = ext_euclid(a, MOD);
	while(x<0)
		x+=MOD;
	return x;
}

ull powx(int b, ll e){
	if(e==0)
		return 1;
	ull ans = powx(b, e/2);
	ans = (ans*ans)%MOD;
	if(e%2)
		ans = (ans*b)%MOD;
	return ans;
}

int main(){
	ll n, m, k;
	vector<ull> fact;
	
	cin>>n>>m>>k;
	fact.assign(n+1, 1);

	for(int i=1;i<=n;i++)
		fact[i] = (fact[i-1]*i)%MOD;

	ull ans = 0;
	for(int i=0;i<=k;i++){
		ull tmp = m;
		tmp = (tmp*powx(m-1, n-i-1))%MOD;

		tmp = (tmp*fact[n-1])%MOD;
		tmp = (tmp*modinverse(fact[i]))%MOD;
		tmp = (tmp*modinverse(fact[n-1-i]))%MOD;

		ans = (ans+tmp)%MOD;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 4744
#A問題
N = int(input())
AB = [list(map(int,input().split())) for i in range(N)]

hiku = 0
for i in range(N):
    I = N-i-1
    a,b = AB[I]
    a+=hiku
    if a%b == 0:
        pass
    else:
        hiku+=(b-(a%b))
        
print(hiku)


Measured memory_bytes: 27380
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	ll A, B, C, X; cin >> A >> B >> C >> X;
	ll cnt = 0;
	for (int a = 0; a <= A; a++) {
		for (int b = 0; b <= B; b++) {
			if ((X - 500 * a - 100 * b) / 50 >= 0 && (X - 500 * a - 100 * b) / 50 <= C)cnt++;
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 03.02.2018 17:42:14       
**/
#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9;
const int N = 200010;

vector<int> g[N];
int f[N][2][3];

inline void update(int &a, int b) {
  a = min(a, b);
}

void dfs(int v, int pr) {
  vector<int> children;
  for (int u : g[v]) {
    if (u == pr) {
      continue;
    }
    dfs(u, v);
    children.push_back(u);
  }
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 3; j++) {
      f[v][i][j] = inf;
    }
  }
  if (children.empty()) {
    f[v][0][0] = 0;
    f[v][1][0] = 1;
    return;
  }
  if ((int) children.size() == 1) {
    int u = children[0];
    update(f[v][0][1], f[u][0][0]);
    update(f[v][0][2], f[u][0][1]);
    update(f[v][0][2], f[u][0][2]);
    update(f[v][1][1], 1 + f[u][0][0]);
    update(f[v][1][2], 1 + f[u][0][1]);
    update(f[v][1][2], f[u][1][1]);
    update(f[v][1][2], f[u][1][2]);
    update(f[v][1][0], f[u][1][0]);
    update(f[v][1][0], 1 + f[u][1][1]);
    return;
  }
  {
    // take = 1
    int sum = 1;
    for (int u : children) {
      sum += min({f[u][1][0], f[u][1][1], f[u][1][2]});
    }
    update(f[v][1][0], sum);
    for (int u : children) {
      sum -= min({f[u][1][0], f[u][1][1], f[u][1][2]});
      update(f[v][1][1], sum + f[u][0][0]);
      update(f[v][1][1], sum + f[u][0][1]);
      update(f[v][1][1], sum + f[u][0][2]);
      sum += min({f[u][1][0], f[u][1][1], f[u][1][2]});
    }
  }
  {
    // take = 0
    int sum = 0;
    for (int u : children) {
      sum += min({f[u][1][0], f[u][1][1], f[u][1][2]});
    }
    update(f[v][1][0], sum);
    if ((int) children.size() > 2) {
      for (int u : children) {
        sum -= min({f[u][1][0], f[u][1][1], f[u][1][2]});
        update(f[v][1][1], sum + f[u][0][0]);
        update(f[v][1][1], sum + f[u][0][1]);
        update(f[v][1][1], sum + f[u][0][2]);
        sum += min({f[u][1][0], f[u][1][1], f[u][1][2]});
      }
    } else {
      for (int u : children) {
        int w = children[0] + children[1] - u;
        sum = min({f[u][0][0], f[u][0][1], f[u][0][2]});
        update(f[v][1][1], sum + f[w][1][0]);
        update(f[v][1][2], sum + f[w][1][1]);
        update(f[v][1][2], sum + f[w][1][2]);
      }
    }
  }
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0, -1);
  printf("%d\n", min(f[0][1][0], f[0][1][1]));
//  for (int i = 0; i < n; i++) {
  //  cerr << i << " -> " << f[i][0][0] << " " << f[i][0][1] << " " << f[i][0][2] << " " << f[i][1][0] << " " << f[i][1][1] << " " << f[i][1][2] << endl;
//  }
  return 0;
}


Measured memory_bytes: 22016
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define all(x) (x).begin(), (x).end() 

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

long long INF=numeric_limits<long long>::max();

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
  int a,x; cin >> a >> x;
  if(a<x)cout << 0 << endl;
  else cout << 10 << endl;
}	

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

int main(){
    int k,s;
    int n=0;
    cin>>k>>s;
    for(int x=0;x<=k;x++){
        for(int y=0;y<=k;y++){
            int z=s-x-y;
            if(0<=z&&z<=k) n++;
        }
    }
    cout<<n<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

const int I_MAX = 26;

int calc_point(const int& D, const VI& c, const VI2D& s, const VI& t) {
	int point = 0;
	VI last(I_MAX + 1, 0);
	REP(i, D) {
		point += s[i][t[i]];
		last[t[i]] = i + 1;
		int down = 0;
		REP(j, I_MAX) { down += c[j] * ((i + 1) - last[j]); }
		point -= down;
	}

	return point;
}

int main() {
	int D;
	cin >> D;
	VI c(I_MAX);
	REP(i, I_MAX) { cin >> c[i]; }
	VI2D s(D, VI(I_MAX));
	REP(i, D) {
		REP(j, I_MAX) { cin >> s[i][j]; }
	}

	std::random_device seed_gen;
	std::mt19937 engine(seed_gen());

	VI t(D);
	REP(i, D) { t[i] = engine() % I_MAX; }

	std::chrono::system_clock::time_point start, end;
	start = std::chrono::system_clock::now();

	int prev = calc_point(D, c, s, t);
	while(true) {
		end = std::chrono::system_clock::now();
		double elapsed =
			std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
				.count();
		if(elapsed > 1800.0) {
			break;
		}
		int d, q;
		d = engine() % D;
		q = engine() % I_MAX;

		int old = t[d];
		t[d] = q;
		int now = calc_point(D, c, s, t);
		if(prev > now) {
			t[d] = old;
		} else {
			prev = now;
		}
	}

	REP(i, D) { cout << t[i] + 1 << endl; }

	return 0;
}

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

int main() {
    int N; cin >> N;
    int d[N];
    for (int i=0; i<N; i++) {
        cin >> d[i];
    }

    sort(d, d+N);
    
    int ans = 1;
    for (int i=0; i<N-1; i++) {
        if (d[i] != d[i+1]) {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#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++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

string s;
ll ans = 0;
int main() {
	cin >> s;
	REP(i,1<<s.size() - 1){
		ll now = s[0] - '0';
		REP(j, s.size() - 1) {
			if (i & (1 << j)) {
				ans += now;
				now = s[j + 1] - '0';

			}
			else now = now * 10 + s[j + 1] - '0';
		}
		ans += now;
	}
	cout << ans << endl;
}	


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

string s;
llint x, y;
vector<llint> vecx, vecy;
bool dp[8005][16005];
llint Zero = 8002;

bool check(vector<llint> vec, llint x)
{
	if(x < -8000 || x > 8000) return false;
	llint n = vec.size();
	for(int i = 0; i <= n; i++){
		for(int j = -8000; j <= 8000; j++){
			dp[i][Zero+j] = false;
		}
	}
	dp[0][Zero] = true;
	
	for(int i = 0; i < n; i++){
		for(int j = -8000; j <= 8000; j++){
			if(!dp[i][Zero+j]) continue;
			if(j+vec[i] <= 8000) dp[i+1][Zero+j+vec[i]] = true;
			if(j-vec[i] >= -8000) dp[i+1][Zero+j-vec[i]] = true;
		}
	}
	return dp[n][x+Zero];
}

int main(void)
{
	cin >> s >> x >> y;
	s += "T";
	
	bool flag = true; llint cnt = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'F') cnt++;
		else{
			if(flag) vecx.push_back(cnt);
			else vecy.push_back(cnt);
			cnt = 0, flag = !flag;
		}
	}
	x -= vecx.front();
	vecx.erase(vecx.begin());
	
	if(check(vecx, x) && check(vecy, y)) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 63872
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1<<30
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define RREP(i,a,b) for(ll i=(a); i>=(b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pl;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n,m;
    ll u,v;
    ll s,t;
    cin >> n >> m;
    vvl G(n, vl());
    rep(i,m){
        cin >> u >> v; 
        u--; v--;
        G[u].push_back(v);
    }
    cin >> s >> t;
    s--; t--;
    
    vvl dist(n, vl(3, -1));
    queue<pl> q;
    dist[s][0] = 0;
    q.push({s,0});

    while(!q.empty()){
        pl p = q.front(); q.pop();
        ll v = p.first;
        ll r = p.second;
        rep(i,G[v].size()){
            ll R = (r + 1) % 3;
            if(dist[G[v][i]][R] == -1){
                dist[G[v][i]][R] = dist[v][r] + 1;
                //cout << G[v][i] << " " << R << "\n";
                q.push({G[v][i],R});
            }
        }
    }

    if(dist[t][0] == -1) cout << -1 << "\n";
    else cout << dist[t][0] / 3 << "\n";

    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

int main()
{
	int n;
	cin >> n;
	printf("%d", n + n * n + n * n * n);
}


Measured memory_bytes: 3660
//ABC113A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int x, y;
	cin >> x >> y;
	int ans = x+y/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
string s,t;
int main(){
  cin>>s>>t;
  int ss=s.size(),ts=t.size();
  bool ff=false;
  rep(i,ss-ts+1){
    bool f=true;
    rep(j,ts){
      if(t[j]!=s[i+j]){
	f=false;
	break;
      }
    }
    if(f){
      ff=true;
      break;
    }
  }
  if(ff){
    rep(i,s.size()){
      if(s[i]=='?'){
	s[i]='a';
      }
    }
    prin(s);
  }
  else{
    bool ffff=true;
    for(int i=ss-ts;i>=0;i--){
      bool fff=true;
      rep(j,ts){
	if(t[j]!=s[i+j]&&s[i+j]!='?'){
	  fff=false;
	  break;
	}
      }
      if(fff){
	rep(j,ts){
	  s[i+j]=t[j];
	}
	rep(i,ss){
	  if(s[i]=='?'){
	    s[i]='a';
	  }
	}
	prin(s);
	ffff=false;
	break;
      }
    }
    if(ffff){
      prin("UNRESTORABLE");
    }
  } 
    
  
  return 0;
}


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

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

using namespace std;

typedef unsigned long long ull;

const int INF=1<<29;

int n,adj[100][100],deg[100];

// decompose to connected component
void dfs(int u,bool *visited,vector<int> &cc){
	visited[u]=true;
	cc.push_back(u);
	rep(v,n) if(adj[u][v] && !visited[v]) dfs(v,visited,cc);
}

int calc(const vector<int> &cc){
	int res=0;
	for(int d=1;d<20;d++){
		//  d ÈãÌ¸_ðSñ
		vector<int> S;
		rep(i,cc.size()){
			int u=cc[i];
			if(deg[u]>=d) S.push_back(u);
		}

		int m=S.size();
		if(m<d+1) continue;

		if(d==1){
			rep(j,m) rep(i,j) res=max(res,2*adj[S[i]][S[j]]);
		}
		else{
			// TCY d+1 Ì subset ðSñ
			ull T=(1<<d+1)-1;
			while(T<(1ULL<<m)){
				// T ªN[N©Ç¤©ð»è
				int w=0;
				bool ok=true;
				rep(i,m) if(T&(1LL<<i)) {
					int w2=INF;
					rep(j,m) if(i!=j && T&(1LL<<j)) w2=min(w2,adj[S[i]][S[j]]);
					if(w2==0){ ok=false; break; }
					else w+=w2;
				}
				if(ok) res=max(res,w);

				ull x=T&-T,y=T+x;
				T=((T&~y)/x>>1)|y;
			}
		}
	}

	return res;
}

int main(){
	int m; scanf("%d%d",&n,&m);
	rep(i,m){
		int u,v,w; scanf("%d%d%d",&u,&v,&w); u--; v--;
		adj[u][v]=adj[v][u]=w;
		deg[u]++;
		deg[v]++;
	}

	int ans=0;
	bool visited[100]={};
	rep(u,n) if(!visited[u]) {
		vector<int> cc;
		dfs(u,visited,cc);
		ans=max(ans,calc(cc));
	}
	printf("%d\n",ans);

	return 0;
}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(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 mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N;
  cin >> N;
  if (N >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<cstdlib>
#define _t putchar(32)
#define _e putchar(10)
#define inf 2147483647
#define ine -2147483647
#define lb(x) ((x)&(-x))
#define sp(x,y) x^=y^=x^=y
using namespace std;
typedef long long ll;
bool o;
char chh,ss[1<<17],*A=ss,*B=ss;
inline char gc(){
	return A==B&&(B=(A=ss)+fread(ss,1,1<<17,stdin),A==B)?EOF:*A++;
}
template <typename _Tp> inline void rd(_Tp &x);
template <typename _Tp> inline void wr(_Tp x);
template <typename _Tp> inline _Tp mx(_Tp x,_Tp y);
template <typename _Tp> inline _Tp mn(_Tp x,_Tp y);
const int dx[2]={0,1},dy[2]={1,0};
int n,m,cnt;
char a[51][51];
bool v[51][51];
namespace flow{
	const int b=0,e=10000;
	int f[10001],to[5000001],ne[5000001],v[5000001],c[5000001],k,x;
	int q[10001],h,t;
	bool in[10001];
	int dis[10001],cur[10001];
	ll cost;
	inline void clear(){
		memset(f,-1,sizeof(f));
		k=0;
	}
	inline void link(int x,int y,int z,int ct){
		to[k]=y,v[k]=z,c[k]=ct,ne[k]=f[x],f[x]=k,k++;
		to[k]=x,v[k]=0,c[k]=-ct,ne[k]=f[y],f[y]=k,k++;
	}
	inline bool spfa(){
		memcpy(cur,f,sizeof(f));
		for(int i=1;i<=e;i++) dis[i]=-1ll<<30;
		dis[b]=0,h=0,t=1,q[1]=b,in[b]=1;
		while(h!=t){
			x=q[h=h%e+1];
			in[x]=0;
			for(int k=f[x];k^-1;k=ne[k]){
				if(v[k]&&dis[to[k]]<dis[x]+c[k]){
					dis[to[k]]=dis[x]+c[k];
					if(!in[to[k]]){
						in[to[k]]=1;
						q[t=t%e+1]=to[k];
					}
				}
			}
		}
		return dis[e]!=-1ll<<30;
	}
	inline int dfs(int i,int tp){
		if(i==e) return tp;
		in[i]=1;
		int gu=0,qwq;
		for(int k=cur[i];k^-1;k=ne[k]){
			if((!in[to[k]])&&v[k]&&dis[to[k]]==dis[i]+c[k]){
				qwq=dfs(to[k],mn(tp,v[k]));
				if(qwq){
					gu+=qwq,tp-=qwq,v[k]-=qwq,v[k^1]+=qwq,cost+=1ll*qwq*c[k];
					if(!tp){
						in[i]=0;
						cur[i]=k;
						return gu;
					}
				}
			}
		}
		dis[i]=inf;
		in[i]=0;
		return gu;
	}
	inline ll dinic(){
		cost=0;
		while(spfa()) dfs(b,inf);
		return cost;
	}
}
inline void dfs(int i,int j,int qwq,int x,int y){
	if(v[i][j]) return;
	v[i][j]=1;
	flow::link(qwq,100+(i-1)*m+j,1,i+j-x-y);
	for(int k=0;k<2;k++){
		int xx=i+dx[k],yy=j+dy[k];
		if(xx<=n&&yy<=m&&a[xx][yy]!='#') dfs(xx,yy,qwq,x,y);
	}
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
	flow::clear();
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	if(a[i][j]=='o') memset(v,0,sizeof(v)),flow::link(0,++cnt,1,0),dfs(i,j,cnt,i,j);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	if(a[i][j]!='#') flow::link(100+(i-1)*m+j,10000,1,0);
	cout<<flow::dinic();
}
template <typename _Tp>
	inline void rd(_Tp &x){
		o=0;
		x=0;
		while (chh^45&&(chh<48||chh>57)) chh=gc();
		if(chh==45)o=1,chh=gc();
		while(chh>47&&chh<58){
			x=(x<<1)+(x<<3)+(chh^48);
			chh=gc();
		}
		if(o) x=-x;
	}
template <typename _Tp>
	inline void wr(_Tp x){
		if(x<0) x=-x,putchar(45);
		if(x<10){
			putchar(x+48);
			return;
		}
		wr(x/10);
		putchar(x%10+48);
	}
template <typename _Tp>
	inline _Tp mx(_Tp x,_Tp y){
		return x>y?x:y;
	}
template <typename _Tp>
	inline _Tp mn(_Tp x,_Tp y){
		return x<y?x:y;
	}

Measured memory_bytes: 6020
n,m = map(int,input().split())
graph = {i:[] for i in range(1,n+1)}

for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
  
bridge = set([])

ans = 0
while 1:
  count = 0
  for i in range(1,n+1):
    if len(graph[i]) == 1:
      count += 1
      a = graph[i][0]
      graph[a].remove(i)
      graph[i] = []
  ans += count
  if count == 0:
    break
  else:
    count = 0
print(ans)
  



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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,m;
string s;
vll f;
// <------------- Implement Functions Here ----------> //

void fact() {
	f.pb(1);
	for(ll i=1;i<=max(n,m);i++) {
		f.pb((i * f[i-1])%MOD);
	}
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n;
	if(n >= 1800) cout<<1;
	else if(n >= 1600) cout<<2;
	else if(n >= 1400) cout<<3;
	else if(n >= 1200) cout<<4;
	else if(n >= 1000) cout<<5;
	else if(n >= 800) cout<<6;
	else if(n >= 600) cout<<7;
	else cout<<8;

}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 238032
#include <bits/stdc++.h>
#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++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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


#pragma optimize("", off)


int main() {
	int h,w,k;cin >> h >> w >> k ;
    vector<LV> s(h,LV(w));
    vector<LV> ans(h,LV(w));
    int kk = 0;
    REP(i,h){
        REP(j,w){
            char a;
            cin >> a;
            s[i][j] = a=='#' ? ++kk : 0;
        }
    }

    int now = 1;
    int f = 0;
    REP(x,h){
        f=0;
        REP(y,w){
            // cout << f <<endl;
            if(s[x][y]>0){
                f = s[x][y];
                ans[x][y]= f;
            }else{
                ans[x][y] =f;
            }
        }
    }

    REPR(x,h-1){
        f = 0;
        REPR(y,w-1){
            if(s[x][y]>0){
                f = s[x][y];
                ans[x][y]= f;
            }else if(f>0){
                ans[x][y] =f;
            }
        }
    }

    REP(i,h){
        REP(x,h-1){
            f=0;
            REP(y,w){
                if(ans[x][y]>0){
                    f = ans[x][y];
                }
            }
            if(f==0){
                REP(y,w){
                    ans[x][y] = ans[x+1][y];
                }
            }
        }
    }

    REP(i,h){
        FORR(x,h-1,1){
            f=0;
            REP(y,w){
                if(ans[x][y]>0){
                    f = ans[x][y];
                }
            }
            if(f==0){
                REP(y,w){
                    ans[x][y] = ans[x-1][y];
                }
            }
        }
    }


    



    REP(x,h){
        int f = 0;
        REP(y,w){
            cout << ans[x][y] ;
            if(y==(w-1) ){
                 cout <<'\n';
            } else cout << ' ';
        }
    }

}


Measured memory_bytes: 2176
import java.util.*;
public class Main {
   public static void main(String[] args) {  
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] ans = new long[n+1];
      ans[0] = 2;
      ans[1] = 1;
      for(int i = 2; i < n+1; i++){
         ans[i] = ans[i-1] + ans[i-2];
      }
      System.out.println(ans[n]);
   }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,z,w;
    cin >> n >> z >> w;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    if(n == 1) cout << abs(a.at(0) - w);
    else cout << max(abs(a.at(n-1) - w), abs(a.at(n-2) - a.at(n-1))) << endl;

    return 0;
}

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

int main() {
  char input[4];
  scanf("%s", input);

  char output[4] = "ABC";
  if (strcmp(input, "ABC") == 0) {
    strcpy(output, "ARC");
  }

  printf("%s", output);
  printf("%c", '\n');
  return 0;
}


Measured memory_bytes: 1736
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}

long long com(long long n,long long k){
	
}
long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}
class G{
	long long node;
	long long w;
	
};
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long N,M;
	cin>>N>>M;
	cout<<(1900*M+100*(N-M))*pow(2,M)<<endl;
}

	


Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define maxn 55
const double g=9.8;
double EPS=1e-6;
int N;
double V, X ,Y;
double L[maxn], B[maxn], R[maxn], T[maxn];
double calc(double vy, double t) {
    return vy*t-g*t*t/2;
}
int cmp(double lb, double ub, double a) {
    return a<lb+EPS?-1:a>ub-EPS?1:0;
}
bool check(double qx, double qy) {
    double a=g*g/4, b=g*qy-V*V, c=qx*qx+qy*qy;
    double D=b*b-4*a*c;
    if (D<0&&D>-EPS)
        D=0;
    if (D<0)
        return false;
    for (int d=-1; d<=1; d+=2) {
        double t2=(-b+d*sqrt(D))/(2*a);
        if (t2<=0)
            continue;
        double t=sqrt(t2);
        double vx=qx/t, vy=(qy+g*t*t/2)/t;
        double yt=calc(vy, X/vx);
        if (yt<Y-EPS)
            continue;
        bool ok=true;
        for (int i=0; i<N; i++) {
            if (L[i]>=X)
                continue;
            if (R[i]==X&&Y<=T[i]&&B[i]<=yt)
                ok=false;
            int yL=cmp(B[i], T[i], calc(vy, L[i]/vx));
            int yR=cmp(B[i], T[i], calc(vy, R[i]/vx));
            int xH=cmp(L[i], R[i], vx*(vy/g));
            int yH=cmp(B[i], T[i], calc(vy, vy/g));
            if (xH==0&&yH>=0&&yL<0)
                ok=false;
            if (yL*yR<=0)
                ok=false;
        }
        if (ok)
            return true;
    }
    return false;
}
void solve() {
    for (int i=0; i<N; i++)
        R[i]=min(R[i], X);
    bool ok=check(X, Y);
    for (int i=0; i<N; i++) {
        ok|=check(L[i], T[i]);
        ok|=check(R[i], T[i]);
    }
    puts(ok?"Yes":"No");
}
int main()
{
    scanf("%d%lf%lf%lf", &N, &V, &X, &Y);
    for (int i=0; i<N; i++)
        scanf("%lf%lf%lf%lf", &L[i], &B[i], &R[i], &T[i]);
    solve();
    return 0;
}

Measured memory_bytes: 1044
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999;
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		if(n < 1200)
		{
			Console.WriteLine("ABC");
		}
		else if(n < 2800)
		{
			Console.WriteLine("ARC");
		}
		else
		{
			Console.WriteLine("AGC");
		}
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	 }
}


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

int main()
{
	int n;
	scanf("%d", &n);
	std::vector<int> a(100000);
	for (int i = 0; i < n; i++)
	{
		int tmp;
		scanf("%d", &tmp);
		tmp--;
		a[tmp]++;
	}
	int variety_count{}, even_count{};
	for (int i = 0; i < 100000; i++)
	{
		if (a[i]) variety_count++;
		if (a[i] > 1 && !(a[i] & 1)) even_count++; 
	}
	printf("%d\n", variety_count - even_count % 2);

	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	static int n, m, k;
	static int[][] time, cost;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			n = sc.nextInt();
			m = sc.nextInt();
			if (n == 0 && m == 0)
				break;
			time = new int[m + 1][m + 1];
			cost = new int[m + 1][m + 1];
			for (int i = 0; i <= m; i++) {
				for (int j = 0; j <= m; j++) {
					cost[i][j] = cost[j][i] = 999999;
					time[i][j] = time[j][i] = 999999;
				}
			}
			int x, y;
			for (int i = 0; i < n; i++) {
				x = sc.nextInt();
				y = sc.nextInt();
				cost[x][y] = cost[y][x] = sc.nextInt();
				time[x][y] = time[y][x] = sc.nextInt();
			}
			initSolution();

			k = sc.nextInt();
			int start, end, condition;
			for (int i = 0; i < k; i++) {
				start = sc.nextInt();
				end = sc.nextInt();
				condition = sc.nextInt();
				if (condition == 0) {
					System.out.println(cost[start][end]);
				} else
					System.out.println(time[start][end]);
			}
		}

	}

	public static void initSolution() {
		for (int k = 1; k <= m; k++) {
			for (int i = 1; i <= m; i++) {
				for (int j = 1; j <= m; j++) {
					if (time[i][j] > time[i][k] + time[j][k])
						time[i][j] = time[i][k] + time[j][k];
					if (cost[i][j] > cost[i][k] + cost[j][k])
						cost[i][j] = cost[i][k] + cost[j][k];
				}
			}
		}
	}
}



Measured memory_bytes: 76232
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    int now=0;
    rep(i,10000){
        if(now%60+a>=c && c>=now%60){
            cout<<now/60*60+c<<endl;
            return 0;
        }else{
            now+=a+b;
        }
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

int lcm(int a, int  b){
    return (a*b)/gcd(a,b);
}

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //xのn乗を計算するのにn乗を2進表記にして計算
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//答えに付加
        }
        x=(x*x)%mod;//2乗
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int z;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.x < riRight.x;
        
    }
};

struct XX{
    int a;
    int b;
};

class xxIntu {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第1条件
        if(riLeft.a != riRight.a){
            return riLeft.a > riRight.a;//<:昇順(小さい順)、>:降順(大きい順)
        }
        //第2条件
        return riLeft.b > riRight.b;
    }
};
bool operator< (const XX &riLeft, const XX &riRight){
    return riLeft.a < riRight.a;
};
bool operator> (const XX &riLeft, const XX &riRight){
    return riLeft.a > riRight.a;
};

int f(int n,int r){
    int si=1;
    int bo=1;
    for(int i=0;i<r;i++){
        si=si*(si-i);
    }
    for(int i=0;i<r;i++){
        bo=bo*(bo-i);
    }
    return si/bo;
}


int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //ここから
    
    int N;
    cin >>N;
    int L[200];
    
    int tmp=N*2;
    N=tmp;
    for(int i=0;i<N;i++){
        cin >>L[i];
    }
    
    sort(L,L+N);
    
    int ans=0;
    for(int i=0;i<N;i=i+2){
        ans=ans+L[i];
    }
    


    cout << ans << endl;
    
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
signed main(){
    int n; cin>>n;
    int sum = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            for(int z = 1; z <=n; z++){
                sum+= gcd(i, gcd(j,z));
            }
        }
    }
    cout<<sum;
    return 0;
}




Measured memory_bytes: 3624
hash = {0=>0b0111111,1=>0b0000110,2=>0b1011011,3=>0b1001111,4=>0b1100110,5=>0b1101101,6=>0b1111101,7=>0b0100111,8=>0b1111111,9=>0b1101111,10=>0b0000000}
loop do
  n =gets.to_i
  break if n==-1
  now = 10
  n.times do
    puts "%07b\n" % (hash[now] ^ hash[now = gets.to_i])
  end
end

Measured memory_bytes: 2412
// ABC140A2.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>

using namespace std;	//命令を短くできます
int main()
{
	int N;
	cin >> N;			//データ入力

	int ans = N * N*N;	//何通りあるか計算します
    
	cout << ans<<endl;	// 答えを出力して改行する
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


int main()
{
	FASTIO
	/*
	//double start_time = clock();
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
//*/
	int T;
	//cin >> T;
	T = 1;
	for (int cs = 1; cs <= T; cs++) {
		int n;
		cin >> n;
		vector<int> v(n + 1);
		for (int i = 1; i <= n; i++) cin >> v[i];

		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			if (v[i] != i) cnt++;
		}
		if (cnt > 2) cout << "NO\n";
		else cout << "YES\n";
	}

	//double end_time = clock();
	//printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
	return 0;
}

Measured memory_bytes: 256
/*
2020-04-25
atcoder ABC
C - Welcome to AtCoder
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main() {
    int N, M, wa_cnt = 0, ac_cnt = 0;
    cin >> N >> M;
    vector<int> wa_cnts(N);
    vector<int> ac_memo(N);
    for(int i = 0; i < M; i++) {
        int p;
        string judge;
        cin >> p >> judge;
        if(ac_memo[p - 1] == 0) {
            if(judge == "WA"){
                wa_cnts[p - 1]++;
            } else {
                ac_memo[p - 1] = 1;
                ac_cnt++;
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(ac_memo[i] == 1) {
            wa_cnt += wa_cnts[i];
        }
    }
    cout <<  ac_cnt << " " << wa_cnt << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int best=100000,n;
int digitSum(int angka){
	int ret=0;
	while(angka)
	{
		ret+=angka%10;
		angka/=10;
	}
	return ret;
}
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
		best=min(best,digitSum(i)+digitSum(n-i));
	cout<<best<<endl;
}


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();
        String s = sc.next();
        char sn[] = s.toCharArray();

        for(int i=0; i <s.length();i++){
            for(int j=1; j<=n; j++){
                sn[i]++;
                if(Objects.equals(sn[i], '[')){
                    sn[i] = 'A';
                }
            }
            System.out.print(sn[i]);
        }


        
    }
}

Measured memory_bytes: 29400
#include<bits/stdc++.h>
using namespace std;
#define int long long int
typedef long double ld;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define mxe max_element
#define mne min_element
#define vi vector<int>
#define vvi vector<vi>
#define pi pair<int,int>
#define size(a)  (int)(a.size())
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define mod 1000000007
#define inf 1000000000
void solve(){
   int n,w;
   cin>>n>>w;
   vector<vi> dp(n+1, vi(w+1));
   vi price(n),cost(n);
   rep(i,0,n){
   	cin>>cost[i]>>price[i];
   }

   rep(i,1,n+1){
   	  rep(j,1,w+1){
   	  	dp[i][j] = dp[i-1][j];
   	  	if(j>=cost[i-1]){
   	  		dp[i][j] = max({dp[i][j],dp[i-1][j-cost[i-1]]+price[i-1]});
   	  	}
   	  }
   }
   cout<<dp[n][w];
 }
 

signed main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);  
    #endif
    */
	int test;
	//cin>>test;
	test=1;
	while(test--){
         solve();
         cout<<endl;
	}
	return 0;
}

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

int main(){
  
  int N, K;
  std::cin >> N >> K;
  
  std::vector<int> prices;
  prices.reserve(N);
  for (int i = 0; i < N; ++i){
    double p;
    std::cin >> p;
    prices.emplace_back(p);
  }
  
  std::sort(prices.begin(), prices.end());
  int totalMinPrice = 0;
  for (int i = 0; i < K; ++i){
    totalMinPrice += prices[i];
  }
  
  std::cout << totalMinPrice << std::endl;
  
  return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  int ans=0;
  int socket=1;
  for(int i=0; ;i++) {
    if(socket<b) {
      socket+=a-1;
      ans++;}
    else break;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  int N,H,W,sum=0;
  cin>>N>>H>>W;
  for(int i=0;i<N;i++){
    int A,B;
    cin>>A>>B;
    if(H<=A&&W<=B)
      sum++;
  }
cout<<sum<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    //int num = Integer.parseInt(sc.next());
    String[] week = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    String line = sc.next();
    for(int i = 0; i < 7; i++){
      if(line.equals(week[i])){
        System.out.println(7-i);
        break;
      }
    }
  }
}

Measured memory_bytes: 23636
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
int main(){
    string s;
    cin >> s;
    bool a = false ,b = false;
    int c = stoi(s.substr(0,2));
    int d = stoi(s.substr(2,2));
    if(1 <= c and c<=12 and  1 <= d  and d <= 12){
        a = b = true;
    }else{
        if(1 <= c and c <= 12)b = true;
        if(1 <= d and d <= 12)a = true;
    }
    if(a and b){
        cout << "AMBIGUOUS" << endl;
    }else if(a){
        cout <<"YYMM" << endl;
    }else if(b){
        cout << "MMYY" << endl;
    }else{
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  long int a,b,c;
  scanf("%ld%ld%ld",&a,&b,&c);

  long int d=c-a-b;
  int ans=1; //yes
  if(d<=0) ans=0; //no
  if(4*a*b >= d*d) ans=0;
  if(ans==0){
    printf("No\n");}
  else{
    printf("Yes\n");}

  return 0;
}


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

int main(){
  int N;
  int cnt=1;

  cin >> N;

  for(int i=0; i<N; i++){
    if(N < cnt)
      break;
    else
      cnt=cnt*2;
  }

  cout << cnt/2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define ar array
#define mxn 2005
#define mod 998244353
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using namespace std;
int main(void){
	fast;
	ll n,k,i,j;
	cin>>n>>k;
	array<ll,2>a[k];
	for(i=0;i<k;i++){
		cin>>a[i][0]>>a[i][1];
	}
	ll dp[n+1]={0};
	ll pre[n+1]={0};
	dp[1]=1;
	pre[1]=1;
	for(i=2;i<=n;i++){
		for(j=0;j<k;j++){
			if(a[j][0]>i)
			continue;
			ll l=a[j][0];
			ll r=min(a[j][1],i-1);
			dp[i]+=(pre[i-l]-pre[i-r-1]+mod)%mod;
			dp[i]%=mod;
		}
		pre[i]=pre[i-1]+dp[i];
		pre[i]%=mod;
	}
	cout<<dp[n];
}


Measured memory_bytes: 6780
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int N, M;
std::vector<int>G[51];

int main()
{
	in >> N >> M;
	rep(i, M)
	{
		int a, b;
		in >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	rep(i, N)
	{
		out << G[i + 1].size() << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256