akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.schoolroad2", "r", stdin );
	string str = "";

	while (getline (cin, str ) ){
		int a, b;
		stringstream ssn (str);
		ssn >> a >> b;
		
		if (a == 0 && b == 0 ){
			break;
		} // end if
		vector <vector <int> > dp (b + 1, vector <int> (a + 1, -1 ) );
		int i,j;

		for (i = 0; i <= b; ++i){
			dp[i][0] = 0;
		} // end for
		for (j = 0; j <= a; ++j){
			dp[0][j] = 0;
		} // end for

		dp[1][1] = 1;

		getline (cin, str );
		int m;
		stringstream ssm (str );
		ssm >> m;

		for (i = 0; i < m; ++i){
			getline (cin, str );
			int x, y;
			stringstream ss (str );
			ss >> x >> y;
			dp[y][x] = 0;
		} // end for

		for (i = 1; i <= b; ++i){
			for (j = 1; j <= a; ++j){
				if (dp[i][j] != 0 ){
					if (i == 1 && j == 1){
						continue;
					}else{
						dp[i][j] = dp[i][j-1] + dp[i-1][j];
					} // end if
				} // end if
			} // end for
		} // end for

		cout << dp[b][a] << endl;
	} // end loop
		
	return 0;
}

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

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
    ll A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
public:
  ll *fac,*finv,*inv;
//public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  ll a,b,n;
  cin >> a >> b >> n;
  ll ans = 0;
  if(b-1 <= n){
    ans = a*(b-1);
    ans /= b;
  }
  else{
    ans = a*n;
    ans /= b;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3556
/*
 * Author : Sadi
 * Tue 14/07/2020
 * 13:48:44.78
 */
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    if(n & 1) {
        double val = (n >> 1) + 1;
        cout << fixed << setprecision(8) << val / n << endl;
    }    
    else {
        double res = n / 2;
        cout << fixed << setprecision(10) << res / n << endl;
    }
    return 0;
}
    

Measured memory_bytes: 3752
N = int(input())
A = list(map(int, input().split()))

now = 1
doubt = 0
ans = 0
for i in range(N):
  if A[i] == now:
    now += 1
    doubt = 1
  else:
    ans += 1
    
if doubt == 0:
  print("-1")
else:
  print(ans)

Measured memory_bytes: 26268
def resolve():
    n=int(input())
    w=[input() for _ in range(n)]
    chk=[]
    chk.append(w[0])
    ans='Yes'
    for i in range(1,n):
        if w[i-1][-1]!=w[i][0] or (w[i] in chk):
            ans='No'
            break
        chk.append(w[i])
    print(ans)

if __name__ == '__main__':
    resolve()

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

bool check(string s){
	for(int i=0;i<s.length();i++){
    	if(s[i]=='7'){
        	return true;
        }
    }
  
  	return false;
}

int main(){
	string s;
  	cin>>s;
  	if(check(s)){
    	cout<<"Yes";
    }
  else{
  	cout<<"No";
  }
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int64_t const INF = 1e18;

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int64_t> A(N), S(N+1, 0);
  for(int i = 0; i < N; ++i) std::cin >> A[i];
  for(int i = 0; i < N; ++i) S[i+1] = S[i] + A[i];
  auto split = [&](auto b, auto e)-> std::pair<int64_t,int64_t> {
    int64_t V = (*e + *b)/2;
    auto m = std::upper_bound(b, e, V);
    int64_t mi = INF;
    std::pair<int64_t, int64_t> res;
    for(auto i: {m-1, m, m+1}) if(b < i && i < e) {
      int64_t cur = std::abs((*i-*b) - (*e-*i));
      if(cur < mi) { mi = cur; res = std::make_pair(*i-*b, *e-*i); }
    }
    return res;
  };
  auto isOK = [&](int64_t k)->bool {
    int64_t vmi = (S[N]+1)/2 - k, vma = S[N]/2 + k;
    auto lb = std::lower_bound(S.begin()+2, S.end()-3, vmi);
    auto ub = std::upper_bound(S.begin()+2, S.end()-2, vma);
    for(auto it = lb; it != ub; ++it) {
      auto L = split(S.begin(), it);
      auto R = split(it, S.end()-1);
      int64_t P[4] = {L.first, L.second, R.first, R.second};
      if(*std::max_element(P, P+4) - *std::min_element(P, P+4) <= k) return true;
    }
    return false;
  };
  
  int64_t ng = -1;
  // rough try
  auto split2 = [&](auto b, auto e) {
    int64_t V = (*e + *b)/2;
    auto m = std::upper_bound(b, e, V);
    int64_t mi = INF;
    auto res = e+1;
    for(auto i: {m-1, m, m+1}) if(b < i && i < e) {
      int64_t cur = std::abs((*i-*b) - (*e-*i));
      if(cur < mi) { mi = cur; res = i; }
    }
    return res;
  };
  auto M = split2(S.begin(), S.end()-1);
  while((M-S.begin()) < 2) ++M;
  while((M-S.begin()) > S.size()-3) --M;
  auto L = split(S.begin(), M);
  auto R = split(M, S.end()-1);
  int64_t P[4] = {L.first, L.second, R.first, R.second};
  int64_t ok = *std::max_element(P, P+4) - *std::min_element(P, P+4);
  while(ok - ng > 1) {
    int64_t mid = (ok+ng)/2;
    if(isOK(mid)) ok = mid; else ng = mid;
  }
  fin(ok);
  return 0;
}



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

