akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF = 10000000;
static const int MAXM = 1005;
static const int MAXN = 105;

int main() {
  int N, M; cin >> N >> M;
  int g[MAXN][MAXN];
  rep(i, MAXN) {
    rep(j, MAXN) g[i][j] = (i == j) ? 0 : INF;
  }

  vector<pair<int, int>> p[MAXN][MAXN];
  rep(i, M) {
    int a, b, c; cin >> a >> b >> c;
    a--;
    b--;
    g[a][b] = c;
    g[b][a] = c;
    p[a][b].push_back(make_pair(a, b));
    p[b][a].push_back(make_pair(b, a));
  }


  int no_road = 0;
  rep(i, N) {
    rep(j, i) {
      if (g[i][j] == INF) no_road++;
    }
  }

  
  rep(k, N) {
    rep(i, N) {
      rep(j, N) {

        int cand = g[i][k] + g[k][j];
        if (g[i][j] > cand) {
          g[i][j] = cand;
          p[i][j].erase(all(p[i][j]));
          for (auto x : p[i][k]) {
            p[i][j].push_back(x);
          }
          for (auto x : p[k][j]) {
            p[i][j].push_back(x);
          }
        }

      }
    }
  }


  bool path[MAXN][MAXN];
  rep(i, MAXN) {
    rep(j, MAXN) path[i][j] = false;
  }

  rep(i, N) {
    rep(j, N) {
      for (auto x : p[i][j]) {
        int a = x.first;
        int b = x.second;
        path[a][b] = true;
      }
    }
  }

  int cnt = 0;
  rep(i, N) {
    rep(j, N) {
      if (path[i][j]) cnt++;
    }
  }
  cnt /= 2;

  int ans = (N * (N-1)) / 2 - cnt - no_road;


  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4480
#include <stdio.h>
#include <math.h>

int main()
{
	int n;
	int i,j;
	double X,Y;
	double x[2],y[2],r[2],h;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<2;j++){
			scanf("%lf %lf %lf",&x[j],&y[j],&r[j]);
		}
		X=x[0]-x[1];
		Y=y[0]-y[1];
		if(X<0)X*=-1;
		if(X<0)Y*=-1;
		h=hypot(X,Y);
		if(h+r[1]<r[0])puts("2");
		else if(h+r[0]<r[1])puts("-2");
		else if(h<=r[0]+r[1])puts("1");
		else puts("0");
	}
	return 0;
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
 
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).end()) i=(c).end(); i!=(c).begin(); --i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
 
#define PB(a) push_back(a)
#define PF(a) pop_front(a)
 
#define MP(a,b) make_pair(a,b)
 
#define FS first
#define SE second
 
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
 
//------show vector---------
template <typename T>
void showV(vector < T > a){
  EACH(i,a){
    cerr << *i << ',';
  }  
  cerr << endl;
}
 
//------show matrix---------
template <typename T>
void showVV(vector < vector < T > > a){
  EACH(i,a){
    showV(*i);
  }  
}
//grobal var
//------------------------------------------
LL dp[2000][2000];
vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}

