akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

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

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int n, m;
map<string, ll> mp;

int main() {
  while(true) {
    cin >> n;
    if (n == 0) break;
    rep(i, n) {
      string s; ll t;
      cin >> s >> t;
      mp[s] = t;
    }

    cin >> m;
    rep(i, m) {
      int ti;
      string s;
      ll res=0;
      cin >> s >> ti;
      rep(j, ti) {
        string st;
        cin >> st;
        res += mp[st];
      }
      mp[s] = min(res, mp[s]);
    }

    string ress;
    cin >> ress;
    cout << mp[ress] << endl;
  }
  
  return 0;
}

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

long long N;
string S;
int P;

long long solve() {
    if (P == 2 || P == 5) {
        long long res = 0;
        for (int i = 0; i < N; ++i) if ((S[N-i-1]-'0') % P == 0) res += N-i;
        return res;
    }
    vector<long long> val(P, 0);
    long long tenfactor = 1;
    long long cur = 0;
    val[cur]++;
    for (int i = 0; i < N; ++i) {
        cur = (cur + (S[N-i-1]-'0') * tenfactor) % P;
        tenfactor = (tenfactor * 10) % P;
        val[cur]++;
    }
    long long res = 0;
    for (int p = 0; p < P; ++p) res += val[p] * (val[p] - 1) / 2;
    return res;
}

int main() {
    cin >> S;
  	N = S.size();
	P = 2019;
    cout << solve() << endl;
}

Measured memory_bytes: 3696
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> p_i;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)
#define srt(vec) sort(vec_all(vec))

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    int n;
    cin >> n;
    int cnt_odd = 0;
    int cnt_4 = 0;
    int tmp;
    rep(i, n) {
        cin >> tmp;
        if (tmp % 4 == 0) {
            cnt_4++;
        }

        if (tmp % 2 == 1) {
            cnt_odd++;
        } 
    }

    if (cnt_4 >= n / 2 || cnt_4 >= cnt_odd) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    
    long long h;
    cin >> h;
    long long ans = 0;
    long long cnt = 1;
    while (h > 1) {
        h = h / 2;
        ans += cnt;
        cnt*=2;
    }
    ans += cnt;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  ll c=0;
  vector<vector<double>>vec(a,vector<double>(b));
  for(ll i=0;i<a;i++){
    for(ll j=0;j<b;j++){
      cin>>vec.at(i).at(j);
    }
  }
  for(ll i=1;i<a;i++){
    for(ll j=0;j<i;j++){
      double d=0;
      for(ll k=0;k<b;k++){
        
        d+=(vec.at(i).at(k)-vec.at(j).at(k))*(vec.at(i).at(k)-vec.at(j).at(k));
      }
      double e=sqrt(d);
      ll f=sqrt(d);
      if(e==f){
        c+=1;
      }
    }
  }
  cout<<c<<endl;
  return 0;
      
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<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; }

bool vis[500][500];
lli dd[500][500];

void func(long long H, long long W){

    lli ans = 0;

    REP(i,0,H)REP(j,0,W){
        if(vis[i][j])continue;
        queue<lli> qi,qj;
        qi.push(i);
        qj.push(j);
        vis[i][j]=true;
        lli c1=0,c2=0;
        while(qi.size()){
            lli topI = qi.front();
            lli topJ = qj.front();
            qi.pop();
            qj.pop();
            if(dd[topI][topJ])c1++;
            else c2++;
            lli di[4]={-1,0,1,0};
            lli dj[4]={0,1,0,-1};
            REP(k,0,4){
                lli ni = topI+di[k];
                lli nj = topJ+dj[k];
                if(ni < 0 || ni >= H || nj < 0 || W<=nj)continue;
                if(dd[topI][topJ] == dd[ni][nj])continue;
                if(vis[ni][nj])continue;
                qi.push(ni);
                qj.push(nj);
                vis[ni][nj]=true;
            }
        }
        ans += c1*c2;
    }

    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);

    REP(i,0,H)REP(j,0,W){
        char c;
        cin>>c;
        if(c=='#')dd[i][j]=1;
    }
    func(H, W);
    return 0;
}


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

int main() {
  ll N,sum=0;
  cin >> N;
  vector<ll> A(N),B(N,0),C(N,0),D(N,0);
  rep(i,N) {
    cin >> A[i];
    B[A[i]-1]++;
  }
  rep(i,N){
    if(B[i]>1) {
      C[i]=B[i]*(B[i]-1)/2;
      sum += C[i];
    }
    if(B[i]>2) D[i]=(B[i]-1)*(B[i]-2)/2;
  }
  rep(i,N){
    ll ans=0;
    ans = sum - C[A[i]-1] + D[A[i]-1];
    cout << ans << endl;
  }
  
  return 0;
}


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

int pow(int a, int n) {
	if (n <= 0) return 0;
	if (n == 1) return a;
	return(pow(a, n - 1) * a);
}

int tri_rev(int t, int n) {
	if (t / n == 0) return t;
	int x = (t % (n * 3)) / n;
	int y = (x == 1) ? 2 : ((x == 2) ? 1 : 0);
	return tri_rev(t - x * n + y * n, n * 3);
}

