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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

const int dr[] = { 0, 1, 0, -1, 0 };
const string sdr= "RDLU";
int rdr(char q){return q=='R'? 0: q=='D'? 1: q=='L'? 2: 3;}
int main()
{
 	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int h,w,n,sr,sc;
	cin >>h >>w >>n >>sr >>sc;
	string s, t;
	cin >>s >>t;
	
	
	VI py(h+4),px(w+4);
	string win = "YES";
	//py[cy]=1; px[cx]=1;
	rep(g,4){
		int cy=sr-1, cx=sc-1;
		
		if(g==0){
			rep(i, 2*n){
				if(i%2==0 && s[i/2]=='U' ) cy--;
				if(i%2==1 && t[i/2]=='D'&& cy<h-1 ) cy++;
			//	dbg(g,i,"cy",cy);
				if(cy <0){ win="NO"; goto lend;}
			}
		}
		if(g==2){
			rep(i, 2*n){
				if(i%2==0 && s[i/2]=='D' ) cy++;
				if(i%2==1 && t[i/2]=='U' && cy>0) cy--;
				//dbg(g,i,"cy",cy);
				if(cy >=h){ win="NO"; goto lend;}
			}
		}
		if(g==1){
			rep(i, 2*n){
				if(i%2==0 && s[i/2]=='L' ) cx--;
				if(i%2==1 && t[i/2]=='R' && cx<w-1) cx++;
				//dbg(g,i,"cx",cx);
				if(cx <0){ win="NO"; goto lend;}
			}
		}
		if(g==3){
			rep(i, 2*n){
				if(i%2==0 && s[i/2]=='R' ) cx++;
				if(i%2==1 && t[i/2]=='L' && cx>0) cx--;
				//dbg(g,i,"cx",cx);
				if(cx >=w){ win="NO"; goto lend;}
			}
		}
		
		
	
	}
	lend:;
		cout << win <<"\n";
	
	return 0;
}


Measured memory_bytes: 2312
line = gets.split(' ').map(&:to_i)

n = line[0]
k = line[1]
s = gets.split('')

start = 0
for i in 0..n-2
  if s[i] == s[i+1] then
    start += 1
  end
end

value = 2 * k + start
if value > n-1 then
  value = n-1
end

p value


Measured memory_bytes: 6780
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

