akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int n, m;

int x[20][20];
double e[30005];

bool fun(double x)
{
   if(fabs(x-(int)x)<1e-8) return true;
   return false;
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i ++)
		for (int j = 0; j < m; j ++)
		{
			scanf("%d", &x[i][j]);

		}
	
	int cnt = 0;
	double temp;
	
	for (int i = 0; i < n - 1; i ++)
	{
		for (int j = i + 1; j < n; j ++)
		{
		temp = 0.0;
		for (int z = 0; z < m; z ++)
		{
	//		printf("%lld  %lld\n", x[i][z], x[j][z]);
			temp = temp + 1.0*(x[i][z] - x[j][z]) *  (x[i][z] - x[j][z]);  
		}
		
			e[++cnt] = sqrt(1.0 * temp);
		}
		
	}
	int sum = 0;
	for (int i = 1; i <= cnt; i ++)
	{
		
			if(fun(e[i]))
		sum ++;
	}

	cout << sum << endl;
}

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

#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define endl '\n'
#define eps  1e-9
const double pi=acos(-1);
const int mod=1e9+7;
//____________________

int a[22][22],n,m,c;

int32_t main()
{ 
  io;

  
  cin>>n>>m>>c;

  for(int i=1;i<=m;i++)
    cin>>a[0][i];
  
  int cnt=0;

  for(int i=1;i<=n;i++)
  {
   int sum=0;
   for(int j=1;j<=m;j++)
   {
     cin>>a[i][j];
     sum+=(a[i][j]*a[0][j]);
   }
   if(sum+c>0)
    cnt++;
  }

  cout<<cnt;
  
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	return B;
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
 	}
	return res;
}


typedef struct _task {
	long day, mon;
}task;

bool comp_task(const task &a, const task &b) {
	printf("%d %d %d %d\n",a.day, a.mon, b.day, b.mon);
	bool res = true;
	if (a.day < b.day) res = true;
	else if (a.day > b.day) res = false;
	
	cout << res << endl;

	return res;
}

bool comp_task2(task a, task b) {
	return a.day < b.day;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	string s;
	cin >> s;


	long zero_c = 0, one_c = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '0') zero_c++;
		else if (s[i] == '1') one_c++;
	}

	cout << min(zero_c, one_c) * 2 << endl;


ProgramEndPointLabel:;

	//Program End
	system("pause");

	return 0;
}
/*

*/




Measured memory_bytes: 712
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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 mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    ll n, m;
    cin >> n >> m;
    vll h(n);
    REP(i, n) {
        cin >> h[i];
    }
    vll ng(n);
    ll a, b;
    REP(i, m) {
        cin >> a >> b;
        a--, b--;
        if (h[a] <= h[b]) ng[a] = 1;
        if (h[b] <= h[a]) ng[b] = 1;
    }
    ll res = 0;
    REP(i, n) {
        if (ng[i] == 0) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>
#include <set>

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 repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n, m, x;
	cin >> n >> m >> x;
	vi a(n);
	rep(i, m) {
		int s;
		cin >> s;
		a[s]++;

	}

	int ans1 = 0;
	repr(i, x, n) {
		if (a[i] == 1) {
			ans1++;
		}
	}

	int ans2 = 0;
	reprrev(i, 0, x) {
		if (a[i] == 1) {
			ans2++;
		}
	}

	cout << min(ans1, ans2) << endl;
	

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

// #define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int H, W;

  cin >> H >> W;

  vector<string> S;
  S.emplace_back('.', W + 2);
  for (int i = 0; i < H; i++) {
    string s;
    cin >> s;

    S.push_back("." + s + ".");
  }
  S.emplace_back('.', W + 2);

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if (S[i][j] == '#' && S[i + 1][j] == '.' && S[i - 1][j] == '.' &&
          S[i][j + 1] == '.' && S[i][j - 1] == '.') {
        cout << "No" << endl;
        return;
      }
    }
  }

  cout << "Yes" << endl;
}

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


Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    S = [str(c) for c in input().strip()]

    ans = 0
    cur = 0
    for s in S:
        if s in ['A', 'T', 'G', 'C']:
            cur += 1
            ans = max(ans, cur)
        else:
            ans = max(ans, cur)
            cur = 0

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
program ABC165_B
  integer(8)::X,N,P,i
  read(*,*)X
  N=0
  P=100
  do i=1,10000
     P=dint(P*1.01d0)
     N=N+1
     if(P>=X) exit
  end do
  write(*,*)N
