akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int N;
	cin >> N;
	
	vector<int> A;
	inputVector(A, N);

	map<int, int> m;
	m[0]++;
	m[A[0]]++;
	REP(i, 1, N - 1) {
		A[i] += A[i - 1];
		m[A[i]]++;
	}

	int ret = 0;
	itrep(it, m) {
		int n = (*it).second;
		ret += n * (n - 1) / 2;
	}

	cout << ret << endl;

    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long int ll;

int main(){
	while(1){
		ll n,q;cin>>n>>q;
		vector<pair<pair<ll,ll>,string> > v(n);
		vector<ll> u(n);
		//その西暦のスタート、そこが何年か（その西暦のゴール）、時代名

		if(n==0 && q==0)return 0;

		for (int i = 0; i < n; ++i)
		{
			ll x,y;string s;
			cin>>s>>x>>y;

			v[i].second=s;
			v[i].first.first=y-x+1;
			v[i].first.second=y;
			u[i]=y-x+1;
		}

		sort(v.begin(),v.end());
		sort(u.begin(),u.end());

		for (int i = 0; i < q; ++i)
		{
			ll z;cin>>z;

			ll it=upper_bound(u.begin(),u.end(),z)-u.begin();

			if(it>0 && v[it-1].first.first<= z && z<=v[it-1].first.second){
				cout<<v[it-1].second <<" "<<z-v[it-1].first.first+1<<endl;
			}else{
				cout<<"Unknown"<<endl;
			}
		}
	}
}


Measured memory_bytes: 3164
object Main extends App {
  val Array(n, k) = io.StdIn.readLine().split(' ').map(_.toInt)
  val k2 = k*2
  val end = k2-1
  // 0 ≦ x,y ≦ 2K に圧縮
  val squares = Array.fill(k2)(Array.fill(k2)(0))
  for (i <- 1 to n) {
    val Array(x, y, color) = io.StdIn.readLine().split(' ')
    // 'W'はY方向にKずらした'B'と同値
    squares(x.toInt % k2)((y.toInt + (if (color == "B") 0 else k)) % k2) += 1
  }
  // 計算量削減のために累積和を事前算出
  for {
    i <- 0 to end
    j <- 1 to end
  } squares(i)(j) += squares(i)(j-1)
  for {
    j <- 0 to end
    i <- 1 to end
  } squares(i)(j) += squares(i-1)(j)
  val max = (for {
    i <- 0 to k-1
    j <- 0 to k-1
  } yield {
    // ex) k = 2
    //      ■ □ □ ■ 
    //  j+k □ ■ ■ □
    //      □ ■ ■ □
    //    j ■ □ □ ■
    //      i   i+k
    val cnt =
      (squares(i)(j)) +
      (squares(end)(j) - squares(i+k)(j)) +
      (squares(i+k)(j+k) - squares(i+k)(j) - squares(i)(j+k) + squares(i)(j)) +
      (squares(i)(end) - squares(i)(j+k)) +
      (squares(end)(end) - squares(end)(j+k) - squares(i+k)(end) + squares(i+k)(j+k))
    Math.max(cnt, n - cnt)
  }).max
  print(max)
}


Measured memory_bytes: 103448
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	int mx=max(a,max(b,c));
	if((mx*3-(a+b+c))%2==0)
		printf("%d\n",(mx*3-(a+b+c))>>1);
	else
		printf("%d\n",(mx*3-(a+b+c)+3)>>1);
}

Measured memory_bytes: 3816
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    int[] d = new int[N];
	    for(int i = 0; i < N; i++) {
	        d[i] = sc.nextInt();
	    }
	    
	    long sum = 0;
	    
	    for(int i = 0; i < N; i++) {
	        for(int j = i+1; j < N; j++) {
	            sum += d[i] * d[j];
	        }
	    }
	    
	    System.out.println(sum);
	    
	}
	
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

int root(int x, vector<int>& par){
  if(par[x] < 0){
    return x;
  }else{
    return par[x] = root(par[x],par);
  }
}

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}

signed main(){
  double a[5];rep(i,5)cin>>a[i];
  int ans = 0;
  int maxd = 0;
  rep(i,5){
    ans += ceil(a[i]/10)*10;
    int aa = ceil(a[i]/10)*10-a[i];
    maxd = max(maxd, aa);
  }
  ans -= maxd;
  cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
data = list(list(map(int, input().split())) for _ in range(n))
m = [[None for _ in range(n+1)]for _ in range(n+1)]
p = []
INF = 1000000000

for i in range(1, n+1):
    m[i][i] = 0

p.append(data[0][0])
for i in range(n):
    p.append(data[i][1])

for l in range(2, n+1):
    for i in range(1, n - l + 2):
        j = i + l - 1
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j])