int main() {
  string S; cin >>S;
  bool a=regex_match(S,regex("A?KIHA?BA?RA?"));
  cout <<(a ? "YES":"NO") <<endl;
  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

template <typename T>
struct edge {
    int from, to;
    T cost;
    edge(){}
    edge(int _from, int _to, T _cost) : from(_from), to(_to), cost(_cost) {}
    bool operator< (const edge& e) const {
        return cost == e.cost ? (from == e.from ? to < e.to : from < e.from) : cost < e.cost;
    }
    bool operator> (const edge& e) const {
        return cost == e.cost ? (from == e.from ? to > e.to : from > e.from) : cost > e.cost;
    }
    void print() {
        cout << from << " " << to << " " << cost << endl;
    }
};

template <typename T>
class Prim {
private:
    int n;
    vector<vector<edge<T>>> G;
public:
    Prim(int _n) : n(_n) {
        G.resize(n);
    }
    // undirected
    void addEdge(int u, int v, T c) {
        G[u].emplace_back(u, v, c);
        G[v].emplace_back(v, u, c);
    }
    T calc(int s, int min_cost) {
        // cout << s << " " << min_cost << endl;

        T ma_gap = -1;
        vector<bool> visited(n);
        int num_visited = 0;
        priority_queue<edge<T>, vector<edge<T>>, greater<edge<T>>> pq;
        pq.push(edge<T>(-1, s, min_cost));
        while (!pq.empty() /* && num_visited < n */) {
            auto e = pq.top(); pq.pop();
            if (visited[e.to]) continue;
            // e.print();

            ma_gap = max(ma_gap, e.cost - min_cost);
            visited[e.to] = true;
            num_visited++;
            for (const auto& ne: G[e.to]) {
                if (!visited[ne.to] && ne.cost >= min_cost) pq.push(ne);
            }
        }
        // cout << num_visited << endl;
        return (num_visited < n ? 1e9 : ma_gap);
    }
};
/* !!!!! T: ?????????????????????(int, double) !!!!! */

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

    int n, m;
    int t = 0;
    while (cin >> n >> m, n) {
        // t++;
        // if (t > 2) return 0;

        Prim<int> prim(n);
        rep(i, m) {
            int a, b, c;
            cin >> a >> b >> c;
            a--, b--;
            prim.addEdge(a, b, c);
        }

        int ans = 1e9;
        const int MAX_W = 10000;
        rep2(min_cost, 1, MAX_W + 1) {
            ans = min(ans, prim.calc(0, min_cost));
        }

        cout << (ans == 1e9 ? -1 : ans) << endl;
    }
}

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main()
{
	vector<int> a;
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int t;
		cin >> t;
		a.push_back(t);
	}
	reverse(a.begin(), a.end());
	cout << a[0];
	for (int i = 1; i < n; ++i) {
		cout << " " << a[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int X;
    cin >> X;
    
    int a = X / 100;
    int b = X % 100;

    if (b == 0) {
        cout << 1 << endl;
        return 0;
    } else if (X == 0) {
        cout << 0 << endl;
        return 0;
    }

    while (a > 0) {
        if (b >= 5) {
            b -= 5;
        }
        else if (b >= 4) {
            b -= 4;
        }
        else if (b >= 3) {
            b -= 3;
        }
        else if (b >= 2) {
            b -= 2;
        }
        else if (b >= 1) {
            b -= 1;
        }
        if (b == 0) {
            cout << 1 << endl;
            return 0;
        }
        a--;
    }

    cout << 0 << endl;
    

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

Measured memory_bytes: 256
tile = input()
total_0 = 0
total_1 = 0

for i in range(len(tile)):
    if i % 2 == 0:
        if int(tile[i]) == 0:
            total_1 += 1
        else:
            total_0 += 1
    else:
        if int(tile[i]) == 0:
            total_0 += 1
        else:
            total_1 += 1
print(total_0 if total_0 <= total_1 else total_1)

Measured memory_bytes: 41324
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int a,b;
  cin>>a>>b;
  string s;
  cin>>s;
  int n=s.size();
  bool ng=false;
  rep(i,a){
    if(s[i]=='-')ng=true;
  }
  for(int i=a+1;i<n;++i)if(s[i]=='-')ng=true;
  if(s[a]!='-')ng=true;
  if(ng)cout<<"No";
  else cout<<"Yes";
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	//cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i;
int main(){
    cin>>a>>b>>e;   
    c=3*e-a-b; 
    h=2*e-b;
    f=2*a-h;
    i=3*e-c-f;
    d=2*e-f;
    g=3*e-h-i;
    printf("%d %d %d\n%d %d %d\n%d %d %d\n",a,b,c,d,e,f,g,h,i);   
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

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

vector<vi> a;
int ans = 0;

void dfs(int x, int y, int cnt){
    ans = max(ans, cnt);
    rep(i,4){
        int nx = x + dx[i];
        int ny = y + dy[i];
        if(nx < 0 || nx >= n || ny < 0 || ny >= m)continue;
        if(a[nx][ny]){
            a[nx][ny]--;
            dfs(nx, ny, cnt+1);
            a[nx][ny]++;
        }
    }
}

signed main(void) {
    while(cin >> m >> n, n){
        a = vector<vi> (n,vi(m));
        rep(i,n)rep(j,m)cin >> a[i][j];
        ans = 0;
        rep(i,n)rep(j,m)if(a[i][j]){
            a[i][j]--;
            dfs(i,j,1);
            a[i][j]++;
        }
        cout << ans << endl;
    }

}



Measured memory_bytes: 3224
#include<stdio.h>

int func(int uma[],int c[])
{
	int num1=0,num2=0;
	int i;
	
	for(i=0;i<8;i++)
	{
		num1+=uma[i];
		num1*=10;
		num2+=c[i];
		num2*=10;
	}
	if(num1>num2)return 0;
	else if(num1<num2)return 1;
}

void logdata(int uma[],int num,int min)
{
	int i;
	printf("min:%d %d: ",min,num);
	for(i=0;i<8;i++)printf("%d ",uma[i]);
	printf("\n");
}

int main()
{
	int p[8]={0},c[8]={0};
	int uma[8]={4,1,4,1,2,1,2,1};
	int i,j,num=0,min=0,k,flag=0;
	
	while(scanf("%d %d %d %d %d %d %d %d",&p[0],&p[1],&p[2],&p[3],&p[4],&p[5],&p[6],&p[7])!=EOF)
	{
		for(i=0;i<8;i++)
		{
			flag=0;
			num=0;
			for(j=0;j<8;j++)if(p[j]>uma[j])num+=(p[j]-uma[j]);
			
			if(i==0)
			{
				min=num;
				for(j=0;j<8;j++)c[j]=uma[j];
			}
			
			if(min>num)
			{
				min=num;
				for(j=0;j<8;j++)c[j]=uma[j];
			}
			else if(min==num)
			{
				flag=func(uma,c);
				if(flag==1)for(j=0;j<8;j++)c[j]=uma[j];
			}
			
			//logdata(uma,num,min);
			
			for(j=0;j<8;j++)
			{
				if(j==0)
				{
					k=uma[0];
					uma[0]=uma[1];
				}
				else if(j<7 && j>0)uma[j]=uma[j+1];
				else if(j==7)uma[j]=k;
			}
		}
		
		for(i=0;i<8;i++)
		{
			if(i!=7)printf("%d ",c[i]);
			else printf("%d",c[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 604
N, K = map(int, input().split())
ls1 = list(map(int, input().split()))
d = dict()
ls2 = ['r', 's', 'p']
for x, y in zip(ls1, ls2):
    d[y] = x
T = input()

S = T.translate(str.maketrans({'r': 'p', 's': 'r', 'p': 's'}))
ans = 0
for i in range(K):
    cur = ''
    for j in range(i, N, K):
        if cur != S[j]:
            ans += d[S[j]]
            cur = S[j]
        else:
            cur = ''
print(ans)

Measured memory_bytes: 9284
/**
 *  author: nayakashutosh9
 *	[2020-09-19 17:25]
**/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define modd 998244353
#define inf 1e18
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> pbds;
const int N = 300005;
/*******************************************************/


void solve() {
	int n; cin >> n;
	vector<pii> a(n);
	for (int i = 0; i < n; i++) cin >> a[i].ff >> a[i].ss;
	bool t = 0; int c = 0;
	for (int i = 0; i < n; i++) {
		if (a[i].ff == a[i].ss) {
			if (t == 0) t = 1, c = 1;
			else c++;
			if (c >= 3) {
				cout << "Yes\n";
				return;
			}
		}
		else {
			c = 0; t = 0;
		}
	}
	cout << "No\n";
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int T = 1;
	// cin >> T; cin.ignore();
	for (int i = 1; i <= T; i++) {
		// cout << "Case #" << i << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,a[3],b,c,ans=0,cnt=0,tmp;
string s,t;
int main(){
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	ans+=a[1]-a[0];
	ans+=a[2]-a[1];
	cout << ans << endl;
	return 0;
}

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

int main() {
  long n,ans=0;
  cin >> n;
  vector<long> u(n-1);
  vector<long> v(n-1);
  for(long i=0;i<n-1;i++) cin >> u[i] >> v[i];
  for(long i=1;i<n;i++) ans+=i*(n-i+1);
  for(long i=0;i<n-1;i++) ans-=(n-max(u[i],v[i])+1)*min(u[i],v[i]);
  ans+=n;
  cout << ans << endl;
}

Measured memory_bytes: 6360
#include<bits/stdc++.h>
#define M 100005
using namespace std;
int n,A[M],ans[M];
long long s=0;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++) {
		scanf("%d",&A[i]);
		s+=A[i];
	}
	A[n+1]=A[1];
	for(int i=2; i<=n; i+=2)s-=2*A[i];
	ans[1]=s;
	for(int i=2; i<=n; i++)
		ans[i]=A[i-1]*2-ans[i-1];
	for(int i=1; i<=n; i++)printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h> 
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e2+2;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int x;
	cin>>x;
	cout<<(x+1)/2;	
}
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

int c(int n) {
    return n * (n-1) / 2;
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    printf("%d\n", c(n) + c(m));
}


Measured memory_bytes: 128
N=int(input())
H=list(map(int,input().split()))
c=0
max_c=0
for i in range(N-1):
    if i!=N-2:
        if H[i]>=H[i+1]:
            c+=1
        else:
            if max_c<c:
                max_c=c
            c=0
    else:
        if H[i]>=H[i+1]:
            c+=1
            if max_c<c:
                max_c=c
        else:
            if max_c<c:
                max_c=c
print(max_c)

Measured memory_bytes: 14252
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    k,s=INTM()
    ct=0
    for x in range(k+1):
        for y in range(k+1):
            z=s-x-y
            if 0<=z and z<=k:
                ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include <stdio.h>
#define N 200000

int main(){

  int A[N],n;
  int min=0,max=0,j,i;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  min=A[0];
  max=A[1]-A[0];
  for(j=1;j<=n-1;j++){
    if(max<A[j]-min)max=A[j]-min;
    if(min>A[j])min=A[j];
  }

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



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

int main()
{
	int H, W;
	cin>>H >> W;
	char a[100][100];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
		}
		
	}
	for (int i = 0; i < W + 2; i++)cout << '#';
	cout << endl;
	if (W == 1) { 
		for (int i = 0; i < H; i++) cout << '#' << a[i][0] << '#' << endl;
	}
	else {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (j == 0)cout << '#' << a[i][j];
				else if (j == W - 1)cout << a[i][j] << '#';
				else cout << a[i][j];
			}
			cout << endl;
		}
	}
	for (int i = 0; i < W + 2; i++)cout << '#';

	return 0;
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	cout<<min({a+b,a+c,b+c})<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=100;
bool vst[maxn][maxn]; // 访问标记
int dir[4][2]={0,1,0,-1,1,0,-1,0}; // 方向向量
int h,w;
int anm=0;

struct State // BFS 队列中的状态数据结构
{
	int x,y; // 坐标位置
	int Step_Counter; // 搜索步数统计器
};

State a[maxn];
char  b[maxn][maxn];

bool CheckState(State s) // 约束条件检验
{
	if(!vst[s.x][s.y] && b[s.x][s.y]=='.') // 满足条件
		return 1;
	else // 约束条件冲突
		return 0;
}

void bfs(State st)
{
	queue <State> q; // BFS 队列
	State now,next; // 定义2 个状态，当前和下一个
	st.Step_Counter=0; // 计数器清零
	q.push(st); // 入队
	vst[st.x][st.y]=1; // 访问标记
	while(!q.empty())
	{
		now=q.front(); // 取队首元素进行扩展
		if(now.x==h&&now.y==w) // 出现目标态，此时为Step_Counter 的最小值，可以退出即可
		{
			printf("%d\n",h*w-now.Step_Counter-anm-1); // 做相关处理
			return;
		}
		for(int i=0;i<4;i++)
		{
			next.x=now.x+dir[i][0]; // 按照规则生成下一个状态
			next.y=now.y+dir[i][1];
			next.Step_Counter=now.Step_Counter+1; // 计数器加1
			if(CheckState(next)) // 如果状态满足约束条件则入队
			{
				q.push(next);
				vst[next.x][next.y]=1; //访问标记
			}
		}
		q.pop(); // 队首元素出队
	}
	printf("-1\n");
	return;
}

int main()
{
	scanf("%d %d",&h,&w);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			scanf(" %c",&b[i][j]);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(b[i][j]=='#') anm++;
		}
	}
	State ans;
	ans.x=1;
	ans.y=1;
	bfs(ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
int i;
int j = 1;
 for(i = 1; i <= 90; i++){
  int k = i % 10; 
  if(k == 0) {
    j++;
    continue;
  }   
  printf("%dx%d=%d\n", j, k, j*k);
 }
  return 0; 
}   

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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



int main() {

	ll N;
	cin >> N;
	string s;
	cin >> s;

	vector<ll> a(N + 1, 0);
	repn(i, N) a[i] = s[i - 1] - '0';

	vector<ll> dp1(N + 1), dp2(N + 1), dp3(N + 1);

	dp1[0] = 0;
	dp2[0] = dp3[0] = INF;

	repn(i, N) {
		if(a[i]==0){
			dp1[i] = dp1[i - 1];
			dp2[i] = INF;

			if (i >= 2 && a[i - 1] == 1) { dp3[i] = dp1[i - 2]; }
			else { dp3[i] = INF; }
		}

		else {
			dp1[i] = min(dp1[i - 1] + 1, dp3[i - 1] + 1);
			if (i >= 2 && a[i - 1] == 0) {dp1[i] = min(dp1[i], dp2[i - 2] + 1);}
			dp2[i] = min(dp1[i - 1], dp2[i - 1]);
			dp3[i] = dp3[i - 1];
			
		}
	}

	ll c = 0;
	repn(i, N)c += a[i];

	cout << c-dp1[N];
	

	system("PAUSE");
}


Measured memory_bytes: 16764
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll S;
	scan(S);
	printf("0 0 ");
	ll H,W,a,b;
	bool heihou=((ll)(sqrt(S)+eps)*(ll)(sqrt(S)+eps)==S);
	if(heihou){
		H=(ll)(sqrt(S)+eps),W=(ll)(sqrt(S)+eps),a=0,b=0;
	}
	else{
		H=(ll)(sqrt(S)+eps)+1,W=H;
		ll sa=H*W-S;
		a=1,b=sa;
	}
	printf("%lld %lld %lld %lld\n",W,b,a,H);
	return 0;
}


Measured memory_bytes: 256
N, K = [int(x) for x in input().split(" ")]
a = [0] * N
for i in range(K):
    _ = input()
    ls = [int(x)-1 for x in input().split(" ")]
    #print(ls)
    for j in ls:
        a[j] = 1
cnt = 0
for i in a:
    if i == 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 67664
#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int A, B;
	string op;

	cin >> A >> op >> B;
	
	if (op == "+") {
		cout << A + B << endl;
	}

	else {
		cout << A - B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c = 0;
    
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    
    if(a < b && b < c){
        printf("Yes\n");
    }else {
        printf("No\n");
    }return 0;}


Measured memory_bytes: 2084
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] ary = br.readLine().split(" ");
        int num = 0;
        int min = 1000000;
        int max = -1000000;
        long sum = 0;
        for(int i=0;i<N;i++){
            num = Integer.parseInt(ary[i]);
            if(num<min) min = num;
            if(num>max) max = num;
            sum += num;
        }
        System.out.println(min+" "+max+" "+sum);
	}
}

Measured memory_bytes: 28596
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))//数组(结构体)清零 
#define ll long long
//int A(int a,int b){if(a<b||a<1||b<0)return 0;int k=1;while(b--){k*=a--;}return k;}//数学中的Aab,传递ab,返回Cab//类型为int//如果不符合条件则返回0 
//int C(int a,int b){if(a<b||a<1||b<0)return 0;b=min(a-b,b);int k=A(a,b),t=1;while(--b)k/=++t;return k;}//数学中的Cab,传递ab,返回Cab//类型为int//如果不符合条件则返回0 
//int HW(char*HWa,int HWl,int HWr){if(HWr<HWl)swap(HWl,HWr);for(int i=0;i<(HWr-HWl)/2+1;i++)if(HWa[HWl+i]!=HWa[HWr-i])return 0;return 1;}//传递字符串名,判断区间l r,如果是回文字符串就返回1,否则返回0 
//int SS(int a){if(a>4&&((a-1)%6)&&((a+1)%6))return 0;for(int i=2;i<=sqrt(a);i++)if(a%i==0)return 0;return 1;}//判断一个数是不是质数，是1 否0；请确保a>1; 
/*记得如果改int为long long,就把printf与scanf中相应的%d也改成%lld*/