int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int K, X;
  while(cin >> K >> X){
    int ulx, llx;
    llx = X-K+1;
    ulx = X+K;
    
    FOR(i,llx,ulx){
      cout << i << ' ';
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int p=in(),q=in(),i,ans=1,t;
    q/=gcd(p,q);
    t=q;
    for(i=2;i*i<=q;i++){
        if(t%i==0){
            ans*=i;
            while(t%i==0)t/=i;
        }
    }
    if(t)ans*=t;
    print(ans);
    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#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...);
}

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,k;cin>>n>>m>>k;
    //int v1[n+2], v2[m+2];
     std::vector<ll int> v1(n), a((n+2));
     std::vector<ll int> v2(m) , b((m+2));
     for (int i = 0; i < n; ++i)
     {
         cin>>v1[i];
     }
     for (int i = 0; i < m; ++i)
     {
         cin>>v2[i];
     }
	 a[0] = 0, b[0] = 0;
     for (int i = 1; i <= n; ++i)
     {
     	a[i] = (a[i - 1] + v1[i-1]);
		//dump(v1[i]);
     }
	 for (int i = 1; i <= m; ++i)
     {
     	b[i] = (b[i - 1] + v2[i-1]);
		//dump(v2[i]);
     }
	 ll int j = m;
	 ll int ans = 0;
	 for (int i = 1; i <= n; ++i)
	 {
		if(a[i] > k) break;
	    while (b[j] > (k - a[i]) && j >0 )
	    {
	    	j--;
	    }
		ans = max(ans , (i+j));
		//if(j == 0) break
		//error(i,j);
	 }
	 //cout<<"second\n";
	 j = n;
	 for (int i = 1; i <= m; ++i)
	 {
		if(b[i] > k) break;
	    while (a[j] > (k - b[i]) && j >0 )
	    {
	    	j--;
	    }
		ans = max(ans , (i+j));
		//if(j == 0) break
		//error(i,j);
	 }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll N = 1e5 + 5, MOD = 1e9+7;

ll n,flag;
ll h[N],ans;

int main(){

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

    cin>>n;
    for( ll i=1; i<=n; i++ )      cin>>h[i];

    for( ll i=1; i<=n; i++ ){
        flag=0;
        for( ll j=1; j<=i; j++ ){
            if(h[j]>h[i]){
                flag=1;
                break;
            }
        }
        if(!flag)    ans++;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();
        
        int[] B_array = new int[M];
        for(int i = 0; i < M; i++){
            B_array[i] = sc.nextInt();
        }
        
        int ans = 0;
        for(int i = 0; i < N; i++){
            int total = C;
            for(int j = 0; j < M; j++){
                int Aij = sc.nextInt();
                total += Aij * B_array[j];
            }
            if(total > 0){
                ans++;
            }
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }

void _main() {
  string S;
  cin >> S;

  YES(regex_match(S, regex("A?KIHA?BA?RA?")));
}

Measured memory_bytes: 256
import math

n, a, b = map(int, input().split())
mod = 10**9+7

c_all = pow(2,n,mod) - 1

c_a_x = 1
c_a_y = 1
for i in range(a):
    c_a_x = c_a_x * (n-i) % mod
    c_a_y = c_a_y * (i+1) % mod

c_a = c_a_x * pow(c_a_y,mod-2,mod) % mod

c_b_x = 1
c_b_y = 1
for i in range(b):
    c_b_x = c_b_x * (n-i) % mod
    c_b_y = c_b_y * (i+1) % mod

c_b = c_b_x * pow(c_b_y,mod-2,mod) % mod

print((c_all - c_a - c_b) % mod)

Measured memory_bytes: 3064
# XORの性質を覚える必要がある
# 解説動画を"最後まで"みるとわかりやすい

from functools import reduce

A, B = map(int, input().split())

def get(x):
  # 何かしらの法則をみつける
  return [x, 1, x + 1, 0][x % 4]

# XORの性質
print( get(B) ^ get(A - 1) )

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 

int main(void) {
  int n;cin>>n;
  ll ans = 0;
  fr(i,n) {
    ll a;cin>>a;
    while(a%2 ==0) {a/=2; ans++;}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        string s;
        cin >> s;
        int val = 0;
        for(auto &it : s){
            val += (it - '0');
            val %= 9;
        }
        cout << (val ? "No\n" : "Yes\n");
    }
}

Measured memory_bytes: 34776
#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() {
  ll n;
  cin >> n;
  string res;
  while (n > 0) {
    n--;
    res.append(string(1,'a'+n%26));
    n = n/26;
  }
  reverse(res.begin(),res.end());
  cout << res << endl;
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;


int main() {
  string s, t;
  cin >> s >> t;
 int count = 0;
 rep (i, s.size()) {
   if (s.at(i) != t.at(i)) {
     count++;
   }
 }
 cout << count << endl;
}


Measured memory_bytes: 3856
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int s = a*b;
		int l = 2*a+2*b;
		System.out.println(s+" "+l);
	}
}


Measured memory_bytes: 26132
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner s = new Scanner(System.in);
	int H = s.nextInt();
	int W = s.nextInt();

	while(H != 0 || W != 0){
	    for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
		    if((i + j) % 2 == 0) System.out.print("#");
		    else System.out.print(".");
		}
		System.out.println();
	    }
	    System.out.println();

	    H = s.nextInt();
	    W = s.nextInt();
	}
    }
}