#print(p)
#print(data)
print(m[1][n])



Measured memory_bytes: 5724
/* C++ */
// ??¢?´¢???P138

#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;
int n;	// ????????°
int t;	// ??????????????°
llong T[MAX]; // ??


// 
int check(llong p){
	int i = 0;	// ?????§?????????P?????¨???????????????????????????????????????
	for (int j = 0; j < t; ++j)
	{
		llong s = 0;	// ?????¨???????????????????????????
		while( s + T[i] <= p){
			s += T[i];
			i++;
			if(i == n) return n; // ?????????????????????????????¨?????§???????????°??¨????????¨???????????°??????????????£?????´??????????????§??????
		}
	}
	return i;
}

int solve(void){
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left > 1){
		mid = (left + right)/2;
		int i = check(mid);
		if(i>=n) right = mid;
		else left = mid;
	}
	return right;
}

int main(int argc, char const *argv[])
{
	cin >> n >> t;
	for (int i = 0; i < n; ++i) cin >> T[i];
	llong ans = solve();
	cout << ans	<< endl;
	return 0;
}

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

using namespace std;

int main(){
  int H, W, N; cin >> H >> W >> N;
  
  int sr, sc; cin >> sr >> sc; --sr; --sc;
  
  string S, T; cin >> S >> T;
  
  int left = 0, right = W, up = 0, down = H;
  
  for(int i = N - 1; i >= 0; --i){
    if(T[i] == 'L'){
      right = min(right + 1, W);
    }else if(T[i] == 'R'){
      left = max(left - 1, 0);
    }else if(T[i] == 'U'){
      down = min(down + 1, H);
    }else{
      up = max(up - 1, 0);
    }
    
    if(S[i] == 'L'){
      ++left;
    }else if(S[i] == 'R'){
      --right;
    }else if(S[i] == 'U'){
      ++up;
    }else{
      --down;
    }
    
    if(left == right || up == down) break;
  }
  
  if(up <= sr && sr < down && left <= sc && sc < right) puts("YES");
  else puts("NO");
  
  return 0;
}

Measured memory_bytes: 3892
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
bool dp[100001];
int main()
{
	int x;
	ll ans=0;
	cin>>x;
	fill(dp,dp+100001,false);
	dp[0]=true;
	for(int i=0;i<1001;i++)
	{
		for(int j=0;j<100001;j++)
		{
			for(int k=0;k<6;k++)
			{
				if(j-k-100>=0)
				{
					if(dp[j-k-100])
						dp[j]=true;
				}
			}
		}
	}
	if(dp[x])
		cout<<"1"<<endl;
	else
		cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 384
//author Forsaken
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))
#define lowbit(x) ((x) & (-(x)))
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.in", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\1.out", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%lld\n", x)
#define memset0(arr) memset(arr, 0, sizeof(arr))
#define il inline
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
il int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
il ll quick_pow(ll base, ll index, ll p) {
	ll res = 1;
	while (index) {
		if (index & 1)res = res * base % p;
		base = base * base % p;
		index >>= 1;
	}
	return res;
}
char s[10];
int res;
map<char, int> cnt;
int main()
{
	scanf("%s", s + 1);
	for (int i = 1; i <= 4; ++i) {
		cnt[s[i]]++;
	}
	for (auto p : cnt) {
		if (p.second == 2)++res;
	}
	if (res == 2)cout << "Yes" << endl;
	else cout << "No" << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define moder 1000000007
#define inf 5000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
int h,w,n;
map<P,int>mp;
int ans[15];
signed main() {
	cin>>h>>w>>n;
	rep(i,n){
		int x,y;
		cin>>x>>y;
		for(int j=x-1;j<=x+1;j++){
			for(int k=y-1;k<=y+1;k++){
				mp[{j,k}]++;
			}
		}
	}
	int s=0;
	for(auto p:mp){
		if(p.first.first>1&&p.first.first<h&&p.first.second>1&&p.first.second<w){
			ans[p.second]++;
			s++;
		}
	}
	cout<<(h-2)*(w-2)-s<<endl;
	REP(i,10)cout<<ans[i]<<endl;
}


Measured memory_bytes: 58496
// Maximum Profit
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>

const int MAX_N = 200000;

int main(void)
{
    int profit = 0, first_num = 0;
    int max_profit = 0;
    int input_num, ary_price[MAX_N];

    for(int i = 0; i < MAX_N; i++)
    {
        ary_price[i] = 0;
    }

    scanf("%d", &input_num);

    for(int i = 0; i < input_num; i++)
    {
        scanf("%d", &ary_price[i]);
    }

    max_profit = ary_price[input_num - 1] - ary_price[input_num - 2];

    for (int i = input_num - 1; i > 0; i--)
    {

        if( first_num < ary_price[i] )
        {
            // 利益の最大値の演算なので、引かれる数が大きい時のみ演算する
            first_num = ary_price[i];
        }
        else
        {
            // 引かれる数が小さくなった時は、以降の演算は実施しない
            continue;
        }

        for(int j = i - 1; j >= 0; j--)
        {
            profit = first_num - ary_price[j];

            if( max_profit < profit )
            {
                max_profit = profit;
            }
        }
    }

    printf("%d\n", max_profit);

    return 0;
}



Measured memory_bytes: 2608
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    vector<int> ans;
    int a,b,c;
    cin >> a >> b >> c;
    ans.pb(abs(a-b));
    ans.pb(abs(b-c));
    ans.pb(abs(c-a));
    SORT(ans);
    pr(ans[0]+ans[1]);
}

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

