akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
ll N,M;
ll x[100010], y[100010];
vector<ll> tree[100010];
// ll h[100010] = {}; 
ll dp[100010] = {};
ll dfs(ll cur){
    ll &res = dp[cur];
    if(~res) return res;
    res = 0;
    for(auto &e: tree[cur]){
        res = max(res, dfs(e) + 1);
    }
    return res;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    rep(i,0,M){
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
        tree[x[i]].push_back(y[i]);
    }
    memset(dp, -1, sizeof(dp));
    ll ans = 0;
    rep(i,0,N){
        ans = max(ans, dfs(i));
    }
    print(ans);
    // printa(dp,N);
    // print(ans);
    // rep(i,0,M){
    //     cin >> x[i] >> y[i];
    //     x[i]--; y[i]--;
    //     tree[x[i]].push_back(y[i]);
    //     h[y[i]]++;
    // }
    // stack<ll> st;
    // rep(i,0,N){
    //     if(h[i] == 0){
    //         st.push(i);
    //     }
    // }
    // vector<ll> ans;
    // while(st.size()){
    //     ll k = st.top();
    //     st.pop();
    //     ans.push_back(k);
    //     for(auto &e: tree[k]){
    //         h[e]--;
    //         if(h[e] == 0) st.push(e);
    //     }
    // }
    // rep(i,0,N){
    //     ll v = ans[i];
    //     for(auto &e : tree[v]){
    //         d[e] = max(d[e], d[v] + 1);
    //     }
    // }
    // ll val = 0;
    // rep(i,0,N){
    //     val = max(val, d[i]);
    // }
    // print(val);

}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,n;
  int ans;
  cin>>n;
  while(n!=0){
    for(int i=0;i<n;i++){
      cin>>a>>b>>c;
      if(a==100||b==100||c==100)cout<<"A"<<endl;
      else if((a+b)>=180)cout<<"A"<<endl;
      else if((a+b+c)>=240)cout<<"A"<<endl;
      else if((a+b+c)>=210)cout<<"B"<<endl;
      else if((a+b+c)>=150&&(a>=80||b>=80))cout<<"B"<<endl;
      else cout<<"C"<<endl;
    }
    cin>>n;
  }
  return 0;
}

Measured memory_bytes: 3084
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;


public class Main {

	public static void main(String[] args) {
		FastScanner stdIn = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		int n = stdIn.nextInt(); //展望台数
		int m = stdIn.nextInt(); //道の数
		
		int[] h = new int[n]; //標高
		
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		
		boolean[] flag = new boolean[n];
		for(int i = 0; i < n; i++) {
			flag[i] = true;
		}
		
		for(int i = 0; i < m; i++) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			
			if(h[a-1]-h[b-1]>0) {
				flag[b-1] =false;
			}else if (h[a-1]-h[b-1]<0){
				flag[a-1] = false;
			}else {
				flag[a-1] = false;
				flag[b-1] = false;
			}
			
			
		}
		
		
		
		
		long cnt = 0;
		for(int i = 0; i < n; i++) { //それぞれの展望台を見ていく
			if(flag[i]==true) {
				cnt++;
			}
			
		}
		
		out.println(cnt);



		out.flush();
	}

}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