void readRS(const char* p, vector<int> &RS) {
	RS.clear();
	int sw = 0;
	int c = 1;
	bool f = true;
	while (f) { // R = 82 = 平行移動, S = 83 = 3置換
		if (*p == sw) {
			c++;
		}
		else {
			if (sw == 83) {
				if (c % 2 == 1) {
					RS.push_back(-1);
				}
			}
			else if (sw == 82) {
				for (int i = 0; i < c; i++) { RS.push_back(1); }
			}
			c = 1;
			sw = *p;
		}
		if (*p == '\0') break;
		p++;
	}

}

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

	// readRS
	string s;
	cin >> s;
	vector<int> RS(200001,0); // 1 = 平行移動, -1 = 3置換
	readRS(s.c_str(), RS);

	// swap set	作成
	vector<int> SW(pow(3, N), 0);
	for (int i = 0; i < pow(3, N); i++){
		if(SW[i] == 0){
			int j = tri_rev(i, 1);
			SW[i] = j;
			SW[j] = i;
		}
	}


	vector<int> P0(1,0); // 前のlvの到達点を入れる。P0[i] = iの最終到達点。初期値はlv=0で、P0[0]=0のみ。
	vector<int> W0(RS.size() + 1, 0); // RSの各点に置いて、最後の座席に座っている人のIDを取っておく。lv = 0ならばW0[k] = 0 for all k
								 // W0[0] = 一度もRSをしていない状態での、最後の席の人のID = 3^lv -1
								 // W0[RS.size()-1] = 最後のRSをする直前の、最後の座席の人のID
	for (int lv = 1; lv <= N; lv++) {
		// 初期化
		// 3^lv の世界を作る
		int M = pow(3, lv); // 座席数＝人数
		int m = M / 3; // 一つ前のlvのm
		vector<int> P1(M, 0); // 最終到達点を入れる
		vector<int> W1(RS.size() + 1, 0); // k回目の操作のあとに最終座席にいる人のIDを入れる。
		map<int,int> D0, D1, D2; // 全員の最大digitを入れて、k回の操作で更新していく。Dxに入っているidは、最大digitがx

		// D初期値
		for (int i = 0; i < m; i++) {
			D0.insert(pair<int, int>(i, i));
			D1.insert(pair<int, int>(i, i + m));
			D2.insert(pair<int, int>(i, i + 2 * m));
		}

		// D更新, W1記録
		W1[0] = M - 1;
		for (int k = 0; k < RS.size(); k++) {
			// Dの更新
			if (RS[k] == -1) {
				// 3置換: Dは1 -> 2, 2 -> 1
				D1.swap(D2);
			}
			else {
				// 平行移動 繰り上がりだけ処理する。
				int i = D2[W0[k]];
				D2[W0[k]] = D1[W0[k]];
				D1[W0[k]] = D0[W0[k]];
				D0[W0[k]] = i;
			}
			// W1[k+1] の作成。W1[k+1]は、2,W0[k+1]の人。
			W1[k + 1] = D2[W0[k + 1]];
		}
		// 最後まで到達した
		for (auto it = D0.begin(); it != D0.end(); it++) {
			P1[it->second] = P0[it->first];
		}
		for (auto it = D1.begin(); it != D1.end(); it++) {
			P1[it->second] = P0[it->first] + m;
		}
		for (auto it = D2.begin(); it != D2.end(); it++) {
			P1[it->second] = P0[it->first] + 2 * m;
		}

		// 次のレベルへ
		P0.swap(P1);
		W0.swap(W1);
	}

	// out
	for (int i = 0; i < pow(3, N); i++) {
		cout << P0[i] << " ";
	}
	cout << endl;
	return(0);
}


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


typedef long long ll;
typedef pair<ll, ll> P;

struct edge {int to, cost; };

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

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

ll LCM(ll a, ll b){
  if(a<b) swap(a,b);
  return a/GCD(a,b)*b;
}

int main(){
  string s, t;
  cin >> s >> t;
  int ans = 0;
  int n=s.length(), m=t.length();
  for(int i=0; i<n-m+1; i++){
    int tmp = 0;
    for(int j=0; j<m; j++){
      if(s[i+j]==t[j]) tmp++;
    }
    ans = max(ans, tmp);
  }
  ans = m-ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();

        Map<String, String> map = new HashMap<>();
        map.put("A", "T");
        map.put("T", "A");
        map.put("C", "G");
        map.put("G", "C");

        System.out.println(map.get(a));
    }
}


Measured memory_bytes: 20052
using System;

namespace B___Palindrome_philia
{
    class Program
    {
        static void Main (string[] args)
        {
            var s = Console.ReadLine ();
            var n = s.Length;
            var ans = 0;
            if (n % 2 == 0)
            {
                for (var i = 0; n / 2 + i < n; i++)
                {
                    if (s[n / 2 - 1 - i] != s[n / 2 + i])
                    {
                        ans++;
                    }
                }
            }
            else
            {
                for (var i = 1; n / 2 + i < n; i++)
                {
                    if (s[n / 2 - i] != s[n / 2 + i])
                    {
                        ans++;
                    }
                }
            }
            Console.WriteLine (ans);
        }
    }
}