int N;
vector<int> res;

bool isPrime(ll n) {
  if (n < 2) return false;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}

signed main() {

  cin >> N;

  for (int i = 4; i <= 55555; i += 5) {
    if (isPrime(i)) res.push_back(i);
  }

  for (int i = 0; i < N; ++i) {
    cout << res[i] << " \n"[i == N - 1];
  }

}


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

using namespace std;
typedef long long ll;

template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cout << x << " ";
    }
    cout << endl;
}

template<typename T>
void qprint(priority_queue<T> q) {
    while(!q.empty()) {
        cout << q.top() << " ";
        q.pop();
    }
    cout << endl;
}

int main(void) {
    ll n;
    cin >> n;
    cout << (n * (n-1) / 2) << endl;
}

Measured memory_bytes: 256
import sys
def q(a,h):
 d[a]=h
 for b in t[a]:q(b,h+1)
t,p,d={},{},{}
input()
for e in sys.stdin:
 e=e.split()
 t[e[0]]=e[2:]
 for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
print('\n'.join(f"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]"for i in map(str,sorted(map(int,t)))))


Measured memory_bytes: 60048
import math
import sys


input = sys.stdin.readline


def main():
    K = int(input())

    ans = 0
    for a in range(1, K + 1):
        for b in range(1, K + 1):
            ab = math.gcd(a, b)
            for c in range(1, K + 1):
                ans += math.gcd(ab, c)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9184