int main()
{
    int n;
    cin >> n;
    if (n % 1000 != 0)
        cout << abs(n % 1000 - 1000) << endl;
    else
        cout << 0 << endl;
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N; cin >> N;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];
    map<i64, i64> mp;
    REP(i, N) mp[A[i]]++;

    i64 cnt = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) {
        i64 key, c;
        key = (*it).first;
        c = (*it).second;
        if (c >= key) {
            cnt += c - key;
        } else {
            cnt += c;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll x,a,b;
int main()
{
//	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>x>>a>>b;
	x-=a;
	cout<<x%b<<"\n";
}

Measured memory_bytes: 764
#![allow(non_snake_case)]

use std::io;

fn main() {
    let sin = io::stdin();

    loop{
        let mut buf = String::new();
        sin.read_line(&mut buf).ok();
        let n = buf.trim().parse::<u64>().unwrap();
        if n == 0 {
            break;
        }
        let n = n as f64;

        let mut buf = String::new();
        sin.read_line(&mut buf).ok();
        let scores = buf.split_whitespace()
            .map(|v| v.parse::<f64>().unwrap())
            .collect::<Vec<f64>>();
        let sum = scores.iter().fold(0.0, |s, x| s + x);
        let mean = sum / n;
        let sigma = scores.iter().fold(0.0, |v, x| v + ((x-mean).powi(2) / n)).sqrt();

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



Measured memory_bytes: 5060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    cin>>a;
    string s;
    cin>>s;
    
    if(a>=s.size()){
        cout<<s;
        return 0;
    }else{
        for(int i=0;i<a;i++){
            cout<<s[i];
        }
        cout<<"...";
        return 0;
        
    }
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    vec v(5);
    rep(i, 5){
        cin >> v[i];
    }
    int res = 0;
    vector<P> pv;
    rep(i, 5){
        if(v[i] % 10 == 0){
            res += v[i];
        }else{
            pv.push_back(make_pair(v[i]%10, v[i]));
        }
    }
    sort(all(pv));
    reverse(all(pv));

    rep(i, pv.size()){
        if(i != pv.size()-1){
            res += pv[i].second/10*10 + 10;
        }else{
            res += pv[i].second;
        }
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string s;
  cin >> s;
  int ans = sz(s);
  rep(i,sz(s)-1) {
    if(s[i] != s[i+1]) {
      ans = min(ans,max(i+1,sz(s)-i-1));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

ll N;
ll table[3][SIZE];

int main(){

	scanf("%lld",&N);

	for(ll y = 1; y <= 2; y++){
		for(ll x = 1; x <= N; x++){

			table[y][x] = 0;
		}
	}

	ll X,Y;

	ll ans = 0;

	for(ll i = 0; i < 2*N; i++){

		scanf("%lld %lld",&X,&Y);

		if(X < 1){ //板の左側

			if(Y > 2){ //板より上

				table[2][1]++;
				ans += abs(X-1)+abs(Y-2);

			}else if(Y < 1){ //板より下

				table[1][1]++;
				ans += abs(X-1)+abs(Y-1);

			}else{ //板の範囲

				if(Y == 1){

					table[1][1]++;
					ans += abs(X-1);

				}else{ //Y==2

					table[2][1]++;
					ans += abs(X-1);
				}
			}

		}else if(X > N){ //板の右側

			if(Y > 2){ //板より上


				table[2][N]++;
				ans += abs(X-N)+abs(Y-2);

			}else if(Y < 1){ //板より下

				table[1][N]++;
				ans += abs(X-N)+abs(Y-1);

			}else{ //板の範囲

				if(Y == 1){

					table[1][N]++;
					ans += abs(X-N);

				}else{ //Y==2

					table[2][N]++;
					ans += abs(X-N);
				}
			}


		}else{ //板の範囲


			if(Y > 2){ //板より上


				table[2][X]++;
				ans += abs(Y-2);

			}else if(Y < 1){ //板より下

				table[1][X]++;
				ans += abs(Y-1);

			}else{ //板の範囲

				table[Y][X]++;
			}
		}
	}

	ll d1 = 0,d2 = 0;

	for(int x = 1; x <= N; x++){

		d1 += table[1][x]-1;
		d2 += table[2][x]-1;
		if(d1 > 0 && d2 < 0){

			int tmp = min(d1,-d2);
			ans += tmp;

			d1 -= tmp;
			d2 += tmp;
		}
		if(d1 < 0 && d2 > 0){

			int tmp = min(-d1,d2);
			ans += tmp;
			d1 += tmp;
			d2 -= tmp;
		}
		ans += abs(d1)+abs(d2);
	}

	printf("%lld\n",ans);

	return 0;
}



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

int main(){
    int a,b,c,f = 0;
    cin >> a >> b >> c;
    
    for( int x = a; x <= b; x++){
        if( c % x == 0) f++;
    }
    
    cout << f << endl;
    
    return 0;
}


Measured memory_bytes: 3092
N,K = map(int,input().split())
Snuke=[0]*N
for _ in range(K):
    d=int(input())
    L = list(map(int,input().split()))
    for l in L:
        Snuke[l-1]+=1

ans=0
for s in Snuke:
    if s==0:
        ans+=1
print(ans)


Measured memory_bytes: 9184
/*ex4_2
 Sweet_Sweet_Soul */

#include <stdio.h>
#include <math.h>

int main(void) {
    double pi=3.141592653589;
    double h_hand,m_hand,hour,minute;
    scanf("%lf",&h_hand);
    scanf("%lf",&m_hand);
    scanf("%lf",&hour);
    scanf("%lf",&minute);
    double h_arg=(pi*hour/6)+(pi*minute/360);/*短針のテッペンからの回転度*/
    double m_arg=pi*minute/30;
    double arg=h_arg-m_arg;/*針のなす角*/
    double ans=m_hand*m_hand+h_hand*h_hand-2*m_hand*h_hand*cos(arg);/*A^2+B^2-2ABcosθ*/
    ans=sqrt(ans);/*余弦定理*/
    printf("%.10f\n",ans);/*下10桁出力*/
}


Measured memory_bytes: 2576
cntz 0 = 0
cntz x =
  if x `mod` 10 == 0
  then 1 + (cntz $ x `div` 10)
  else 0

ans' x =
  let p = product [1..x]
  in 
    cntz p

main = do
  c <- getContents
  let i = takeWhile (/= 0) $ map read $ lines c :: [Integer]
      o = map ans' i
  mapM_ print o

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

int main() {
	int n, sum = 0;
	cin >> n;
	vector<int> p(n);
	for (int& x : p)
		cin >> x;
	sort(p.begin(), p.end());
	p.at(n - 1) /= 2;
	for (int x : p)
		sum += x;
	cout << sum << endl;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b] <- map strToInt . words <$> getLine
    -- 出力
    putStrLn $ show $ (a + b) `mod` 24


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

#define fi first
#define se second
#define inf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f

using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pll = pair<ll, ll>;

#define MAX 501

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

	ll x; cin>>x;
	vector<ll> pow5(MAX);
	for (ll i = -1* MAX/2; i <= MAX/2; ++i)
		pow5[i+MAX/2] = i*i*i*i*i;

	ll i = 0, j;
	bool obj = false;
	while(!obj && i < MAX)
	{
		ll hi = MAX-1, lo = 0;
		j = (hi+lo)/2;
		
		while(pow5[i]-pow5[j] != x && lo <= hi)
		{
			if (pow5[i] - pow5[j] < x)
				hi = j-1;
			else
				lo = j+1;
			j = (hi+lo)/2;
		}
		if (pow5[i] - pow5[j] == x)
			obj = true;
		++i;
	}
	--i;
	if (!obj)
		cout<<-1<<'\n';
	else
		cout<<i-MAX/2<<' '<<j-MAX/2<<'\n';
	return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n;
    long long int W;
    cin >> n >> W;
    vector<long long int>v(n+1);
    vector<long long int>w(n+1);
    for(int i=1;i<=n;++i){
        cin >> w[i] >> v[i];
    }
    long long int m=1e5+9;
    vector<long long int>dp(m,INT_MAX);
    dp[0]=0;
    for(int i=1;i<=n;++i){
        for(long long int j=m;j>=0;--j){
            if(j>=v[i]){
                if(dp[j-v[i]]!=INT_MAX)
                    dp[j]=min(dp[j],w[i]+dp[j-v[i]]);
            }
        }
    }
    long long int ans=0;
    for(long long int j=1;j<m;++j){
        if(dp[j]<=W)
            ans=j;
    }
     cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 4012
#include <iostream>
#include <vector>
#include <cstdio>
#include <fstream>
#include <limits.h>
#include <algorithm>
using namespace std;

int main()
{
    //freopen("input.in", "r", stdin);
    int n;
    cin>>n;
    string str;
    vector<int> ans(26, 0);
    for(int i=0;i<n;i++){
        cin>>str;
        if(i==0){
            for(int j=0;j<str.length();j++){
                ans[str[j]-'a']++;
            }
        }
        else{
            vector<int> tmp(26, 0);
            for(int j=0;j<str.length();j++){
                tmp[str[j]-'a']++;
            }
            for(int j=0;j<26;j++){
                ans[j]=min(ans[j], tmp[j]);
            }
        }
    }
    string res="";
    for(int i=0;i<26;i++){
        while(ans[i]--){
            res+=(i+'a');
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int x,y;

  scanf("%d %d",&x,&y);

  while (1){
      if (x == 0 && y == 0)break;

      if (x < y){
     printf("%d %d\n",x,y);
      } else {
     printf("%d %d\n",y,x);
      }

      scanf("%d %d\n",&x,&y);
  }
    return 0;
  }

Measured memory_bytes: 604
def compare(a, b):
    if a < b:
        return "a < b"
    elif a == b:
        return "a == b"
    else:
        return "a > b"

if __name__ == "__main__":
    param = input()
    param = param.split(" ")
    a = int(param[0])
    b = int(param[1])
    print(compare(a, b))


Measured memory_bytes: 5600
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<bitset>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define ok cout<<"OK"<<endl
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
struct dat
{
    string str;
    int val;
    int id;
}x[maxn];
bool cmp(dat a,dat b)
{
    if(a.str==b.str) return a.val>b.val;
    return a.str<b.str;
}
int ans[maxn];
int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) x[i].id=i;
    for(int i=1;i<=n;i++) cin>>x[i].str>>x[i].val;
    sort(x+1,x+1+n,cmp);
   // for(int i=1;i<=n;i++) cout<<x[i].str<<" "<<x[i].val<<endl;
    for(int i=1;i<=n;i++) printf("%d\n",x[i].id);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int n ,m ,c;
int main()
{
    cin>>n>>m>>c;

        if(n!=m&&n==c)cout<<m;
        else if(n!=c&&n==m)cout<<c;
        else cout<<n;



    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#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 PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;
const char ENDL = '\n';

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n, t;
    cin >> n >> t;
    VI a(n);
    REP(i, n) {
        cin >> a[i];
    }


    int mina = a[0], minac = 1, maxr = 0, ans = 0;
    FOR(i, 1, n) {
        if (a[i] - mina > maxr) {
            maxr = a[i] - mina;
            ans = minac;
        } else if (a[i] - mina == maxr) {
            ans += minac;
        }
        if (mina > a[i]) {
            mina = a[i];
            minac = 1;
        } else if (mina == a[i]) {
            minac++;
        }
    }

    cout << ans << ENDL;
    
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

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

int main(void) {
    ll N;
    vector<ll> A;
    ll count = 0;
    cin >> N;
    A.resize(N);
    rep(i, N) cin >> A[i];
    rep(i, N) {
        if(A[i] - 1 > i && A[A[i] - 1] - 1 == i) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1024
TREES,MAKEUP = gets.chomp.split(" ").map(&:to_i)
height = []
min = nil
TREES.times do
  height << gets.to_i
end
height.sort!
for i in 0...TREES-(MAKEUP-1)
  if min == nil || (height[i+MAKEUP-1] - height[i]) < min
    min = height[i+MAKEUP-1] - height[i]
  end
end
puts min

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

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    if (s[s.size() - 1] != 's') {
        cout << s + 's' << endl;
    }
    else {
        cout << s + "es" << endl;
    }
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ll N;
Vl A;
using Graph = vector<Vi>;
Graph g;

Vl ans;

ll dp[200010];

void dfs(int idx, int par) {
    int p = lower_bound(begin(dp), end(dp), A[idx]) - begin(dp);
    ll prev = dp[p];
    dp[p] = A[idx];
    ans[idx] = lower_bound(begin(dp), end(dp), L_INF) - begin(dp);
    for (const auto& to : g[idx]) {
        if (to == par) continue;
        dfs(to, idx);
    }
    dp[p] = prev;
}

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif

    cin >> N;
    g.resize(N);
    A.resize(N);
    ans.resize(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (ll i = 0; i < N - 1; i++) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }

    fill_n(&dp[0], sizeof(dp) / sizeof(dp[0]), L_INF);

    dfs(0, -1);

    for (ll i = 0; i < N; i++) {
        cout << ans[i] << "\n";
    }

    cout << flush;
    return 0;
}

Measured memory_bytes: 33168
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "functional"
#include "cmath"
 
using namespace std;
 
 
int main() {
    string S;
    cin >> S;
    S[5] = ' ';
    S[13] = ' ';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	string s[3];
	cin >> s[0] >> s[1] >> s[2];
	for (int i = 0; i < 3; i++) {
		cout << char(s[i][0] + 'A' - 'a');
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	for(int i=0;i<t.size();i++)cout<<s[i]<<t[i];
	if(s.size()>t.size())cout<<s[s.size()-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main()
{
    int x, a, sum = 0;

    //input
    scanf("%d", &x);

    a = x/500;
    sum = sum + (a*1000);
    x = x%500;

    a = x/5;
    sum = sum + (a*5);
    printf("%d\n", sum);


    return 0;
}


Measured memory_bytes: 128
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {

    
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        List<Integer> list = new ArrayList<>(200000);
        
        int number = sc.nextInt();
        for(int i = 0; i < number ; i++){
            list.add(sc.nextInt());
        }

        Collections.sort(list);
        int count = 0;
        // for(int i = 0; i < list.size(); i++){
        //     System.out.print(list.get(i)+" ");
        // }
        for(int i = 0; i < number - 1 ; i++){
            if(list.get(i).equals(list.get(i+1))){
                count++;
            }else{}
        }


        if(count == 0){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        


    
	}
}

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

int main() {

  string S;
  cin >> S;

  long long answer = 0;

  for (int bits = 1; bits < (1 << S.size()-1); bits++) {

    vector<string> s(S.size());
    
    int current = 0;

    for (int i = 0; i < S.size(); i++) {
      s[current] += S[i];
      if (bits >> i & 1) {
        current++;
      }
    }

    long long result = 0;
    
    for (int i = 0; i < s.size(); i++) {
      result += atoi(s[i].c_str());
    }

    answer += result;

  }

  cout << answer + atoll(S.c_str()) << endl;
  
  return 0;

}

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

int main() {
	int m, d;
	std::cin >> m >> d;
	int ans = 0;
	for (int i = 10; i <= d; i++) {
		int d0 = i % 10, d1 = i / 10;
		if (d0 < 2 || d1 < 2) continue;
		if (0 < d0 * d1 && d0 * d1 <= m) ans++;
	}
	std::cout << ans << "\n";
	return 0;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  int ret = 0;
  vector<int> b(N - 1);
  for (int i = 0; i < N - 1; ++i) {
    cin >> b[i];
    if (i == 0)
      ret += b[0];
    else {
      if (b[i - 1] > b[i])
        ret += b[i];
      else
        ret += b[i - 1];
    }
  }
  ret += b[N - 2];

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
package main

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

var in = bufio.NewScanner(os.Stdin)

func nextSlice(n int) []int {
	var mat []int
	in.Scan()
	temp := strings.Split(in.Text(), " ")
	for i := 0; i < n; i++ {
		li, _ := strconv.Atoi(temp[i])
		mat = append(mat, li)
	}
	return mat
}

func main() {
	var n, t, a int
	var h = make([]int, n)

	fmt.Scan(&n)
	fmt.Scanf("%d %d\n", &t, &a)

	h = nextSlice(n)

	var tempra = make([]float64, n)
	for i := 0; i < len(h); i++ {
		tempra[i] = float64(t) - float64(h[i])*float64(0.006)
	}

	near := 9999999999.909999
	index := 0
	for i := 0; i < len(tempra); i++ {
		deff := math.Abs(float64(a) - tempra[i])
		if deff < near {
			near = deff
			index = i
		}
	}
	fmt.Println(index + 1)
}


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let r: usize = read();
    let c: usize = read();
    let mut array: Vec<Vec<u32>> = vec![vec![0; c + 1]; r + 1];
    for r_index in 0..(r as u32 + 1) {
        if r_index != (r as u32) {
            let mut sum_row: u32 = 0;
            for c_index in 0..(c as u32 + 1) {
                if c_index != (c as u32) {
                    let number: u32 = read();
                    array[r_index as usize][c_index as usize] = number;
                    print!("{} ", number);
                    sum_row += number;
                } else {
                    println!("{}", sum_row);
                    array[r_index as usize][c_index as usize] = sum_row;
                }
            }
        } else {
            for c_index in 0..(c as u32 + 1) {
                let mut sum_col: u32 = 0;
                for r_index_2 in 0..(r as u32) {
                    sum_col += array[r_index_2 as usize][c_index as usize]
                }
                if c_index != (c as u32) {
                    print!("{} ", sum_col);
                } else {
                    println!("{}", sum_col);
                }
            }
        }
    }
}



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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 2e5 + 5;
const ll INF = (ll) 1e18;
ll arr[MAX], pref[MAX];
int n;

inline ll range_sum(int left, int right) {
	return max(0LL, pref[right] - pref[left - 1]);
}

int main() {
	scanf("%d", &n);
	fori(i, 1, n + 1) {
		scanf("%lld", arr + i);
		pref[i] = pref[i - 1] + arr[i];
	}

	ll ans = INF;

	int left = 1, middle = 2, right = 3;
	while(middle <= n - 2) {
		while(left + 1 < middle) {
			ll a = range_sum(1, left), b = range_sum(left + 1, middle);
			ll c = range_sum(1, left + 1), d = range_sum(left + 2, middle);
			if(abs(a - b) > abs(c - d)) {
				left++;
			}
			else {
				break;
			}
		}
		while(right + 1 < n) {
			ll a = range_sum(middle + 1, right), b = range_sum(right + 1, n);
			ll c = range_sum(middle + 1, right + 1), d = range_sum(right + 2, n);
			if(abs(a - b) > abs(c - d)) {
				right++;
			}
			else {
				break;
			}
		}
		ll minn = min({range_sum(1, left), range_sum(left + 1, middle), range_sum(middle + 1, right), range_sum(right + 1, n)});
		ll maxx = max({range_sum(1, left), range_sum(left + 1, middle), range_sum(middle + 1, right), range_sum(right + 1, n)});
		ans = min(ans, maxx - minn);
		middle++;
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin >> s;
    ll ans;
    if (s == "MON")ans = 6;
    else if (s == "TUE")ans = 5;
    else if (s == "WED")ans = 4;
    else if (s == "THU")ans = 3;
    else if (s == "FRI")ans = 2;
    else if (s == "SAT")ans = 1;
    else if (s == "SUN")ans = 7;
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
ll ceil(ll a,ll b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    vector<ll> adjlist[5];
    ll n,k,i;
    for(i=0;i<3;i++)
    {
        cin>>n>>k;
        adjlist[n].push_back(k);
        adjlist[k].push_back(n);
    }
    ll cnt=0,cnt1=0;
    for(i=1;i<=4;i++)
    {
        if(adjlist[i].size()==1)
        {
            cnt++;
        }
        else if(adjlist[i].size()==2)
        {
            cnt1++;
        }
    }
    if(cnt==2 && cnt1==2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>

#include <atcoder/lazysegtree>
#include <atcoder/modint>

using namespace std;
using namespace atcoder;
#define rep(i,l,r) for(int i = l; i < r; ++i)
#define fir first
#define sec second

using mint = modint998244353;
using S = pair<mint, int>;
using F = pair<mint, mint>;

S op(S s1, S s2)
    {return {s1.fir + s2.fir, s1.sec + s2.sec};}
S e() {return {0, 0};}

S mapping(F f, S s)
    {return {s.fir * f.fir + s.sec * f.sec, s.sec};}
F composition(F f1, F f2)
    {return {f2.fir * f1.fir, f2.sec * f1.fir + f1.sec};}
F id() {return {1, 0};}

int main() {
    int n, q, x, t, l, r, b, c;
    cin >> n >> q;

    vector<S> a(n);
    rep(i, 0, n) {
        cin >> x;
        a[i] = {x, 1};
    }

    lazy_segtree<S, op, e, F, mapping, composition, id> lseg(a);

    rep(i, 0, q) {
        cin >> t >> l >> r;
        if (t == 0) {
            cin >> b >> c;
            lseg.apply(l, r, {b, c});
        } else {
            cout << lseg.prod(l, r).fir.val() << endl;
        }
    }
}


Measured memory_bytes: 19276
//code_sm
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define si set<int>
#define ll long long
#define pb push_back
int pow(int n)
{
	int p=0;
	while(n%2==0)
	{
		p++;
		n/=2;
	}
	return p;
}
int main()
{
int n;
cin>>n;
int max1=pow(1);
int res=1;
for(int i=1;i<=n;i++)
{
if(pow(i)>=max1)
{
	res=i;
	max1=pow(i);
}
}
cout<<res;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll n, d;
    cin >> n >> d;
    vector<ll> xs(n), ys(n);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%lld %lld", &xs[i], &ys[i]);
        if(xs[i]*xs[i]+ys[i]*ys[i] <= d*d) ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6412
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);string s;cin>>s;int n = s.size(),d=10;int su[n],c[2019];memset(c,0,sizeof(c));long long ans=0;su[n-1] = s[n-1]-'0';
    for(int i=n-2;i>=0;i--){
        su[i] = ((int)(s[i]-'0')*d+su[i+1])%2019;d*=10;d%=2019;
    }
    for(int i=0;i<n;i++)c[su[i]]++;
    c[0]++;
    for(int i=0;i<2019;i++)ans+=c[i]*(c[i]-1)/2;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 4552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define all(obj) (obj).begin(),(obj).end()

int n,m;
vector<int> d[200005];
bool bl[200005];
void dfs(int k,int l){
    if(l==3)return;
    bl[k]=1;
    if(bl[n]==1)return;
    rep(i,d[k].size()) dfs(d[k][i],l+1);
    return ;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    rep(i,n)bl[i]=0;
    rep(i,m){
        int a,b;cin>>a>>b;
        d[a].push_back(b);
    }
    dfs(1,0);
    if(bl[n]==1)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


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

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

long sd[4][200005];
long td[4][200005];

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

  long h, w, n;
  cin >> h >> w >> n;

  long x, y;
  cin >> y >> x;

  bool res = true;
  string s,t;
  cin >> s >> t;
  {
    long ud = w;
    long ld = 1;
    per(i, n) {
      if (i != n-1) {
        if (t[i] == 'R') {
          ld = max(1L, ld-1);
        }
        if (t[i] == 'L') {
          ud = min(w, ud+1);
        }
      }
      if (s[i] == 'L') {
        ld++;
      }  
      if (s[i] == 'R') {
        ud--;
      }
      if (ud < ld) {
        res = false;
        break;
      }
    }
    if (x < ld || x > ud) {
      res = false;
    }
  }
  {
    long ud = h;
    long ld = 1;
    per(i, n) {
      if (i != n-1) {
        if (t[i] == 'D') {
          ld = max(1L, ld-1);
        }
        if (t[i] == 'U') {
          ud = min(h, ud+1);
        }
      }
      if (s[i] == 'U') {
        ld++;
      }  
      if (s[i] == 'D') {
        ud--;
      }
      if (ud < ld) {
        res = false;
        break;
      }
    }
    if (y < ld || y > ud) {
      res = false;
    }
  }


  cout << (res?"YES":"NO") << endl;
}


Measured memory_bytes: 920
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back

vector<bool> SievePrimes(ll n) {
  vector<bool> primes(n,true);
  primes[0] = primes[1] = false;

  ll m = 2;
  while (m*m <= n) {
    if (primes[m]) {
      for (ll i = m; i <= n; i += m) {
        if (i == m) continue;
        if (primes[i]) {
          primes[i] = false;
        }
      }
    }
    m++;
  }

  return primes;
}

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

  vector<bool> primes(100010, false);
  vector<int> sum(100010, 0);
  primes = SievePrimes(100010);

  for (int i = 1; i < 100010; i += 2) {
    int j = (i + 1) / 2, s = 0;
    if (primes[i] and primes[j]) {
      s++;
    }
    if (i == 1) {
      sum[i] = s;
    } else {
      sum[i] = sum[i-2] + s;
    }
  }

  for (int i = 0; i < q; ++i) {
    ll l,r;
    cin >> l >> r;

    if (l - 2 < 0) {
      cout << sum[r] - sum[0] << endl;
    } else {
      cout << sum[r] - sum[l-2] << endl;
    }
  }
}


Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int sx, sy, tx, ty;
        sx = sc.nextInt();
        sy = sc.nextInt();
        tx = sc.nextInt();
        ty = sc.nextInt();

        var ans = "";
        var c1 = ty - sy;
        var c2 = tx - sx;
        ans += new string('U', c1);
        ans += new string('R', c2);
        ans += new string('D', c1);
        ans += new string('L', c2);
        ans += new string('L', 1);
        ans += new string('U', c1 + 1);
        ans += new string('R', c2 + 1);
        ans += new string('D', 1);
        ans += new string('R', 1);
        ans += new string('D', c1 + 1);
        ans += new string('L', c2 + 1);
        ans += new string('U', 1);

        WriteLine(ans);
    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

int main(){
  int N;
  cin >> N;
  
  set<string> g;
  for(int i=0;i<N;i++){
    string s;
    cin >> s;
    g.insert(s);
  }
  
  cout << g.size() <<endl;
}


Measured memory_bytes: 19208
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define s(x, n) memset(x, n, sizeof(x));
#define pb(x) push_back(x)

ll findProductSum(ll A[], ll n)
{
    ll array_sum = 0;
    for (ll i = 0; i < n; i++)
    {
        array_sum = (array_sum % mod) + (A[i] % mod);
        array_sum %= mod;
    }

    ll array_sum_square = (array_sum * array_sum) % mod;

    ll individual_square_sum = 0;
    for (ll i = 0; i < n; i++)
    {
        individual_square_sum += (A[i] * A[i]) % mod;
        individual_square_sum %= mod;
    }

    return ((array_sum_square - individual_square_sum + mod) % mod * 500000004) % mod;
}
int main()
{
#ifdef WIN32
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

#ifndef WIN32
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#endif
    ll n;
    cin >> n;
    ll arr[n];
    for (ll i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    cout << findProductSum(arr, n) % mod << "\n";
    return 0;
}

Measured memory_bytes: 5192