Measured memory_bytes: 35236
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

ll cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ld r;
    cin >> r;

    cout << fixed << setprecision(10) << r * 2.0 * M_PI << endl;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b;
    int d, e;
    cin >> d >> e;
    cin >> c;
    if (a == c)
        cout << d - 1 << " " << e << endl;
    if (b == c)
        cout << d << " " << e - 1 << endl;
    return 0;
}


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

int main() {
  ll N;
  cin >> N;
  string s;
  while (N > 0) {
    ll q = N % 26;
    if (q == 0) q = 26;
    s += 96+q;
    N = (N-q)/26;
  }
  reverse(s.begin(),s.end());
  cout << s << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define sz(v) (ll)v.size()
#define inf 100000000000000
#define vll vector<ll>
#define pll pair<ll,ll>nnnn
using namespace std;
const int N=200004;
ll a[N],vis[N],tim,in[N],out[N];
vll adj[N];
void dfs(ll r)
{
	vis[r]=1;
	in[r]=++tim;
	for(auto it:adj[r])
		if(!vis[it])
			dfs(it);
	
	out[r]=tim;
}
void solve()
{
	ll n,q,u,v,i,x,y;
	cin>>n>>q;
	for(i=1;i<n;i++)
	{
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	dfs(1);
	
	while(q--)
	{
		cin>>x>>y;
		a[in[x]]+=y;
		a[out[x]+1]-=y;
	}
	for(i=2;i<=n;i++)
		a[i]+=a[i-1];
	for(i=1;i<=n;i++)
		cout<<a[in[i]]<<" ";
	


}
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

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

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

    if (n % 3 == 0) 
    {
        n /= 3;
        if (a[0] == a[n - 1] && a[n] == a[2 * n - 1] && a[2 * n] == a[3 * n - 1] && (a[0] ^ a[n] ^ a[2 * n]) == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        if (a[n - 1] == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
        return 0;
        
    }
    
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	lint N;
	cin >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	lint Q;
	cin >> Q;
	lint b, e, k;
	lint cnt = 0;
	rep(i, Q) {
		cnt = 0;
		cin >> b >> e >> k;
		for (int i = b; i < e; i++) {
			if (A[i] == k) {
				cnt++;
			}
		}
		cout << cnt << endl;
	}
}




Measured memory_bytes: 3104
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, W, dp[N], x, y;
	cin >> n >> W;
	for (int i=1; i<=1e5; i++) {
        dp[i] = INT_MAX;
	}
	for (int i=1; i<=n; i++) {
        cin >> x >> y;
        for (int j=1e5-y; j>=0; j--) {
            if (dp[j] != INT_MAX && dp[j]+x <= W) dp[j+y] = min(dp[j] + x, dp[j+y]);
        }
        dp[y] = min(dp[y], x);
	}
	int ans = 0;
	for (int i=1; i<=1e5; i++) {
        if (dp[i] != INT_MAX) ans = i;
	}
	cout << ans;
    return 0;
}


Measured memory_bytes: 640
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
string strLeft(string strOrigin, long long nCount){
	if (nCount >= strOrigin.length()) return strOrigin;
	long long i;
	string ans("");
	if (strOrigin.length() == 0){
		return ans;
	}
	if (nCount == 0){
		return ans;
	}
	for (i = 0; i <= nCount - 1; ++i){
		ans += strOrigin[i];
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
	string sInput;
	getline(cin, sInput);
	cout << strLeft(sInput, sInput.length() - 8) << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;

typedef struct r {

  char team;
  int win;
  int lose;

} record;

int comp(const void* c1,const void* c2) {

  r t1=*(r*)c1;
  r t2=*(r*)c2;

  if(t1.win==t2.win) return t1.lose-t2.lose;

  else return t2.win-t1.win;

}

int main() {

  int n;
  char t;

  record rec[10];

  int temp;


  while(cin >> n) {

    if(n==0) break;

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

      cin >> t;
      
      rec[i].team=t;
      
      rec[i].win=rec[i].lose=0;
   
      for(int j=0;j<n-1;j++) {

	cin >> temp;

	switch(temp) {

	case 0:
	  rec[i].win++;
	  break;

	case 1:
	  rec[i].lose++;
	  break;

	}

      }

      //cout << rec[i].team << " " << rec[i].win << " " << rec[i].lose << endl;

    }

    qsort(rec,n,sizeof(r),comp);

    for(int i=0;i<n;i++) cout << rec[i].team << endl;

  }

  return 0;

}

Measured memory_bytes: 0
N,M = list(map(int, input().split()))
cakes = []
for i in range(N):
    cakes.append(list(map(int, input().split())))

ans = 0

for i in range(8):
    values = []
    for cake in cakes:
        value = 0
        for j in range(3):
            if (i >> j) % 2 == 1:
                value -= cake[j]
            else:
                value += cake[j]
        values.append(value)
    values.sort()
    values = values[::-1]
    ans = max(ans, sum(values[:M]))

print(ans)
    

Measured memory_bytes: 3316
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = LongArray(N)
    (1..N).forEach {
        A[it-1] = readLine()!!.toLong()
    }


    val set = mutableSetOf<Long>()
    A.forEach {
        if (set.contains(it)) {
            set.remove(it)
        } else {
            set.add(it)
        }
    }

    println(set.size)
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    string A;
    cin >> A;

    const i64 len=A.size();
    i64 count[26]={};
    rep(i,0,len) ++count[A[i]-'a'];

    i64 ans=len*(len+1)/2+1;
    rep(i,0,26) ans-=count[i]*(count[i]+1)/2;
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        sc.close();

        int ans = 0;
        if (A < 2 * B) {
            System.out.println(ans);
        } else {
            System.out.println(A - 2 * B);
        }
    }
}


Measured memory_bytes: 23124
program abc17
 implicit none
 integer::K,N,i,ia,s
 integer,allocatable::a(:),b(:)
 read(*,*)K,N
 allocate(a(N),b(N))
 read(*,*)(a(i),i=1,N)
 do ia=1,N-1
  b(ia)=a(ia+1)-a(ia)
 end do
 b(N)=K-a(N)+a(1)
 s=sum(b)-maxval(b)
 print'(i0)',s
end program abc17

Measured memory_bytes: 4572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
const int mod=1e9+7;
ll fac[maxn]={1},ifac[maxn];
ll fastpow(ll a,ll b) {
	ll ans=1;
	for(;b;b>>=1,a=a*a%mod) if(b&1) ans=ans*a%mod;
	return ans;
}
inline void init() {
    for(int i=1;i<maxn;i++) fac[i]=fac[i-1]*i%mod;
    ifac[maxn-1]=fastpow(fac[maxn-1],mod-2);
    for(int i=maxn-2;i>=0;i--) ifac[i]=ifac[i+1]*(i+1)%mod;
}
inline ll C(int n,int m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
inline ll A(ll n,ll m) {
	return fac[n]*ifac[n-m]%mod;
}
int main() {
	init();
    ll n,m,ans=0;cin>>n>>m;
    for(int i=0;i<=n;i++) {
    	ans=(ans+C(n,i)*A(m-i,n-i)%mod*(i%2?-1:1))%mod;
    }
    cout<<(ans+mod)%mod*A(m,n)%mod<<endl;
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  vector<int> x(999);
  x.at(0) = 1;
  for(int i = 1; i < 999; i++){
    x.at(i) = x.at(i - 1) + i + 1;
  }
  
  cout << x.at(b - a - 1) - b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl            "\n"
#define ll                long long
#define all(v)            ((v).begin()), ((v).end())
#define sz(v)            ((int)((v).size()))
#define clr(v, d)        memset(v, d, sizeof(v))
#define rep(i, v)        for(int i=0;i<sz(v);++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)
#define vi                vector <int>
#define vl                vector <ll>
#define ii                pair <ll,ll>
#define vii                vector <ii>
const double PI = 2 * acos(0.0);
void run() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
}
const int M = 3 * 1e3;
int n;
vector<double> p;
double dp[M + 3][M + 3];
double sol(int i, int cnt) {
	if (i == n)
		return (cnt > (n / 2));
	double &ret = dp[i][cnt];
	if (ret != -1)
		return ret;
	return ret = p[i] * sol(i + 1, cnt + 1) + (1 - p[i]) * sol(i + 1, cnt);
}
int main() {
	run();
	cin >> n;
	p.resize(n);
	cout << fixed << setprecision(12);
	lp(i,n)
		cin >> p[i];
	//clr(dp, -1);
	lp(i,M+3)
	{
		lp(j,M+3)
			dp[i][j] = -1;
	}
	cout << sol(0, 0);
}


Measured memory_bytes: 70912
N = int(input())
D = list(map(int, input().split()))

if D[0] != 0:
    print(0)
    exit()
    
del D[0]
D = sorted(D)

length = 1
length_list = []
count = 0
for i in range(len(D)):
    if length == D[i]:
        count += 1
    else:
        if length+1 != D[i]:
            print(0)
            exit()
        else:
            length += 1
            length_list.append(count)
            count = 1
length_list.append(count)
        
ans = 1
for i in range(len(length_list)-1):
    ans *= length_list[i] ** length_list[i+1]
    ans %= 998244353


print(ans)

Measured memory_bytes: 14396
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
    long long D,T,S;
    cin>>D>>T>>S;
    if (T*S<D) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define F first
#define S second
#define en "\n"
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;



template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	cin >> n;
	map<ll, ll>mp;

	bool flag = true;
	REP(i, n) {
		ll a;
		cin >> a;
		if (mp.find(a) == mp.end()) mp[a]++;
		else flag = false;
	}

	cout << ((flag) ? "YES" : "NO") << endl;

	return 0;
}


Measured memory_bytes: 12800
import math
a,b,x=map(int,input().split())
x=x/a
c=b/2
if x<=a*c:
    d=2*x/b
    print(round(math.degrees(math.atan(b/d)),10))
elif x==a*b:
    print(0)
else:
    x=a*b-x
    d=2*x/a
    print(round(90-math.degrees(math.atan(a/d)),10))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main() {
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i=0;i<n;i++) {
		cin>>a[i]>>b[i]>>c[i];
	}
	vector<vector<int>> dp(n,vector<int> (3)); // 3 states for 3 types of vacation jobs
	dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
	for(int i=1;i<n;i++) {
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + c[i];
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	
}


Measured memory_bytes: 9852
from collections import Counter

def c2(a):
    if a <= 1:
        return 0
    return a * (a - 1) / 2

def solve(arr):
    cum = [0]
    s = 0
    for i in arr:
        s += i
        cum.append(s)

    return int(sum(c2(v) for k, v in Counter(cum).items()))

input()
print(solve([int(i) for i in input().split()]))


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

#define int long long
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)

