akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 200010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
int A[MAXN];
ll L[MAXN], R[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int i=1; i<=n; i++) cin>>A[i];
	for (int i=1; i<=n; i++) for (L[i]=i-1; L[i] && A[L[i]]>=A[i]; L[i]=L[L[i]]);
	for (int i=n; i; i--) for (R[i]=i+1; R[i]<=n && A[R[i]]>A[i]; R[i]=R[R[i]]);
	for (int i=1; i<=n; i++) ans+=A[i]*(i-L[i])*(R[i]-i);
	cout<<ans<<'\n';
	
	return 0;
}
/*
3 2
1 2
2 3

*/

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


#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()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

const int dr[]={0,1,0,-1,1,1,-1,-1,0, 0};

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h, w, n;
	cin >>h >>w >>n;
	set<pii> st;
	rep(i, n){
		int a, b; cin >>a >>b;
		st.insert(pii(a-1,b-1));
	}
	map<pii, ll> mp;
	
	for(auto& p: st){
		int py=p.first, px=p.second;
		rep(i, 9){
			int ny=py+dr[i], nx=px+dr[i+1];
			if(ny<0 ||ny>=h ||nx<0 ||nx>=w) continue;
			if(mp.count(pii(ny, nx))) continue;
			int sm = 0;
			rep(j, 9){
				int by=ny+dr[j], bx=nx+dr[j+1];
				if(by<0 ||by>=h ||bx<0 ||bx>=w){ sm = -9999; break;}
				if(st.count(pii(by, bx))) sm++;
			}
			if(sm > 0) mp[pii(ny, nx)] = sm;
		}
	}
	//for(auto& q: mp){
	//	printf("[%d:%d %d] ",q.first.first,q.first.second, q.second);
	//}
	VL ans(10);
	for(auto& q: mp){
		ans[q.second]++;
	}
	ans[0] = (ll)(h-2) * (w-2) - sz(mp);
	
	for(auto x :ans) cout<<x<<"\n";
	return 0;
}


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

using namespace std;

const int MAX_N = (1 << 19);
const int INF = 1000000007;

int seg[2*MAX_N];

void init(){
	for(int i=0;i<2*MAX_N;++i) seg[i] = INF;
}

void update(int pos, int val){
	int idx = pos+MAX_N-1;
	seg[idx] = val;
	while(idx){
		idx = (idx-1)/2;
		seg[idx] = min(seg[2*idx+1], seg[2*idx+2]);
	}
}

int query(int l, int r, int idx = 0, int L = 0, int R = MAX_N){
	if(l <= L && R <= r) return seg[idx];
	if(r <= L || R <= l) return INF;
	int a = query(l, r, 2*idx+1, L, (L+R)/2);
	int b = query(l, r, 2*idx+2, (L+R)/2, R);
	return min(a, b);
}

int N, K;
int P[500000];
int res[500000];

void check(int i, int& r){
	if(P[i] == INF) return;
	while(true){
		int v = query(0, P[i]);
		if(v >= i+K) break;
		check(v, r);
	}
	res[i] = r++;
	update(P[i], INF);
	P[i] = INF;
}

int main(){
	while(cin >> N >> K){
		init();
		for(int i=0;i<N;i++){
			scanf("%d", &P[i]);
			--P[i];
			update(P[i], i);
		}
		int r = 1;
		for(int i=0;i<N;i++) check(i, r);
		for(int i=0;i<N;i++) printf("%d\n", res[i]);
	}
}


Measured memory_bytes: 27136
N = int(input())

if N == 1:
    print(N)
elif N >= 2 and N < 4:
    print(2)
elif N < 8:
    print(4)
elif N < 16:
    print(8)
elif N < 32:
    print(16)
elif N < 64:
    print(32)
else:
    print(64)


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

