akhauriyash/Code-Regression huggingface dataset:
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
void print(ll n)
{
	string ans = "";
	while (n)
	{
		ans = char((n - 1) % 26 + 'a') + ans;
		n = (n - 1) / 26;
	}
	cout << ans;
}
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll n, cnt = 0;
	string s = "abcdefghijklmnopqrstuvwxyz";
	cin >> n;
	print(n);
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<string>
#include<math.h>
using namespace std;
int main(){
    int a,d=0;
    cin>>a;
    int b[a],c[a];
    for(int i=0;i<a;i++){
        cin>>b[i]>>c[i];
        d+=c[i]-b[i]+1;
    }
    cout<<d<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
# define ld long double
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int ma=4e5+5;
int main()
{
  char c;
  cin>>c;
  char d=c+1;
  cout<<d<<endl;
  return 0;
}


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

namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
            int.Parse(Console.ReadLine());
            List<long> beta = Console.ReadLine().Split(' ').Select(gamma =>long.Parse(gamma)).ToList();
            Console.WriteLine("{0} {1} {2}", beta.Min(), beta.Max(), beta.Sum());
        }
    }

}



Measured memory_bytes: 18656
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint d2[3010][6010];
lint co[3010][3010];
lint dp[3010][6010][2][2];
lint mo=998244353;
int main()
{
	int n,x;cin>>n>>x;
	/*memset(dp,0,sizeof(dp));
	dp[0][0][0][0]=1;
	rep(i,n) rep(j,x+5) rep(k,2){
		rep(l,2) dp[i][j][k][l]%=mo;
		//0
		dp[i+1][j][k][0]+=dp[i][j][k][0];
		dp[i+1][j][k][1]+=dp[i][j][k][1];
		//1
		dp[i+1][j][k][0]+=dp[i][j][k][0]+dp[i][j][k][1];
		//2
		if(j<1){
			dp[i+1][j][1][1]+=dp[i][j][k][0];
		}
		else{
			dp[i+1][j][k][1]+=dp[i][j][k][0]+dp[i][j][k][1];
		}
	}
	lint out=0;
	rep(i,x) rep(j,2) rep(k,2){
		out+=dp[n][i][j][k];out%=mo;
	}
	out+=dp[n][x+1][1][1];out%=mo;*/
	
	memset(d2,0,sizeof(d2));
	d2[0][0]=1;
	rep(i,n) rep(j,6005){
		d2[i][j]%=mo;
		rep(k,3) d2[i+1][j+k]+=d2[i][j];
	}
	memset(co,0,sizeof(co));
	rep(i,3005){
		co[i][0]=co[i][i]=1;
		REP(j,1,i) co[i][j]=(co[i-1][j]+co[i-1][j-1])%mo;
	}
	lint out=0;
	rep(i,x){
		out+=d2[n][i];out%=mo;
	}
	//cout<<out<<endl;
	for(int i=1;i<3010;i++){
		int re=x+i*2-1-i*4;
		if(re<0){
			int sum=x+i*2-1;
			//cout<<sum<<endl;
			if(sum%2==0 && sum/2<=n){
				out+=co[n][sum/2];out%=mo;
			}
			continue;
		}
		rep(j,n+1){
			if(n-2*i-j<0) continue;
			out+=d2[j][re]*co[n-j-1][2*i-1];
			out%=mo;
		}
	}
	cout<<out%mo<<endl;
}


Measured memory_bytes: 212480
n, c, k = map(int, raw_input().split())
T = [int(raw_input()) for i in xrange(n)]
T.sort()

first = -1
cnt = 0
ans = 1
for t in T:
    if first == -1:
        first = t
        cnt = 1
    else:
        if first + k < t or c == cnt:
            first = t
            cnt = 1
            ans += 1
        else:
            cnt += 1
print ans

Measured memory_bytes: 6332
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(defun next-value (x)
  (if x
	(1+ x)
	1))
(defun now-value (x)
  (if x
	x
	0))

(defun get-value (x)
  (let ((b (mod x 10)))
	(loop while (>= x 10)
		  do
		  (setf x (floor x 10)))
	(cons x b)))

