akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  char c;
  cin >> c;
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    cout << "vowel";
  }
  else {
    cout << "consonant";
  }
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
class UnionFind():
  def __init__(self,n):
    self.n=n
    self.parent=list(range(n))
    self.size=[1]*n
    #print(self.size, end=" self.size \n")
  def find(self,x):
    if self.parent[x]==x:
      return x
    else:
      self.parent[x]=self.find(self.parent[x])
      return self.parent[x]
  def union(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x==y:
      return
    else:
      if self.size[x]>=self.size[y]:
        self.parent[y]=x
        self.size[x]+=self.size[y]
      else:
        self.parent[x]=y
        self.size[y]+=self.size[x]
  def cnt(self,x):
    return self.size[self.find(x)]
def main():
  n,m,k=map(int,input().split())
  u=UnionFind(n)
  ans=[0]*n
  for _ in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    u.union(a,b)
    ans[a]-=1
    ans[b]-=1
  for _ in range(k):
    c,d=map(int,input().split())
    c-=1
    d-=1
    if u.find(c)==u.find(d):
      ans[c]-=1
      ans[d]-=1
  for i in range(n):
    ans[i]+=u.cnt(i)-1
  print(" ".join(map(str,ans)))
main()


Measured memory_bytes: 18712
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} 



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

i64 N, A, B; cin >> N >> A >> B;
VI h(N); invec(h);
sort(ALL(h), greater<i64>());

if (N == 1) {
    cout << (h[0] + A - 1) / A << "\n";
    return 0;
}
i64 lose = 0, win = 1e9+1;
while(win - lose > 1){
    i64 m = (win + lose) / 2; // m回の攻撃で勝てるなら true;
    i64 d = 0;
    for(i64 a: h)
        if (a > B * m) d += (a - B * m + A-B - 1) / (A-B);
    if (d <= m) win = m; else lose = m;
}

cout << win <<  "\n";

return 0;
}
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 1024
n,m= map(int, input().split())
A = [int(x) for x in input().split()]
s=0
for i in range(n):
  s+=A[i]
c=0
for i in range(n):
  if A[i]>=s/(4*m):
    c+=1
if c>=m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

void solve() {
  vector<vector<int>> room(105, vector<int>(50, inf));
  vector<int> door(105, 0), d(105, 0), idx(105, 0);
  int id = 1;
  int t;
  stack<int> path;
  while (cin >> t, t) {
    if (t > 0) {
      if (path.size()) {
        room[path.top()][idx[path.top()]++] = id;
        room[id][idx[id]++] = path.top();
      }
      door[id] = t;
      d[id] = path.size();
      path.push(id);
      id++;
      while (path.size() && idx[path.top()] == door[path.top()]) {
        path.pop();
      }
    }
    else {
      FOR(i, 1, id) {
        if (d[i] - d[path.top()] == t && idx[i] != door[i]) {
          room[i][idx[i]++] = path.top();
          room[path.top()][idx[path.top()]++] = i;
          while (path.size() && idx[path.top()] == door[path.top()]) {
            path.pop();
          }
          break;
        }
      }
    }
  }
  FOR(i, 1, id) sort(room[i].begin(), room[i].end());
  FOR(i, 1, id) {
    cout << i;
    rep(j, door[i]) cout << ' ' << room[i][j];
    cout << '\n';
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n;
  cin >> n;
  while (n--) {
    solve();
  }

  




  
  return 0;
}


Measured memory_bytes: 3224
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);