int main() {
    string s;
    cin >> s;
    string operators[s.size() - 1];
    bool isFinished = false;
    for(int bit = 0; bit < (1 << (s.size() - 1)); bit++){
        long tmp = s.at(0) - '0';
        for(int i = 0; i < s.size() - 1; i++){
            if(bit & (1 << i)){
                tmp -= s.at(i + 1) - '0';
                operators[i] = "-";
            } else {
                tmp += s.at(i + 1) - '0';
                operators[i] = "+";
            }
            
        }
        if(tmp == 7){
            isFinished = true;
            break;
        }
        if (isFinished == true){
            break;
        }
    }
    cout << s.at(0) << operators[0] << s.at(1) << operators[1]
    << s.at(2) << operators[2] << s.at(3) << "=7" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    ll ans = 0;
    rep(i,n+1) {
        if(i%3!=0 && i%5!=0) ans += i;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3648
/*  ex3_2
    potter0723sw  */

#include <stdio.h>

int main(void) {
	int number,poo;
	scanf("%d", &number);
	poo = number % 10; //pooはplace of oneの略
	if(poo == 2 || poo == 4 || poo == 5 || poo == 7 || poo == 9){//１の位を参照するために%10をした
    	printf("hon\n");
    }else if(poo == 0 || poo == 1 || poo == 6 || poo == 8){
    	printf("pon\n");
    }else printf("bon\n");
	return 0;
}


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

#define R (long long)(1e9 + 7)
#define INF (long long)(1e16L + 5)
#define ll long long
#define grid vector<vector<ll>>

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
  

vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};


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

    int n, m;
    cin >> n >> m;

    pair<int, int> src, dst;
    
    cin >> src.first >> src.second;
    cin >> dst.first >> dst.second;
    
    vector<string> g(n);
    for(string& x : g)
        cin >> x;

    src.first--;
    src.second--;
    dst.first--;
    dst.second--;

    grid d(n, vector<ll>(m, INF)), color(n, vector<ll>(m, 0));
    
    deque<pair<int, int>> q;
    q.push_back(src);

    if(g[src.first][src.second] == '#' || g[dst.first][dst.second] == '#')
    {
        cout << "-1\n";
        return 0;
    }
    
    d[src.first][src.second] = 0;

    while(!q.empty())
    {
        int i = q.front().first, j = q.front().second;
        q.pop_front();
        if(color[i][j] == 0)
        {
            color[i][j] = 1;

            for(int k = 0; k < 4; k++)
            {
                int x = i + dx[k], y = j + dy[k];
                if(x >= 0 && x < n  && y >= 0 && y < m)
                {
                    if(g[x][y] == '.' && color[x][y] == 0)
                    {
                        if(d[i][j] < d[x][y])
                        {
                            q.push_front({x, y});
                            d[x][y] = min(d[x][y], d[i][j]);
                        }
                    }
                }
            }
            for(int dx : {-2, -1, 0, 1, 2})
            {
                for(int dy : {-2, -1, 0, 1, 2})
                {
                    if(!(dx == 0 && dy == 0))
                    {
                        int x = i + dx, y = j + dy;
                        if(x >= 0 && x < n  && y >= 0 && y < m)
                        {
                            if(g[x][y] == '.' && color[x][y] == 0)
                            {
                                if(d[x][y] > d[i][j] + 1)
                                {
                                    q.push_back({x, y});
                                    d[x][y] = min(d[x][y], d[i][j] + 1);
                                }
                            }
                        }

                    }
                }
            }
        }
    }

    if(d[dst.first][dst.second] == INF)
        cout << "-1\n";
    else
        cout << d[dst.first][dst.second] << '\n';
    return 0;
}

Measured memory_bytes: 20444
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
bool safe(int i,int j, int h,int w){
  return (i>=0 && i<h && j>=0 && j<w);
}
void solve(){
  int h,w;
  cin>>h>>w;
  int a[h][w];
  int dp[h][w],sum=0;
  bool vis[h][w];
  rep(i,0,h){
    string s;
    cin>>s;
    rep(j,0,w){
      if(s[j]=='.') {sum++;a[i][j]=1;}
      else a[i][j]=0;
      dp[i][j]=1e9;
      vis[i][j]=0;
    }
  }
  vector<pii> v1;
  v1.push_back({0,0});
  int curr=0;
  dp[0][0]=1;
  while(v1.size()!=0){
    int sz=v1.size();
    vector<pii> v2;
    rep(i,0,sz){
      vis[v1[i].f][v1[i].s]=1;
      rep(j,0,4){
        if(safe(v1[i].f+dx[j],v1[i].s+dy[j],h,w) && !vis[v1[i].f+dx[j]][v1[i].s+dy[j]] && a[v1[i].f][v1[i].s]){
          if(dp[v1[i].f+dx[j]][v1[i].s+dy[j]] > dp[v1[i].f][v1[i].s]+1){
            dp[v1[i].f+dx[j]][v1[i].s+dy[j]]=dp[v1[i].f][v1[i].s]+1;
            v2.pb({v1[i].f+dx[j],v1[i].s+dy[j]});
          }
        }
      }
    }
    v1=v2;
  }
  if(dp[h-1][w-1]==1e9) cout<<-1<<endl;
  else cout<<sum-dp[h-1][w-1]<<endl;
}