Measured memory_bytes: 13140
n = int(input())
s = input()
wcount = 0
wecount = 0
prev = ""
for c in s:
    if c == "W":
        if prev == "E": wcount = 0
        wcount += 1
    if wcount and c == "E":
        wcount -= 1
        wecount += 1
print(wecount)


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

using namespace std;


int main() {

	int N, M,tmp;
	const int at = pow(10,9)+7;
	cin >> N >> M;
	vector<int>dp(N+1),br(N+1,1);
	for (size_t i = 0; i < M; i++)
	{
		cin >> tmp;
		br.at(tmp) = 0;
	}
	dp.at(0) = 1;
	dp.at(1) = 1 * br.at(1);
	for (size_t i = 2; i < N+1; i++)
	{
		dp.at(i) = (dp.at(i - 2) % at + dp.at(i - 1) % at)%at * br.at(i);
	}
	cout << dp.at(N);
}


Measured memory_bytes: 1024
#include <cstdio>
#include <map>
#include <deque>

const int N = 1000010;

int cnt;

std::map<int, int> mp[N];

struct Edge {
    int v, nex, len;
}edge[N << 2]; int top;

int e[N], dis[N], vis[N];

inline int get(int x, int type, int &f) {
    if(mp[x][type]) {
        f = 0;
        return mp[x][type];
    }
    f = 1;
    return mp[x][type] = ++cnt;
}

inline void add(int x, int y, int z) {
    ++top;
    edge[top].v = y;
    edge[top].len = z;
    edge[top].nex = e[x];
    e[x] = top++;
    edge[top].v = x;
    edge[top].len = z;
    edge[top].nex = e[y];
    e[y] = top;
    return;
}

inline int BFS(int s, int t) {
    vis[s] = 1;
    dis[s] = 0;
    std::deque<int> Q;
    Q.push_back(s);
    while(!Q.empty()) {
        int x = Q.front();
        Q.pop_front();
        for(int i = e[x]; i; i = edge[i].nex) {
            int y = edge[i].v;
            if(vis[y]) {
                continue;
            }
            dis[y] = dis[x] + edge[i].len;
            if(y == t) { /// error : y == s
                return dis[y];
            }
            vis[y] = 1;
            if(edge[i].len) {
                Q.push_back(y);
            }
            else {
                Q.push_front(y);
            }
        }
    }
    return -1;
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    cnt = n;
    for(int i = 1, x, y, z, f; i <= m; i++) {
        scanf("%d%d%d", &x, &y, &z);
        int x_type = get(x, z, f);
        if(f) {
            add(x, x_type, 1);
        }
        int y_type = get(y, z, f);
        if(f) {
            add(y, y_type, 1);
        }
        add(x_type, y_type, 0);
    }

    int ans = BFS(1, n);
    printf("%d", ans >> 1);

    return 0;
}


Measured memory_bytes: 94080
def examC():
    St = S()
    N = len(St)
    cur = int(0)
    for i in range(N-1):
        if St[i]!=St[i+1]:
            cur +=1
    print(cur)