int main() {
  int A, B, M;
  cin >> A >> B >> M;

  vector<int> a(A);
  vector<int> b(B);
  int min_a = INT_MAX;
  int min_b = INT_MAX;
  rep(i, A) {
    cin >> a[i];
    min_a = min(min_a, a[i]);
  }
  rep(i, B) {
    cin >> b[i];
    min_b = min(min_b, b[i]);
  }

  int ans = min_a + min_b;
  ;
  rep(i, M) {
    int x, y, c;
    cin >> x >> y >> c;
    ans = min(ans, a[x - 1] + b[y - 1] - c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4040
#include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int a[200000];
int b[200000];

int main(void)
{
	int N;
	cin >> N;
	Rep(i, N){
		cin >> a[i];
	}

	if(N % 2 == 0){
		Rep(i, N){
			if(i % 2 == 0){
				b[N / 2 + i / 2] = a[i];
			}else{
				b[N / 2 - ((i + 1) / 2)] = a[i];
			}
		}
	}else{
		Rep(i, N){
			if(i % 2 == 0){
				b[N / 2 - i / 2] = a[i];
			}else{
				b[N / 2 + (i + 1) / 2] = a[i];
			}
		}
	}

	Rep(i, N){
		cout << b[i];
		if(i != N-1){
			cout << " ";
		}else{
			cout << endl;
		}
	}
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a.at(i);
    
    int ans = 0;
    rep(i, N){
        if(i%2 == 0 && a.at(i)%2 == 1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h1,m1,h2,m2,k;cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << (h2 * 60 + m2) - (h1 * 60 + m1) - k << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
using namespace std;
int y[101],r,n;

bool check(double cy){
  double x=sqrt(r*r-cy*cy);
  if(cy>=0)x=r;
  int L=(-x-0.999999),R=(x+0.999999),hb[101]={};

  for(int i=L+50;i<R+50;i++){
    int x1=i-49-i/50;
    double y1=y[i]-cy;
    if(sqrt(x1*x1+y1*y1)>=r)hb[i]++;
  }
  for(int i=L+50;i<R+50;i++)if(!hb[i])return 0;
  return 1;
}

int main(){
  while(1){
    cin>>r>>n;
    if(!r&&!n)break;
    for(int i=0;i<100;i++)y[i]=0;

    for(int i=0;i<n;i++){
      int x1,x2,h;
      cin>>x1>>x2>>h;
      for(int j=x1;j<x2;j++) y[j+50]=max(y[j+50],h);
    }
    double ans=0;
    while(check(ans-r))ans+=0.0001;
    cout << ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<queue>
#include<functional>
#include<vector>
#include<algorithm>
using namespace std;
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> Q;
long long d[200000], n, m, q, a, b, c, f[200000], g[200000]; vector<pair<long long, long long>> x[200000];
pair<long long, long long> F[200000]; vector<long long>G;
template<typename Type> class RangeTree {
private:
	int size_; std::vector<std::vector<Type> > dat;
	inline int query_(int a, int b, Type x, int k, int l, int r) {
		// Find range [a, b) : value < x : Now k-th node and the range is [l, r)
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return lower_bound(dat[k].begin(), dat[k].end(), x) - dat[k].begin();
		int lc = query_(a, b, x, (k << 1), l, (l + r) >> 1);
		int rc = query_(a, b, x, (k << 1) + 1, (l + r) >> 1, r);
		return lc + rc;
	}
public:
	RangeTree() : size_(0), dat(std::vector<Type>()) {};
	template<class T>
	RangeTree(T begin_, T end_) {
		int n = (end_ - begin_);
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, std::vector<Type>());
		for (int i = 0; i < n; i++) dat[i + size_] = std::vector<Type>({ *(begin_ + i) });
		for (int i = size_ - 1; i > 0; i--) {
			dat[i].resize(dat[i << 1].size() + dat[(i << 1) + 1].size());
			std::merge(dat[i << 1].begin(), dat[i << 1].end(), dat[(i << 1) + 1].begin(), dat[(i << 1) + 1].end(), dat[i].begin());
		}
	}
	inline int size() { return size_; }
	inline int query(int l, int r, Type x) {
		// Find range [a, b) : value < x
		return query_(l, r, x, 1, 0, size_);
	}
};

void dijkstra(long long s) {
	for (long long i = 0; i < 200000; i++) { d[i] = (long long)((1ULL << 63) - 1); }
	d[s] = 0; Q.push(make_pair(0, s));
	while (!Q.empty()) {
		pair<long long,long long>p = Q.top();
		Q.pop();
		for (long long i = 0; i < x[p.second].size(); i++) {
			long long a = x[p.second][i].first;
			long long b = x[p.second][i].second;
			if (d[a] > d[p.second] + b) {
				d[a] = d[p.second] + b;
				Q.push(make_pair(d[a], a));
			}
		}
	}
}
int main() {
	cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b >> c; x[a].push_back(make_pair(b, c)); x[b].push_back(make_pair(a, c)); }
	dijkstra(0); for (int i = 0; i < 200000; i++)f[i] = d[i];
	dijkstra(n - 1); for (int i = 0; i < 200000; i++)g[i] = d[i];
	for (int i = 0; i < n; i++)F[i] = make_pair(f[i], g[i]); sort(F, F + n);
	for (int i = 0; i < n; i++)G.push_back(F[i].second);
	cin >> q;
	RangeTree<long long> S(G.begin(), G.end());
	for (int i = 0; i < q; i++) {
		cin >> a >> b;
		long long pos1 = lower_bound(F, F + n, make_pair(a + 1, 0LL)) - F;
		long long p1 = S.query(0, pos1, 9223372036854775807LL);
		long long p2 = S.query(0, pos1, b);
		cout << p1 - p2 << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
const int maxN = 405;
int n, m;
vector < pair < int, int > > g[maxN];
int t[maxN][maxN];
int WHO;
const int INF = (int)1e9;
bool ok[maxN];
void dfs(int v) {
    for (auto it : g[v]) {
        if (t[WHO][v] > it.second) {
            if (t[WHO][it.first] != -1 && t[WHO][it.first] != it.second) {
                ok[WHO] = false;
                break;
            }
            if (t[WHO][it.first] == -1) {
                t[WHO][it.first] = it.second;
                dfs(it.first);
            }
        }
    }
}
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        g[x].emplace_back(y, i);
        g[y].emplace_back(x, i);
    }
    for (int i = 1; i <= n; i++) {
        WHO = i;
        ok[i] = true;
        for (int j = 1; j <= n; j++) {
            t[WHO][j] = -1;
        }
        t[WHO][i] = INF;
        dfs(i);
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (!ok[i] || !ok[j]) continue;
            bool can = true;
            for (int a = 1; a <= n; a++) {
                if (t[i][a] != -1 && t[j][a] != -1 && t[i][a] != t[j][a]) {
                    can = false;
                    break;
                }
            }
            if (can) cnt++;
        }
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()


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

  vector<pair<int,int>> vec;
  rep(i,0,N - 1){
    int a,b;
    cin >> a >> b;
    vec.push_back({a,b});
  }
  cin >> N;
  rep(i,0,N - 1){
    int a,b;
    cin >> a >> b;
    vec.push_back({a,b});
  }
  sort(vec.begin(),vec.end());
  vec.erase(unique(vec.begin(),vec.end()),vec.end());
  for(int i = 0;i < vec.size();i++){
    int a = vec[i].first;
    int b = vec[i].second;
    cout << a << ":" << (b <= 9 ? "0" : "") << b << " \n"[i == vec.size() - 1];
  }
}



Measured memory_bytes: 3108
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <queue>
#include <limits.h>
#include <bitset>
#include <cmath>

using namespace std;

#define rip(i, n, s) for (int i = (s);i < ( int )( n ); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

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

int main() {
	ll a, b;
	cin >> a >> b;
	ll x = gcd(a, b);
	ll ans = 1;
	ll now = 2;
	while(now<1000001){
		if (x%now==0) {
			ans += 1;
			while (x%now==0)
			{
				x = (ll)x / now;
			}
		}
		now++;
	}
	if (x > 2) {
		ans++;
	}
	cout << ans << endl;
}


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

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

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

  int max = sqrt(n);
  vector<int> ans(100000,0);
  
  for(int i=1; i<max; i++){
    for(int j=1; j<max; j++){
      for(int k=1; k<max; k++){
        int sum = i*i+j*j+k*k+i*j+j*k+k*i;
        ans.at(sum)++;
      }
    }
  }

  for(int i=1;i<=n;i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x=1,y=1;
    int ans=0;
    if(n==0||n==1){
        cout<<1<<endl;
        return 0;
    }
    for(int i=2;i<=n;i++){
        ans = x+y;
        x = y;
        y = ans;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,A=1;
  cin >> N >> K;
  for(int i=0; i<N; i++){
    if(A*2 < A+K){
      A *= 2;
    }
    else{
      A += K;
    }
  }
  cout << A << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vi point(n, k-q);
    for(int i = 0; i < q; i++) {
        int ans;
        cin >> ans;
        point[ans-1]++;
    }
    rep(i,n) {
        if(point[i]  <= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 1024
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fucking interest
*******************************
Higher, higher, even higher, to the point you won’t even be able to see me
https://www.a2oj.com/Ladder16.html
*******************************
NEVER DO 300IQ CONTESTS EVER
300IQ AS WRITER = EXTRA NONO
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         System.out.println(N*M);
      }
   }

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


int main(){

    char a,b;
    cin >> a >> b;
    bool ans = false;
    if(a == 'H'){
        if(b == 'H'){
            ans = true;
        }else{
            ans = false;
        }
    }else{
        if(b == 'H'){
            ans = false;
        }else{
            ans = true;
        }
    }

    if(ans){
        cout << "H" << endl;
    }else{
        cout << 'D' << endl;
    }



    return 0;
}

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

#define int long long
#define pb emplace_back
#define f(i,n) for(int i=1 ; i<=n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);
const int N =1e5 + 5;
int a[N][3] , n , dp[N][3] ;
int32_t main(){
	fast;
	cin >>  n;
	f(i,n)  cin >> a[i][0] >> a[i][1] >> a[i][2];
	
	dp[1][0] = a[1][0];
	dp[1][1] = a[1][1];
	dp[1][2] = a[1][2];
	
	for(int i=2 ; i<=n ; i++)
	{
		dp[i][0] = max(dp[i-1][1] , dp[i-1][2]) + a[i][0];
		dp[i][1] = max(dp[i-1][0] , dp[i-1][2]) + a[i][1];
		dp[i][2] = max(dp[i-1][0] , dp[i-1][1]) + a[i][2];
	}
	
	cout << (int)(max({dp[n][0] , dp[n][1] , dp[n][2]}));
	
}







Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
vector<int> tree[100010];
int f[100010],s[100010];

void dfsf(int p,int me){
  f[me]=f[p]+1;
  for(auto &e:tree[me]){
    if(e==p) continue;
    dfsf(me,e);
  }
}

void dfss(int p,int me){
  s[me]=s[p]+1;
  for(auto &e:tree[me]){
    if(e==p) continue;
    dfss(me,e);
  }
}

int main(){
  int n;
  cin>>n;
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  dfsf(0,1);
  dfss(0,n);
  int ff=0,ss=0;
  for(int i=1;i<=n;i++){
    if(f[i]<=s[i]) ff++;
    else ss++;
  }
  if(ff>ss) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;

  return 0;
}


Measured memory_bytes: 11136
import kotlin.math.abs

fun main() {
    val n = readLine()!!.toInt()
    val (t, a) = readLine()!!.split(' ').map { it.toInt() * 1000 }
    val hs = readLine()!!.split(' ').map { it.toInt() }
    val ans = hs
            .mapIndexed { i, h -> i + 1 to abs((t - h * 6) - a) }
            .minBy { it.second }!!
            .first
    println(ans)
}


Measured memory_bytes: 38404
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;

int N, A;

int main(){
	cin >> N >> A;
	
	N = N % 500;
	if(N <= A){
		cout << "Yes" << endl;
	} else {
		cout <<"No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1500;
/*
int main()
{
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ll t1=a-(a-1)%8;
    ll t2=b-(b%8);
    ll ans=0;
    for(ll i=t1;i<a;i++)ans^=i;
    for(ll i=t2;i<=b;i++)ans^=i;
    printf("%lld\n",ans);
    return 0;
}
*/


int main()
{
    ll a,b;
    scanf("%lld%lld",&a,&b);
    ll t1=(a-1)-(a-1)%8;
    ll t2=b-(b%8);
    ll ans=0;
    for(ll i=t1;i<=a-1;i++)ans^=i;
    for(ll i=t2;i<=b;i++)ans^=i;
    printf("%lld\n",ans);
    return 0;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        int n[] = new int[3];
        for (int i = 0; i < 3; i++) {
            n[i] = sc.nextInt();
        }

        Arrays.sort(n);

        int cnt = 0;

        int tmp = (n[2] - n[0]) / 2;
        n[0] += tmp * 2;
        cnt += tmp;

        tmp = (n[2] - n[1]) / 2;
        n[1] += tmp * 2;
        cnt += tmp;

        tmp = n[0] + n[1] - 2 * n[2] + 3;
        cnt += tmp % 3;

        System.out.println(cnt);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(int i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

class runtime_modint {
  using u64 = std::uint_fast64_t;

  static u64 &mod() {
    static u64 mod_ = 0;
    return mod_;
  }

public:
  u64 a;

  runtime_modint(const u64 x = 0) : a(x % get_mod()) {}
  u64 &value() noexcept { return a; }
  const u64 &value() const noexcept { return a; }
  runtime_modint operator+(const runtime_modint rhs) const {
    return runtime_modint(*this) += rhs;
  }
  runtime_modint operator-(const runtime_modint rhs) const {
    return runtime_modint(*this) -= rhs;
  }
  runtime_modint operator*(const runtime_modint rhs) const {
    return runtime_modint(*this) *= rhs;
  }
  runtime_modint operator/(const runtime_modint rhs) const {
    return runtime_modint(*this) /= rhs;
  }
  runtime_modint &operator+=(const runtime_modint rhs) {
    a += rhs.a;
    if (a >= get_mod()) {
      a -= get_mod();
    }
    return *this;
  }
  runtime_modint &operator-=(const runtime_modint rhs) {
    if (a < rhs.a) {
      a += get_mod();
    }
    a -= rhs.a;
    return *this;
  }
  runtime_modint &operator*=(const runtime_modint rhs) {
    a = a * rhs.a % get_mod();
    return *this;
  }
  runtime_modint &operator/=(runtime_modint rhs) {
    u64 exp = get_mod() - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }

  runtime_modint pow(unsigned long n){
    runtime_modint res(1),a=*this;
    while(n){
      if(n%2){
        res*=a;
      }
      a*=a;
      n/=2;
    }
    return res;
  }


  static void set_mod(const u64 x) { mod() = x; }
  static u64 get_mod() { return mod(); }
};
using mint=runtime_modint;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,score;cin>>n>>score;
  mint::set_mod(1e9+7);
  vector<vector<mint>>dp(n+1,vector<mint>(n*n+1));
  auto tdp=dp;
  dp[0][0]=1;
  rep(i,n){
    rep(j,n+1)tdp[j].assign(n*n+1,0);
    rep(j,n+1){
      if(j<n)rep(k,n*n+1-2*j){
        if(dp[j][k].value()==0)continue;
        tdp[j+1][k+2*j]+=dp[j][k];
      }
      rep(k,n*n+1-2*j){
        if(dp[j][k].value()==0)continue;
        tdp[j][k+2*j]+=dp[j][k]*(2*j+1);
      }
      if(j>0)rep(k,n*n+1-2*(j)){
        if(dp[j][k].value()==0)continue;
        tdp[j-1][k+2*(j)]+=dp[j][k]*(j)*(j);
      }
    }
    swap(dp,tdp);
  }
  cout<<dp[0][score].value()<<endl;
  return 0;

}


Measured memory_bytes: 2304
#include<iostream>
#include<set>
using namespace std;
int main()
{
    int n, temp;
    set<int> s;
    cin >> n;
    while(n--)
    {
        cin >> temp;
        if(s.count(temp) == 0)
            s.insert(temp);
        else
            s.erase(temp);
    }
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 4864
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY


S=get_nsp
ans=0
2.times do|i|
    if S[i]=="R" and S[i+1]=="R"
      ans+=1
    end
end
if ans.zero?
    if S.include?("R")
        puts 1
    else
      puts 0

    end
else
    puts ans+1
end

Measured memory_bytes: 14292
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;
int main (){
    int a,b,c;
    cin >> a >> b >> c;

    if (a+b+c >=22){
        cout << "bust";
    }
    else cout << "win";
    


}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;

constexpr ll mod = 1e9+7;

int main() {
    int N; cin >> N;
    map<int, int> m;
    for(int n=2; n <= N; ++n) {
        int t = n;
        for(int i=2; i <= t; ++i) {
            while(t % i == 0) {
                m[i] += 1;
                t /= i;
            }
        }
    }
    ll res = 1;
    for(auto p : m) {
        res = res * (p.second + 1) % mod;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 200010
int a[N], n, m;

int main(){
	cin>>n>>m;
	rep(i, m+1){
		if(i==m){
			cout<<"IMPOSSIBLE"<<endl;
			return 0;
		}
		int u, v;
		cin>>u>>v;
		if(u>v) swap(u, v);
		if(u==1) if(a[v]++) break;
		if(v==n) if(a[u]++) break;
	}
	cout<<"POSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 1024
N, M, X = map(int, input().split())
a = [list(map(int, input().split())) for l in range(N)]
 
ans = 10**8
 
for i in range(2**N):
    score = [0] * M
    total = 0
    for j in range(N):
        if ((i >> j) & 1):
            total += a[j][0]
            for k in range(M):
                score[k] += a[j][k+1]
        
    if min(score) >= X:
        ans = min(ans, total)
 
if ans == 10**8:
    print(-1)
else:
    print(ans)

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

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)   __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)   __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)   __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define ll long long
#define pb push_back
#define PI M_PI
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
     IOS
     int n,i;
     string s;

     cin>>n;
map<string,int> m;
     while(n--)
     {

          cin>>s;
          m[s]++;

     }
     cout<<m.size()<<endl;

     return 0;
}



Measured memory_bytes: 19196
import itertools
n, m, x = map(int, input().split())
c = [list(map(int, input().split())) for i in range(n)]
comb = []
for i in range(1, n+1):
    comb.append(list(itertools.combinations(c, i)))
ans = []
for i in range(len(comb)):
    for j in range(len(comb[i])):
        flag = True
        for l in range(1, m+1):
            sum = 0
            for k in range(len(comb[i][j])):
                sum += comb[i][j][k][l]
            if sum < x:
                flag = False
                break
        if flag:
            cos = 0
            for k in range(len(comb[i][j])):
                cos += comb[i][j][k][0]
            ans.append(cos)
if ans:
    print(min(ans))
else:
    print(-1)

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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll r = 0, g = 0, b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') r++;
        if (s[i] == 'G') g++;
        if (s[i] == 'B') b++;
    }
    ll ans = r * g * b, sub = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (s[i] == s[j]) continue;
            int k = 2 * j - i;
            if (k >= n) continue;
            if (s[i] == s[k] || s[j] == s[k]) continue;
            sub++;
        }
    }
    cout << ans - sub << endl;
    return 0;
}


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

using namespace std;
int a[100010],dp[100010];

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        dp[i]=2e9;
    }
    dp[0]=0;
    dp[1]=0;
    for(int i=2;i<=n;i++){
        for(int j=1;j<=k;j++){
            if(i-j>=1){
                dp[i]=min(dp[i-j]+abs(a[i]-a[i-j]),dp[i]);
            }
        }
    }
    printf("%d",dp[n]);
}


Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(){
    int n,A[1000];

    while(1){
     cin >> n;
     if(n==0)break;

     for(int i=0;i<n;i++)cin >>A[i];

     int sum = 0;

     for(int i=0;i<n;i++)sum += A[i];

     double m=1.0*sum/n;
     double s=0;

     for(int i=0;i<n;i++){    
     s += (A[i]-m)*(A[i]-m);
    }

     double a=s/n;
     double S=sqrt(a);

     printf("%lf\n",S);


    }

    return 0;
}


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

#define ll long long int
using namespace std;
int main()
{
    int n=0,m=INT_MAX;
    string s,x;
    cin>>s;
    for(int i=0;i<=s.size()-3;i++)
    {
        for(int j=i;j<i+3;j++)
            n = (n*10) +(s[j]-'0');
        m = min(m,abs(n-753));
        n=0;
    }
    cout<<m<<endl;

    return 0;
}


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

int n,m; char s[10005],a[10005];
bool check(int n){
	int i;for (i=2; i<=n; i++) if (a[1]!=a[i]) return 0; return 1;
}
int main(){
	scanf("%s",s+1); n=strlen(s+1);
	char c;
	int ans=0,i;
	for (c='a'; c<='z'; c++){
		//cout<<c<<endl;
		for (i=1; i<=n; i++) a[i]=s[i];
		m=n;
		while (!check(m)){
			for (i=1; i<m; i++) if (a[i]!=c) a[i]=a[i+1];
			m--;
		//	for (i=1; i<=m; i++) cout<<a[i];puts("");
		}//cout<<m<<endl;
		ans=max(ans,m);
	}
	cout<<n-ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int A, B;
    cin >> A >> B;
    cout << 6 - A - B << endl;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
A = [input() for _ in range(H)]

h_check = [0] * H
w_check = [0] * W

for i in range(H):
  for j in range(W):
    if A[i][j] == ".":
      h_check[i] += 1
      w_check[j] += 1

h_check = list(map(lambda x: 1 - x // W, h_check))
w_check = list(map(lambda x: 1 - x // H, w_check))

for i in range(H):
  if h_check[i]:
    tmp = ""
    for j in range(W):
      if w_check[j]:
        tmp += A[i][j]
    print(tmp)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
	int N;
	cin >> N;
	cout << N*(N + 1) / 2 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    long long a;
    cin >> a;
    string b;
    cin >> b;
    int bint = (b[0] - '0') * 100 + (b[2] - '0') * 10 + b[3] - '0';
    long long ans = a * bint;
    ans /= 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
	string s,t;
	char alpha[26],beta[26];
	for(int i=0;i<26;i++){
		alpha[i]='0';
		beta[i]='0';
	}
	cin>>s>>t;
	for(int i=0;i<int(s.size());i++){
		if(alpha[t[i]-'a']=='0'){
			alpha[t[i]-'a']=s[i];
		}else{
			if(alpha[t[i]-'a']!=s[i]){
				cout<<"No\n";
				return 0;
			}
		}
		if(beta[s[i]-'a']=='0'){
			beta[s[i]-'a']=t[i];
		}else{
			if(beta[s[i]-'a']!=t[i]){
				cout<<"No\n";
				return 0;
			}
		}
	}
	cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 776
fn main() {
    let (n, k) = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        let ns: Vec<i64> = line.split_whitespace().map(|a|a.parse().unwrap()).collect();
        (ns[0], ns[1])
    };
    let h: Vec<i64> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.split_whitespace().map(|a|a.parse().unwrap()).collect()
    };

    println!("{}", h.iter().filter(|&&a| a >= k).count());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 1000001;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =  1e9+7;
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll x=a/c;
	if(a%c)
	x++;
	ll y=b/c;
	x=(y-x+1);
	y=(a/d);
	if(a%d)
	y++;
	ll z=b/d;
	y=(z-y+1);
//	cout<<c<<" "<<d<<endl;
	ll aa=(c*d)/GCD(c,d);
//	 cout<<aa<<endl;
	z=a/aa;
	if(a%aa)
	z++;
	ll e=b/aa;
	z=(e-z+1);
//	cout<<x<<" "<<y<<" "<<z<<endl;
	cout<<(b-a+1-x-y+z);
}

Measured memory_bytes: 256
using System;

class MyClass
{
    public static void Main(string[] args)
    {
        var str = Console.ReadLine().Split(' ');
        var r = int.Parse(str[0]);
        var c = int.Parse(str[1]);
        var table = new int[r+1, c+1];
        for (int i = 0; i < r; i++)
        {
            var input = Console.ReadLine().Split(' ');
            var sum = 0;
            for (int j = 0; j < c; j++)
            {
                table[i, j] = int.Parse(input[j]);
                sum += table[i, j];
            }
            table[i, c] = sum;
        }
        var total = 0;
        for (int j = 0; j < c; j++)
        {
            var csum = 0;
            for (int i = 0; i < r; i++)
            {
                csum += table[i, j];
            }
            table[r, j] = csum;
            total += csum;
        }
        table[r, c] = total;

        for (int i = 0; i <= r; i++)
        {
            var output = table[i, 0].ToString();
            for (int j = 1; j <= c; j++)
            {
                output += " " + table[i, j].ToString();
            }
            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 20044
#include <stdio.h>
#include <math.h>
int main(void){
	double xa,ya,xb,yb,ra,rb,d;
	int n;
	for(scanf("%d",&n);n--;){
		scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
		d=hypot(xa-xb,ya-yb);
		if(d>ra+rb)puts("0");

			else if(ra>rb+d)puts("2");

			else if(rb>ra+d)puts("-2");
			else puts("1");

	}
	return 0;
}

Measured memory_bytes: 0