(let ((n (read))
	  (table (make-hash-table :test #'equal)))
  (loop for i from 1 to n
		do
		(setf (gethash (get-value i) table) (next-value (gethash (get-value i) table))))
  (princ (loop for i from 1 to n
			   sum 
			   (let* ((x (get-value i))
					  (y (cons (cdr x) (car x))))
				 (now-value (gethash y table))))))


Measured memory_bytes: 25272
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;

  int c_pos = -1;
  int f_pos = -1;

  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'C') {
      c_pos = i;
    }

    if (c_pos != -1 && s[i] == 'F') {
      f_pos = i;
    }
  }

  if (c_pos < f_pos) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);


int main(){
    TB
	ll x=0;
	int k;cin>>k;
	for(int i=1;i<=k;i++){
		x=(x*10LL+7LL)%(ll)k;
		if(x==0){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#include<stdio.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fr(i, a, b) for(int i=a; i>=b; i--)
#define l long int
#define endl '\n'
#define pb push_back
#define pf pop.front()

using namespace std;
ll MOD=1000000000000007;
int main()
{
FAST
l d,t,s;
cin>>d>>t>>s;

if(t*s>=d)
cout<<"Yes";
else
cout<<"No";
}








Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

struct Dsu {
	vector<int> sz;
	vector<int> p;

	int get(int v) {
		if (p[v] != v) {
			p[v] = get(p[v]);
		}
		return p[v];
	}

	void merge(int a, int b) {
		a = get(a);
		b = get(b);
		if (a == b) return;
		if (sz[a] < sz[b]) swap(a, b);
		p[b] = a;
		sz[a] += sz[b];
	}

	Dsu(int n) {
		p.resize(n);
		iota(p.begin(), p.end(), 0);
		sz.resize(n, 1);
	}

	int comp(int v) {
		return sz[get(v)];
	}
};

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

	int n, m1, m2;
	cin >> n >> m1 >> m2;
	Dsu all(n);
	Dsu f(n);
	Dsu s(n);
	while (m1--) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		f.merge(u, v);
	}
	while (m2--) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		s.merge(u, v);
	}
	map<pair<int, int>, int> occ;
	for (int i = 0; i < n; i++) {
		occ[{f.get(i), s.get(i)}]++;
	}
	for (int i = 0; i < n; i++) {
		cout << occ[{f.get(i), s.get(i)}] << ' ';
	}
	cout << endl;
}


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