(let ((s (read-line)))
  (princ (if (and (char= (char s 0) #\A)
                  (= (count #\C s :start 2 :end (1- (length s)) :test #'char=) 1)
                  (string= (remove-if #'lower-case-p (remove #\C (subseq s 1) :test #'char= :count 1)) ""))
             "AC"
             "WA")))

Measured memory_bytes: 12000
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  rep(i, N + 1){
    if(i * 108 / 100 == N){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    vector<int> in;
    for(int n; cin >> n; in.push_back(n));
    
    sort(in.begin(), in.end(), greater<int>());

    for(int i = 0; i < 5; i ++) cout << ((i) ? " ":"") << in[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

class UnionFind {
public:
	vector<int> Parent;

	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	int root(int A) {
		if (Parent[A] < 0)return A;
		return Parent[A] = root(Parent[A]);
	}

	int size(int A) {
		return -Parent[root(A)];
	}

	bool unite(int A, int B) {
		A = root(A);
		B = root(B);
		if (A == B)
			return false;

		if (size(A) < size(B))
			swap(A, B);

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}

	bool same(int A, int B) {
		if (root(A) == root(B))
			return true;
		else
			return false;
	}
};

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

	int N,M;
	cin >> N >> M;
	vector<vector<int> > L(M);
	UnionFind uni(N);

	int q;
	REP(i, N) {
		int K;
		cin >> K;
		REP(j, K) {
			int a;
			cin >> a;
			a--;
			q = i;
			L[a].push_back(i);
		}
	}
	REP(i, M) {
		if (L[i].empty())
			continue;

		REP(j, L[i].size() - 1) {
			if (!uni.same(L[i][j], L[i][j + 1])) {
				//cout << L[i][j] << " " << L[i][j + 1] << endl;
				uni.unite(L[i][j], L[i][j + 1]);
			}
			//cout << i << endl;
		}
	}
	//cout << q << endl;
	if (uni.size(q) == N)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 4736
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        int T = scan.nextInt();
        int answer = T / A * B;
        System.out.println(answer);
    }
}


Measured memory_bytes: 22740
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
mt19937_64 mt(1);//seed
uniform_real_distribution<double> rnd(0.00,1.00);


int main(){
	ll N,K;
	cin >> N >> K;
	ll ok=0,ng=-1;
	vector<ll> A(N),F(N);
	FOR(i,0,N) cin >> A[i];
	FOR(i,0,N) cin >> F[i];
	SORT(A);SORT(F);REV(F);
	FOR(i,0,N) ok = max(ok,A[i]*F[i]);
	while(ok-ng>1LL){
		ll mid = (ok+ng)/2;
		ll cnt = 0;
		FOR(i,0,N){
			if(mid<A[i]*F[i]){
				cnt += A[i]-mid/F[i];
			}
		}
		if(cnt <= K){
			ok = mid;
		}else{
			ng = mid;
		}
	}
	cout << ok << endl;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
const int MAX = 500 + 5;
int a[MAX][MAX],n,m,q; 
int main()
{
	cin>>n>>m>>q;
	int maxx = -1,l,r;
	while(m--) {
		cin>>l>>r;
		maxx = max(maxx,r);
		a[l][r]++;
	}
	for(int i=1;i<=maxx;i++){
		for(int j=1;j<=maxx;j++){
			a[i][j]+=a[i][j-1];
		}
	}
		while(q--) {
		long long ans = 0;
		cin>>l>>r;
		for(int i = l; i<=r; i++) {
			ans += a[i][r];
		}
		cout<<ans<<endl;
	}
	
 
	return 0 ;


}

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

using namespace std;

int main() {
    char c;
    string vowel = "aiueo";

    cin >> c;

    for (int i = 0; i < vowel.size(); i++) {
        if (c == vowel[i]) {
            cout << "vowel" << endl;
            return 0;
        }
    }
    cout << "consonant" << endl;
    return 0;
}


Measured memory_bytes: 256
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   int a,b,c;
   cin >> a >> b >> c;
   int x=a+b+c;
   if(x>=22)cout << "bust";
   else cout << "win";
  
   return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
	int a,b,c,k,k1=0;scanf("%d%d%d%d",&a,&b,&c,&k);
	while(b<=a)b<<=1,k1++;
	while(c<=b)c<<=1,k1++;
	if(k1<=k)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3732
a,b,deg = gets.split.map(&:to_f)
puts "#{sprintf("%.4f",0.5*a*b*Math.sin(deg/180.0 * Math::PI))}"
puts "#{sprintf("%.4f",a+b+Math::sqrt(a**2+b**2-2*a*b*Math.cos(deg/180.0 * Math::PI)))}"
puts "#{sprintf("%.4f",(0.5*a*b*Math.sin(deg/180.0 * Math::PI))/(a/2))}"


Measured memory_bytes: 8968
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(auto &x : A) cin >> x;

    REP(i, n){
        if(i != n - 1) cout << A[i] << " ";
        else cout << A[i] << endl;
    }
    FOR(i, 1, n){
        if(A[i - 1] > A[i]){
            for(int j = i; j > 0; j--){
                int tmp = A[j];
                if(A[j - 1] > A[j]){
                    A[j] = A[j - 1];
                    A[j - 1] = tmp;
                }else break;
            }
        }
        REP(i, n){
            if(i != n - 1) cout << A[i] << " ";
            else cout << A[i] << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int N, K; cin >> N >> K;
    vector<int> H(N); for(int i = 0; i < N; i++) cin >> H[i];
    sort(H.rbegin(), H.rend());
    long long ans = 0;
    for(int i = 0; i < N; i++){
        if(K > 0){
            K--;
            continue;
        }
        ans += H[i];
    }
    cout << ans << endl;

}

Measured memory_bytes: 1024
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

N = input()
print(N.count('2'))


Measured memory_bytes: 3956
n, k = map(int, input().split())
A = tuple(map(int, input().split()))
d = dict()
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

cs = sorted(list(d.values()))

if len(cs) <= k:
    print(0)
else:
    c = 0
    print(sum(cs[:-k]))


Measured memory_bytes: 32448
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n, d; cin >> n >> d;
	vector<vector<int> > x(n, vector<int>(d));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < d; ++j) cin >> x[i][j];
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			int sum = 0;
			for (int k = 0; k < d; ++k) {
				sum += ((x[i][k] - x[j][k]) * (x[i][k] - x[j][k]));
			}
			if ((int)sqrt(sum) * (int)sqrt(sum) == sum) ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <stdio.h>
using namespace std;

int toNumber(char c){
	switch (c){
	case 'S':
		return 0;
	case 'H':
		return 1;
	case 'C':
		return 2;
	case 'D':
		return 3;
	default:
		return NULL;
		break;
	}
}
char toStr(int n){
	switch(n){
	case 0:
		return 'S';
	case 1:
		return 'H';
	case 2:
		return 'C';
	case 3:
		return 'D';
	default:
		return NULL;
		break;
	}
}

int main(){
	int n;
	char c; 
	int a;
	int m;
	bool t[4][14];
	cin >> n;
	
	//????????????????????????
	for (int i = 0;i < 4;i++){
		for (int j=1;j <= 13;j++){
			t[i][j]=true;
		}
	}
	
	for (int i = 0;i < n;i++){ 
		cin >> c >> a;
		m = toNumber(c);
		t[m][a] = false;
	}
	
	for (int i = 0;i < 4;i++){
		for (int j=1;j <= 13;j++){
			if (t[i][j]==true) {
				cout << toStr(i) << " " << j << endl;
			}
		}
	}
	//cout << endl;
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h=sc.nextInt(),w=sc.nextInt();
		int ansh=0,answ=0;
		for(int i=0;i<h;i++) {
			for(int j=0;j<w;j++) {
				if(sc.next().equals("snuke")) {
					ansh=i+1;
					answ=j;
				}
			}
		}
		System.out.println((char)(65+answ)+""+ansh);
		//char a='A';
		//System.out.println(Integer.valueOf(a));
	}
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,m;
int inde[N],awa[N]; 
vector<int>E[N];
int main()
{
	cin>>n>>m;
	for(int i=0;i<n+m-1;i++)
	{
		int x,y; cin>>x>>y;
		x--; y--;
		E[x].push_back(y);
		inde[y]++; 
	} 
	queue<int>qaq;
	for(int i=0;i<n;i++)
		if(!inde[i])
		{
			awa[i+1]=0;
			qaq.push(i);
		}
	while(!qaq.empty())
	{
		int u=qaq.front();
		qaq.pop();
		for(int i=0;i<E[u].size();i++)
		{
			int uu=E[u][i];
			inde[uu]--;
			if(!inde[uu])
			{
				awa[uu+1]=u+1;
				qaq.push(uu);
			}
		}
	}
	for(int i=1;i<=n;i++)
		cout<<awa[i]<<endl;
	return 0;
}

Measured memory_bytes: 7040
//BIRDS SET FREE
#include<bits/stdc++.h> 
using namespace std;                          //31 July 1999
#pragma GCC optimize("O3")
typedef long long ll;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vec(i, a)  for( auto i=a.begin();i != a.end(); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sp '\t'
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define in  freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define rocket in out 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...); }
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
const ll MOD = 10e9 + 7;
const ll N=10e6;
ll n_bits(ll n ) { ll x= __builtin_popcount(n) ; return x ;}
ll least_bits(ll n ) { ll x= __builtin_ffs(n) ; return x ;}
ll gcd(ll x, ll y) { ll n=__gcd(x,y); return n;}
ll binpow(ll a, ll b, ll m=MOD) 
{
    a%=m;
    ll res=1;
    while (b>0) 
    {
        if (b&1)    res=res*a%m;
        a=a*a%m,b>>=1;
    }
    return res;
}
void I(vi &v, int n)
{
    ll a;
    rep(i,0,n)    cin>>a,v.pb(a);
}
void O(vi &v, int n)
{

    rep(i,0,n)    cout<<v[i]<<" ";
    cout<<endl;
}
ll get_second( pair<string, ll> i ){ return i.second; }
int main()
{    
    #ifndef ONLINE_JUDGE
    rocket
    #endif
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {    
        ld temp = 0 , flag = 0 , diff = 0 , sum = 0 , result = 0 , ct = 0 , cnt = 0 , found = 0;
        ld a = 0 , b = 0 , c = 0 , n = 0 , m = 0 , k = 0 , x = 0 , y = 0 ; 
        set<ll> s1;
        map<ll,ll> mapp;
        vi v,v1,v2;
        string s;
        //transform( mapp.begin(), mapp.end(), v1.begin(), get_second );
        cin >> a >> b >> n >> m ;
        n += ( m / ( ld) 60 )  ;
        //cout<< n ;
        m = m / (ld)5;
        diff = abs( n - m ) ;
        ld angle = diff * 30 ;
        angle = cos( ( M_PI * angle ) / 180 ) ;
        //cout<<angle;
        cout << std::setprecision( 9 ) << fixed << sqrt( a*a + b*b - 2*a*b*( angle ) ) ;
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 4148
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1e9+7;

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

//********************************template END****************************************//

void solve(void){

	int N;
	cin >> N;

	if (N == 1)
	{
		cout << "Hello World" << endl;
		return;
	}

	int A, B;
	cin >> A >> B;

	cout << A + B << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#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>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;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<pair<ll,ll>>
#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=2e4+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    int n;
    cin>>n;
    int arr[n];
    loop(n,i,0)
        cin>>arr[i];
    sort(all(arr,n));
    int cnt=0;
    loop(n,i,0){
        loop(n,j,i+1){
            loop(n,k,j+1){
                set<int>st;
                st.insert(arr[i]);
                st.insert(arr[j]);
                st.insert(arr[k]);
                if(arr[i]+arr[j]>arr[k]&&sz(st)==3)
                    cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long money = 100;
		long cnt = 0;
		while(money < x) {
			cnt++;
			money *= 1.01;
		}
		System.out.println(cnt);

	}

}


Measured memory_bytes: 35700
n,k=map(int,input().split())
ans=0
if k==0:
    print(n**2)
else:
    for i in range(k+1,n+1):
        temp=(i-k)*(n//i)
        r=n%i
        if r>=k:
            temp=temp+(r+1-k)
        ans=ans+temp
    print(ans)


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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;


int main() {
  int A, B;
  cin >> A >> B;
  for(int i = 2; i <= 999; i++) {
    int latte = i * (i + 1) / 2;
    int malta = i * (i - 1) / 2;
    if(B - A == latte - malta) {
      cout << latte - B << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

type drink struct {
	a int
	b int
}

type A []*drink

func (a A) Len() int           { return len(a) }
func (a A) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a A) Less(i, j int) bool { return a[i].a < a[j].a }

func main() {
	nm := strings.Split(readLine(), " ")
	n, _ := strconv.Atoi(nm[0])
	m, _ := strconv.Atoi(nm[1])
	var ab A
	for i := 0; i < n; i++ {
		abstr := strings.Split(readLine(), " ")
		a, _ := strconv.Atoi(abstr[0])
		b, _ := strconv.Atoi(abstr[1])
		ab = append(ab, &drink{a: a, b: b})
	}
	sort.Sort(ab)
	var cost int
	for i := 0; i < n; i++ {
		if m > ab[i].b {
			cost += ab[i].a * ab[i].b
			m -= ab[i].b
		} else {
			cost += ab[i].a * m
			break
		}
	}
	fmt.Println(cost)
}


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

int main() {
    int n, a;
    cin >> n >> a;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
        x[i] -= a;
    }
    vector<map<int,ll> > dp(n+1);
    dp[0][0] = 1;
    for(int i=0;i<n;i++){
        for(auto p : dp[i]){
            dp[i+1][p.first+x[i]] += p.second;
            dp[i+1][p.first] += p.second;
        }
    }
    cout << dp[n][0]-1 << endl;
    return 0;
}


Measured memory_bytes: 1664
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		var c = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		int a = c[0];
		int b = c[1];
		
		if(a<=9){
			if(b<=9){
				Console.WriteLine(a*b);
			}else{
				Console.WriteLine(-1);
			}
		}else{
			Console.WriteLine(-1);
		}
	}
}

Measured memory_bytes: 13268
from collections import deque

d = {i:[] for i in range(1, 11)}
q = deque([(1, "a")])
while q:
    pos, s = q.popleft()
    if pos == 11:
        break
    d[pos].append(s)
    size = len(set(s))
    for i in range(size+1):
        q.append((pos+1, s+chr(97+i)))

N = int(input())
for i in d[N]:
    print(i)

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

int main() 
{
  string S,T;
  cin >> S >> T;
  int cnt = 0;

  for(int i = 0; i < S.size(); i++){
    if(S.at(i) !=T.at(i))
    {
      S.at(i) = T.at(i);
      cnt++;
    }
    else
    {
      continue;
    }
  }
  cout << cnt;
}

Measured memory_bytes: 3844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

map<string, int> memo;

using P=pair<int, int>;
int main() {
	//sort(a.begin(),a.end());
	int n;
	cin >> n;
	pair<pair<string, int>, int> p[101];
	rep(i, n) {
		string s;
		int a;
		cin >> s >> a;
		p[i] = make_pair(make_pair(s, -a), i);
	}
	sort(p, p + n);
	rep(i, n) cout << p[i].second + 1<<endl;
	return 0;
}









Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n;
const ull BASE = 1e+9+7;
map<ull, int> open[2];

ull getHash(const vector<char> &seq) {
  ull ret = 0;
  REP(i, n) {
    ret = ret * BASE + seq[i];
  }
  return ret;
}

int main() {
  while (scanf("%d", &n) > 0) {
    open[0].clear();
    open[1].clear();
    vector<char> ini;
    REP(i, n) {
      int v;
      scanf("%d", &v);
      v--;
      ini.push_back(v);
    }
    queue<pair<vector<char>, char> > que;
    open[0][getHash(ini)] = 0;
    que.push(make_pair(ini, 0));
    {
      vector<char> sorted(n);
      REP(i, n) {
        sorted[i] = i;
      }
      open[1][getHash(sorted)] = 0;
      if (ini == sorted) {
        printf("0\n");
        continue;
      }
      que.push(make_pair(sorted, 1));
    }
    while (!que.empty()) {
      vector<char> seq = que.front().first;
      int lr = que.front().second;
      int ncost = open[lr][getHash(seq)] + 1;
      que.pop();
      REP(i, n) {
        FOR(j, i + 1, n) {
          vector<char> nseq = seq;
          reverse(nseq.begin() + i, nseq.begin() + j + 1);
          ull h = getHash(nseq);
          if (open[lr].count(h)) { continue; }
          if (open[lr ^ 1].count(h)) {
            printf("%d\n", ncost + open[lr ^ 1][h]);
            goto next;
          }
          open[lr][h] = ncost;
          que.push(make_pair(nseq, lr));
        }
      }
    }
    assert(false);
next:;
  }
}

Measured memory_bytes: 70228
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
	let N = parseInt(input[0][0], 10);
	let p = input[1].map(e => parseFloat(e, 10));
	let maxUra = Math.ceil((N + 1) / 2);
	let DP = Array.from({length: maxUra}, () => 0);
	DP[0] = 1;
	for (let i = 0; i < N; i++){
		for (let j = maxUra - 1; j >= 1; j--){
			DP[j] = DP[j - 1] * (1 - p[i]) + DP[j] * p[i];
		}
		DP[0] = DP[0] * p[i];
		// console.log(DP);
	}
	let ans = 0;
	for (x of DP){
		ans += x;
	}
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));	

Measured memory_bytes: 34056
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        if(a==b)
            cout<<c<<endl;
        if(a==c)
            cout<<b<<endl;
        if(b==c)
            cout<<a<<endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc014.contest.atcoder.jp/tasks/agc014_b>
問題文============================================================
 高橋君は木の問題が苦手です。そこで、青木君は高橋君の練習相手になってあげることにしました。
 
 まず、高橋君は N 頂点からなる木を用意し、頂点に 1 から N の番号を付けました。 そして、各辺に 0 と書きました。
 
 次に、青木君は高橋君に M 個のクエリを与えました。i 個目のクエリは以下のような内容です。
 
 頂点 ai と頂点 bi を結ぶパス上の辺すべてに対して、書かれている数を 1 増やす。
 全てのクエリを終えた後、高橋君は青木君にどの辺を見ても書かれている数が偶数になったと伝えました。
 しかし、青木君は最初に高橋君が用意していた木を確認していなかったので、
 高橋君が正しくクエリを処理できたか分かりませんでした。
 
 青木君を助けるために、高橋くんの言う性質を満たす木が存在するかどうかを判定してください。
=================================================================

解説=============================================================

================================================================
*/
string solve(){
    ll N,M; cin >> N >> M;
    vector<ll> a(M),b(M);
    for(int i = 0; i < M;i++){
        cin >> a[i] >> b[i];
    }
    vector<ll> cnt(N+1);
    for(int i = 0; i < M;i++){
        cnt[a[i]]++; cnt[b[i]]++;
    }
    for(auto v:cnt){
        if(v&1) return "NO";
    }
    return "YES";
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


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

namespace contest_Csharp
{
    
    class Program
    {
        public static (long m,long s)[,] dp;

        static void Main(string[] args)
        {
            checked
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                var vals = Console.ReadLine().Split(' ').
                    Select(x => long.Parse(x)).ToList();
                
                
                var N = vals[0];
                
                var L= Console.ReadLine().Split(' ').
                    Select(x => long.Parse(x)).ToList();

                //L.Sort();

                var ans = 0;

                for (int i = 0; i < N; i++)
                {
                    for (int k = i; k < N; k++)
                    {
                        for (int m = k; m < N; m++)
                        {
                            if ((L[i] != L[k] && L[k] != L[m] && L[i] != L[m])&&
                                (L[i]+L[k] >L[m] && L[k] + L[m] > L[i] && L[i] + L[m] > L[k]))
                                ans++;
                        }
                    }
                }

                

                Console.WriteLine(ans);

                Console.Out.Flush();
            }




        }
    }
}




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


int A[100];
long long dp[100][100][5000];

int main(){
	int n,k;
	cin >> n >> k;
	for(int i=0;i<n;i++){
		cin >> A[i];
	}
	
	dp[0][0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<2500;k++){
				if(dp[i][j][k]){
					dp[i+1][j][k]+=dp[i][j][k];
					dp[i+1][j+1][k+A[i]]+=dp[i][j][k];
				}
			}
		}
	}
	
	long long ans=0;
	for(int i=1;i<=n;i++) ans+=dp[n][i][i*k];
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 151808
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define eb emplace_back
typedef long long ll;
auto const inf = numeric_limits<ll>::max()/4;

using Weight = ll;
using Capacity = int;
struct Edge {
    int src, dst; Weight weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

pair<vector<Weight>, bool> spfa(const Graph &g, int s){
    const Weight inf = numeric_limits<Weight>::max()/4;
    const int n = g.size(); queue<int> q;
    vector<Weight> dist(n, inf); vector<int> inQ(n);
    vector<int> count(n);
    dist[s] = 0; q.emplace(s); inQ[s] = true; ++count[s];
    bool negCycle = false;
    for(int i = 0; q.size(); i++){
        int v = q.front(); q.pop(); inQ[v] = false;
        for(auto &e : g[v]){
            if(dist[v] != inf && dist[e.dst] > dist[v] + e.weight){
                dist[e.dst] = dist[v] + e.weight;
                if(!inQ[e.dst]){
                    q.emplace(e.dst); inQ[e.dst] = true; ++count[e.dst];
                    // if(count[e.dst] >= n){ negCycle = true; goto END; }
                }
            }
        }
    }
    // END:;
    return make_pair(dist, !negCycle);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int V,E,r;
    while(cin >> V >> E >> r){
        Graph g(V);
        rep(i,E){
            int a,b,c;
            cin >> a >> b >> c;
            g[a].eb(a,b,c);
        }
        bool ok;
        vector<Weight> dist;
        tie(dist, ok) = spfa(g,r);
        if(ok){
            for(int i = 0; i < (int)dist.size(); i++){
                if(dist[i] == inf) cout << "INF";
                else cout << dist[i];
                cout << endl;
            }
        } else {
            cout << "NEGATIVE CYCLE" << endl;
        }
    }
}

Measured memory_bytes: 19156
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  int a[N];
  
  for (int i = 0; i < N; ++i){
    scanf("%d", &a[i]);
  }
  sort(a, a + N);
  int minHDifference = a[K - 1] - a[0];
  
  for (int i = 1; i <= N - K; ++i){
    if(minHDifference > a[i + K - 1] - a[i]){
      minHDifference = a[i + K - 1] - a[i];
    }else{
      continue;
    }
  }
  
  cout << minHDifference << endl;
  
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define chmin(x, y) x = min(x, y)
#define ll long long
#define ld long double
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int N, M, X, Y; cin >> N >> M >> X >> Y;

  int xmax = -INF;
  int ymin = INF;
  rep(i, N) {
    int x; cin >> x;
    xmax = max(xmax, x);
  }
  rep(i, M) {
    int y; cin >> y;
    ymin = min(ymin, y);
  }
  // cout << ymin << " " << xmax << endl;
  // if (xmax <= ymin ) {
  //   cout << "No war" << endl;
  // } else {
  //   cout << "War" << endl;
  // }
  int flag = 0;
  for (int i = ymin ; i > xmax; i--) {
    if (i <= Y && i > X) {
      flag = 1;
      break;
    }
  }
  cout << (flag ? "No War" : "War") << endl;
}


Measured memory_bytes: 256
#include <cstdio>

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

	if (a >= b) {
		int i;
		for (i = 0; i < a; i++)
			printf("%d", b);
	} else {
		int i;
		for (i = 0; i < b; i++)
			printf("%d", a);
	}
			printf("\n");
	return 0;
}


Measured memory_bytes: 1700
#include<iostream>
#include<limits.h>
using namespace std;
int n,m;
const int MAX = 50;
const int MAXN = 100000; 
const int INF = INT_MAX;
int C[MAX];
int T[MAXN];


void solve()
{
	for(int i = 1; i <= m; i++)
		for(int j = C[i]; j <= n; j++)
		{
			T[j] = min(T[j],T[j-C[i]]+1);
		}
	cout <<	T[n]<<endl;
}

int main()
{
	
	cin >> n >> m;
	for(int i = 1 ; i <= m; i++)
		cin >> C[i];	
	
	for(int i = 1 ; i <= n; i++)
		T[i] = INF;
	T[0] = 0;
	solve();

}

Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
int n,a[200005];
long long r;
map <int,int> m;
int main()
{ cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin>>n;
  for(int i=1;i<=n;i++)
  { cin>>a[i];
    if(i>a[i])
       m[i-a[i]]++;
  }
  for(int i=1;i<=n;i++)
  { m[i-a[i]]--;
    r+=1LL*m[a[i]+i];
  }
  cout<<r<<'\n';
  return 0;
}


Measured memory_bytes: 21432
// 2011/02/06 Tazoe

#include <iostream>
using namespace std;

struct team{
	char t;
	int win;
	int los;
	int drw;
	int ord;
};

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		struct team tea[10];
		for(int i=0; i<n; i++){
			tea[i].win = 0;
			tea[i].los = 0;
			tea[i].drw = 0;
			tea[i].ord = i;

			cin >> tea[i].t;
			for(int j=0; j<n-1; j++){
				int r;
				cin >> r;
				if(r==0)
					tea[i].win++;
				else if(r==1)
					tea[i].los++;
				else if(r==2)
					tea[i].drw++;
			}
		}

		for(int i=0; i<n-1; i++)
			for(int j=i+1; j<n; j++)
				if(tea[i].win<tea[j].win||(tea[i].win==tea[j].win&&tea[i].los>tea[j].los)
				 ||(tea[i].win==tea[j].win&&tea[i].los==tea[j].los&&tea[i].ord>tea[j].ord)){
					struct team tmp = tea[i];
					tea[i] = tea[j];
					tea[j] = tmp;
				}

		for(int i=0; i<n; i++)
			cout << tea[i].t << endl;
	}

	return 0;
}

Measured memory_bytes: 0
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/22/20 21:00:03
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
  vector<int> dp(f+1, -1);
  dp[0] = 0;
  for (int i = 0; i*a*100<=f; i++) {
    dp[i*a*100] = 0;
  }
  for (int m = f; m >= 0; m--) {
    if (dp[m] == -1) continue;
    for (int i = 1; m+i*b*100 <= f; i++)
      dp[m+i*b*100] = 0;
  }
  for (int m = f-c; m >= 0; m--) {
    if (dp[m] == -1) continue;
    for (int i = 1; m+i*c<=f; i++) {
      auto w = m;
      if (w*e/100 < i*c) break;
      dp[m+i*c] = max(dp[m+i*c], i*c);
    }
  }
  for (int m = f-c; m >= 0; m--) {
    if (dp[m] == -1) continue;
    for (int i = 1; m+i*d<=f; i++) {
      auto w = m+i*d-(dp[m]+i*d);
      if (w*e/100 < dp[m]+i*d) break;
      dp[m+i*d] = max(dp[m+i*d], dp[m]+i*d);
    }
  }
  int ans_i = 0;
  double max_ans = 0;
  for (int m = 1; m <= f; m++) {
    if (dp[m] == -1) continue;
    if ((double)dp[m]/m > max_ans) {
      max_ans = (double)dp[m]/m;
      ans_i = m;
    }
  }
  if (ans_i == 0) ans_i = 100*a;
  cout << ans_i << " " << dp[ans_i] << endl;

  return 0;
}


Measured memory_bytes: 256