int main()
{
	ll a,b;
	cin>>a>>b;
	ll n=a/b;
	cout<<min(abs(a-n*b),abs(a-(n+1)*b));
	return 0;
}

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

int main(){
    int n, m, max;
    int a[1000];

    while(cin >> n >> m){
        max = 0;
        if(n == 0 && m == 0) break;
        for(int i=0;i<n;i++){
            cin >> a[i];
        }
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(a[i]+a[j] <= m){
                    if(a[i]+a[j] >= max){
                        max = a[i] + a[j];
                    }
                }
            }
        }
        if(max == 0){
            cout << "NONE\n";
        }else{
            cout << max << "\n";
        }
    }
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 998244353;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

//n -> big, a -> small
mint choose(int n,int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    int max_depth = 0;
    map<int,int> mii;
    rep(i,n){
        int d;
        cin >> d;
        mii[d]++;
        max_depth = max(max_depth, d);
        if(i == 0 && d !=0){
            cout << 0 << endl;
            return 0;
        }
    }
    if(max_depth >= n){
        cout << 0 << endl;
        return 0;
    }
    if(mii[0] > 1){
        cout << 0 << endl;
        return 0;
    }
    rep(i,max_depth+1){
        if(mii[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    mint ans = 1;
    rep(i,max_depth){
        //cout << i << " start" << endl;
        rep(j,mii[i+1]){
            ans *= mii[i];
        }
    }
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 8180
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
  int a[100],v,f;
  char d[100];
cin >> f;
FOR(i,4){
  a[3-i]=f%10;
  f/=10;
}
  
  FOR(i,8){
    v=a[0];
    FOR(j,3){
      if(i & (1<<j)){
        v+=a[j+1];
        d[j]='+';
      }else{
        v-=a[j+1];
        d[j]='-';
      }
    }
    if(v==7){
      printf("%d%c%d%c%d%c%d=7",a[0],d[0],a[1],d[1],a[2],d[2],a[3]);
      return 0;
    }
  }
}

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

typedef long long ll;
vector<ll> adj[100002];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    ll n, m;
    cin >> n >> m;
    ll elevation[n];
    for(int i=0; i<n; i++) cin >> elevation[i];

    ll u, v;

    for(int i=0; i<m; i++){
        cin >> u >> v;
        adj[u-1].push_back(v-1);
        adj[v-1].push_back(u-1);
    }

    ll count=0;
    bool flag;
    for(int i=0; i<n; i++){
        flag=true;
        if(adj[i].size()>0){
            for(int j=0; j<adj[i].size(); j++){
                if(elevation[adj[i][j]]>=elevation[i]){
                    flag=false;
                    break;
                }
            }
        }
        if(flag) count++;
    }

    cout << count << '\n';

    return 0;
}


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

int n, b, a[3][3], cr[3][3];

int main(){
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            cin >> a[i][j];
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> b;
        for(int j = 0; j < 3; j++)
            for(int k = 0; k < 3; k++)
                if(b == a[j][k])
                    cr[j][k] = 1;
    }
    for(int i = 0; i < 3; i++){
        if((cr[i][0]&&cr[i][1]&&cr[i][2])
        ||(cr[0][i]&&cr[1][i]&&cr[2][i])
        ||(cr[0][0]&&cr[1][1]&&cr[2][2])
        ||(cr[0][2]&&cr[1][1]&&cr[2][0])){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
import math
A, B = map(int, input().split())

is_true = False
for x in range(1, 10000):
    if A == math.floor(x * 0.08) and B == math.floor(x * 0.1):
        is_true = True
        break

if is_true:
    print(x)
else:
    print('-1')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 99999999
typedef pair<int, int> P;

//迷路と方向を定義
#define msize 100
vector<string> maze(100);
vector<vector<ll>> dist(100, vector<ll>(100, INF));
ll dx[2] = {0, 1};
ll dy[2] = {1, 0};

//目的地から終了地点までの幅優先探査
bool bfs(P start, P goal, ll H, ll W, char wall, ll times, queue<P> &walls,vector<vector<bool>>count)
{
    queue<P> que;
    que.push(start);
    //距離
    dist[start.first][start.second] = times;

    P here;
    while (!que.empty())
    {
        here = que.front();
        ll y = here.first;
        ll x = here.second;
        que.pop();

        
        //goal地点にいるなら終了
        if (here == goal)
        {
            return true;
        }
  

        for (ll i = 0; i < 2; ++i)
        {
            ll ny = y + dy[i];
            ll nx = x + dx[i];

            //例外条件
            if (0 > ny || ny >= H || 0 > nx || nx >= W)
            {
                //処理記入
            }

            //内部ならば距離に1を足して処理
            if (0 <= ny && ny < H && 0 <= nx && nx < W && maze[ny][nx] != wall &&
                dist[ny][nx] == INF)
            {
              //リスク
              if(dist[ny][nx]>times){
                dist[ny][nx] = times;
                que.push(make_pair(ny, nx));
              }
            }

            if (0 <= ny && ny < H && 0 <= nx && nx < W && maze[ny][nx] == wall &&
                dist[ny][nx] == INF && !count[ny][nx])
            {
              count[ny][nx]=true;
                walls.push(make_pair(ny, nx));
            }
        }
    }

    return false;
}

int main(void)
{
    ll H, W;
    cin >> H >> W;
    for (int i = 0; i < H; i++)
    {
        cin >> maze[i];
    }

    char wall[2] = {'#', '.'};

    P start = make_pair(0, 0);
    P end = make_pair(H - 1, W - 1);

    ll times = 0;
  
  if(maze[0][0]=='#'){
    times++;
  }

    queue<P> walls;
    queue<P> nwalls;
  bool check=false;

    walls.push(start);

    while (!check)
    {
      vector<vector<bool>> count(H,vector<bool>(W,false));
        while (!walls.empty())
        {
        start = walls.front();
        walls.pop();
    if(dist[start.first][start.second]>times){
        if(bfs(start,end,H,W,wall[times%2],times,nwalls,count)){
          check=true;
                break;
        }
    }
        }
        walls = nwalls;
        times++;
    }
  /*
for(int i=0;i<H;i++){
  for(int j=0;j<W;j++){cout<<dist[i][j]<<" ";}
  cout<<""<<endl;
}
*/
ll res = (dist[H - 1][W - 1]+1)/2;
  
cout << res << endl;
return 0;
}

Measured memory_bytes: 732
// C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int X;
  cin>>X;
  int kosuu = X / 100;
  int amari = X%100;
  if (kosuu*5 >= amari) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


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

using namespace std;

int main() {
  int num; double time;
  
  vector<pair<double, int> > last;
  
  { 
    vector<pair<double, int> > score(8);
    
    for(int i=0; i<8; i++) {
      cin >> num >> time;
      score[i] = make_pair(time, num);
    }
    sort(score.begin(), score.end());
    
    for(int i=0; i<2; i++) {
      printf("%d %.2f\n", score[i].second, score[i].first);
    }
    
    for(int i=2; i<8; i++) {
      last.push_back(score[i]);
    }
  }
  
  { 
    vector<pair<double, int> > score(8);
    
    for(int i=0; i<8; i++) {
      cin >> num >> time;
      score[i] = make_pair(time, num);
    }
    sort(score.begin(), score.end());
    
    for(int i=0; i<2; i++) {
      printf("%d %.2f\n", score[i].second, score[i].first);
    }
    
    for(int i=2; i<8; i++) {
      last.push_back(score[i]);
    }
  }
  
  { 
    vector<pair<double, int> > score(8);
    
    for(int i=0; i<8; i++) {
      cin >> num >> time;
      score[i] = make_pair(time, num);
    }
    sort(score.begin(), score.end());
    
    for(int i=0; i<2; i++) {
      printf("%d %.2f\n", score[i].second, score[i].first);
    }
    
    for(int i=2; i<8; i++) {
      last.push_back(score[i]);
    }
  }
  
  sort(last.begin(), last.end());
  
  for(int i=0; i<2; i++) {
    printf("%d %.2f\n", last[i].second, last[i].first);
  }
  
  return 0;
}

Measured memory_bytes: 1252
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int cnt=0;
    int i;
    for(i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        if(tmp!=i+1) cnt++;
    }
    if(cnt<=2) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N,A,B;
    cin >> N >> A >> B;
    if (N == 1){
        if (A == B) cout << 1 << endl;
        else cout << 0 << endl;
    }
    else if (N == 2){
        if (A <= B) cout << 1 << endl;
        else cout << 0 << endl;
    }
    else{
        if (A > B){
            cout << 0 << endl;
        }
        else{
            ll minsum = B + (N - 1) * A;
            ll maxsum = A + (N - 1) * B;
            cout << maxsum - minsum + 1 << endl;
        }
    }
}

Measured memory_bytes: 3640
<?php
// Your code here!

    $num = trim(fgets(STDIN));
    $arr = explode(" ",trim(fgets(STDIN)));
    $arr_rev = array();
    $j = $num;

    for($i = $num-1; $i >= 0; $i--) {
        $arr_rev[] = $arr[$i];
    }
    
    $ans = implode(" ",$arr_rev);
    echo $ans;
    
?>



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

int main(){
  int i,j,k;
  int n;
  while(1){
  cin>>n;
    if(n==0) {
      return 0;
    }
  int w[n+1];
  int dp[n+1][n+1];
  for(i=1;i<=n;i++) cin>>w[i];
  for(k=0;k<=n-1;k++){
    for(i=1;i<=n-k;i++){
      if(k==0) dp[i][i+k]=0;
      else if(k==1) {
        if(abs(w[i]-w[i+1])<=1) dp[i][i+1]=2;
        else dp[i][i+1]=0;
      }
      else {
        if(abs(w[i]-w[i+k])<=1&&dp[i+1][i+k-1]==k-1) dp[i][i+k]=k+1;
        else dp[i][i+k]=0;
          for(j=i;j<=i+k-1;j++) dp[i][i+k]=max(dp[i][i+k],dp[i][j]+dp[j+1][i+k]);
      }
    }
  }
  // for (int i = 1; i < n; i++) {
  //   for (int j = i; j < n; j++) {
  //     // cout << "dp[" << i << "][" << j << "]" << "\t\t" <<  dp[i][j] << endl;
  //   }
  // }
  cout<<dp[1][n]<<endl;
  }
}



Measured memory_bytes: 3440
#include<stdio.h>
int main(){
  int i,j,cnt=0;
  char s[4];
  scanf("%s",s);
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(i==j)
        continue;
      if(s[i]==s[j])
        cnt++;
    }
  }
  if(cnt==4){
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;


int main(){

  int a,b;
  
  cin >> a >> b;
  
  if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0)
    cout << "Possible" << endl;
  
  else cout << "Impossible" << endl;


 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,0,n-1) {
    cin>>a[i];
  }
  int ans = 0;
  sort(all(a));
  REP(i,0,n-1) {
    REP(j,i+1,n-1) {
      REP(k,j+1,n-1) {
        if(a[i]!=a[j] && a[j]!=a[k] && a[i]+a[j]>a[k]) {
          ans++;
        }
      }
    }
  }
  cout<<ans;
}

int main() {
    //freopen("./sort/b2.in","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 3648
class Dice(object):
    """Dice Class

    """

    def __init__(self, numbers):
        """

        Args:
            numbers:
        """
        self.numbers = {1: numbers[0], 2: numbers[1], 3: numbers[2], 4: numbers[3], 5: numbers[4], 6: numbers[5]}

        self.vertical = [self.numbers[1], self.numbers[2], self.numbers[6], self.numbers[5]]
        self.horizontal = [self.numbers[4], self.numbers[1], self.numbers[3], self.numbers[6]]

    def move_dice(self, s):
        """

        Args:
            s: move direction

        Returns:

        """
        if s == 'N':
            self.move_north()
        elif s == 'S':
            self.move_south()
        elif s == 'W':
            self.move_west()
        elif s == 'E':
            self.move_east()

    def move_south(self):
        """move this dice towered north
        """
        self.vertical = (self.vertical * 2)[3:7]
        self.horizontal[1] = self.vertical[0]
        self.horizontal[3] = self.vertical[2]

    def move_north(self):
        """move this dice towered south
        """
        self.vertical = (self.vertical * 2)[1:5]
        self.horizontal[1] = self.vertical[0]
        self.horizontal[3] = self.vertical[2]

    def move_east(self):
        """move this dice towered east
        """
        self.horizontal = (self.horizontal * 2)[3:7]
        self.vertical[0] = self.horizontal[1]
        self.vertical[2] = self.horizontal[3]

    def move_west(self):
        """move this dice towered west
        """
        self.horizontal = (self.horizontal * 2)[1:5]
        self.vertical[0] = self.horizontal[1]
        self.vertical[2] = self.horizontal[3]

    def get_top(self):
        return self.vertical[0]


numbers = [int(x) for x in raw_input().split()]
dice1 = Dice(numbers=numbers)
for s in raw_input():
    dice1.move_dice(s)

print(dice1.get_top())

Measured memory_bytes: 6464
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";

ostream& operator<<(ostream& cerr, vector<ll> aux) {
  cerr << "[";
  for (auto e : aux) cerr << e << ' ';
  cerr << "]";
  return cerr;
}

const int maxN = 1000011;

int n, curr, z;
char s[maxN];
int aux[maxN];
stack<int> where;

int check(int lower) {
  int higher = 0;
  curr = 0;

  while (!where.empty()) where.pop();

  for (int i = 0; i < n; i++) {
    aux[i] = (s[i] == '1' ? +1 : -1);
    curr += aux[i];
    if (s[i] == '?') where.push(i);

    if (curr < lower) {
      aux[where.top()] = 1;
      where.pop();
      curr += 2;
    }
  } 

  while (!where.empty()) where.pop();
  for (int i = 0; i < n; i++) {
    if (i > 0) aux[i] += aux[i - 1];
    higher = max(higher, aux[i]);
  }
 
  return higher - lower;
}

int main()
{
  //freopen("test.in", "r", stdin);

  scanf("%s", s);
  n = strlen(s);

  for (int i = 0; i < n; i++) {
    curr += (s[i] == '0' ? -1 : +1);
    z = min(z, curr);
  }

  printf("%d", min(check(z), check(z - 1)));



  return 0;
}


Measured memory_bytes: 10552
#include<iostream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define int long long int
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int j,arr[n];
	for(j=0;j<n;j++)
	{
		cin>>arr[j];
	}
	int count[1000001]={0};
	for(j=0;j<n;j++)
	{
		count[arr[j]]++;
	}
	int answer=0;
	for(j=0;j<n;j++)
	{
		int x=arr[j];
		int i;
		int here=0;
		for(i=1;i*i<=x;i++)
		{
			if(x%i==0)
			{
				int p=i;
				int q=x/i;
				if(p==q)
				   here+=count[p];
				else
				{
					here+=count[p];
					here+=count[q];
				}
			}
		}
		if(here==1)
		  answer++;
	}
	cout<<answer<<endl;
}



Measured memory_bytes: 13016
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

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

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

struct UnionFind
{
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<int> childN;
	ll r = 0;

	UnionFind(int N) : par(N), childN(N)
	{ 
		//最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) 
			par[i] = i, childN[i] = 1;
	}

	int root(int x) 
	{ 
		// データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) 
	{
		// xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		r -= childN[rx] * (childN[rx] - 1) / 2;
		r -= childN[ry] * (childN[ry] - 1) / 2;
		childN[ry] += childN[rx];
		childN[rx] = 0;
		r += childN[ry] * (childN[ry] - 1) / 2;
	}

	bool same(int x, int y)
	{
		// 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

using xpair = pair<int, int>;
bool operator>(const xpair &a, const xpair &b) { return a.second > b.second || (a.second == b.second && a.first > b.first); };
bool operator<(const xpair &a, const xpair &b) { return a.second < b.second || (a.second == b.second && a.first > b.first); };
bool operator==(const xpair &a, const xpair &b) { return a.first== b.first; };

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a.begin(), a.end());
	int r = 0;
	for (int i = 0; i < k; i++)
		r += a[i];
	printf("%d", r);

	return 0;
}


Measured memory_bytes: 3252
#include <cstdio>

using namespace std;

int main(){
    int h, w;
    
    while(scanf("%d %d", &h, &w), h > 0 && w > 0){
        for(int i = 0; i < h; ++i){
            for(int j = 0; j < w; ++j){
                putchar('#');
            }
            
            putchar('\n');
        }
        
        putchar('\n');
    }
    
    return 0;
}


Measured memory_bytes: 2700