void solve(){
    int n,m,c;
    cin>>n>>m>>c;
    int b[m];
    loop(m,i,0)
        cin>>b[i];
    int res=0;
    loop(n,i,0){
        int tot=0;
        loop(m,j,0){
            int x;
            cin>>x;
            x*=b[j];
            tot+=x;
        }
        res+=(tot+c>0);
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

// N, E, S, W
const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = { 0, 1, 0, -1};

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;

//==============================================

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

	queue<char>A, B, C;

	string s;
	cin >> s;
	REP(i, s.size()) A.push(s[i]);
	cin >> s;
	REP(i, s.size()) B.push(s[i]);
	cin >> s;
	REP(i, s.size()) C.push(s[i]);

	char ans;
	char turn = 'a';
	while (true) {

		if (turn == 'a') {
			if (A.empty()) {
				ans = 'A';
				break;
			}
			turn = A.front(); A.pop();
		} else if (turn == 'b') {
			if (B.empty()) {
				ans = 'B';
				break;
			}
			turn = B.front(); B.pop();
		} else {
			if (C.empty()) {
				ans = 'C';
				break;
			}
			turn = C.front(); C.pop();
		}
	}

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,h[200001],x=1;
    cin>>n;
    rep(i,n) cin>>h[i];
    rep(i,n-1) if(h[i]>h[i+1]+1) x=0;
    vector<int> H;
    H.push_back(h[0]);
    rep(i,n-1) if(h[i]!=h[i+1]) H.push_back(h[i+1]);
    rep(i,(H.size()-2)*(H.size()>2)) if(H[i]==H[i+1]+1&&H[i+1]==H[i+2]+1) x=0;
    if(x) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back


#define L_B lower_bound
#define U_B upper_bound

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf (1000*1000*1000+5)
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll a,b;
	rl2(a,b);
	ll ans=(a/b);
	
	if(a%b!=0)
		ans++;
	wl(ans);
	NL;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
n, m = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]

a.sort(reverse=True)
s = sum(a)
thresh = s/(4*m)
flag=True
for i in range(m):
    if a[i]< thresh:
        flag=False
        break

if flag:
    print("Yes")
else:
    print("No")

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

int main(){
  int n,k,ans=1,a,b;
  cin >> n >>k;
  for(int i=0;i < n;i++){
    a=2*ans;
    b=ans+k;
    if(a>b){
      ans=b;
    }else{
      ans=a;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
#define pb push_back

const int N = 55;
const int T = 111;
const int INF = 300000000;

int n,m,a,b,c;

int dp[T][N][N];
int edge[N][N];


int main(){
  cin>>n>>m>>a>>b>>c;

  rep(i,N)rep(j,N)rep(k,T)dp[k][i][j] = INF;
  rep(i,N)rep(j,N)edge[i][j] = INF;

  rep(i,m){
    int t,u;
    cin>>t>>u;
    edge[t][u] = 1;
    dp[1][t][u] = 1;
  }

  reps(i,2,T){
    reps(j,1,n+1){
      reps(k,1,n+1){
	reps(p,1,n+1){
	  if(dp[i-1][j][p]!=INF && edge[p][k]!=INF){
	    dp[i][j][k] = 1;
	  }
	}
      }
    }
  }

  int check[N][3]={0};
  int visit[N]={0};

  typedef pair<int,int> pii;
  queue<pii> que;
  que.push(pii(n,0));
  check[n][0] = check[n][1] = check[n][2] = 1;

  while(!que.empty()){


    pii U = que.front();
    que.pop();

    int u = U.first;

    if(visit[u]!=0)continue;
    visit[u]=1;


    if(U.first==1){
      printf("%d\n",U.second);
      return 0;
    }

    reps(i,1,n+1){
      bool hitted = false;      
      if(dp[a][i][u]==1){
	check[i][0] = 1;
	hitted = true;
      }

      if(dp[b][i][u]==1){	
	check[i][1]=1;
	hitted = true;
      }
      if(dp[c][i][u]==1){
	check[i][2]=1;
	hitted = true;
      }


      if(hitted){
	bool ok = true;
	rep(j,3)if(check[i][j]!=1)ok=false;
	if(ok)que.push(pii(i,U.second+1));
      }
    }
  }

  puts("IMPOSSIBLE");

  /*
  rep(i,10){
    printf("%d\n",i);

    reps(j,1,n+1){
      reps(k,1,n+1){
	if(dp[i][j][k]!=INF) printf("%2d ",dp[i][j][k]);
	else printf("oo ");
      }puts("");
    }
  }
  */
  
}

Measured memory_bytes: 2540
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
	while (1) {
		int n, x;
		cin >> n >> x;
		if (n == 0 && x == 0) return 0;

		int count = 0;
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) count++;
				}
			}
		}
		cout << count << endl;
	}

	return 0;
}



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