import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 3188
N,M=map(int,input().split())
if N<2:
  if M<2:
    print(0)
  else:
    print(int(M*(M-1)//2))
else:
  if M<2:
    print(int(N*(N-1)//2))
  else:
    print(int(N*(N-1)//2)+int(M*(M-1)//2))

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

  vector<vector<int>> CSF(N+1, vector<int> (3));
  rep(i, 1, N) {
    rep(j, 0, 3) {
      cin >> CSF[i][j];
    }
  }

  vector<int> ans(N+1, 0);

  rep(i, 1, N) {
    int time = 0;
    rep(j, i, N) {
      int c = CSF[j][0];
      int s = CSF[j][1];
      int f = CSF[j][2];

      if (time <= s) {
        time = s + c;
      } else {
        time = ((time + f - 1) / f) * f + c;
      }
    }
    ans[i] = time;
  }

  rep(i, 1, N+1) {
    cout << ans[i] << endl;
  }

  return 0;
};


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  bool flag = false;
  for(int i=1; i<=9; i++){
    if( n%i == 0 ){
      if( n/i <= 9 ){
        flag = true;
        break;
      }
    }
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll K;
	cin >> K;
	if (K <= 9) {
		cout << K << endl;
		return 0;
	}
	queue<ll> lunlun_que;
	for (int i = 1; i <= 9; i++)
		lunlun_que.push(i);
	ll count = 9;
	while (1) {
		ll N = lunlun_que.front();
		lunlun_que.pop();
		ll d = N % 10;
		for (ll dinc = -1; dinc <= 1; dinc++) {
			ll dnxt = d + dinc;
			if (dnxt < 0 || dnxt > 9)
				continue;
			ll Nnxt = N * 10 + dnxt;
			count++;
			if (K == count) {
				cout << Nnxt << endl;
				return 0;
			}
			lunlun_que.push(Nnxt);
		}
	}
}

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

    #define all(v) v.begin(),v.end()
    #define rall(v) v.rbegin(),v.rend()
    #define trav(i,a) for(auto i: a)
    #define ff first
    #define ss second
    #define eb emplace_back
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr))
    #define mod %MOD
    #define sz(a) a.size()
    
    const long long inf = (long long)1e18;
    const long long MOD = (long long)1e9+7;
    
    #define f(i,n)     for(ll i=0;   i<n;  i++)
    #define fab(i,a,b) for(ll i=a;   i<b;  i++)
    #define fr(i,n)    for(ll i=n-1; i>=0; i--)
    #define fba(i,b,a) for(ll i=b-1; i>=a; i--)

    ll bpw(ll a, ll b) {
        if(b == 0) return 1;
        if(b % 2 == 1) {
            return bpw(a, b - 1) * a mod;
        } else {
            ll b2 = bpw(a, b / 2) mod;
            return b2 * b2 mod;
        }
    }
    ll ncr(ll n, ll r) { 
        ll p = 1, k = 1, m; 
        if (n - r < r) 
            r = n - r; 
        if (r != 0) { 
            while (r) { 
                p *= n; 
                k *= r; 
                m = __gcd(p, k); 
                p /= m; 
                k /= m; 
                n--; 
                r--; 
            } 
        } 
        else
            p = 1;  
        return p; 
    } 

    int main() {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a, b, c;
        cin >> a >> b >> c;
        swap(a, b);
        swap(a, c);
        cout << a << ' ' << b << ' ' << c;
        return 0;
    }

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

namespace test
{


    class Program
    {
        static void Main(string[] args)
        {

            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);

            const double tubo = 3.305785;

            Console.WriteLine(a * b / tubo);

        }

    }
}

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

int main(){
    int n,b=0,ans=0; cin>>n;
    vector<int> a(8);
    for(int i=0; i<n; i++) {
        int x; cin>>x;
        if(0<x && x<400) a[0]++;
        if(399<x && x<800) a[1]++;
        if(799<x && x<1200) a[2]++;
        if(1199<x && x<1600) a[3]++;
        if(1599<x && x<2000) a[4]++;
        if(1999<x && x<2400) a[5]++;
        if(2399<x && x<2800) a[6]++;
        if(2799<x && x<3200) a[7]++;
        if(3199<x) b++;
    }
    for(int i=0; i<8; i++) {
        if(a[i]>0) ans++;
    }
    if(ans>0) cout<<ans<<"\n";
    else cout<<1<<"\n";
    cout<<ans+b<<"\n";
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    M = 10**9 + 7

    sa = [0] + list(accumulate(A))
    ans = 0
    for i, a in enumerate(A[:-1]):
        ans += a * (sa[-1] - sa[i+1])
        ans %= M

    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 116964
# ####################################################################
# import io
# import sys

# _INPUT = """\
# 84 97 66
# 79 89 11
# 61 59 7
# 7
# 89
# 7
# 87
# 79
# 24
# 84
# 30

# """
# sys.stdin = io.StringIO(_INPUT)
####################################################################
import sys
def p(*_a):
  # return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
yn = lambda b: print('Yes') if b else print('No')
####################################################################
N = int(input())
K = int(input())
X = [int(i) for i in input().split()]

ans = 0
for x in X:
  ans += min(x, abs(K-x)) * 2

print(ans)


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

int main() {
    int h, w;

    while (1) {
        cin >> h >> w;
        if (h == 0 && w == 0) break;

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if ((i + j) % 2 == 0) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>

#define MOD 1000000007


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}






int main()
{

	int n;
	cin >> n;

	vector<int> s;

	int sum = 0;
	int wk;
	int min = 100;
	for (int i = 0; i < n; i++) {
		cin >> wk;
		sum += wk;

		if (wk % 10 != 0 && wk < min)min = wk;
	}


	if (sum % 10 != 0) {
		cout << sum << endl;
		return 0;
	}

	sum -= min;

	if (sum % 10 == 0) {
		cout << 0 << endl;
	}
	else {
		cout << sum << endl;
	}



	return 0;

}



Measured memory_bytes: 256
from heapq import heappush, heappop
def main():
  n = int(input())
  que = []
  for i in range(n):
    lst = sorted(list(map(int, input().split()))[1:], reverse=True)[:i+1]
    heappush(que, lst[-1])
    for v in lst[:-1]:
      heappush(que, v)
      heappop(que)
  print(sum(que))
main()


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    if (s.size() + 1 != t.size()) {
        cout << "No";
        return 0;
    }
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) != t.at(i)) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


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

int main() {
  int N, W; cin >> N >> W;
  vector<pair<int, int>> items(N);
  for (int i=0; i<N; i++) cin >> items[i].first >> items[i].second;
  vector<vector<int>> dp(N+1, vector<int>(W+1, 0));
  for (int i=0; i<N; i++) {
    for (int j=1; j<=W; j++) {
      if (j>=items[i].second) {
        int w = items[i].second;
        int v = items[i].first;
        dp[i+1][j] = max({dp[i][j],dp[i][j-w]+v,dp[i+1][j-w]+v});
      }
      else dp[i+1][j] = dp[i][j];
    }
  }
  cout << dp[N][W] << "\n";
}


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

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
	fast	
	int n,ele,f=1;
	cin>>n;
	while(n--)	
	{
		cin>>ele;
		if(!(ele&1))
		{
			if(!(ele%3==0 || ele%5== 0))
				f=0;
		}
	}
	f?cout<<"APPROVED\n":cout<<"DENIED\n";
}

Measured memory_bytes: 256
N = 2 * 10 ** 5
n = int(input())
x = input()

def popcount(n):
    res = 0
    while n > 0:
        res += n & 1
        n >>= 1
    return res

f = [0] * (N + 1)
for i in range(1, N + 1):
    m = i
    while True:
        f[i] += 1
        p = popcount(m)
        m %= popcount(m)
        if m == 0:
            break

px = x.count('1')
m01 = 0
m10 = 0
for c in x:
    b = int(c)
    m01 = (2 * m01 + b) % (px + 1)
    if px - 1 != 0:
        m10 = (2 * m10 + b) % (px - 1)

for i, c in enumerate(x):
    if c == '0':
        m = m01 + pow(2, n - i - 1, px + 1)
        m %= px + 1
        print(f[m] + 1)
    elif px - 1 == 0:
        print(0)
    else:
        m = m10 - pow(2, n - i - 1, px - 1)
        m %= px - 1
        print(f[m] + 1)

Measured memory_bytes: 11104
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;

const ll MOD = 1e9 + 7;

int main(){
	int n;
	ll t[100001];
	ll a[100001];
	ll mint[100001];
	ll mina[100001];
	ll dect[100001];
	ll deca[100001];
	ll ans = 1;

	cin >> n;

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

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	if(t[n-1] != a[0]){
		cout << 0 << endl;
		return 0;
	}
	ll tmp;
	mint[0] = 1;
	tmp = t[0];
	for (int i = 1; i < n; ++i)
	{
		if(tmp < t[i]){
			mint[i] = 1;
			tmp = t[i];
			dect[i] = t[i];
		}else{
			mint[i] = tmp;
		}
		if(tmp > t[i]){
			cout << 0 << endl;
			return 0;
		}
	}

	mina[n-1] = 1;
	tmp = a[n-1];
	for (int i = n-2; i >= 0; --i)
	{
		if(tmp < a[i]){
			mina[i] = 1;
			tmp = a[i];
			deca[i] = a[i];
		}else{
			mina[i] = tmp;

		}
		if(tmp > a[i]){
			cout << 0 << endl;
			return 0;
		}
		if(dect[i] != 0){
			if(tmp >= dect[i]){

			} else{
				cout << 0 << endl;
				return 0;
			}
		}
	}

	tmp = t[0];
	for (int i = 0; i < n; ++i)
	{
		ans *= min(mint[i], mina[i]) % MOD;
		ans %= MOD;
		if(tmp < t[i]){

			tmp = t[i];
		}
		if(deca[i] != 0){
			if(tmp >= deca[i]){

			} else{
				cout << 0 << endl;
				return 0;
			}
		}
		// cout << mina[i] << " ";
	}

	cout << ans << endl;

}


Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main ()
{
  int N,good;
 good=0;
  cin>>N;
  int A[N],B[N],C[N-1];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
for(int i=0;i<N;i++){
  cin>>B[i];
  good+=B[i];
}
  for(int i=0;i<N-1;i++){
    cin>>C[i];
    
  }
  for(int i=0;i<N-1;i++){
    if(A[i+1]-A[i]==1){good+=C[A[i]-1];}
  }
  cout << good;
}

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

int n, first, second;

int main() {
	cin >> n;
	first =  n/1.08;
	second = first+1;
	if((int)(first*1.08) == n){
		cout << first << endl;
	}
	else if((int)(second*1.08) == n){
		cout << second << endl;
	}
	else{
		cout << ":(" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    int count = 0;
    for(int i = a; i <= b; i++){
      if(c % i == 0){
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 26344
A, B = map(int, input().split())

res = 0
for i in range(A, B+1):
    s = str(i)
    temp = True
    for j in range(len(s)//2):
        if s[j] != s[len(s) - 1 - j]:
            temp = False
            break
    if temp:
        res += 1

print(res)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int a, b, k;
    cin >> a >> b  >> k;

    if(2*k <= b-a+1){
    for(int i = a; i < a+k; i++) cout << i << endl;
    for(int i = b-k+1; i<b+1; i++) cout << i << endl;
    }

    else{
        for(int i= a; i<b+1; i++) cout << i << endl;
    }
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Ratio
import Text.Printf
import System.IO

main :: IO ()
main = do
  e <- isEOF 
  when (not e) $ do
    [a,b] <- map read . words <$> getLine :: IO [Int]
    printf "%d %d\n" (gcd a b) (lcm a b)
    main



Measured memory_bytes: 4120
/**
 *
 * AtCoder Beginner Contest 104 - Problema C: All Green (https://abc104.contest.atcoder.jp/tasks/abc104_c)
 *
 * Check if a given string satisfies all conditions.
 *
 * Ad-hoc solution: check all conditions, one by one.
 */
#include <iostream>

using namespace std;
using ii = pair<int, int>;

const int MAX { 12 };
const int oo { 2000000000 };

int ps[MAX], cs[MAX];

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : vec) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

void solve(int D, int G)
{
    int min_problems = oo;

    for (int bonus = 0; bonus < (1 << D); ++bonus)
    {
        int problems = 0, left = G;
        
        for (int i = D; i >= 1 and left > 0; --i)
        {
            if (bonus & (1 << (i - 1)))
            {
                problems += ps[i];
                left -= (ps[i] * i * 100 + cs[i]);
            }
        }

        if (left <= 0)
        {
            min_problems = min(min_problems, problems);
            continue;
        }

        for (int i = D; i >= 1 and left > 0; --i)
        {
            if (bonus & (1 << (i - 1)))
                continue;

            int p = min(ps[i] - 1, (left + (100 * i - 1))/(100 * i));
            int value = p * 100 * i;

            problems += p;
            left -= value;
        }

        if (left <= 0)
            min_problems = min(min_problems, problems);
    }

    cout << min_problems << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int D, G;
    cin >> D >> G;

    for (int i = 1; i <= D; ++i)
        cin >> ps[i] >> cs[i];

    solve(D, G);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int a,b,c,t;
	scanf("%d %d %d",&a,&b,&c);
	if (a>b) {
		t=a;
		a=b;
		b=t;
	}
	if (c<a) {
		t=c;
		c=b;
		b=a;
		a=t;
	} else if (a<=c && c<b) {
		t=c;
		c=b;
		b=t;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}



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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

template<class T>
class Segtree2{
	int n;
	vector<T>dat;
	T INIT;
	function<T(T,T)>F;
public:
	Segtree2(int n_,T INIT,function<T(T,T)>F):INIT(INIT),F(F){
		n=1;while(n<n_)n<<=1;
		dat=vector<T>(2*n,INIT);
	}
	void update(int l,int r,T x){
		for(l+=n,r+=n;l<r;l>>=1,r>>=1){
			if(l&1){dat[l]=F(dat[l],x);l++;}
			if(r&1){r--;dat[r]=F(dat[r],x);}
		}
	}
	T query(int k){
		k+=n;
		T res=dat[k];
		while(k>1){
			k>>=1;
			res=F(res,dat[k]);
		}
		return res;
	}
};

int main(){
	int n,q;cin>>n>>q;
	Segtree2<int>seg1(n,n-1,[](int a,int b){return min(a,b);}),
			seg2(n,n-1,[](int a,int b){return min(a,b);});
	ll cnt=(n-2)*(ll)(n-2);
	rep(i,q){
		int ty,x;scanf("%d%d",&ty,&x);x--;
		if(ty==1){
			int t=seg2.query(x);
			cnt-=t-1;
			seg1.update(0,t,x);
		}
		else{
			int t=seg1.query(x);
			cnt-=t-1;
			seg2.update(0,t,x);
		}
	}
	cout<<cnt<<endl;
}

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

int main()
{
	int r ,D ,x ,a ,b ,c ,d ,e ,f ,g ,h ,j ,k ;
	cin>>r>>D>>x;
	a = r *x -D;
	cout<<a<<"\n";
	b = r *a -D;
	cout<<b<<"\n";
	c = r *b -D;
	cout<<c<<"\n";
	d = r *c -D;
	cout<<d<<"\n";
	e = r *d -D;
	cout<<e<<"\n";
	f = r *e -D;
	cout<<f<<"\n";
	g = r *f -D;
	cout<<g<<"\n";
	h = r *g -D;
	cout<<h<<"\n";
	j = r *h -D;
	cout<<j<<"\n";
	k = r *j -D;
	cout<<k<<"\n";
	
	
return 0;
}

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

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

int main() {
  int N, K;
  ll ans = 0, cnt=0, cnt2=0;
  cin >> N >> K;

  if(K % 2 == 0){ // Kが偶数の時
    for(int i = 1; i <= N; i++){
      if(i%K == 0) cnt++;
      else if(i % (K/2) == 0) cnt2++;
    }
    // 組み合わせを数える
    // 3つ同じ数の場合
    ans += cnt + cnt2;
    // 2つ同じ数の場合
    ans += (cnt) * (cnt-1) / 2 * 6;
    ans += (cnt2) * (cnt2-1) / 2 * 6;
    // 3つとも違う場合
    ans += (cnt2) * (cnt2-1) * (cnt2 - 2);
    ans += (cnt) * (cnt-1) * (cnt - 2);
  } else { // Kが奇数の時
    for(int i = 1; i <= N; i++){
      if(i%K == 0) cnt++;
    }
    // 組み合わせを数える
    // 3つ同じ数の場合
    ans += cnt;
    // 2つ同じ数の場合
    ans += (cnt) * (cnt-1) / 2 * 6;
    // 3つとも違う場合
    ans += (cnt) * (cnt-1) * (cnt - 2);
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

#include<bits/stdc++.h>
using namespace std;
#define ll long long int



ll N,M;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
  string S,T;
  cin>>S;
  cin>>T;

  ll ans = 0 ; 
  if(S.length() == T.length()){
    for(ll i = 0 ; i<S.length() ; i++){
      if(S[i] != T[i])
        ans++;
    }
  }

  else{
    ll ans1 = LONG_LONG_MAX;
    for(ll i = 0 ; i<S.length()-T.length()+1 ; i++){
        ll dark = 0;
  for(ll j = 0 ; j<T.length() ; j++){
    if(S[i+j] != T[j]){
       dark++;
    }
  }

   ans1 = min(ans1 , dark);

    }

    ans = ans1;
  }


  cout<<ans<<'\n';




}



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

  return 0;
}


Measured memory_bytes: 3576
fn main() {
  let mut t = Vec::new();
  for _ in 0..5 {
    t.push(read_num());
  }
  let mut smallest = 10;
  let mut result = 0;
  for time in t {
    if time % 10 == 0 {
      result += time;
      continue;
    }
    result += (time / 10 + 1) * 10;
    if time % 10 < smallest {
      smallest = time%10;
    }
  }
  if smallest != 10 {
    result = result - 10 + smallest;
  }
  println!("{}", result);
}

fn read_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().to_string()
}

fn read_num() -> i32 {
    read_line().parse().unwrap()
}

Measured memory_bytes: 4352
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
ans = -1
for i in range(m):
    s[i],c[i] = map(int,input().split())
for i in range(1000):
    a = str(i)
    if len(a) != n:
        continue
    if all(a[s[j]-1] == str(c[j]) for j in range(m)):
        ans = i
        break
print(ans)


Measured memory_bytes: 63624
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int l = m / 2;
	int l2 = m - l;//こっちのがおおい
	//1  .... 2*l2
	for (int n = 1;n <= l2;++n) {
		cout << n <<" "<< 2 * l2  + 1- n << endl;
	}
	// 2l+1......(2l + l2 *2)
	for (int n = 1;n <= l;++n) {
		cout << 2 * l2 + n << " " << 2 * l2 + 2 * (l + 1) - n << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
constexpr double pi=3.14159265358979;

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

void solve(){
  int h,w;
  int ansh;
  char answ;
  cin>>h>>w;
  vector<vector<string>>s(h,vector<string>(w));
  rep(i,h)rep(j,w){
    cin>>s[i][j];
    if(s[i][j]=="snuke"){
      ansh=(i+1);answ='A'+j;
    }
  }
  cout<<answ<<ansh<<"\n";
  return;
}

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


Measured memory_bytes: 256
func main() {
    let inputs = readLine()!.split(separator: " ")
    let N = Int(inputs[0])!
    let M = Int(inputs[1])!
    // print("N: \(N)")
    // print("M: \(M)")
    let H = readLine()!.split(separator: " ").map { Int($0)! }
    var nums = Array(repeating: 1, count: N)
    for _ in 0..<M {
        let inputs = readLine()!.split(separator: " ")
        let A = Int(inputs[0])!
        let B = Int(inputs[1])!
        let Ha = H[A - 1]
        let Hb = H[B - 1]

        if Ha < Hb {
            nums[A - 1] = 0
        }
        if Ha > Hb {
            nums[B - 1] = 0
        }
        if Ha == Hb {
            nums[A - 1] = 0
            nums[B - 1] = 0
        }
    }
    let output = nums.filter { $0 == 1 }.count
    print(output)    
}

main()


Measured memory_bytes: 13740
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n, ans = 0;
    int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
    cin >> n;
    vector<vector<int>> now(n, vector<int>(n));
    vector<vector<int>> s(n, vector<int>(n, 1));
    rep(i, n)rep(j, n){
        now[i][j] = min({i, j, n-i-1, n-j-1});
    }
    rep(i, n*n){
        int a;
        cin >> a; a--;
        int X = a / n, Y = a % n;
        ans += now[X][Y];
        s[X][Y] = 0;
        queue<P> que;
        que.push({X, Y});
        while(!que.empty()){
            P p = que.front(); que.pop();
            int x = p.first, y = p.second;
            rep(j, 4){
                int nx = x + dx[j], ny = y + dy[j];
                if(nx < 0 || nx >= n || ny < 0 || ny >= n)continue;
                if(chmin(now[nx][ny], now[x][y]+s[x][y]))que.push({nx, ny});
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5496
#include <bits/stdc++.h>
using namespace std;
#define int                     long long   
#define double                  long double
#define endl                    "\n"
#define pb                      push_back
#define PI                      3.1415926535897932384626433832795l
#define F                       first
#define S                       second
#define mp                      make_pair
#define f(i,n)                  for(int i=0;i<n;i++)
#define fastio                  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)                  (v).begin(),(v).end()
#define rall(v)                 (v).rbegin(),(v).rend()
#define gcd(a,b)                __gcd((a),(b))
#define fill(a,value)           memset(a,value,sizeof(a));
#define minn(v)                 *min_element(v.begin(), v.end());
#define maxx(v)                 *max_element(v.begin(), v.end());
#define print(x)                cout<<(x)<<endl;
#define sum(v)+x                accumulate(v.begin(), v.end(),x);
#define debug(x)                cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int>           pii;
typedef vector<int>             vi;
 
int dig(int x)
{
    int ans=0;
    while(x>0)
    {
        ans++;
        x/=10;
    }
    return ans;
}
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    vi a(n);
    f(i,n)cin>>a[i];
    int x=a[0];
    for(int i=1;i<n;i++)
    {
        if(x-a[i]>1)
        {
            cout<<"No"<<endl;
            return 0;
        }
        x=max(x,a[i]);
        
    }
    cout<<"Yes"<<endl;
    
    
    
    return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
typedef  long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define int long long int
#define F first
#define S second
#define pb push_back
#define check(x) cout << (#x) << " is " << (x) << endl
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793238
#define INF 1e9+5
#define N 200005



signed main()
{

		int n,ans=0;
		cin>>n;
		string s,f="ABC";
        cin>>s;
       	for(int x=0;x<n;x++){
        	string k=s.substr(x,3);
            if(k==f){ans++;}
        }
    	    cout<<ans<<endl;

}


Measured memory_bytes: 3600
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func main() {
	sc.Split(bufio.ScanWords)

	N, C := scanInt(), scanInt()
	D := make([][]int, C)
	for i := 0; i < C; i++ {
		D[i] = make([]int, C)
		for j := 0; j < C; j++ {
			D[i][j] = scanInt()
		}
	}

	Map := make([][3]int, C)
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			color := scanInt() - 1
			Map[color][(i+j)%3]++
		}
	}

	ans := int(math.Pow10(10))
	for a := 0; a < C; a++ {
		for b := 0; b < C; b++ {
			for c := 0; c < C; c++ {
				if (a-b)*(b-c)*(c-a) == 0 {
					continue
				}

				color := [3]int{a, b, c}
				tmp := 0
				for i := 0; i < 3; i++ {
					for j := 0; j < C; j++ {
						tmp += D[j][color[i]] * Map[j][i]
					}
				}
				ans = intMin(ans, tmp)
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2276
#include <stdio.h>
int main(){
  int i,j,n,answer;
  int list[11][11];
  while(1){
    scanf("%d",&n);
    if(n == 0){
      break;
    }
    answer=0;
    for(i=0;i<11;i++){
      memset(list[i],0,sizeof(list[i]));
    }
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	scanf("%d",&list[i][j]);
      }
    }
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	answer = answer + list[j][i];
	if(j == n-1){
	  list[j+1][i] = answer;
	  list[n][n] += answer;
	  answer=0;
	}
      }
    }
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	answer = answer + list[i][j];
	if(j == n-1){
	  list[i][j+1] = answer;
	  answer=0;
	}
      }
    }
    for(i=0;i<n+1;i++){
      for(j=0;j<n+1;j++){
	printf("%5d",list[i][j]);
      }
      printf("\n");
    }
  }
  return (0);
}

Measured memory_bytes: 616
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;

int n;
int a[N];
map <int, int> cnt[2];
int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n;
	rep(i, 1, n) {
		cin >> a[i];
		cnt[i & 1][a[i]]++;
	}
	vector <pair<int, int>> b, c;
	for (auto it : cnt[0]) b.pb({it.s, it.f});
	for (auto it : cnt[1]) c.pb({it.s, it.f});
	sort(all(b));
	sort(all(c));
	reverse(all(b));
	reverse(all(c));
	
	int ans = 0;

	auto upd = [&](int i, int j) {
		if (i >= sz(b) || j >= sz(c)) return;
		if (b[i].s == c[j].s) {
			// cout << b[i].f << ' ' << c[j].f << nl;
			ans = max({ans, b[i].f, c[j].f});
			return;
		}
		ans = max(ans, b[i].f + c[j].f);
	};
	upd(0, 0);
	upd(0, 1);
	upd(1, 0);
	upd(1, 1);
	// cout << ans << nl;
	cout << n - ans;
	ioi
}
/*
m - cnt_x + cnt_y

*/


Measured memory_bytes: 6524
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
	Scanner scanner = new Scanner(System.in);
	List<Integer> list = new ArrayList<Integer>();

	int n = scanner.nextInt();
	int m = scanner.nextInt();

	int sumVotes = 0;

	for (int i = 0; i < n; i++)
	{
	    list.add(scanner.nextInt());
	    sumVotes = sumVotes + list.get(i);
	}
	scanner.close();

	double minimum = (sumVotes * (1.0 / (m * 4)));
	int count = 0;

	for (Integer integer : list)
	{
	    if ((double) integer >= minimum)
	    {
		count++;
	    }
	}
	System.out.println(count >= m ? "Yes" : "No");
    }
}

Measured memory_bytes: 22096
using System;

class Program {
  static void Main() {
    var s = "";
    while ((s = Console.ReadLine()) != "0") {
      var t = new string[3];
      t[0] = s;
      t[1] = Console.ReadLine();
      t[2] = Console.ReadLine();
      var a = '_';
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          var d = t[i][j];
          if (d == '+') continue;
          if (i + 2 < 3 && t[i + 1][j] == d && t[i + 2][j] == d) a = d;
          if (j + 2 < 3 && t[i][j + 1] == d && t[i][j + 2] == d) a = d;
          if (i + 2 < 3 && j + 2 < 3 && t[i + 1][j + 1] == d && t[i+2][j+2] == d) a = d;
          if (i + 2 < 3 && j - 2 >= 0 && t[i + 1][j - 1] == d && t[i + 2][j - 2] == d) a = d;
        }
      }
      Console.WriteLine(a == '_' ? "NA" : a.ToString());
    }
  }
}


Measured memory_bytes: 13748