int main(){
    optimizeIO();
    solve();
}


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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> a(h);
  rep(i, h) {
    cin >> a[i];
  }
  int ans = 0;
  rep(i, 1 << h) {
    rep(j, 1 << w) {
      vector<string> c = a;
      int cnt = 0;
      rep(ii, h) {
        if (i & 1 << ii) {
          rep(jj, w) {
            c[ii][jj] = '.';
          }
        }
      }
      rep(jj, w) {
        if (j & 1 << jj) {
          rep(ii, h) {
            c[ii][jj] = '.';
          }
        }
      }
      rep(ii, h) {
        rep(jj, w) {
          if (c[ii][jj] == '#') cnt++;
        }
      }
      if (cnt == k) ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3668
#zero sum ranges
n=int(input())
lists=list(map(int,input().split()))
sumlist=[0]
c=0
for some in lists:
    c+=some
    sumlist.append(c)
from collections import Counter
D=dict(Counter(sumlist))
d=0
for some in D.values():
    d+=some*(some-1)//2
print(d)

Measured memory_bytes: 113096
#include <bits/stdc++.h>
#include <cstdint>
#include <sys/time.h>

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

const unsigned long mod = 1000000007;
const double EPS = 0.00000001;
const int INF = (1 << 29);

typedef std::pair<int, int> P;

template<typename T>
void print_array(T *A_, s32 size) {
  //printf("%d\n", size);
  if( size != 0 ) {
    for(int i = 0; i < size - 1; ++i) {
      printf("%d ", A_[i]);
    }
    printf("%d\n", A_[size - 1]);
  }
}

int main() {

  for(;;) {
    int a[64];
    int l;
    std::cin >> a[0] >> l;
    if( a[0] == 0 and l == 0 ) break;

    for(int i = 1; i < 64; ++i) {
      std::string numstr = std::to_string(a[i - 1]);
      while( (int)numstr.size() < l ) numstr += '0';

      std::string minstr = numstr; std::sort(minstr.begin(), minstr.end());
      std::string maxstr = minstr; std::reverse(maxstr.begin(), maxstr.end());
      int min = std::stoi(minstr);
      int max = std::stoi(maxstr);

      a[i] = max - min;
    }

    for(int i = 0; i < 64; ++i) {
      for(int j = 0; j < i; ++j) {
        if( a[i] == a[j] ) {
          std::cout << j << " " << a[i] << " " << i - j << std::endl;
          goto label_1;
        }
      }
    }
  label_1:;
  }

  return 0;
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int H, W;
	char fld[50][50];
	char ans[50][50];
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> fld[i][j];
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			ans[i][j] = '0';
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(fld[i][j] == '#'){
				for(int k = -1; k <= 1; k++){
					if(i + k < 0 || i + k >= H) continue;
					for(int l = -1; l <= 1; l++){
						if(j + l < 0 || j + l >= W) continue;
						ans[i + k][j + l]++;
					}
				}
			}
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(fld[i][j] == '#') cout << '#';
			else cout << ans[i][j];
			if(j == W - 1) cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import sys

c=["light fly", "fly", "bantam", "feather", "light", "light welter",
   "welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
    i=0
    while i<len(w) and w[i]<s:
        i+=1
    print c[i]

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

int gcd(int $a, int $b) {
    if ($b == 0)
        return $a;

    return gcd($b, $a % $b);
}

int main()
{
  int k, a, b, c;
  long sum = 0;
  cin >> k;
  
  for (a=1; a<=k; a++) {
    for (b=1; b<=k; b++) {
      for (c=1; c<=k; c++) {
        int tmp;
        tmp = gcd(a, b);
        tmp = gcd(tmp, c);
        sum += tmp;
      }
    }
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 3624
#include <iostream> 
using namespace std; 
  
long long findTrailingZeros(long long n) 
{ 
    long long count = 0; 
  
    for (long long i = 5; n / i >= 1; i *= 5) 
        count += n / i; 
  
    return count; 
} 
  
int main() 
{ 
    long long n;
    cin >> n;

    if (n % 2 != 0) cout << 0 << endl;
    else cout << findTrailingZeros(n / 2) << endl;
    return 0; 
} 

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

int main()
{
    long long n,a,b;
    std::cin >> n>>a>>b;
    long long x,y;
    x = n / (a+b);
    y = n  % (a+b);
    long long ans = std::min(a, y) + a*x;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

int main () {
  string S;
  cin >> S;
  char a = S[0];
  char b = S[S.size()-1];
  int x = (int)S.size() % 2;
  if (a == b) {
    cout << ((x == 0) ? "First" : "Second") << endl;
  } else {
    cout << ((x != 0) ? "First" : "Second") << endl;
  }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,j,k,l,a,b,cc,arr[13]={};
    char c[30009];
    scanf("%d %s",&n,&c);
    m=0;
    for(i=0; i<=9; i++)
    {
        for(k=0; k<=9; k++)
        {
            for(j=0; j<n; j++)
            {
                l=c[j]-'0';
                if(l==i){
                        j++;
                    break;

                }
            }
            for(;j<n;j++){
                l=c[j]-'0';
                if(l==k){
                        j++;
                    break;
                }
            }
            for(cc=0;cc<10;cc++)
                arr[cc]=0;
            for(;j<n;j++){
                l=c[j]-'0';
                arr[l]++;
            }
            for(cc=0;cc<10;cc++){
                if(arr[cc]>0)
                    m++;
            }
           // printf("%d %d %d\n",i,j,m);
        }
    }
    printf("%d",m);

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;

    int cnt=0;
    for(int i=0; i<N; i++){
        int p;
        cin >> p;

        if(p!=i+1){
            cnt++;
        }
    }
    if(cnt<=2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 1e6 + 10;

long long modpow(long long n, long long k, long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
void solve(){
  int n,t;
  cin >> n >> t;
  int mini = INT_MAX;
  for(int i = 0;i<n;i++){
    int a,b;cin >> a >> b;
    if(b<=t) mini = min(mini,a);
  }
  if(mini==INT_MAX) cout << "TLE";
  else cout << mini;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

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

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

Measured memory_bytes: 3612
n=int(input())

prime = []

for i in range(11,55556,2):
    flag = True
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            flag=False
            break
    if flag:
        prime.append(i)
        
prime_mod1 = []

for i in prime:
    if i%5==1:
       prime_mod1.append(i)
print(*prime_mod1[:n])

Measured memory_bytes: 41068
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string S;
    cin >> S; 
    string a,b,c,d;
    a="0"; b="1";c="01";d="10";
    int length = (int)(S.length());
    string S1="0";
    string S2="1";
    if(length % 2 ==0){
        int p = length / 2 - 1;
        for(int i = 0; i < p; i++){
            S1 = S1 + d;
            S2 = S2 + c;
        }
        S1 = S1 + b;
        S2 = S2 + a;
    }
    else{
        int p = length / 2 ;
        for(int i = 0; i < p; i++){
            S1 = S1 + d;
            S2 = S2 + c;
        }
    }

    int C1 = 0;
    int C2 = 0;
    for(int i = 0; i <= length; i++){
        string si,s1i,s2i;
        si = S.substr(i, 1);
        s1i = S1.substr(i, 1);
        s2i = S2.substr(i, 1);
        if(si != s1i){
            C1++;
        }
        if(si != s2i){
            C2++;
        }
    }

    if(C1 < C2){
        cout << C1 << endl;
    }
    else{
        cout << C2 << endl;
    }
    return (0);
}

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

int main() {
    int n, d;
    double x, y;
    cin >> n >> d;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        double dist = sqrt(((x*x) + (y*y)));
        if (dist <= d)
        {
            count++;
        }
        
    }
    cout << count << endl;   
    return 0;
}

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

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

  return 0;
}

Measured memory_bytes: 3620
//
//  main.cpp
//  A
//
//  Created by E SAMEER KUMAR on 09/04/20.
//  Copyright © 2020 E SAMEER KUMAR. All rights reserved.

#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
int main(int argc, const char * argv[]) {
    // insert code here...
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    double p[n];
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    double dp[n][n+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<n+1;j++){
            dp[i][j]=0.000000000;
        }
    }
    dp[0][0]=1-p[0];dp[0][1]=p[0];
    for(int i=1;i<n;i++){
        for(int j=0;j<=i+1;j++){
            if(i-1>=0 && j-1>=0){
            dp[i][j]=dp[i-1][j-1]*p[i];
            }
            if(i-1>=0){
            dp[i][j]+=dp[i-1][j]*(1-p[i]);
            }
        }
    }
    /*for(int i=0;i<n;i++){
        for(int j=0;j<n+1;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    double ans=0.0;
    for(int i=n/2+1;i<=n;i++){
        //cout<<i<<endl;
        ans+=dp[n-1][i];
    }
    printf("%.10lf\n",ans);
    //cout<<ans<<endl;
    return 0;
}


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

int main()
{
	int n,d;
	cin>>n>>d;
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		double x,y;
		cin>>x>>y;
		double h = sqrt(x*x+y*y);
		if(h<=d)
			ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define fs first
#define sc second
using namespace std;
const int maxn = 1e5+10;
using pii = pair<int,int>;
typedef long long ll;
int F[maxn];
vector<int> B[maxn];
int N,M,K;
int fa[maxn],cnt[maxn];
void init(){
    for(int i = 1;i<=N;i++) fa[i] = i;
}
int find(int x){
    if(x != fa[x])
        fa[x] = find(fa[x]);
    return fa[x];
}
void join(int x,int y){
    int fx = find(x),fy = find(y);
    if(fx != fy){
        fa[fx] = fy;
    }
}
int main(){
    cin>>N>>M>>K;
    init();
    while(M--){
        int a,b;
        scanf("%d %d",&a,&b);
        F[a]++,F[b]++;
        join(a,b);
    }
    for(int i = 1;i<=N;i++) find(i);
    for(int i = 1;i<=N;i++) ++cnt[fa[i]];
    while(K--){
        int a,b;
        scanf("%d %d",&a,&b);
        B[a].push_back(b);
        B[b].push_back(a);
    }
    for(int i = 1;i<=N;i++){
        int total = cnt[fa[i]] - 1;
        total -= F[i];
        for(auto b:B[i]){
            if(find(i) == find(b))
                total -= 1;
        }
        printf("%d ",total);
    }

    return 0;
}

Measured memory_bytes: 7424
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;

int main() {
  char s[210];
  fgets(s, sizeof(s), stdin);
  size_t len = strlen(s);
  for (size_t i = 0; i < len; ++i) {
    s[i] = toupper(s[i]);
  }
  printf("%s", s);
}


Measured memory_bytes: 2608
n,k = map(int, input().split())
p = list(map(int, input().split()))

rsum  = [0]*n
for i in range(n):
    rsum[i] = (p[i]+1) / 2
    if(i != 0):
        rsum[i] = rsum[i] + rsum[i-1]

result = 0
if(n == k):
    result = rsum[n-1]
else:
    for i in range(n-k):
        if(result < rsum[i+k] - rsum[i]):
            result = rsum[i+k] - rsum[i]
print(result)

Measured memory_bytes: 25060
#include <stdio.h>
 
int main()
{
    for (;;) {
        int h, w, x, y;
        scanf("%d %d", &h, &w);
        if (h == 0 & w == 0) {
            return 0;
        }
        for (y = 0; y < h; y++) {
            for (x = 0; x < w; x++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}
 

 

Measured memory_bytes: 572
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] e=new int[55556];
		int count=0;
		for(int i=2; i<55556; i++){
			if(e[i]!=-1){
				if(i%5==1){
					count++;
					System.out.print(i+" ");
				}
				if(count==n){
					return;
				}
				int k=i;
				k+=i;
				while(k<55556){
					e[k]=-1;
					k+=i;
				}
			}
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    a*=100; b*=100;
    int T=-1,S=0;
    for(int w=0;w<=f;w+=a){
        for(int w2=0;w+w2<=f;w2+=b){
            for(int s=0;w+w2+s<=f;s+=c){
                for(int s2=0;w+w2+s+s2<=f;s2+=d){
                    if(s+s2<=(w+w2)/100*e&&w+w2&&(T<0||(s+s2)*T>S*(w+w2+s+s2))){
                        S=s+s2; T=w+w2+s+s2;
                        // cout<<T<<" "<<S<<endl;
                    }
                }
            }
        }
    }
    cout<<T<<" "<<S;
    return 0;
}

Measured memory_bytes: 256
//Be Name Khoda
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
const ll M=4e2+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;

typedef bitset<M*M> bst;

bst ned[M];
bst bad;
ll n;
pll a[M*M];
int main()
{
	ios::sync_with_stdio(0);
	ll m;
	cin >> n >> m;
	For(i,0,n) For(j,i,n) bad[i*M+j]=1;
	For(i,n,M) For(j,0,M)
	{
	    bad[i*M+j]=1;
	    bad[j*M+i]=1;
    }
	For(i,0,n) For(j,0,i)
	{
	    ned[i][i*M+j]=1;
	    ned[j][i*M+j]=1;
	}
	For(i,0,m)
	{
	    ll x,y;
	    cin >> x >> y;
	    x--;
	    y--;
	    a[i]={x,y};    
	}
	Ford(i,m-1,0)
	{
	    ll x=a[i].X,y=a[i].Y;
	    bad|=(ned[x]&ned[y]);
	    ned[x]=ned[y]=ned[x]|ned[y];
	}
	RET(M*M-bad.count());
} 

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long n,m;
  cin >> n >> m;
  if(1<min(n,m)) cout << (n-2)*(m-2) << endl;
  else if(n!=m) cout << max(n,m)-2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=2005;
const int inf=1000000000;

int n,m,lef[N][N],rig[N][N],up[N][N];
bool ma[N][N];
char str[N];

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		scanf("%s",str+1);
		for (int j=1;j<=m;j++) ma[i][j]=str[j]=='#'?1:0;
	}
	for (int i=1;i<n;i++)
	
		for (int j=1;j<m;j++)
			ma[i][j]=ma[i][j]^ma[i][j+1]^ma[i+1][j]^ma[i+1][j+1];
	n--;m--;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++) lef[i][j]=ma[i][j]?0:lef[i][j-1]+1;
		for (int j=m;j>=1;j--) rig[i][j]=ma[i][j]?0:rig[i][j+1]+1;
	}
	for (int i=1;i<=m;i++) lef[0][i]=rig[0][i]=inf;
	int ans=max(n+1,m+1);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
		{
			if (ma[i][j]) up[i][j]=0,lef[i][j]=rig[i][j]=inf;
			else
			{
				up[i][j]=up[i-1][j]+1;
				lef[i][j]=min(lef[i][j],lef[i-1][j]);
				rig[i][j]=min(rig[i][j],rig[i-1][j]);
				ans=max(ans,(up[i][j]+1)*(lef[i][j]+rig[i][j]));
			}
		}
	printf("%d",ans);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int large{-1000000}, small{1000000};
  long long sum{};
  for (int i{}; i < n; ++i) {
    int a; cin >> a;
    large = max(large, a);
    small = min(small, a);
    sum += a;
  }
  cout << small << ' ' << large << ' ' << sum << endl;
  return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long int a[n];
  for(int i=0;i<n;++i){
    cin>>a[i];
  }

  sort(a,a+n);

  long long int tem=a[0],c=1,ans=0;

  for(int i=1;i<n;++i){
    //cout<<c<<endl;
    if(a[i]==tem){
      c++;
    }
    else{
      if(c%2==1){
        ans++;
      }
    c=1;
    tem=a[i];
    }
  }
    if(c%2==1){
      ans++;
    }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 5010
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll dp[MAXN][MAXN],f[MAXN],t[MAXN];
int siz[MAXN];
vector<int> a[MAXN];
void dfs(int x,int fa){
	siz[x]=1;
	dp[x][1]=1;
	for(int i=0;i<a[x].size();i++){
		int u=a[x][i];
		if(u==fa)
			continue;
		dfs(u,x);
		for(int j=0;j<=siz[x];j++){
			t[j]=dp[x][j];
			dp[x][j]=0;
		}
		for(int j=0;j<=siz[x];j++)
			for(int k=0;k<=siz[u];k++)
				(dp[x][j+k]+=t[j]*dp[u][k]%MOD)%=MOD;
		siz[x]+=siz[u];
	}
	for(int i=0;i<=siz[x];i+=2)
		dp[x][0]=(dp[x][0]-dp[x][i]*f[i]%MOD+MOD)%MOD;
}
int n,u,v;
int main(){
	SF("%d",&n);
	for(int i=1;i<n;i++){
		SF("%d%d",&u,&v);
		a[u].push_back(v);
		a[v].push_back(u);
	}	
	f[0]=1;
	for(int i=2;i<=n;i+=2)
		f[i]=f[i-2]*(i-1)%MOD;
	dfs(1,0);
	PF("%lld",MOD-dp[1][0]);
}

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

const int maxn = 1e5 + 10;

typedef long long ll;
vector<int>v[maxn];
int dp[maxn];

int dfs(int x)
{
    if(dp[x] != -1)return dp[x];
    int mx = 0;
    for(int i = 0; i < v[x].size(); i++){
        mx = max(mx,1+dfs(v[x][i]));
    }
    return dp[x] = mx;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m; cin >> n >> m;
    int x,y;
    for(int i = 0;i < m;i++){
        cin >> x >> y;
        v[x].push_back(y);
    }
    fill(dp,dp+n+1,-1);
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans,dfs(i));
    }
    cout << ans << endl;
    return 0;
}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int n=sc.nextInt();
			if(n==0){
				break;
			}
			int[] a=new int[n];
			for(int i=0; i<n; i++){
				a[i]=sc.nextInt();
			}
			for(int r=31, i=0;; i=(i+1)%n){
				println(""+r);
				r-=a[i];
				if(r<=0){
					println("0");
					break;
				}
				println(""+r);
				r-=(r-1)%5;
			}
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
<?php
fscanf(STDIN, "%d %d", $N, $M);
$r = [];
$g = array_fill(1, $N, null);
$ans = 0;
$cnt = 0;
for ($i = 0; $i < $M; $i++) {
    fscanf(STDIN, "%d %d", $A, $B);
    $r[$A][$B] = 1;
    $r[$B][$A] = 1;
}
$memo = [];
for ($i = 1; $i <= $N; $i++) {
    // echo "i: {$i}\n";
    if (is_null($g[$i])) {
        $cnt++;
        $g[$i] = $cnt;
    } else {
        continue;
    }
    $stack = [];
    $memo = [];
    $t = $i;
    while(true) {
        if (!isset($r[$t])) break;
        foreach ($r[$t] as $k => $dummy) {
            // echo "k: {$k}\n";
            if (!isset($memo[$k])) {
                // echo "stack: {$k}\n";
                $memo[$k] = 1;
                $stack[] = $k;
                $g[$k] = $cnt;
                // echo "set {$k} is {$cnt}\n";
            }
        }
        if ($stack) {
            $t = array_pop($stack);
        } else {
            break;
        }
    }
    // $stack = [];
    // while(true) {
    //     if (!isset($r[$i])) break;
    //     foreach ($r[$i] as $k => $v) {
    //         if (!isset($memo[$k])) {
    //             echo "stack: {$k}\n";
    //             $memo[$k] = 1;
    //             $stack[] = $k;
    //         }
    //     }
    //     if (!$stack) break;
    //     while($stack) {
    //         $x = array_pop($stack);
    //         if (is_null($g[$x])) {
    //             $g[$x] = $cnt;
    //         }
    //     }
    // }
}
// var_dump($g);
// var_dump(array_count_values($g));
printf("%d", max(array_count_values($g)));

Measured memory_bytes: 114652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  vector<int> t;
  t.pb(a); t.pb(b); t.pb(c);
  sortd(t);
  
  cout << t[0] * 10 + t[1] + t[2] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

vector<vector<PAIR>> edge(101);
int dist[101][101] = {};

void dijkstra(int start){
	priority_queue<PAIR, vector<PAIR>, greater<PAIR>> pq;
	dist[start][start] = 0;
	pq.push({ 0,start });
	while(!pq.empty()){
		int from = pq.top().second;
		pq.pop();
		REP(i, edge[from].size()){
			int to = edge[from][i].first;
			//cout << start << " " << from << " " << to << endl;
			if (dist[start][to] > dist[start][from] + edge[from][i].second) {
				dist[start][to] = dist[start][from] + edge[from][i].second;
				pq.push({dist[start][from] + edge[from][i].second,to});
			}		
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, pair<int, int>>> cab(M);
	REP(i,M){
		int a, b, c;
		cin >> a >> b >> c;
		edge[a].push_back({ b, c });
		edge[b].push_back({ a, c });
		cab[i].first = c; cab[i].second.first = a; cab[i].second.second = b;
	}
	
	REP(i, 101)REP(j, 101) dist[i][j] = 1000000;

	FOR(i, 1, N + 1) {
		//cout << endl;
		dijkstra(i);
	}
	int cnt = M;
	REP(i,M){
		int flag = 0;
		FOR(j,1,N+1){
			if (dist[j][cab[i].second.first] + cab[i].first == dist[j][cab[i].second.second]) {
				flag = 1;
				break;
			}
		}
		cnt -= flag;
	}
	//cout << endl;
	//FOR(i, 1, N + 1) {
	//	FOR(j, 1, N + 1){
	//		cout << dist[i][j] << " ";
	//	}
	//	cout << endl;
	//}
	//cout << endl;
	cout << cnt << endl;
	//cin >> N >> M;
	return 0;
}


Measured memory_bytes: 384
import math
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


D,T,S = LI()
if T < D/S:
    ans = 'No'
else:
    ans = 'Yes'


print(ans)

Measured memory_bytes: 9240
def inputInt():
    return int(input())
def inputIntSplit():
    return list(map(int, input().split()))

INF = pow(10,4)

N = inputInt()
h = inputIntSplit()
DP = [INF] * N
DP[0] = 0
DP[1] = abs(h[0] - h[1])

for i in range(2, N):
    DP[i] = min(abs(h[i] - h[i-1]) + DP[i-1], abs(h[i] - h[i-2]) + DP[i-2])

print(DP[N-1])

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

bool cmp(string a, string b)
{
    if (a < b) return true;
    return false;
}

int main()
{
    string x[1200];

    int n, l;
    cin >> n >> l;

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

    sort(x, x+n, cmp);

    for (int i = 0; i < n; i++) {
        cout << x[i];
    }
}


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

using ll = long long;

const int MAX_N = 2e5+10;
int N, Q;
int a[MAX_N],b[MAX_N],p[MAX_N],x[MAX_N];

long long ans[MAX_N];
vector<int> g[MAX_N];

void dfs(int x, int pre, ll v)
{
	ans[x] += v;
	for(int i=0;i<g[x].size();++i)if(g[x][i]!=pre){
		dfs(g[x][i],x,ans[x]);
	}
}

void solve()
{
	for(int i=0;i<N-1;++i)g[a[i]].push_back(b[i]), g[b[i]].push_back(a[i]);
	for(int i=0;i<Q;++i)ans[p[i]]+=x[i];
	dfs(1,0,0LL);
	for(int i=1;i<=N;++i)cout << ans[i] << " ";
	cout << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> Q;
	for(int i=0;i<N-1;++i){
		cin >> a[i] >> b[i];
	}
	for(int i=0;i<Q;++i){
		cin >> p[i] >> x[i];
	}
	solve();
	return 0;
}

Measured memory_bytes: 30592
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,x[100001],y[100001],a[100001];
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i]>>x[i]>>y[i];
	for(int i=1; i<=n; i++)
		if(x[i]+y[i]>a[i]||(a[i]-x[i]-y[i])%2!=0) {
			cout<<"No";
			goto no;
		}
	cout<<"Yes";
	no:
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <cfenv>
#include <queue>
#include <bits/stdc++.h>
using ll = unsigned long long;
using namespace std;
const ll INF = 7+(1e+22);
typedef ll Weight;
struct Edge {  //src:辺の始点,dst:辺の終点,weight:辺の重さ
  ll src, dst;
  Weight weight;
  Edge(ll src, ll dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : //辺は重さが重いものを"小さい"と定義する
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
//引数 g:隣接リスト,s:始点,dist:各頂点までの距離が入る,prev:最短路木の親頂点が入る
//戻値 なし
void shortestPath(const Graph &g,ll s,vector<Weight> &dist,vector<ll> &prev) {
  ll n = g.size();
  dist.assign(n, INF); dist[s] = 0;
  prev.assign(n, -1);
  priority_queue<Edge> Q;
  Q.push(Edge(-2, s, 0));
  while(!Q.empty()) {
    Edge e = Q.top(); Q.pop();
    if (prev[e.dst] != -1) continue;
    prev[e.dst] = e.src;
    for(auto f=g[e.dst].begin();f!=g[e.dst].end();f++){
      if (dist[f->dst] > e.weight+f->weight) {
        dist[f->dst] = e.weight+f->weight;
        Q.push(Edge(f->src, f->dst, e.weight+f->weight));
      }
    }
  }
}

//引数 prev:最短路木の親頂点集合,t:終点
//戻値 path:sからtへの最短経路
vector<ll> buildPath(const vector<ll> &prev, ll t) {
  vector<ll> path;
  for (ll u = t; u >= 0; u = prev[u])
    path.push_back(u);
  reverse(path.begin(), path.end());
  return path;
}
int main(){
    ll n;
    cin >> n;
    Graph g(n);
   // vector<vector<int>> vec(n,vector<int>(n));
    for(int i=0;i<n-1;i++){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        g[a].push_back(Edge(a,b,c));
        g[b].push_back(Edge(b,a,c));
    }
    ll q,k;
    cin >> q >> k;
  //  cout<<k<<endl;
    k--;
   // cout<<k<<endl;
    vector<Weight> dist;
    vector<ll> prev;
    vector<ll> reg(n);
    shortestPath(g,k,dist,prev);
    
    for(int i=0;i<q;i++){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        cout<<dist[a]+dist[b]<<endl;
    }
}

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

#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF INT_MAX
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )

typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int N=2e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7  ;
ll fact[2010],comp[2010][2010];

void initial(){
  fact[0]=1;
  for(ll i=1;i<=2000;i++){
    fact[i]=(fact[i-1]*i)%mod;
  }
}

ll po(ll a,ll x){
  if(x==0)
    return 1;
  if(x==1)
    return a%mod;
  ll z=po(a,x/2)%mod;
  z=(z*z)%mod;
  if(x&1)
    z=(z*a)%mod;
  return z%mod;
}

ll inv(ll x){
  return po(x,mod-2)%mod;
}

ll  comb(ll n,ll r){
  ll ans=(((fact[n]*inv(fact[r]))%mod)*inv(fact[n-r]))%mod;
  return ans;
}
void work(){
    ll n,k;
    cin >> n >> k;
    initial();
    // cout << fact[5] << " " << po(2,5) << "  " << comb(5,2);
    for(ll i=0;i<=n;i++){
      for(ll j=0;j<=i;j++){
        comp[i][j]=comb(i,j);
      }
    }
    for(ll i=1;i<=k;i++){
      ll x=comp[n-k+1][i],y=comp[k-1][i-1];
      ll ans=(x*y)%mod;
      cout << ans << "\n";
    }
}
int main(){
 ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t,z;
    // cin >> t;
    // z=t;
    t=1;
    while(t--){
            // cout << "Caso" << z-t << "\n";//<< ": ";
            work();
    }
   return 0;

}


Measured memory_bytes: 30208
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int x = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (a == b) {
            x++;
            if (x >= 3) {
                cout << "Yes" << endl;
                return 0;
            }
        } else {
            x = 0;
        }
    }
    cout << "No" << endl;
}


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

using namespace std;

int main ( ) {
    string N;

    cin >> N;

    if (N[0] == N[1] && N[1] == N[2] ) {
        cout << "Yes" << endl;
    }else if (N[1] == N[2] && N[2] == N[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
sentinel = 10 ** 9 + 10 ** 8

X, Y, A, B, C = map(int, input().split())
ps = [sentinel] + sorted(map(int, input().split()), reverse = True)
qs = [sentinel] + sorted(map(int, input().split()), reverse = True)
rs = sorted(map(int, input().split()), reverse = True)

X += 1
Y += 1

red_apples = X
green_apples = Y

while X+Y-red_apples-green_apples < C:
    if rs[X+Y-red_apples-green_apples] > qs[green_apples-1]:
        if qs[green_apples-1] > ps[red_apples-1]:
            red_apples -= 1
        else:
            green_apples -= 1
    elif rs[X+Y-red_apples-green_apples] > ps[red_apples-1]:
            red_apples -= 1
    else:
        break

print(sum(ps[1:red_apples]) + sum(qs[1:green_apples]) + sum(rs[:X+Y-red_apples-green_apples]))


Measured memory_bytes: 23296
#include<cstdio>
#include<cstring>
using namespace std;
int n;
char s[1005];
int main(){
	scanf ("%s",s+1);
	n=strlen(s+1);
	if (n%2==1){
		printf ("No\n");return 0;
	}
	for (register int i=1;i<=n;++i){
        if (i%2==0){
        	if (s[i]!='i'){
        		printf ("No\n");
        		return 0;
			}
		}
		else{
			if (s[i]!='h'){
				printf ("No\n");
				return 0;
			}
		}
	}
	printf ("Yes\n");
	return 0;
}

Measured memory_bytes: 128