using namespace std;
int dp[100001],h[100001];
int ma = 1e9;
int main()
{

    int n,k;cin>>n>>k;
    for(int i=1;i<=n;i++){cin>>h[i];dp[i]= ma;}

    dp[1] = 0;
    for(int i=2;i<=n;i++){
            for(int j=1;j<=k;j++){

                if(i-j >0){
                         int b= dp[i-j] + abs(h[i-j] - h[i]);
                    dp[i] = min (dp[i],b);

                }

            }
           // a = dp[i-1] +  abs(h[i-1] - h[i]);





    }
    cout << dp[n] << endl;
    return 0;
}


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

long long N, Q;
vector<long long> tree[200005];
set<long long> visit;
long long ans[200005];

void dfs(long long cur, long long cost){
	if(visit.count(cur)){
		return;
	}
	visit.insert(cur);
	long long curcos = cost + ans[cur];
	ans[cur] = curcos;
	for(auto ne : tree[cur]){
		dfs(ne, curcos);
	}
}

int main(){
	cin >> N >> Q;
	for(long long i = 0; i < N - 1; i++){
		long long a, b;
		cin >> a >> b;
		a--;b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	
	for(long long i = 0; i < Q; i++){
		long long p,x;
		cin >> p >> x;p--;
		ans[p] += x;
	}
	
	dfs(0, 0);

	for(long long i = 0; i < N; i++){
		cout << ans[i];
		if(i != N-1){
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


Measured memory_bytes: 33664
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int partition(int *A, int left, int right) {
	int x = A[right];
	int i, j;
	i = left - 1;
	for (j = left; j < right; j++)
	{
		if (A[j] <= x)
		{
			i++;
			swap(A[j], A[i]);
		}
	}
	i++;
	swap(A[i], A[right]);
	return i;
}

int main(void) {
	int n, *A, i;
	scanf("%d", &n);
	A = new int[n];
	for (i = 0; i < n; i++) 
		scanf("%d", &A[i]);
	int p = partition(A, 0, n - 1);
	for (i = 0; i < p; i++) {
		if (i) printf(" ");
		printf("%d", A[i]);
	}
	printf(" [%d]", A[i]);
	for (i = p + 1; i < n; i++) 
		printf(" %d", A[i]);
	printf("\n");
}


Measured memory_bytes: 3500
#![allow(unused_imports, dead_code, non_snake_case)]

use std::io::*;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::str::FromStr;

const MOD: i32 = 1_000_000_007;

macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(usize);
    let mut v = Vec::new();
    for _ in 0..N {
        v.push(get!(usize));
    }
    let sum = v.iter().sum();
    let ans = if sum % 10 != 0 {
        sum
    } else {
        if let Some(x) = v.iter().filter(|&x| x % 10 != 0).min() {
            sum - x
        } else {
            0
        }
    };
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

        int size(int x) {
            return -parent[find(x)];
        }

        bool is_same(int x, int y) {
            return find(x) == find(y);
        }

        // CAUTION!! : This method is heavy due to scanning linearly.
        int component_count() {
            int c = 0;
            for (const int x : parent) {
                if (x < 0) {
                    c++;
                }
            }
            return c;
        }
};

void solve() {
    int n;
    cin >> n;
    vi x(n);
    vi y(n);
    REP(i, n) cin >> x[i] >> y[i];
    vi r(n);
    iota(ALL(r), 0);
    ld ans = 0;
    do {
        REP(i, n - 1) {
            ans += sqrt(pow(x[r[i]] - x[r[i + 1]], 2) + pow(y[r[i]] - y[r[i + 1]], 2));
        }
    } while (next_permutation(ALL(r)));
    int p = 1;
    REP1(i, n) p *= i;
    cout << ans / p << endl;
}


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

ans = 0
for i in range(n - 2):
    for j in range(i + 1,n - 1):
        for k in range(j + 1,n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:
                    ans += 1

print(ans)                    

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    double T, X;
    cin >> T >> X;
    cout << T / X << endl;
    return 0;
}


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

int main(){
    int N, A[20], B[20], C[20];
    cin >> N;
    int ans = 0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        A[i]--;
    }
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        ans += a;
    }
    for(int i=0; i<N-1; i++) cin >> C[i];
    for(int i=0; i<N-1; i++) if(A[i] + 1 == A[i+1]) ans += C[A[i]];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int n;
int a[100];
int main(){
	cin >> n;
	REP(i,n) {
		cin >>a[i];
	}

	bool f = true;
	REP(i,n){
		if(a[i] < 0)
			f = false;
	}

	if(f) {
		cout << n - 1 << endl;
		REP(i,n - 1)
			cout << i + 1 << " " << i + 2 << endl;
		return 0;
	}

	f = true;
	REP(i,n){
		if(a[i] > 0) {
			f = false;
		}
	}
	if(f) {
		cout << n - 1 << endl;
		RREP(i,n - 1) {
			cout<< i + 2 << " " << i + 1 << endl;
		}
		return 0;
	}

	int maxi = 0;int mini = 0;
	REP(i,n) {
		if(a[maxi] < a[i]) 
			maxi = i;
		if(a[mini] > a[i])
			mini = i;
	}

	cout << 2 * n - 1 << endl;
	if(a[maxi] + a[mini] >= 0) {
		REP(i,n) {
			cout << maxi + 1 << " " << i + 1 << endl;
		}
		REP(i,n - 1) {
			cout<< i + 1 << " " << i + 2 << endl;
		}
	}else{
		REP(i,n) {
			cout << mini + 1 << " "  << i + 1 << endl;
		} 
		RREP(i,n - 1)
			cout<< i + 2 << " " << i + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#define INF 3000000000
using namespace std;
typedef long long ll;
int main(){
  ll n,val,tmp,m,ans=0;
  cin >> n;
  ll a[n];
  map<ll,ll> mp;
  vector<ll> list;
  bool can;
  for(ll i=2;i<INF;i*=2){
    list.push_back(i);
  }
  m = list.size();
  for(int i=0;i<n;i++){
    cin >> a[i];
    mp[a[i]]++;
  }
  sort(a,a+n);
  for(int i=n-1;i>=0;i--){
    val=a[i];
    can=false;
    if(mp.find(val)==mp.end()){
      continue;
    }
    mp[val]--;
    if(mp[val]==0){
      mp.erase(val);
    }
    for(int j=m-1;j>=0;j--){
      tmp = list[j]-val;
      if(mp.find(tmp)!=mp.end()){
        can=true;
        break;
      }
    }
    if(can){
      ans++;
      mp[tmp]--;
      if(mp[tmp]==0){
        mp.erase(tmp);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;



int main() {
    ll mod=2019;
    ll l,r,mini1=2018,mini2; cin>>l>>r;
    for(ll i=l; i<r; i++){
        for(ll j=i+1; j<=r; j++){
            mini2=(i*j)%mod;
            mini1= min(mini1,mini2);
            if(mini1==0) break;
        }
        if(mini1==0) break;
    }
    cout<<mini1<<endl;
}

Measured memory_bytes: 256
import math
import copy

def main():
    N=int(input())
    zero_fish=0

    Pair={}

    for i in range(N):
        A,B=map(int,input().split())

        if A==0 and B==0:
            zero_fish+=1
            continue
        if B==0:
            bunsi=1
            bunbo=0
        elif B>0:
            bunsi=A//math.gcd(A,B)
            bunbo=B//math.gcd(A,B)
        else:
            bunsi=-1*A//math.gcd(A,B)
            bunbo=-1*B//math.gcd(A,B)

        key = str(bunsi) + "/" + str(bunbo)

        if bunsi == 0 or bunbo == 0:
            rev_bunsi = bunbo
            rev_bunbo = bunsi
        elif bunsi < 0:
            rev_bunsi = bunbo
            rev_bunbo = -1 * bunsi
        else:
            rev_bunsi = -1 * bunbo
            rev_bunbo = bunsi
        rev_key = str(rev_bunsi) + "/" + str(rev_bunbo)

        if (key in Pair.keys()):
            Pair[key][0]+=1
        elif (rev_key in Pair.keys()):
            Pair[rev_key][1]+=1
        else:
            Pair[key]=[1,0]

    res=1
    mod=1000000007
    for p in Pair.values():
        if p[1]==0:
            temp=pow(2,p[0],mod)
        else:
            temp=(pow(2,p[0],mod)+pow(2,p[1],mod)-1)%mod
        res=(res*temp)%mod
    res+=zero_fish-1

    print(res%mod)

if __name__=="__main__":
    main()


Measured memory_bytes: 54672
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main( )
    {
        long N = long.Parse( Console.ReadLine( ) );
        var A = Console.ReadLine( ).Split( ).Select( long.Parse ).ToArray( );
        long ans = 1;

        if ( A.Any(x=>x==0 ) )
        {
            Console.WriteLine(0);
            return;
        }

        foreach ( var x in A )
        {
            try
            {
                checked
                {
                    ans *= x;
                    if ( ans > 1000000000000000000 )
                    {
                        Console.WriteLine( -1 );
                        return;
                    }
                }
            }
            catch ( OverflowException )
            {
                Console.WriteLine( -1 );
                return;
            }
        
        }
        Console.WriteLine( ans );
    }


}



Measured memory_bytes: 42644
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	string t;
	cin>>s>>t;
	int l1 = s.length();
	int l2 = t.length();
	vector<vector<int>> dp(l1+1,vector<int>(l2+1,0));
	for(int i=0;i<=l1;i++) {
		for(int j=0;j<=l2;j++) {
			if(i == 0 || j == 0) {
				dp[i][j] = 0;
			}
			else if(s[i-1] == t[j-1]) {
				dp[i][j] = 1 + dp[i-1][j-1];
			}
			else {
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	//cout<<dp[l1][l2];
	int len = dp[l1][l2];
	string lcs(len,' ');
	int i = l1;
	int j = l2;
	while(i > 0 && j>0) {
		if(s[i-1] == t[j-1]) {
			lcs[len-1] = s[i-1];
			i--;
			j--;
			len--;
		}
		else if(dp[i-1][j] > dp[i][j-1]) {
			i--;
		}
		else {
			j--;
		}
	}
	cout<<lcs;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

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

  vector<vector<pair<ll, ll>>> G(N);

  for(int i = 1; i < N; i++){
    G[i].push_back(make_pair(i-1, 0));
  }

  ll L, R, C;
  for(int i = 0; i < M; i++){
    cin >> L >> R >> C;
    L--;
    R--;
    G[L].push_back(make_pair(R, C));
  }

  vector<ll> d(N);
  for(int i = 0; i < N; i++){
    d[i] = INF;
  }
  d[0] = 0;

  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
  que.push(make_pair(0, 0));

  while(!que.empty()){
    auto p = que.top();
    que.pop();
    ll v = p.second;
    if(d[v] < p.first) continue;

    for(int i = 0; i < G[v].size(); i++){
      auto e = G[v][i];
      if(d[e.first] > d[v] + e.second){
        d[e.first] = d[v] + e.second;
        que.push(make_pair(d[e.first], e.first));
      }
    }
  }

  if(d[N-1] >= INF){
    cout << -1 << endl;
  }else{
    cout << d[N-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 10112
# a
require 'pp'
k = gets.to_i
a = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(',').map(&:to_i)
p a[k-1]



Measured memory_bytes: 2172
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll x;cin>>x;
    ll now=x;
    if(x==2){
        cout<<2<<endl;
        return 0;
    }
    while(1){
        bool f=1;
        REP(i,2,sqrt(now)+1){
            if(now%i==0)f=0;
        }
        if(f){
            cout<<now<<endl;
            break;
        }
        now++;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    string s;
    LL k;
    while (cin >> s >> k) {
        int cnt;
        FOR(i,0,s.size()){
            if (s[i] != '1') {
                cnt = i + 1;
                break;
            }
        }
        if (cnt > k)
            cout << '1' << endl;
        else
            cout << s[cnt-1] << endl;
    }
}   


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n;
    int count = 0;
    scanf("%d", &n);
    int d[n];
    for(int i=0; i<n; i++){
        scanf("%d", &d[i]);
    }
    
    int pd = -1;
    int max = 1;
    int id = -1;
    while(max > 0){
        max = d[0];
        id = 0;
        for(int i=1; i<n; i++){
            if(max < d[i] && (d[i] < pd || pd == -1)){
                max = d[i];
                id = i;
            }
        }
        if((0 < max) || pd == -1){
            pd = max;
            d[id] = 0;
            count++;
        }else{
            break;
        }
    }
    printf("%d", count);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static int tc=1;
    static String[] s;

    public static long[] ila(String[] s){
        long[] array=new long[s.length];
        for(int i=0;i<array.length;i++)
            array[i]=Long.parseLong(s[i]);
        return array;
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        tc=1;
        t:
        for(int z=1;z<=tc;z++){
        	double L = Double.parseDouble(br.readLine());
        	double length = L/3;
        	L-=length;
        	double breadth = L/2;
        	double height = L - breadth;
        	double result = length*breadth*height;
        	System.out.println(String.format("%.12f",result));
        }
    }
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll X;
    ll i;
    cin >> X;
    for(i = 1;i * (i + 1) / 2 < X;i++);
    cout << i << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //昇順
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順

int main(){
  ll n, k;
  cin >> n >> k;
  ll tmp = max(n, k);
  ll tmp2 = min(n, k);
  k = tmp;
  n = tmp2;

  if(n == 1 && k == 1){
    cout << 1 << endl;
    return 0;
  }
  if(n >= 2){
    cout << (n-2)*(k-2) << endl;
    return 0;
  }
  if(n == 1){
    cout << k - 2 << endl;
    return 0;
  }
}

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

using namespace std;

bool visited[200];
vector<int> path[200];

bool solve(int num, int s) {

    bool ret = false;

    if(num == s && visited[num]) {
        return true;
    }

    for(int i = 0; i < path[num].size(); ++i) {
        if(!visited[path[num][i]]) {
            visited[path[num][i]] = true;
            ret |= solve(path[num][i], s);
        } else {
            //return true;
        }
    }

    return ret;
}

int main() {

    int n;
    bool dead_locked = false;

    cin >> n;

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

        int u, d;
        string command;

        cin >> u >> command >> d;

        --u;
        --d;

        if(command == "lock") {
            path[100 + d].push_back(u);
        } else if(command == "wait") {
            path[u].push_back(100 + d);
        }

    }

    for(int i = 0; i < 200; ++i) {
        memset(visited, false, sizeof(visited));
        //visited[i] = true;
        dead_locked |= solve(i, i);
        /*
        if(dead_locked) {
            cout << i << endl;
        }
        */
    }

    cout << dead_locked << endl;

}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 

    
    signed main(){
     int n;cin>>n;
     int a[n+1];
     forr(i,0,n)cin>>a[i];
    int dp[n+1]{0};
    dp[1]=abs(a[1]-a[0]);
    forr(i,2,n){
        dp[i]=min(   dp[i-1]  +abs(a[i-1]-a[i])                      ,dp[i-2]   +abs(a[i-2]-a[i]));
    }cout<<dp[n-1];
      }
        
        
        
       

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

using ll = long long;
ll c2, c3, c5, c1;

map<ll, ll> memo;

ll solve(ll n){
	if(!memo.count(n)){
		if(n == 0){
			memo[n] = 0;
		} else {
			ll res = 7e18;
			if(n <= res / c1) res = min(res, c1 * n);
			res = min(res, solve(n / 2) + c2 + c1 * (n % 2));
			res = min(res, solve(n / 3) + c3 + c1 * (n % 3));
			res = min(res, solve(n / 5) + c5 + c1 * (n % 5));
			if(n > 1){
				if(n > 2) res = min(res, solve(1 + n / 2) + c2 + c1 * (2 - (n % 2)));
				res = min(res, solve(1 + n / 3) + c3 + c1 * (3 - (n % 3)));
				res = min(res, solve(1 + n / 5) + c5 + c1 * (5 - (n % 5)));
			}
			memo[n] = res;
		}
	}
	return memo[n];
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(nullptr);
	int T;
	cin >> T;
	while(T--){
		memo = {};
		ll n;
		cin >> n;
		cin >> c2 >> c3 >> c5 >> c1;
		ll ans = solve(n);
		cout << ans << '\n';
	}
}

Measured memory_bytes: 4852
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
using ll = long long int;

struct RollingHash {
    typedef long long int_type;

    int_type base1;
    int_type base2;
    int_type mod1;
    int_type mod2;
    vector<int_type> hash1;
    vector<int_type> hash2;
    vector<int_type> pow1;
    vector<int_type> pow2;

    RollingHash() : base1(1009), base2(1007), mod1(1000000007), mod2(1000000009) {}

    void init(const string &s) {
        int n = s.size();

        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);

        for(int i=0;i<n;i++) {
            hash1[i+1] = (hash1[i]+s[i]) * base1 % mod1;
            hash2[i+1] = (hash2[i]+s[i]) * base2 % mod2;
            pow1[i+1] = pow1[i] * base1 % mod1;
            pow2[i+1] = pow2[i] * base2 % mod2;
        }
    }

    int_type get(int l,int r) {
        int_type t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
        int_type t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
        return t1 * mod2 + t2;
    }
};

int main(void) {
    int n; cin >> n;
    string s; cin >> s;
    RollingHash rh;
    rh.init(s);
    for(int l=n/2; l>0; l--){
        unordered_map<ll, int> um;
        for(int i=0; i<n-l+1; i++){
            ll hash = rh.get(i, i+l);
            auto itr = um.find(hash);
            if(itr != um.end()){
                if(i - um[hash] >= l){
                    cout << l << endl;
                    return 0;
                }
            }
            else{
                um[hash] = i;
            }
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 736
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
using ll = long long int;

// 回転した時の最小
vector<int> normalize(vector<int> v) {
    vector<int> ret = v;
    for(int i=0; i<4; i++) {
        vector<int> tmp = v;
        rotate(tmp.begin(), tmp.begin() + i, tmp.end());
        ret = min(ret, tmp);
    }
    return ret;
}

void print_vec(vector<int> v) {
    for(auto x : v) printf("%d ", x);
    printf("\n");
}

map< vector<int>, int > cnt, mul;

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

    vector< vector<int> > squares(N);
    for(int i=0; i<N; i++) {
        vector<int> v(4);
        for(int k=0; k<4; k++) {
            scanf("%d", &v[k]);
        }
        squares[i] = normalize(v);
        cnt[ squares[i] ]++;


        if(squares[i][0] == squares[i][1] && squares[i][1] == squares[i][2] && squares[i][2] == squares[i][3]) {
            mul[squares[i]] = 4;
        }
        else if(squares[i][0] == squares[i][2] && squares[i][1] == squares[i][3]) {
            mul[squares[i]] = 2;
        }
        else {
            mul[squares[i]] = 1;
        }
    }

    ll ans = 0;
    // i: front, j: back
    for(int fr=0; fr<N; fr++) {
        vector<int> front = squares[fr];
        for(int bc=fr+1; bc<N; bc++) {
            vector<int> back_orig = squares[bc];
            cnt[front]--; cnt[back_orig]--;
            for(int k=0; k<4; k++) {
                // rotate (back)
                vector<int> back(4);
                for(int x=0; x<4; x++) {
                    int value = squares[bc][(x+k)%4];
                    back[x] = value;
                }

                vector< vector<int> > sides(4);
                sides[0] = {front[0], back[1], back[0], front[1]};
                sides[1] = {front[1], back[0], back[3], front[2]};
                sides[2] = {front[2], back[3], back[2], front[3]};
                sides[3] = {front[3], back[2], back[1], front[0]};

                ll add = 1;
                map< vector<int>, int > used;
                for(auto vec : sides) {
                    vec = normalize(vec);
                    int exist = cnt[vec] - used[vec];
                    if(exist == 0) {
                        add = 0;
                        break;
                    }
                    add *= exist * mul[vec];
                    used[vec]++;
                }
                ans += add;
            }
            cnt[front]++; cnt[back_orig]++;
        }
    }
    printf("%lld\n", ans / 3);
    return 0;
}

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

typedef long long ll;
#define SZ(a) (int)a.size()
#define PB push_back
//#define cerr if(false)cerr
#define print(x) cerr<<"\n" << (#x) << " is " << (x) << endl;



int32_t main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(auto &i : v)
		cin >> i;
	bool f = true;
	for(auto x : v){
		if(x % 2) continue;
		if((x % 3) && (x % 5)) f = false;
	}
	if(f) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
  long X, A, B;
  std::cin >> X >> A >> B;
  if(-A+B <= 0) std::cout << "delicious" << std::endl;
  else if(-A+B<= X) std::cout << "safe" << std::endl;
  else std::cout << "dangerous" << std::endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;

const ll maxn =8e5+5;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

int n;
int a[maxn];
int mn = 1e6;
int cnt = 0;

int main(){
    migmig
    cin >> n;
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i];
        if(a[i] < mn){
            mn = a[i];
            cnt++;
        }
    }
    cout << cnt;


    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,cnt=0;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>arr[i];
    while(1)
    {
        int f=0;
        for(int i=0; i<n; i++)
        {
            if(arr[i]==0)
             {
                 f=1;
                 break;
             }

            if(arr[i]%2)
                f=1;
            else
                arr[i]/=2;
        }
        if(f)
            break;
        else
            cnt++;
    }
cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>

int main(){
  int i;
  int j;

  for(i=0;i<9;i++){
    for(j=0;j<9;j++){
      printf("%dx%d=%d\n",i+1,j+1,(i+1)*(j+1));
    }
  }

  return 0;
}

Measured memory_bytes: 524
k = ('a'..'z').to_a
v = Array.new(26, 0)
h = {}
k.zip(v).each{|kk, vv| h[kk] = vv}
while line = gets
  line.chomp.split('').each do |c|
    next if /[^a-zA-Z]/ =~ c
    c.downcase!
    h[c] += 1
  end
end
h.each do |key, val|
  print "#{key} : #{val}\n"
end

Measured memory_bytes: 6116
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007


using namespace std;

int main(void){
    VI E(12);
    rep(i,12)cin>>E[i];
    sort(E.begin(),E.end());
    if(E[0]==E[3]&&E[4]==E[7]&&E[8]==E[11]){
        cout<<"yes"<<endl;
        return 0;
    }
    cout<<"no"<<endl;
}




Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int x,a;
	cin >> x >> a;
	if(x < a){
		cout << 0 << endl;
	}else{
		cout << 10 << endl;
	}
}

Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const int IINF = 1e9;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

int main() {
  int a, b;
  cin >> a >> b;
  for (double i = 0.0; i < 11000.0; i++) {
    if (int(i * 0.08) == a && int(i * 0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		while(true) {
			int H=in.nextInt(),W=in.nextInt();
			if(H==0)break;
			for(int i=0;i<H;i++) {
				for(int j=0;j<W;j++)out.print("#");
				out.println();
			}
			out.println();
		}
		
		out.flush();
	}

}



Measured memory_bytes: 28384