int H, W, M;
int numH[300010], numW[300010];
vector<int> vW[300010];
vector<int> vH[300010];

signed main()
{
    cin >> H >> W >> M;
    rep(i, M)
    {
        int h, w;
        cin >> h >> w;
        numH[h]++;
        numW[w]++;
        vW[w].push_back(h);
    }

    int maxW = -1;
    for(int i = 1; i <= 300000; i++)
        maxW = max(maxW, numW[i]);

    int num = 0;
    for(int i = 1; i <= 300000; i++)if(numW[i] == maxW)
    {
        num++;
        for(auto e : vW[i])vH[e].push_back(i);
    }

    int ans = 0;
    for(int i = 1; i <= 300000; i++)
    {
        int tmp;
        if(vH[i].size() == num)tmp = numH[i] + maxW - 1;
        else tmp = numH[i] + maxW;
        ans = max(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 41096
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  cout << n * n << endl;
}

Measured memory_bytes: 3580
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
typedef long long int ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
ll n, k, ans = 0, h, w;
int main() {
	cin >> h >> w; vector<vector<char>> a(h, vector<char>(w));
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
		}
	}vector<vector<int>> dp(h, vector<int>(w));
	dp[0][0] = 1;
	req(i, h -1) {
		if (a[i][0] == '#') dp[i][0] = 0;
		else dp[i][0] = dp[i - 1][0];
	}
	req(i, w - 1) {
		if (a[0][i] == '#') dp[0][i] = 0;
		else dp[0][i] = dp[0][i - 1];
	}
	req(i, h - 1) {
		req(j, w - 1) {
			if (a[i][j] != '#') dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			else dp[i][j] = 0;
		}
	}cout << dp[h - 1][w - 1] << endl;
}

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