int main(){
	double A[2][2];
	double B[2][1];
	double x,y;
	while(cin >> A[0][0] >> A[0][1] >> B[0][0] >> A[1][0] >> A[1][1] >> B[1][0]){
		A[0][1] /= A[0][0];
		B[0][0] /= A[0][0];
		A[1][1] -= A[1][0]*A[0][1];
		B[1][0] -= A[1][0]*B[0][0];
		B[1][0] /= A[1][1];
		B[0][0] -= A[0][1]*B[1][0];
		cout << fixed<< setprecision(3) << B[0][0] << " " << setprecision(3) << B[1][0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#include <assert.h>
 
using namespace std;
 
int main()
{
	string s;
	cin >> s;
	bool ok = true, c = false;
	for (int i = 0; i < s.length(); i++)
	{
		if (i == 0)
		{
			if (s[i] != 'A')
				ok = false;
		}
		else
		{
			if (s[i] == 'C')
			{
				if (c || 2 > i || i == s.length() - 1)
					ok = false;
				c = true;
			}
			else if (s[i] < 'a' || 'z' < s[i])
				ok = false;
		}
	}
	if (ok && c)
		cout << "AC" << endl;
	else
		cout << "WA" << endl;
 
	return 0;
}

Measured memory_bytes: 3624
N,K = map(int, input().split())
Cseq = [i for i in range(N+1)]
CCseq = [0]
for i in range(1,N+1):
    CCseq.append(Cseq[i] + CCseq[-1])
ans = 1
for i in range(K,N+1):
    ans += CCseq[-1]-CCseq[len(CCseq)-1-i]-CCseq[i-1]+1
print(ans % (10**9+7))

Measured memory_bytes: 27108
#include <iostream>
#include <map>


using namespace std;
int main(){
	int N;
  	int A[200001];
  cin >> N;
  map<int,int> dif;
  for(int i=1; i<=N;i++){
   cin >> A[i]; 
    if(dif.find(A[i]+i)==dif.end())
      dif[A[i]+i] = 0;
    dif[A[i]+i]++;
  }
	long count = 0;
  	for(int j=1;j<=N;j++){
      if(dif.find(j-A[j])!=dif.end())
		count+=dif[j-A[j]];
    }
  
  cout << count <<endl;
  return 0;
}


Measured memory_bytes: 13748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, vector<long long> d){
	SORT(d);
	cout << d[N/2] - d[N/2-1] << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> d(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&d[i]);
	}
	solve(N, d);
	return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int k,a,b,c;
int main()
{
cin>>a>>b>>c>>k;
if (k<=a)
cout<<k;
else
if(k<=a+b)
cout<<a;
else
cout<<a-k+a+b;

return 0;

}

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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

ll fac (int x)
{
    ll res = 1;
    for (int i = 1; i <= x; i++)
        res = (res * i) % MOD;
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    int N, M;
    cin >> N >> M;

    ll x = (fac (N) * fac(M)) % MOD;
    if (abs (N - M) == 1)
        cout << x << "\n";
    else if (N == M)
        cout << (2 * x) % MOD << "\n";
    else
        cout << "0\n";
}

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

int main(){
  
  string a,b;
  
  cin>>a;
  cin>>b;
  
  for(int i=0;i<a.size();i++){
    cout<<a[i];
    if(i<b.size()){
      cout<<b[i];
    }
  }
  
  cout<<endl;
  

return 0;
}

Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;
const int mod = 1e9+7;

using ll = long long;

pair<ll, ll> a[N];
ll ans;
int n;

ll fast_pw(ll x, ll y) {
	x %= mod;
	ll ret = 1;

	for(;y;y>>=1) {
		if(y&1) ret = (ret * x) % mod;
		x = (x*x) % mod;
	}
	return ret;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;

	int t1 = 0, t2 = 0, t3 = 0;

	for(int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;

		if(a[i].first == 0 && a[i].second) t1++;
		if(a[i].second == 0 && a[i].first) t2++;
		if(a[i].first == 0 && a[i].second == 0) t3++;
	}

	map<pair<ll,ll>, int> neg, pos;

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

		if(a[i].first == 0 || a[i].second == 0) continue;

		bool f = true;
		pair<ll,ll> now = a[i];
		
		if( (now.first < 0) != (now.second < 0) ) f = false;

		now.first = abs(now.first);
		now.second = abs(now.second);

		ll g = __gcd(now.first, now.second);

		now.first /= g;
		now.second /= g;

		if(f) {
			pos[now]++;
		}
		else {
			neg[now]++;
		}

	}

	vector<pair<int,int>> vp;

	for(auto &x : pos) {
		vp.emplace_back(x.second, neg[make_pair(x.first.second, x.first.first)]);
	}

	for(auto &x : neg) {
		if(pos.find(make_pair(x.first.second, x.first.first)) != pos.end()) continue;
		
		vp.emplace_back(x.second, 0);

	}

	if(t1 || t2) vp.emplace_back(t1, t2);

	ans = 1;

	for(auto &p : vp) {
		ll x = ans * ((fast_pw(2, p.first) - 1 + mod ) % mod + (fast_pw(2, p.second) - 1 + mod) % mod  ) % mod;
		x %= mod;
		ans = (ans + x) % mod;
	}

	cout << (ans - 1 + mod + t3) % mod;

	
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  ll x;
  cin >> x;

  ll a=100;
  int ans=0;
  while(a<x){
    a += a/100;
    ans++;
  }
  cout << ans << endl;
}



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

int n;
vector<vector<int>> tree;
vector<int> d1,d2;

void dfs1(int s, int d = 0, int p = -1){
	d1[s] = d;
	rep(i,tree[s].size()){
		if(tree[s][i] == p) continue;
		dfs1(tree[s][i] , d+1, s);
	}
}

void dfs2(int s, int d = 0, int p = -1){
	d2[s] = d;
	rep(i,tree[s].size()){
		if(tree[s][i] == p) continue;
		dfs2(tree[s][i] , d+1, s);
	}
}

int main(){
	int u,v;
	cin >> n >> u >> v;
	tree.resize(n);
	int a,b;
	rep(i,n-1){
		cin >> a >> b;
		a--; b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	d1.resize(n);
	dfs1(u-1);
	d2.resize(n);
	dfs2(v-1);
	int mx(0);
	rep(i,n){
		if(d1[i] < d2[i] && mx <= d2[i]){
			mx = d2[i];
		}
	}
	cout << mx-1 << endl;
	return 0;
}

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

vector<vector<int>>graph(100005);
vector<int>degree(100005);
vector<int>dp(100005);

int32_t main(){
     // freopen("input.txt",  "r",  stdin);
     // freopen("output.txt", "w", stdout);
    int n,m;cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        graph[a].push_back(b);
        degree[b]++;
    }
    queue<int>q;
    for(int i=1;i<=n;i++){
        if(degree[i]==0){
            q.push(i);
        }
    }
    while(!q.empty()){
        int cur=q.front();
        q.pop();
        for(auto x:graph[cur]){
            dp[x]=max(dp[x],dp[cur]+1);
            degree[x]--;
            if(degree[x]==0){
                q.push(x);
            }
        }
    }
    int ans=0;
    for(auto a:dp){
        ans=max(ans,a);
    }

    cout<<ans;

}





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

using namespace std;

int main(){
	int N;
	cin >> N;
	int X[110];
	rep(i,N) cin >> X[i];
	int ans=10000000;
	for(int i=1; i<=100; i++){
		int sum=0;
		rep(j,N){
			sum+=(i-X[j])*(i-X[j]);
		}
		ans=min(ans,sum);
	}
	cout << ans << endl;

	return 0;
}

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;
using P = pair<int, int>;

int n,m,q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n){
        int now = 0;
        rep(i, q){
            if(A[b[i]-1]- A[a[i]-1]==c[i]) now += d[i];
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }
}