end program ABC165_B

Measured memory_bytes: 2856
#include<stdio.h>
#include<string.h>
int main(){
	
	char s[19];
	scanf("%s",s);
	for(int i=0; i<strlen(s); i++){
		if(s[i]==','){
			printf(" ");
		}else{
			printf("%c",s[i]);
		}	
	}
	puts(" ");
	return 0;
}

Measured memory_bytes: 1604
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n;
    cin >> n;
    set<long> st;
    map<long,int> mp;
    long a;
    rep(i,n){
        cin >> a;
        st.insert(a);
        mp[a]++;
    }
    int ans = 0;
    for(auto itr = st.begin();itr!=st.end();itr++){
        if(mp[*itr]<*itr) ans+=mp[*itr];
        else ans+=(mp[*itr]-*itr);
    }
    cout << ans << endl;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int L, R, d;
    cin >> L >> R >> d;

    int ans = 0;
    repd(i, L, R + 1) {
        if (i % d == 0) ans++;
    }

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

Measured memory_bytes: 3628
#pragma GCC optimize "trapv" 
#include<bits/stdc++.h>
#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define inarr(arr,n)   rep(i,a,n)cin>>arr[i]
#define ll             long long int
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define IOS            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ret            return 0
#define pi             3.1415926536
#define hell           1000000007
#define narak          998244353
const int inf1=1e9;
const ll inf2=1e18;
const int N=100000;
using namespace std;
int dirs[4][2] ={{1,0},{-1,0},{0,1},{0,-1}};
int solve(){
 int n,m;cin>>n>>m;           
  cout<<n*(n-1)/2+m*(m-1)/2<<endl;          
 ret;
}
int main(){
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef cat
    cat();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    ret;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
	#define ll long long int
	#define ld long double
	#define f first
	#define s second
	#define pb push_back
	#define eb emplace_back
	#define mk make_pair
	#define mt make_tuple
	#define MOD 1000000007
	#define fo(i,a,b) for(i=a;i<b;i++)
	#define foe(i,a,b) for(i=a;i<=b;i++)
	#define all(x) x.begin(), x.end()
	#define vi vector<int>
	#define vl vector <long long int>
	#define pii pair <int,int>
	#define pll pair <long long int, long long int>
	#define vpii vector< pair<int,int> >
	#define vpll vector < pair <long long int,long long int> >
	#define boost ios::sync_with_stdio(false); cin.tie(0)
	using namespace std;
	const int inf = 1e9 + 5;
	const ll inf64 = 1e18 + 5;
	int main()
	{
		boost;
		string s;
		cin >> s;
		for(int i = 0; i < s.size(); i++) {
			if(s[i] == '7') {
				cout << "Yes";
				return 0;
			}
		}
		cout << "No";
	}


Measured memory_bytes: 3612
package main

import "fmt"

func main() {
	var a, b, c, d, e, k int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	fmt.Scanf("%d", &c)
	fmt.Scanf("%d", &d)
	fmt.Scanf("%d", &e)
	fmt.Scanf("%d", &k)

	if e - a > k {
		fmt.Println(":(")
	} else {
		fmt.Println("Yay!")
	}
}


Measured memory_bytes: 512
N, X, M = map(int, input().split())

visited = [-1] * (M + 1)
x = X
i = 0
while visited[x] == -1 :
  visited[x] = i
  x = x * x % M
  i += 1

loop_l = i - visited[x]
loop_s = x

ret = 0
x = X
while x != loop_s :
  ret += x
  x = x * x % M
  N -= 1
  if N == 0 : break
    
if N > 0 :
  i = 0
  while i != loop_l :
    ret += x * ((N - i + loop_l - 1) // loop_l)
    x = x * x % M
    i += 1
  
print(ret)

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

#define sz(o) ((int)o.size())
#define all(o) o.begin(), o.end()
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define repr(i, a, b) for(int i = (a); i >= (b); i--)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define EPS 1e-9
#define PI 3.1415926535
#define ff first
#define ss second
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pi> vpi;


void solve(int testcase) {
    int r;
    cin >> r;
    if(r < 1200) cout << "ABC";
    else if(r < 2800) cout << "ARC";
    else cout << "AGC";
}

int main() {
    #ifdef VPAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed << setprecision(20);
    clock_t b = clock();
    int t = 1;
    //cin >> t;
    rep(tt, 1, t) solve(tt);
    clock_t e = clock();
    cerr << (double(e - b) / CLOCKS_PER_SEC) << " sec";
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<vector<pair<int, int>>> V(N);
    REP(i, M) {
        int P, Y;
        cin >> P >> Y;
        V[P - 1].push_back({Y, i});
    }
    REP(i, N) {
        SORT(V[i]);
    }
    vector<pair<int, int>> res(M);
    REP(i, N) {
        int cnt = 1;
        for (auto v : V[i]) {
            res[v.second] = {i + 1, cnt};
            cnt++;
        }
    }
    REP(i, M) {
        printf("%06d%06d\n", res[i].first, res[i].second);
    }
    return 0;
}


Measured memory_bytes: 7808
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();

    for c in 1..=3 {
        if a * b * c % 2 == 1 {
            return "Yes".to_string();
        }
    }

    return "No".to_string();
}


Measured memory_bytes: 2144
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace::std;
using lint=long long;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
__attribute__((constructor))
void init(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
}

class persistent_union_find{
    template<typename T>
    struct persistent_array{
        struct node;
        using np=node*;
        struct node{
            T data;
            np ch[20];
        };
        np root=nullptr;
        persistent_array(){}
        np get_root(){
            return root;
        }
        void destructive_set(int idx,T val,np& t){
            if(!t)t=new node();
            if(idx==0){
                t->data=val;
            }else{
                t->ch[idx%20]=set(idx/20,val,t->ch[idx%20]);
            }
        }
        np set(int idx,T val,const np& t){
            np res=new node();
            if(t){
                memcpy(res->ch,t->ch,sizeof(t->ch));
                res->data=t->data;
            }
            if(idx==0){
                res->data=val;
            }else{
                res->ch[idx%20]=set(idx/20,val,res->ch[idx%20]);
            }
            return res;
        }
        T get(int idx,np t){
            if(!t)return 0;
            if(idx==0){
                return t->data;
            }else{
                return get(idx/20,t->ch[idx%20]);
            }
        }
    };
    using lint=long long;
    using PA=persistent_array<lint>;
    PA data;
    public:
    using np=PA::np;
    persistent_union_find(){}
    np init(lint n){
        np res=data.get_root();
        for(lint i=0;i<n;i++)data.destructive_set(i,-1,res);
        return res;
    }
    pair<bool,np> unite(lint x,lint y,np t){
        x=root(x,t);y=root(y,t);
        if(x==y)return {0,t};
        if(data.get(x,t)>data.get(x,t))swap(x,y);
        np res=data.set(y,x,data.set(x,data.get(x,t)+data.get(y,t),t));
        return {1,res};
    }
    inline lint root(lint x,np t){return data.get(x,t)<0?x:root(data.get(x,t),t);}
    inline bool same(lint x, lint y,np t){return root(x,t)==root(y,t);}
	inline lint size(lint x,np t){return -data.get(root(x,t),t);}
};
using PUF=persistent_union_find;
using np=PUF::np;

lint bs(lint ok,lint ng,function<bool(lint)> func) {
    if(ok>ng){ok++;ng--;}
    else {ok--;ng++;}
	while(abs(ok-ng)>1){
		lint mid=(ng+ok)/2;
		if(func(mid))ok=mid;
		else ng=mid;
	}
    return ok;
}

int main(){
    lint a,b,c;
    cin>>a>>b>>c;
    cout<<(a+c-2*b==0?"YES":"NO")<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
long long X;
vector<P> G[1000];
int p2[3000];

int U[100000], R[100000];

int find(int x) {
  if (U[x] == x) return x;
  return U[x] = find(U[x]);
}

void unite(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (R[x] < R[y]) swap(x, y);
  U[y] = x;
  R[x] += R[y];
  R[y] = 0;
}

bool same(int x, int y) {
  return find(x) == find(y);
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  p2[0] = 1;
  for (int i=1; i<3000; i++) p2[i] = (2LL*p2[i-1])%MOD;
  cin >> N >> M >> X;
  vector<pair<int, P> > edges2;
  map<int, vector<P> > edges;
  rep(i, M) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    G[u].pb(P(v, w));
    G[v].pb(P(u, w));
    edges[w].pb(P(u, v));
    edges2.pb(make_pair(w, P(u, v)));
  }
  rep(i, N) U[i] = i, R[i] = 1;
  int free = 0;
  long long mst = 0;
  for (auto &pp : edges) {
    for (P p : pp._2) {
      int u = p._1, v = p._2;
      if (same(u, v)) free++;
    }
    for (P p : pp._2) {
      int u = p._1, v = p._2;
      if (!same(u, v)) {
        mst += pp._1;
        unite(u, v);
      }
    }
  }
  if (X < mst) {
    cout << 0 << "\n";
  }
  else if (X == mst) {
    int x = (p2[M] + (MOD - p2[free+1]))%MOD;
    cout << x << "\n";
  }
  else {
    //cout<<"X="<<X<<", mst="<<mst<<"\n";
    int yes = 0, ok = 0;
    for (auto p : edges2) {
      long long x = p._1;
      rep(i, N) U[i] = i, R[i] = 1;
      unite(p._2._1, p._2._2);
      for (auto &pp : edges) {
        for (P p : pp._2) {
          int u = p._1, v = p._2;
          if (!same(u, v)) {
            x += pp._1;
            unite(u, v);
          }
        }
      }
      if (x == X) yes++;
      else if (x > X) ok++;
    }
    int w = (1LL*(p2[yes]+MOD-1)*p2[ok+1])%MOD;
    cout << w << "\n";
  }
  return 0;
}


Measured memory_bytes: 640
# coding: utf-8
# Your code here!

input_moji = input().split()
mojiretsu = int(input_moji[0])
mojikosuu = int(input_moji[1])
s=""

input_list = [input() for i in range(mojiretsu)]
input_list.sort()

for i in input_list:
    s = s+i
print(s)

Measured memory_bytes: 3060
#include<stdio.h>
char s[110];
char t[110];
int main(void){
  int a;
  scanf("%d",&a);
  scanf("%s %s",s,t);
  for(int loop=0;loop<a;loop++){
    printf("%c%c",s[loop],t[loop]);
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repn(i,a,b) for (int i = a; i >=b ;i--)
#define MOD 1000000007


int main(){
ios::sync_with_stdio(0);
cin.tie(0);
    ll n;cin>>n;
    ll tmp;
    map<ll,ll>st;
    rep(i,0,n){
        cin>>tmp;
        st[tmp]++;
    }
    n=st.size();
    ll arr[n];
    ll p=0;
    for(auto x:st){
        arr[p]=x.first;
        p++;
    }
    ll cnt=0;
    rep(i,0,n-2){
        rep(j,i+1,n-1){
            rep(k,j+1,n){
                if(arr[k]<arr[i]+arr[j]){
                    cnt+=(st[arr[k]]*st[arr[i]]*st[arr[j]]);
                }
            }
        }
    }
    cout<<cnt;
 
return 0;
}

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

int main(){
    ll a,b,x; cin >> a >> b >> x;
    ll r = b/x;
    ll l;
    if(a==0){
        l = -1;
    }else{
        l = (a-1)/x;
    }

    cout << r - l << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
#define co(x) cout << x << endl;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
#define couts(v) rep(i,v.size()){cout << v.at(i) << endl;}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  long double a,b;
  cin >> a >> b;
  cout << (ll)(a*b) << endl;
  return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;

int A[110];
  
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  for(int i=0; i<m; i++){
    int l;
    cin >> l;
    A[l] = 1;
  }
  int ans1 = 0;
  for(int i=x+1; i<n; i++){
    ans1 += A[i];
  }
  int ans2 = 0;
  for(int i=x-1; i>0; i--){
    ans2 += A[i];
  }
  

  cout << min(ans1,ans2) << endl;
  

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int n;
vector<vector<int>> a;
ll dp[1 << 21];
bool done[1 << 21];
ll dfs(int rest, int line) {
    if (done[rest]) {
        // cout << "memo" << endl;
        return dp[rest];
    }
    if (line == n - 1) {
        for (int j = 0; j < n; j++) 
            if (a[line][j] == 1 && rest & 1<<j) return 1;
            return 0;
    }
    done[rest] = true;
    ll res = 0;
    for (int i = 0; i < n; i++) {
        if (rest & 1<<i && a[line][i] == 1) {
            rest ^= 1<<i;
            res += dfs(rest, line+1);
            res %= MOD;
            rest ^= 1<<i;
        }
    }
    // cout << res << endl;
    return dp[rest] = res;
}

int main() {
    cin >> n;
    a.assign(n, vector<int>(n));
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> a[i][j];
    int rest = (1<<n) - 1;
    ll ans = dfs(rest, 0);
    cout << ans << endl;
    // for (auto d: done) cout << d.second << endl;
    return 0;
}

Measured memory_bytes: 22020
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

int maxN = 55556;
int arr[55556];

bool check(std::vector<int> a, int n)
{
    do {
        if (arr[a[0] + a[1] + a[2] + a[3] + a[4]]) {
            return false;
        }
    } while (std::next_permutation(a.begin(), a.end()));
    return true;
}

void Eratosthenes(){
    for(int i = 0; i < maxN; i++){
        arr[i] = 1;
    }
    for(int i = 2; i < std::sqrt(maxN); i++){
        if(arr[i]){
            for(int j = 0; i * (j + 2) < maxN; j++){
                arr[i *(j + 2)] = 0;
            }
        }
    }
    arr[0] = 0;
    arr[1] = 0;
    return;
}

int main(int argc, char const* argv[])
{
    Eratosthenes();
    int n, start;
    std::cin >> n;
    std::vector<int> a;
    for (int i = 6; i < maxN; i += 5) {
        if (arr[i]) {
            a.push_back(i);
        }
        if (a.size() > n) {
            a.pop_back();
        }
    }
    for (int i = 0; i < n; i++) {
        std::cout << a[i] << ' ';
    }
    std::cout << std::endl;
    return 0;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
#define int ll

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

signed main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  vector<vector<bool>> dp(n+1, vector<bool> (k));
  for(int i=0;i<n;++i) {
    dp[i][0] = true;
  }
  for(int i=0;i<n;++i) {
    for(int j=0;j<k;++j) {
      if(j + a[i] < k) {
        dp[i+1][j+a[i]] = dp[i+1][j+a[i]] | dp[i][j];
      }
      dp[i+1][j] = dp[i+1][j] | dp[i][j];
    }
  }

/*   for(int i=0;i<n+1;++i) {
    printv(dp[i]);
  } */


  vector<int> s(n+1);
  for(int i=n-1;i>=0;--i) {
    s[i] = s[i+1] + a[i];
  }
  // printv(s);
  int cnt = 0;
  bool noneed = true;
  for(int i=0;i<n;++i) {
    // printv(dp[i]);
    // cout << s[i] << endl;
    noneed = true;
    for(int j=0;j<k;++j) {
      if(dp[i][j] && j + s[i] >= k) {
        // cout << i << ":" << j << endl;
        noneed = false;
        break;
      }
    }
    if(noneed) cnt++;
  }
  cout << cnt << endl;

}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> h(n);
  rep(i,n){
      cin >> h[i];
  }
  reverse(all(h));
  ll mi = LINF;
  rep(i,n){
      mi = min(mi,h[i]);
      if(h[i]>mi+1){
          cout << "No" << endl;
          return 0;
      }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int main(){
ll a=read(),b=read(),c=read(),x=read(),y=read();
write(min(c*2*max(x,y),min(a*x+b*y,c*2*min(x,y)+(x-min(x,y))*a+(y-min(x,y))*b)));
}

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

int main(){
    int l;
    cin >> l;
    //rは頂点数
    //2^(頂点数-1)だけパスが作れるので、2^rがlを超えるような最小のrが頂点数となる
    int r = 1;
    for (int i = 1; i<=20; i++){
        if (pow(2,i)>l) {
            r = i;
            break;
        }
    }
    queue<vector<int>> x;
    int rm = l-1;
    //もし辺iから辺rに長さxの辺を貼ったとすると、2^(i-1)個の新しいパスができる
    //このとき、そのパスの長さをrm,rm-1,...,rm-2^(i-1)+1とすると、rm-2^(i-1)+1が2^r以上であれば良い
    //そしてx=rm-2^(i-1)+1となる
    for (int i = r; i>0; i--){
        if (rm - pow(2,i-1) + 1 >= pow(2,r-1)){
            x.push({i,r,rm-(int)pow(2,i-1)+1});
            rm -= pow(2,i-1);
        }
    }
    cout << r << " " << (r-1)*2 + x.size() << endl;
    for (int i = 1; i<r; i++){
        cout << i << " " << i+1 << " " << 0 << endl;
        cout << i << " " << i+1 << " " << (int)pow(2,i-1) << endl;
    }
    vector<int> ans(3);
    int k = (int)x.size();
    for (int i = 0; i<k; i++){
        ans = x.front(); x.pop();
        cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
    }
}


Measured memory_bytes: 256
x,y = input().split()  #半角スペースorTABor改行で文字列を分割する
x = int(x)
y = int(y)
pmt = x*2 + y*2
sqr = x*y
print('%d %d'%(sqr,pmt)) #変換指定子 %d 整数  %f 浮動小数点数　文字列%s


Measured memory_bytes: 5592
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  map<string,vector<int> > m;
  string s;
  int page;

  while(cin>>s>>page){
    m[s].push_back(page);
  }

  for(map<string,vector<int> >::iterator i=m.begin();i!=m.end();i++){
    vector<int> v = (i->second);
    cout<<(i->first)<<endl;
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
      if(i != 0) cout<<" ";
      cout<<v[i];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 0
import sys

a = list(map(int,input().split()))
H = a[0]
W = a[1]
board = [["d" for j in range(W+2)] for i in range(H+2)]
for i in range(H):
    temp = input()
    for j in range(W):
        board[i+1][j+1] = temp[j]


for i in range(1, H+1):
    for j in range(1, W+1):
        if board[i][j] == "#" and board[i][j-1] != "#" and board[i][j+1] != "#" and board[i-1][j] != "#" and board[i+1][j] != "#":
            print("No")
            sys.exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int m, k;
  cin >> m >> k;
  int n = (1 << m);
  if (k == 0) {
    REP(i, n) { cout << i << " "; }
    for (int i = n - 1; i >= 0; i--) {
      cout << i;
      if (i != 0) {
        cout << " ";
      } else {
        cout << endl;
      }
    }
    return 0;
  }

  if (m == 1 || n <= k) {
    cout << -1 << endl;
    return 0;
  }

  cout << k << endl;
  REP(i, n) {
    if (i == k)
      continue;
    cout << i << " ";
  }
  cout << k << " ";
  for (int i = n - 1; i >= 0; i--) {
    if (i == k)
      continue;
    cout << i;
    if (i != 0) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
}


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

int main() {
        int n, m;
        cin >> n >> m;
        vector<int> a(n);
        vector<int> cnt(n + 1, 0);
        set<int> s;
        for (int i = 0; i < n; i ++) { 
                cin >> a[i];
                cnt[a[i]] ++;
                s.insert(a[i]);
        }
        vector<int> seg_cnt(n + 1, 0);
        for (auto a : s) {
                int left = a - cnt[a];
                int right = a;
                if (left < 0) seg_cnt[0] ++;
                else seg_cnt[left] ++;
                seg_cnt[right] --;
        }
        for (int i = 0; i < n - 1; i ++) seg_cnt[i + 1] += seg_cnt[i];
        int not_covered = 0;
        for (int i = 0; i < n; i ++) not_covered += seg_cnt[i] == 0;
        while (m --) {
                int x, y;
                cin >> x >> y;
                x --;
                int prev = a[x];
                a[x] = y;
                if (prev - cnt[prev] >= 0) { 
                        seg_cnt[prev - cnt[prev]] --;
                        if (seg_cnt[prev - cnt[prev]] == 0) not_covered ++;
                }
                cnt[prev] --;
                if (y - cnt[y] - 1 >= 0) { 
                        seg_cnt[y - cnt[y] - 1] ++;
                        if (seg_cnt[y - cnt[y] - 1] == 1) not_covered --;
                }
                cnt[y] ++;
                cout << not_covered << endl;
        }
        return 0;
}


Measured memory_bytes: 13184
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

typedef pair<int, int> pii;
typedef vector<pii> vp;

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

    vp yi[n];
    for (int i = 0; i < m; i++) {
        int p, y;
        cin >> p >> y;
        yi[p-1].push_back(pii(y, i));
    }

    pii id[m];
    for (int i = 0; i < n; i++) {
        sort(yi[i].begin(), yi[i].end());
        for (int j = 0; j < yi[i].size(); j++) {
            id[yi[i][j].second] = pii(i, j);
        }
    }

    for (int i = 0; i < m; i++) {
        printf("%06d%06d\n", id[i].first + 1, id[i].second + 1);
    }

    return 0;
}

Measured memory_bytes: 7808
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

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

static const int intMAX = 1 << 31 - 1;
static const long long llMAX = 1 << 63 - 1;


int MakePrime(long long x) {
	int sqrtx = sqrt(x);
	for (int i = sqrtx; i > 0;i--) {
		if (x % i == 0) {
			return i;
		}
	}
}

int main() {
	long long N;
	cin >> N;
	
	int Prime = MakePrime(N);
	int ans = max(log10(Prime) + 1, log10(N/Prime) + 1);

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

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys 
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#Union Find

#xの根を求める
def find(x,par):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x],par)
        return par[x]
#xとyの属する集合の併合
def union(x,y,par):
    x = find(x,par)
    y = find(y,par)
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y] #xにyの個数くっつける 
        par[y] = x #yをxにくっつける
        return True

#xとyが同じ集合に属するかの判定
def same(x,y,par):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

N,K,L = map(int,readline().split())
par_road = [-1]*(N+1)
par_rail = [-1]*(N+1)


for i in range(K):
    x,y = map(int,readline().split())
    union(x,y,par_road)
    
for i in range(L):
    x,y = map(int,readline().split())
    union(x,y,par_rail)
    
num = []
d = defaultdict(int)  
for i in range(1,N+1):
    id = find(i,par_road)+find(i,par_rail)*10**6
    num.append(id)
    d[id] += 1

print(' '.join(str(d[n]) for n in num))


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

int main(){
	int n,k;
	while(1){
		cin >> n >> k;
		int data[100300];
		for(int i=0;i<n+3;i++){
			data[i] = 0;
		}
		int all = 0,ans = 0;
		if(n == 0 && k == 0) break;
		for(int i=0;i<k;i++){
			int card; cin >> card;
			if(card == 0) all++;
			else data[card] = 1;
		}
		for(int i=1;i<=n;i++){
			int tmp = all;
			int cnt = 0;
			for(int j=i;j<=n;j++){
				if(data[j] == 1) cnt++;
				else if(tmp != 0){
					cnt++; tmp--;
				}
				else break;
			}
			ans = max(ans,cnt);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1552
from collections import defaultdict
from operator import itemgetter

N,K = map(int, input().split())
a = list(map(int, input().split()))
cnt_d = defaultdict(lambda: 0)
for ai in a:
    cnt_d[ai] += 1

cnt_l = sorted(cnt_d.items(), key=itemgetter(1))
ans = sum([v for k,v in cnt_l[:-K]])
print(ans)


Measured memory_bytes: 41116
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
    if(*(long*)a - *(long*)b>0)return 1;
	else if(*(long*)a - *(long*)b==0)return 0;
	else return -1;
}

int main(){
		int n,i;
		long abc[3][100000];
		long long ans=0;
		scanf("%d",&n);
		for(i=0;i<n;i++)scanf("%ld",&abc[0][i]);
		for(i=0;i<n;i++)scanf("%ld",&abc[1][i]);
		for(i=0;i<n;i++)scanf("%ld",&abc[2][i]);
		qsort(abc[0],n,sizeof(long),compare_int);
		qsort(abc[2],n,sizeof(long),compare_int);
		for(i=0;i<n;i++){
				long k=abc[1][i];
				long lb=-1,ub=n;
				while(ub-lb>1){
						int mid=(lb+ub)/2;
						if(abc[0][mid]>=k)ub=mid;
						else lb=mid;
				}
				int a=ub;
				lb=-1,ub=n;
				while(ub-lb>1){
						int mid=(lb+ub)/2;
						if(abc[2][mid]>=k+1)ub=mid;
						else lb=mid;
				}
				//printf("%d,%d\n",a,n-ub);
				ans+=(n-ub)*a;
		}
		printf("%lld\n",ans);
		return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
using std::swap;


int main()
{	
	int a[3],s,min;
	for (int i = 0; i < 3; ++i)cin >> a[i];
	s = a[0] + a[1] + a[2];
	min = s;
	for (int i = 0; i < 3; ++i) {
		if (s - a[i] < min)min = s - a[i];
	}
	cout << min << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <limits>

using namespace std;
using graph = vector<vector<int>>;


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

    graph G(n, vector<int>(n, -1));
    for (int i = 0; i < n; ++i) {
        int u, k;
        cin >> u >> k;

        for (int j = 0; j < k; ++j) {
            int v, c;
            cin >> v >> c;
            G[u][v] = c;
        }
    }

    // Dijkstra's algorithm
    vector<int> d(n, -1);
    vector<bool> visited(n, false);

    d[0] = 0;
    visited[0] = true;
    while (1) {
        int u = -1;
        int v = -1;
        int minw = numeric_limits<int>::max();
        for (int i = 0; i < n; ++i) {
            if (!visited[i])
                continue;
            for (int j = 0; j < n; ++j) {
                if (visited[j] || G[i][j] < 0)
                    continue;
                int w = G[i][j] + d[i];
                if (w < minw) {
                    u = i;
                    v = j;
                    minw = w;
                }
            }
        }
        if (v < 0) {
            break;
        }
        d[v] = minw;
        visited[v] = true;
    }

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

    return 0;
}

Measured memory_bytes: 3208
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    for(int i=0;i<s.size()-1;i++){
        if(s[i] == s[i+1]){
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = max(b * c, max(a * c, max(a * d, b * d)));
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    cout << N*M << endl;
}


Measured memory_bytes: 3212
import heapq
class Heapq :
    def __init__(self, arr, desc=False) :
        if desc :
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
    def pop(self) :
        return heapq.heappop(self.hq) * self.sign
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
    def top(self):
        return self.hq[0] * self.sign
    def size(self):
        return len(self.hq)


N,M = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]

L = [[] for i in range(10**5+1)]
for a,b in AB :
    L[a].append(b)

q = Heapq([], desc=True)
ans = 0
for i in range(1,M+1) :
    for j in range(len(L[i])) :
        q.push(L[i][j])
    ans += q.pop() if q.size() > 0 else 0
print(ans)


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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

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

struct UF{
	vector<int> p;
	UF(int n) : p(n, -1) {}
	int find(int a){ return p[a] < 0 ? a : p[a] = find(p[a]); }
	bool unite(int a, int b) {
		a = find(a); b = find(b);
		if(a == b) return false; //閉路検出
		if(-p[a] < -p[b]) swap(a, b);
		p[a] += p[b]; p[b] = a;
		return true;
	}
	bool root(int a){ return p[a] < 0; }
	bool same(int a, int b){ return find(a) == find(b); }
};

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	VI od, ev;
	rep(i, n) (i%2? od: ev).push_back(a[i]);
	if(n%2==0){
		reverse(all(od));
		for(auto x: od) cout<<x<<" ";
		for(auto x: ev) cout<<x<<" ";
	}else{
		reverse(all(ev));
		for(auto x: ev) cout<<x<<" ";
		for(auto x: od) cout<<x<<" ";
	}
	cout <<"\n";
	return 0;
}


Measured memory_bytes: 3956
#include <stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&d);
  if(a>=b){
    a=b;
  }else{
  }if(c>=d){
    c=d;
  }else{
  }
   printf("%d\n",a+c);
  return 0;
}

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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        int n;
        cin >> n;
        string str;
        cin >> str;
        auto get = [](char c) -> int {
            if (c == 'R')
                return 0;
            if (c == 'G')
                return 1;
            // if(c == 'B')
            return 2;
        };
        vector<vector<int>> poses(3);
        for (size_t i = 0; i < n; i++)
            poses[get(str[i])].pb(i);
        ll res = 0;
        for (size_t i = 0; i < n; i++)
        {
            for (size_t j = i + 1; j < n; j++)
            {
                if (get(str[i]) != get(str[j]))
                {
                    int nextClr = 3 - get(str[i]) - get(str[j]);
                    int cnt = upper_bound(all(poses[nextClr]), j) - poses[nextClr].begin();
                    int scare = j + (j - i);
                    auto it = lower_bound(all(poses[nextClr]), scare);
                    bool ss = false;
                    if (it != poses[nextClr].end())
                        if (*it == scare)
                            ss = true;
                    res += poses[nextClr].size() - cnt - ss;
                }
            }
        }

        cout << res << '\n';
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 3700