int main(void)
{
	int n, k;
	cin >> n >> k;
	
	int x, y;
	for (int i = 0; i < k; i++){
		cin >> x >> y;
		int tmp = min(min(x, y), min(n - x + 1, n - y + 1));
//		cout << x << " " << y << " " << n - x + 1 << " " << n - y + 1 << endl;
		if (tmp % 3 == 1) puts("1");
		if (tmp % 3 == 2) puts("2");
		if (tmp % 3 == 0) puts("3");
	}
	
	return 0;
}

Measured memory_bytes: 0
N, K = map(int, input().split())

flag = True
check = []
a = 1
while flag:
    check.append(a)
    a *= 2
    if a >= 10 ** 5:
        flag = False
        
ans = 0
for i in range(1, N+1):
    count = 0
    for j in check:
        if j * i >= K:
            break
        count += 1
    ans += 1 / N * 0.5 ** count
print(round(ans, 12))

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
  int N;
  double A,S=0.0;
  scanf("%lld",&N);
  for(int i=1;i<=N;i++){
    scanf("%lf",&A);
    S+=1.0/A;
  }
  printf("%lf\n",1.0/S);
  return 0;
}


Measured memory_bytes: 1728
import sys
from collections import defaultdict

def main():
    input = sys.stdin.readline
    d = defaultdict(lambda: 0)
    N, M = map(int, input().split())
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] += 1
        d[b] += 1

    for i in range(N):
        print(d[i+1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
N = int(input())
nums = [int(input()) for _ in range(N)]
 
all_max = max(nums)
 
new_nums = list(nums)
new_nums.remove(all_max)
 
second_max = max(new_nums)  # max関数はfor文の中にいれずに、先に2番目の最大値をもとめておく
 
for i in range(N): #indexをまわしているので、iとおく
    if nums[i] == all_max: 
        print(second_max)
    else:
        print(all_max)

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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	int N;
	cin >> N;
	vector<LL> A(N);
	cin >> A;
	for (int i : range(N)) {
		A[i] -= i + 1;
	}
	sort(ALL(A));
	LL ret = 0;
	for (int i : range(N)) {
		ret += abs(A[i] - A[N / 2]);
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
    int a[1000],b[1000],j,k,l;
    int i=0;
    while(1){
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0 && b[i]==0){
            break;
            }
        i++;
        }
    for(j=0;j<i;j++){
        for(k=0;k<a[j];k++){
            for(l=0;l<b[j];l++){
                printf("#");
            }
            printf("\n");
    }
    printf("\n");
    
}    
    return 0;
}
    


Measured memory_bytes: 2100
import scala.io.Source.stdin

object Main extends App {
  var b = new StringBuilder

  for(d<-stdin.getLines.map(_.toInt)) {
    var (j,s) = (0,0)

    while((j-1)*d < 600-d) {
      s += j*j
      j += 1
    }
    b.append(s*d*d*d+"\n")
  }

  print(b.result)
}

Measured memory_bytes: 43860
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{//??´???
  L(const P &a, const P &b){
    push_back(a);push_back(b);
  }
};

struct C{//???
  P c; double r;
  C(const P &c,double r): c(c),r(r){}
};

namespace std{//??????????????????
  bool operator < (const P& a,const P& b){
    return real(a)!= real(b) ? real(a) < real(b) : imag(a) < imag(b);
    //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b)
  }
  bool operator == (const P& a,const P& b){
    return a.real()==b.real()&&a.imag()==b.imag();
  }
}

double dot(P a,P b){
  return real(conj(a)*b);
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

int ccw(P a, P b, P c){
  b-=a;c-=a;
  if(cross(b,c)>0)   return +1;// counter clockwise 
  if(cross(b,c)<0)   return -1;// clockwise 
  if(dot(b,c)<0)     return +2;// c-a-b on line
  if(norm(b)<norm(c))return -2;// a-b-c on line
  return 0;                    // a-c-b on lone
}

P projection(P p1, P p2, P p){//p???p1p2???????°???±????????????
  return dot(p2-p1,p-p1)/norm(p2-p1)*(p2-p1);
}

P reflection(P p1,P p2, P p){//p1p2?????¢??????????§°??????
  return p-2.0*(p-p1)+2.0*projection(p1,p2,p);
}

int main()
{
  double xp1,yp1,xp2,yp2;
  int q;
  int i,j;

  cin>>xp1>>yp1>>xp2>>yp2;
  cin>>q;

  P p1(xp1,yp1),p2(xp2,yp2);

  rep(i,q){
    double xp,yp;
    cin>>xp>>yp;
    P p(xp,yp);
    P ans=reflection(p1,p2,p);
    printf("%.10f %.10f\n",ans.real(),ans.imag());
  }

}

Measured memory_bytes: 3252
#include <stdio.h>
#include<stdlib.h>
#include <string.h>
#define MAX 10000000

struct  node {
	int  key;
	struct node *parent;
	struct node *right;
	struct node *left; 
} ;
typedef struct node * Node;

Node root, noParent;

Node serch(Node t, int n){
	while (t != noParent && n != t->key) {
		if(n < t->key) t = t->left;
		else t = t->right;
	}
	return t;
}

void insert (int k) {
	 Node y = noParent;
	 Node x = root;
	 Node z;
	
	z = malloc(sizeof(struct node));
	z->key = k;
	z->left = noParent;
	z->right = noParent;
	
	while(x != noParent){
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
		z->parent = y;
		
		if(y == noParent) {
			root = z;
		} else {
			if (z->key < y->key) {
				y->left = z;
			} else y->right = z;
	}
}

void inorder (Node x){
	if(x == noParent) return;
	inorder(x->left);
	printf(" %d",x->key);
	inorder(x->right);
}

void preorder (Node x){
	if(x == noParent) return;
	printf(" %d",x->key);
	preorder(x->left);
	preorder(x->right);
}

int main(){
  int i,n,a;
  Node x;
  char sentence[20];

	scanf("%d", &n);
	for(i=0;i < n;i++){
		scanf("%s",sentence);
		if( strcmp(sentence, "find") == 0) {
			scanf("%d",&a);
			x = serch(root, a); 
			if(x != noParent) printf("yes\n");
			else printf("no\n");
		} else if( strcmp(sentence, "insert") == 0) {
			scanf("%d",&a);
			insert(a);
		} else if(strcmp(sentence,"print") == 0) {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}	
	return 0;
}


Measured memory_bytes: 20456
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	String a=sc.next(),b=sc.next(),c=sc.next();
    if(a.substring(a.length()-1,a.length()).equals(b.substring(0,1))&&b.substring(b.length()-1,b.length()).equals(c.substring(0,1))){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define ll long long int
#define l(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
int main(){
	ll n,a,b,calc=0;
	cin>>n>>a>>b;
	calc = b/n;
	calc*=n;
	if(a<=calc) cout<<"OK\n";
	else cout<<"NG\n";
}

Measured memory_bytes: 3588
import collections
import math

def func(n):
    ans = math.factorial(n)//((math.factorial(n-2))*math.factorial(2))
    return ans

N = int(input())
a = input().split()
ans = dict(collections.Counter(a))
sums = 0
for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
            
for j in range(N):  
    print(sums-(ans[a[j]]-1))


Measured memory_bytes: 109004
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
struct SegTree {
    int N;
    vector<pair<int, int>> A;
    SegTree(int n) {
        N = 1;
        while (N < n) N *= 2;
        A.resize(2 * N);
        for (int i = 0; i < N; i++) {
            A[N + i] = make_pair(INF, i);
        }
        for (int i = N - 1; i > 0; i--) {
            A[i] = min(A[2*i+0], A[2*i+1]);
        }
    }
    void set(int idx, int val) {
        auto p = make_pair(val, idx);
        idx += N;
        A[idx] = p;
        idx /= 2;
        while (idx > 0) {
            A[idx] = min(A[2*idx+0], A[2*idx+1]);
            idx /= 2;
        }
    }
    pair<int, int> minrange(int L, int R) {
        pair<int, int> ans = make_pair(INF, -1);
        L += N, R += N;
        while (L < R) {
            if (R & 1) ans = min(ans, A[--R]);
            if (L & 1) ans = min(ans, A[L++]);
            R /= 2, L /= 2;
        }
        return ans;
    }
};
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    string S; cin >> S;
    SegTree st(N + 1);
    vector<int> prev(N + 1);
    st.set(0, 0);
    for (int i = 1; i <= N; i++) {
        if (S[i] == '1') continue;
        auto p = st.minrange(max(0, i - M), i);
        st.set(i, p.first + 1);
        prev[i] = p.second;
    }
    if (st.minrange(N, N + 1).first == INF) {
        cout << "-1\n";
    } else {
        vector<int> A;
        int curr = N;
        while (curr > 0) {
            A.push_back(curr - prev[curr]);
            curr = prev[curr];
        }
        reverse(begin(A), end(A));
        for (int i = 0; i < A.size(); i++) {
            cout << A[i] << " \n"[i == A.size() - 1];
        }
    }
    return 0;
}

Measured memory_bytes: 3528
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc077_a.cpp
 * time   : Wed Apr 29 22:34:26 2020
 * quest  : A - Rotation
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  char a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  if (f == a && e == b && c == d)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;

ll a,b;

ll check(ll i)
{
    ll ans=0;
    if (b/i!=a/i)
    {
        ans=((b/i)-(a/i)-1)*i/2;
        if (a%i<i/2) ans+=i/2;
            else ans+=i-1-a%i+1;
        if (b%i>=i/2) ans+=b%i-i/2+1;
    }
    else
    {
        if (b%i>=i/2) ans+=b%i-i/2+1;
        if (a%i>=i/2) ans-=a%i-i/2;
    }
    return ans%2;
}
    

int main()
{
    cin>>a>>b;
    ll ans=0;
    for (ll i=2; i<longinf; i=i*2)
    {
        ans+=i/2*check(i);
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    set<int> se;
    for(int i = 0; i < 3; i++) {
        int a;
        cin >> a;
        se.insert(a);
    }
    cout << se.size() << endl;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
vi g[100010];
int gr[100010];

int dfs(int v, int p)
{
	for (int to : g[v]) if (to != p) {
		gr[v] ^= (dfs(to, v) + 1);
	}
	return gr[v];
}

int main() {
	cin >> N;

	rep(i, N-1) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].pb(b);
		g[b].pb(a);
	}

	puts(dfs(0, -1) == 0 ? "Bob" : "Alice");

	return 0;
}

Measured memory_bytes: 10752
import string
import sys

sent = sys.stdin.read()
sent = sent.lower()
#print(sent)
results = {let: sent.count(let) for let in set(sent)}
alphas = [chr(ord('a') + i) for i in range(26)]

for a in alphas:
    if a not in results:
        print("{} : {}" .format(a, 0))
    else:
        print("{} : {}" .format(a, results[a]))



Measured memory_bytes: 6680