int main(){
    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i,q) cin >> a[i] >> b[i] >> c[i] >> d[i];
    dfs(vector<int>(1,1));
    cout << ans << endl;
    return 0;
}


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

int main() {
	int p,q,r;
	cin >> p >> q >> r;
	int ans=1000;
	if (p+q<ans) ans=p+q;
	if (q+r<ans) ans=q+r;
	if (r+p<ans) ans=r+p;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1ll << 59;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

/*<ここから>***********************************************************/


int main()
{
	int N;
	cin >> N;
	vi p(N);
	rep(i, N) {
		cin >> p[i];
		p[i]--;
	}

	int cnt = 0;
	rep(i, N) {
		if (p[i] == i) {
			if (i != N - 1)	swap(p[i], p[i + 1]);
			else swap(p[i], p[i + 1]);
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int num[1000000];

int main(void)
{
	int n, i, j;
	int count;
	
	for (i = 0; i <= 999999; i++){
		num[i] = 1;
	}
		
	num[0] = 0;
	num[1] = 0;
	
	for (i = 2; i * i <= 999999; i++){
		if (num[i] == 1){
			for (j = i * i; j <= 999999; j += i){
				num[j] = 0;
			}
		}
	}
	
	while (scanf("%d", &n) != EOF){
		count = 0;
		for (i = 0; i <= n; i++){
			if (num[i] == 1){
				count++;
			}
		}
		printf("%d\n", count);
	}
	return (0);
}

Measured memory_bytes: 4496
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> v(n+1);
    rep(i,n){
        int x;
        cin >> x;
        v[x]++;
    }
    sort(v.begin(),v.end(),greater<int>());
    int res = 0;
    rep(i,k){
        res+=v[i];
    }
    cout << n-res << endl;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    set<string> items;
    string item;
    for (int i = 0; i < n; i++) {
        cin >> item;
        items.insert(item);
    }
    cout << items.size();
}


Measured memory_bytes: 19240
#include <iostream>

using namespace std;

int main()
{
    int N;
    while(cin>>N)
    {
        int a[20];
        int i;
        for(i=0;i<N;i++)
            cin>>a[i];
            int hmax=a[0],cnt=0;
        for(i=0;i<N;i++)
        {
            if(a[i]>=hmax)
                cnt++;
            hmax=hmax>a[i]?hmax:a[i];
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect

class Solver:

    def __init__(self, n, a_s):
        self.n = n
        self.a_s = a_s
        self.extra = 1 if self.n % 2 == 0 else 2
        self.dp = self.prepare_dp()

    def prepare_dp(self):
        dp = [None] * (self.n + 1)
        for i, _ in enumerate(dp):
            dp[i] = [-1 * math.inf] * (1 + self.extra)
        dp[0][0] = 0
        return dp

    def run(self):
        extra = 1 + self.n % 2
        for i, a in enumerate(self.a_s):
            for j in range(self.extra):
                self.dp[i + 1][j + 1] = self.dp[i][j]
            for j in range(self.extra + 1):
                v = self.dp[i][j]
                if (i + j) % 2 == 0:
                    v += a
                self.dp[i + 1][j] = max(self.dp[i + 1][j], v)
        #print('self.dp') # debug
        #print(self.dp) # debug
        return self.dp[n][extra]



if __name__ == '__main__':
    n = int(input())
    a_s = list(map(int, input().split()))
    ans = Solver(n, a_s).run()
    #print('ans') # debug
    print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug


Measured memory_bytes: 123016
import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.math.BigInteger;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int k = saori.saori_hayami();
		long ans = 0;
		for(int i =1;i <= k;i++){
			for(int j = i;j <=k;j++){
				for(int l = j;l <= k;l++){
					if(i == j && j == l){
						ans += gcd(i,j,l);
					} else if(i == j || j == l){
						ans += gcd(i,j,l) * 3;
					} else {
						ans += gcd(i,j,l)*6;
					}
				}
			}
		}
		System.out.println(ans);
		saori.close();
	}
	public static int gcd(int a,int b,int c) {
		return IntStream.of(a,b,c)
		.mapToObj(BigInteger::valueOf)
		.reduce(BigInteger::gcd)
		.orElse(BigInteger.ZERO)
		.intValue();
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 62148
#include <bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,c,d,i;
	cin>>a>>b>>c>>d;
	for(i=1;a>0&&c>0;i++){
		if(i%2==1) c-=b;
		else a-=d;
	}
	if(i%2==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3624
# coding:utf-8

def main():
    N = int(input())
    s = input()
    count_white = 0
    count_black = 0
    count_border = N

    if (not "." in s) or (not "#" in s):
        print(0)
        return

    for i in s:
        if i == ".":
            count_white += 1
        elif i == "#":
            count_black += 1

    patern_border_white = 0
    patern_border_black = 0
    temp_border_white = 0
    temp_border_black = 0
    
    for i in range(N-1):
        if i == 0:
            if s[0] == "#":
                temp_border_white = 1
                temp_border_black = count_white

            else:
                temp_border_white = 0
                temp_border_black = count_white -1

        else :
            if s[i] == "#":
                temp_border_white = patern_border_white + 1
                temp_border_black = patern_border_black
            else :
                temp_border_white = patern_border_white
                temp_border_black = patern_border_black - 1

        if count_border > temp_border_white + temp_border_black :
            count_border = temp_border_white + temp_border_black

        patern_border_white = temp_border_white
        patern_border_black = temp_border_black

    print(min(count_white,count_black,count_border))
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 3500
"use strict"

function Main(input) {
  input = input.trim().split('\n').map(Number);
  const N = input[0];
  const D = input.slice(-N).sort((a, b) => b-a);

  let tmp = D[0];
  let ret = 1;
  for(let i=1; i<N; i++){
    if(tmp > D[i]){
      ret += 1;
      tmp = D[i];
    }
  }

  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    LL sum = 0;
    REP(i,0,n) sum += a[i];
    LL ans = -1;
    LL sum2 = 0;
    REP(i,0,n-1) {
        sum2 += a[i];
        LL diff = abs(sum2 - (sum - sum2));
        if (ans < 0) ans = diff;
        ans = min(ans, diff);
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

int main() {
    int N;
    cin >> N;
    int ans = 0;
    int m = 0;
    rep(i, N) {
        int p;
        cin >> p;
        ans += p;
        chmax(m, p);
    }

    ans -= m / 2;
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 0x3f3f3f3f;
const ll LINF = 1ll << 55;
const ll MOD = 1e9 + 7;
const ll MAXN = 400 + 5;
const ll MAXK = 1e5 + 10;

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

int main() {
    ll A, B, C;
    cin >> A >> B >> C;
    if (A + B >= C) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main()
{
  int N;
  int c[510], s[510], f[510];
  int mul[510];
  int res[510]={0};
  cin >> N;

  rep(i,N-1) cin >> c[i] >> s[i] >> f[i];

  rep(i,N-1){
    int t = s[i];
    for(int j=i;j<N-1;j++){
      if(t<=s[j]) t = s[j];
      else t = (t + f[j] - 1)/f[j] * f[j];
      t += c[j];
    }
    res[i] = t;
  }
  res[N-1] = 0;

  rep(i,N){
    cout << res[i] << endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll A,B,m;
  cin>>A>>B>>m;
  vll a(A),b(B);
  ll ma=INF;
  ll mb=INF;
  rep(i,A){
cin>>a[i];
    ma=min(a[i],ma);
  }
  rep(i,B){
    cin>>b[i];
  mb=min(mb,b[i]);
  }
  ll ans=ma+mb;
  rep(i,m){
    ll q,w,e;
    cin>>q>>w>>e;
    q--;
    w--;
    ans=min(ans,a[q]+b[w]-e);
  }
  COUT(ans);
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main() {
	int a, b, c, d, e = 0, f = 0, g = 0;
	cin >> a;
	for (int i = 0; i < a; ++i) {
		cin >> b >> c >> d;
		int mon = c + d - f - g, mmon = b - e;
		if (!(mon <= mmon && mon % 2 == mmon % 2)) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
#include<bitset>
#include<deque>
//#include<pair>
#define vchar vector<char>
#define vchar2 vector<vchar> 
#define vchar3 vector<vchar2> 
#define pr pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int H, W, K;

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

void print(vchar2 b){
	for (int y = 0; y < H; y++){
		for (int x = 0; x < W; x++){
			cerr << (int)b[y][x];
		}
		cerr << endl;
	}
	cerr << endl;
}

int dist(int y, int x){
	int mi = 9999;
	 mi = min(y, mi);
	 mi = min(H - 1 - y, mi);
	 mi = min(x, mi);
	 mi = min(W - 1 - x, mi);
	 return mi;
}

bool check(int y, int x){
	return (y == 0 || y == H - 1 || x == 0 || x == W - 1);
}
bool check(pr p){
	return check(p.first,p.second);
}


int main(){
	int a[2] ;
	cin >> H >> W >> K;
	vchar2 kabe(H, vchar(W, 0));
	vchar2 s(H, vchar(W, 0));
	deque<pr> pos;
	pr start;
	REP(y, H){
		REP(x, W){
			char c;
			cin >> c;
			if (c == '#')kabe[y][x] = 1;
			if (c == 'S'){ s[y][x] = 1; start = pr(y, x); pos.push_back(start); }
		}
	}

	
	print(kabe);
	cerr << endl;
	cerr << "s" << endl;
	print(s);

	


	int mi = dist(start.first,start.second);
	REP(k, K){
		deque<pr>tpos;

		while (!pos.empty()){
			pr tp = pos.front(); pos.pop_front();
			REP(i, 4){
				int ty = tp.first + dy[i]; int tx = tp.second + dx[i];
				if (s[ty][tx] == 0){
					if (kabe[ty][tx] == 0){ tpos.push_back(pr(ty, tx)); s[ty][tx] = 1; mi =min(mi, dist(ty, tx)); if (check(ty, tx)){ cout << 1 << endl; return 0; } }


				}
			}
			tpos.push_back(tp);
		}
		while (!tpos.empty()){
			pr tp = tpos.front(); pos.push_back(tp); tpos.pop_front();
		}



	}
	cout << (mi-1) / K +1+1 << endl;

	


	return 0;


}



Measured memory_bytes: 2176
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    string S;
    cin >> S;
    ll cnt = 0;
    rep(i, S.size()) {
        if (S[i] == '1') cnt++;
    }
    print(cnt);
    return 0;
}


Measured memory_bytes: 256
//from:https://atcoder.jp/contests/exawizards2019/submissions/4794708

#include<cstdint>
using namespace std;

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

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



#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	using mint=modint<1000000007>;

	int n,x;
	mint k;
	cin >> n >> x;
	k=x;

	vector<int> a(n);
	vector<mint> left(n,0);
	vector<mint> right(n,0);

	for(int i=0;i<n;i++)
		cin >> a[i];
	
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
		{
			if(a[i]>a[j])
			{
				if(i==j)
				{
					;
				}
				else if(i<j)
				{
					right[i]+=1;
				}
				else if(j<i)
				{
					left[i]+=1;
				}
			}
		}

	mint ans=0;

	for(int i=0;i<n;i++)
	{
		ans+=((right[i]+left[i])*k*(k+1)/2);
		ans-=(left[i]*k);


	}

	cout << ans.value() << endl;




}

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

int main() {
  int n,m;
  cin>>n>>m;
  
  vector<int> A(m);
  rep(i,m){
   cin>>A[i] ;
  }
  	int asobitai =n;
  
  rep(i,m){
  	asobitai -=A[i];
  }
  
  if(asobitai<0){
   	  cout<<"-1"<<endl;
  }
  
  else{
  cout<<asobitai<<endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define MP make_pair
#define llu unsigned long long
#define U unsigned int
#define ff first
#define ss second
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define pair pair<ll,ll>
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 1000000000
#define INF 1000000000000005
#define N 10000
vector<ll>vec;
map<string,ll> mps;
map<ll,string> mpss;
set<ll>s1;
set<string>s2;
map<string,ll>::iterator str;
set<ll>::iterator itr;
/*
std::cout << std::fixed;
std::cout << std::setprecision(1);
std::cout << VALUE NAME<<endl;
*/
ll tra[100006],tra1[100006];
ll n,m;


int main()
{
    fast_cin;
    ll t;

    map<ll,ll>mp;
    map<ll,ll>::iterator it;
    string s,s1;
    ll lock=0,sum=0,co=0;

    cin>>n;
    for(int i=1; i<=9; i++)
    {
        for(int j=1; j<=9; j++)
        {
            if((i*j)==n)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    s1.clear();
    vec.clear();

}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 105;
const int mod = 1000000007;

int a[maxn][maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  unordered_set<int>st;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      cin>>a[i][j];
  int n;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    st.insert(x);
  }
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++) {
      if(st.find(a[i][j])==st.end())a[i][j] = 0;
      else a[i][j] = 1;
    }
  for(int i=0;i<3;i++){
    bool sign = 0;
    for(int j=0;j<3;j++){
      if(!a[i][j])sign=1;
    }
    if(!sign){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  for(int i=0;i<3;i++){
    bool sign = 0;
    for(int j=0;j<3;j++){
      if(!a[j][i])sign=1;
    }
    if(!sign){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(a[0][0]&&a[1][1]&&a[2][2]){
    cout<<"Yes"<<endl;
    return 0;
  }
  if(a[2][0]&&a[1][1]&&a[0][2]){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
 return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
A = input().split()

if "0" in A:
    print(0)

else:
    ans = 1
        
    for n in range(N):
        ans = ans*int(A[n])

        if ans>10**18:
            print(-1)
            sys.exit()
            
    if ans<=10**18:
        print(ans)

Measured memory_bytes: 19416
#include <iostream>
#include <vector>
int main() {
    using namespace std;
    int n;
    cin >> n;

    vector<int> h(n);
    for (int &hi : h) cin >> hi;

    int h_max = 0;
    int ans   = 0;
    for (const int &hi : h) {
        if (h_max <= hi) {
            h_max = hi;
            ++ans;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = input().split()
N = int(s[0])
X = int(s[1])
ss = input().split()
L = [0]*(N+1)
for i in range(N):
    L[i] = int(ss[i])
    
D = 0
count =0
for i in range(N+1):
    D = D+L[i]
    count = count+1
   # print(D)
    if D > X:
        break
        
print(count)

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        String b = scan.next();
        String c = scan.next();
        System.out.println(a.charAt(0)+""+b.charAt(0)+""+c.charAt(0));
    }
}

Measured memory_bytes: 10196
import java.util.*;
import java.io.*;
import java.math.*;
 class Main{
    public static void main(String[] args) {
        MyScanner sc=new MyScanner();
        int x=sc.nextInt();
        int y=sc.nextInt();
        if(y>x){
          System.out.println(x);
          System.exit(0);
        }
        else if(x%y==0){
          System.out.println(-1);
          System.exit(0);
        }
        for(int i=x;;i+=x){
          if(i%y!=0){
            System.out.println(i);
            System.exit(0);
          }
        }

    }


    private static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }
   }
}

Measured memory_bytes: 22868
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll H, W, K;
    cin >> H >> W >> K;

    vector<string> S(H);
    rep(i, H) cin >> S[i];

    ll ans = INF;

    vector<ll> idxs;
    for (ll bit = 0; bit < (1 << (H - 1)); bit++) {
        // cout << "-----" << endl;
        idxs.pb(0);
        for (ll i = 0; i < H - 1; i++) {
            if (bit & (1 << i)) {
                idxs.pb(i + 1);
            }
        }
        idxs.pb(H);

        // repv(idxs) cout << *it << " ";
        // cout << endl;

        vector<vector<ll>> sum_all;
        rep(i, SZ(idxs) - 1) {
            vector<ll> sum;
            rep(k, W) {
                ll cnt = 0;
                reps(j, idxs[i], idxs[i + 1]) { cnt += S[j][k] - '0'; }
                sum.pb(cnt);
            }
            sum_all.pb(sum);
        }

        // rep(i, SZ(sum_all)) {
        //     rep(j, SZ(sum_all[i])) { cout << sum_all[i][j] << " "; }
        //     cout << endl;
        // }

        bool is_lined;
        rep(i, SZ(sum_all)) {
            is_lined = true;
            rep(j, SZ(sum_all[i])) {
                if (sum_all[i][j] > K) {
                    is_lined = false;
                }
            }
            if (!is_lined) break;
        }

        if (!is_lined) {
            idxs.clear();
            continue;
        }

        vector<ll> line_idxs;
        vector<ll> sum(SZ(sum_all), 0);
        rep(j, W) {
            rep(i, SZ(sum_all)) { sum[i] += sum_all[i][j]; }

            bool flg = false;
            rep(i, SZ(sum_all)) {
                if (sum[i] > K) {
                    flg = true;
                    line_idxs.pb(j - 1);
                    break;
                }
            }

            if (flg) {
                rep(i, SZ(sum_all)) { sum[i] = sum_all[i][j]; }
            }
        }

        // cout << "line_idxs :" << endl;
        // repv(line_idxs) cout << *it << " ";
        // cout << endl;

        // cout << "total : " << SZ(idxs) - 2 + SZ(line_idxs) << endl;
        chmin(ans, SZ(idxs) - 2LL + SZ(line_idxs));
        idxs.clear();
    }
    cout << ans << endl;

    return 0;
}


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

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_A(){
    int a;
    cin >> a;
    cout << a + a*a + a * a * a; 
}

void solve_B(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int ctr = 0;
    REP(i,n){
        if(s[i] != t[i]) ctr++;
    }
    cout << ctr << endl;
}

int main(void){
    solve_B();
    
    return 0;
}

Measured memory_bytes: 3868