akhauriyash/Code-Regression huggingface dataset:
import math

abhm = list(map(lambda x:int(x), input().split()))
a = abhm[0]
b = abhm[1]
h = abhm[2]
m = abhm[3]

bang = 2*math.pi * (m * (1/60))
aang = 2*math.pi * (h * (1/12) + m * (1 / 12 / 60) )
#print(aang)
#print(bang)

apos = (a*math.cos(aang), a*math.sin(aang))
bpos = (b*math.cos(bang), b*math.sin(bang))
#print(apos)
#print(bpos)
lenx = apos[0]-bpos[0]
leny = apos[1]-bpos[1]

ablengh =lenx*lenx+leny*leny

ablengh = math.sqrt(ablengh)

print(ablengh)

Measured memory_bytes: 9564
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using p = pair<int, int>;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << a*b << endl;
	return 0;
}

Measured memory_bytes: 3624
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

a_all = []
for a in A:
  a_all.append(a)
  a_all.append(a - 1)
  a_all.append(a + 1)

a_counter = Counter(a_all)
print(a_counter.most_common()[0][1])

Measured memory_bytes: 30940
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int x;
    cin>>x;
    if(x%100==0){
        cout<<1<<endl;
    }
    else{
        for(int i=1;i<=1000;i++){
            int memo=x/(i*100);
            int a=x%(i*100);
            if(a<=memo*5){
                cout<<1<<endl;break;
            }
            if(i==1000){
                cout<<0<<endl;
            }
        }
    }
    
}

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

pub fn main() {
    const MAX: usize = 100001;
    let mut is_prime = [true;MAX];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 2..MAX {
        if !is_prime[i] {continue;}
        let mut m = 2;
        while i*m < MAX {
            is_prime[i*m] = false;
            m += 1;
        }
    }

    let mut is_likenum = [false;MAX];
    for i in 0..MAX {
        if i % 2 == 1 && is_prime[i] && is_prime[(i+1)/2] {
            is_likenum[i] = true;
        }
    }

    let mut csum = [0;MAX + 1];
    for i in 0..MAX {
        csum[i+1] = csum[i] + (if is_likenum[i] {1} else {0})
    }

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let q: u32 = iter.next().unwrap().parse().unwrap();
    for _ in 0..q {
        let left: usize = iter.next().unwrap().parse().unwrap();
        let right: usize = iter.next().unwrap().parse().unwrap();
        println!("{}", csum[right+1] - csum[left]);
    }
}


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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int  h, n;
    cin >> h >> n;
    ivec a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    ivec dp(h+1, inf);
    dp[0] = 0;
    for (int i = 1; i < h+1; i++){
        for (int j = 0; j < n; j++) dp[i] = min(dp[i], dp[max(0, i-a[j])] + b[j]);
    }
    cout << dp[h] << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
#define testing 1
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto it : v) cerr << it << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto it : v) cerr << "{"  << it.f << ',' << it.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9+500
#define oo (ll)1e18+500
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
template <typename T> void chmax(T& a, T b) {
	a = max(a, b);
}
template <typename T> void chmin(T& a, T b) {
	a = min(a, b);
}
#define MAXN
#if !testing
#define cerr if(0)cout
#endif

int32_t main() {
	IAMSPEED
	int n,a; cin >> n>> a;
	cout<<n*n-a;
}


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

int main() {
  int N;
  cin >> N;
 
  if (N % 1110 <= 9) {
    cout << "Yes" << endl;
  }
  
  else if (N % 1000 % 111 == 0) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 1005;
ll x[MAX_N],y[MAX_N],z[MAX_N],w[MAX_N];

ll f(int a)
{
	if (a == 0) return ll(1);
	else return ll(-1);
}

int main()
{
	int N,M;
	cin >> N >> M;
	rep(i,N)
	{
		cin >> x[i] >> y[i] >> z[i];
	}
	ll ans = 0 ,temp = 0;
	int a,b,c;
	for (int i = 0; i < 8; ++i)
	{
		temp = 0;
		a = i & (1 << 0), b = i & (1 << 1), c = i & (1 << 2);
		rep(j,N)
		{
			w[j] = x[j]*f(a) + y[j]*f(b) + z[j]*f(c);
		}
		sort(w,w+N);
		/*
		rep(j,N)
		{
			cout << w[j] << " ";
		}
		cout << endl;
		*/
		rep(j,M)
		{
			temp += w[N-1-j];
		}
		ans = max(ans,temp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N, T, A;
 cin >> N >> T >> A;
 vector<int> H(N);
 for(int i = 0; i < N; i++) cin >> H.at(i);
 int min = 1001001;
 int ans;
   
 for(int i = 0; i < N; i++){
    int temp = T*1000 - H.at(i)*6 -A*1000;
    if (temp < 0) temp = - temp ;
    if(temp < min){ 
      min = temp;
      ans = i+1;
    }
 }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double xLong = 0;
		double yLong = 0;
		double xShort = 0;
		double yShort = 0;
		double ans = 0;

		double ThetaLong = 0;
		double ThetaShort = 0;

		double minute = H * 60 + M;

		if(H < 3) {
			ThetaShort = 90 - 0.5 * minute;
			xShort = A * Math.cos(Math.toRadians(ThetaShort));
			yShort = A * Math.sin(Math.toRadians(ThetaShort));
		}else if(H < 6) {
			ThetaShort = 0.5 * minute - 90;
			xShort = A * Math.cos(Math.toRadians(ThetaShort));
			yShort = -A * Math.sin(Math.toRadians(ThetaShort));
		}else if(H < 9) {
			ThetaShort = 270 - 0.5 * minute;
			xShort = -A * Math.cos(Math.toRadians(ThetaShort));
			yShort = -A * Math.sin(Math.toRadians(ThetaShort));
		}else {
			ThetaShort = 0.5 * minute - 270;
			xShort = -A * Math.cos(Math.toRadians(ThetaShort));
			yShort = A * Math.sin(Math.toRadians(ThetaShort));
		}

		if(M < 15) {
			ThetaLong = 90 - 6 * M;
			xLong = B * Math.cos(Math.toRadians(ThetaLong));
			yLong = B * Math.sin(Math.toRadians(ThetaLong));
		}else if(M < 30) {
			ThetaLong = 6 * M - 90;
			xLong = B * Math.cos(Math.toRadians(ThetaLong));
			yLong = -B * Math.sin(Math.toRadians(ThetaLong));
		}else if(M < 45) {
			ThetaLong = 270 - 6 * M;
			xLong = -B * Math.cos(Math.toRadians(ThetaLong));
			yLong = -B * Math.sin(Math.toRadians(ThetaLong));
		}else {
			ThetaLong = 6 * M - 270;
			xLong = -B * Math.cos(Math.toRadians(ThetaLong));
			yLong = B * Math.sin(Math.toRadians(ThetaLong));
		}

		ans = Math.sqrt( Math.pow(xShort-xLong, 2) + Math.pow(yShort-yLong, 2));
		System.out.println(ans);

		scan.close();
	}
}


Measured memory_bytes: 35916
/******************************************
* AUTHOR : SOMU KUMAR *
* INSTITUTION : IIT BHUBANESWAR *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//code here...............//
int n;
cin>>n;
ll a[n],b[n];
for(int i=0;i<n;i++){
	ll x,y;
	cin>>x>>y;
	a[i]=(x-y);
	b[i]=(x+y);
}
sort(a,a+n);
sort(b,b+n);
cout<<max(abs(a[0]-a[n-1]),abs(b[0]-b[n-1]))<<endl;
return 0;
}

Measured memory_bytes: 6788
H, W, K = gets.split.map(&:to_i)
MOD = 1_000_000_007

f = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 0] # f(w) = number of Amida in a row
dp = Array.new(H + 1){Array.new(W + 2, 0)} # dp[h][w] : 1 at w in row h
dp[0][1] = 1
[*1 .. H].product([*1 .. W]).each do |h, w|
  dp[h][w] = (f[w - 2]*f[W - w]*dp[h - 1][w - 1] + f[w - 1]*f[W - w]*dp[h - 1][w] + f[w - 1]*f[W - w - 1]*dp[h - 1][w + 1]) % MOD
end
puts dp[H][K]

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl

int main(){
    FIN;
    int n;
    cin >> n;
    vector<double> p(n, 0);
    forn(i, n) cin >> p[i];

    vector<double> dp(n + 1, 0), nex(n + 1, 0);

    dp[1] = p[0];
    dp[0] = 1 - p[0];

    forr(i,1,n){
        nex[0] = dp[0] * (1 - p[i]);
        forr(j, 1, n + 1) if (j <= i + 1)
            nex[j] = dp[j - 1] * p[i] + dp[j] * (1 - p[i]);
        forn(j, n + 1) dp[j] = nex[j];
    }
    double sum = 0;
    forn(i, n + 1) if (i > n - i) sum += dp[i];
    cout << fixed << setprecision(12) << sum << endl;
    

    return 0;
}



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

int main() {
  string S;
  cin >> S;
  int max = 0;
  int count = 0;
  
  for (int i = 0; i < S.size(); i++) {
    if (
      S[i] == 'A' ||
      S[i] == 'C' ||
      S[i] == 'G' ||
      S[i] == 'T'
    ) {
      count++;
      if (count > max) {
        max = count;
      }
    } else {
      count = 0;
    }
  }
  
  cout << max;
}

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

int main(){
  int a[5], k;
  for(int i=0; i < 5; i++)cin >> a[i];
  cin >> k;
  for(int i=0; i < 5; i++){
    for(int j=i+1; j < 5; j++){
      if(abs(a[i]-a[j]) > k){
        cout << ":(";
        return 0;
      }
    }
  }
  cout << "Yay!";

  return 0;
}


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

int main()
{
  int N,Y ;
  cin>>N>>Y ;
  Y=Y/1000 ;
  for(int x=0;10*x<=Y;x++){
    for(int y=0;10*x+5*y<=Y;y++){
      int z=Y-10*x-5*y ;
      if(z>=0&&x+y+z==N){
        cout<<x<<" "<<y<<" "<<Y-10*x-5*y<<endl ;
        return 0 ;
      }
    }
  }
  cout<<"-1 -1 -1"<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


int main(){
    int h,w,k;
    cin >> h >> w >> k;
    char c[h][w];
    int all = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> c[i][j];
            if(c[i][j] == '#') all++;
        }
    }

    int ans = 0;

    for(int i = 0; i < (1<<h); i++){
        set<int> row;
        int black = 0;
        for(int l = 0; l < h; l++){
            if((i>>l) & 1){
                row.insert(l);
                for(int m = 0; m < w; m++){
                    if(c[l][m] =='#') black++;
                }
            }
        }
        for(int j = 0; j < (1<<w); j++){
            int tmp = black;
            vector<int> col;
            for(int l = 0; l < w; l++){
                if((j>>l) & 1){
                    for(int m = 0; m < h; m++){
                        if(row.find(m) != row.end()) continue;
                        if(c[m][l] == '#') tmp++;
                    }
                }
            }
            if(all-tmp == k) ans++;
        }
    }

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

Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N, K;
  cin >> N >> K;
  ll ans;
  if (K < N) {
    ll last = N - K * (N / K);
    if (last < abs(last - K)) {
      ans = last;
    } else {
      ans = abs(last - K);
    }
  } else {
    if (N < abs(N - K)) {
      ans = N;
    } else {
      ans = abs(N - K);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
 
using namespace std;
 
int main() {
    int a[3000], b[3000],n=0;
    while(1){
        cin >> a[n] >> b[n];
    if (a[n] == 0 && b[n] == 0)break;
        n++;
    }
    for(int j=0;j<=n;j++){
        if (a[j] == 0 && b[j] == 0)break;
        int cnt = 0;
        if (j != 0)cout << endl;
        for (int i = a[j]; i <= b[j]; i++) {
             
             
            if (i % 4 == 0) {
                if (i % 100 == 0) {
                    if (i % 400 == 0) {
                        cnt++;
                        cout << i << endl;
                    }
                }
                else {
                    cnt++;
                    cout << i << endl;
                }
            }
            if (i == b[j]) {
                if (cnt == 0)cout << "NA" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3036
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <atcoder/all>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using namespace atcoder;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const int INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 1e9;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d;
    cin >> n >> d;
    vector<ll> x(n),y(n);
    rep(i,n) cin >> x[i] >> y[i];
    two_sat g(n);
    rep(i,n-1){
        rep(j,i+1,n){
            if (abs(x[i]-x[j]) < d) g.add_clause(i,0,j,0);
            if (abs(x[i]-y[j]) < d) g.add_clause(i,0,j,1);
            if (abs(y[i]-x[j]) < d) g.add_clause(i,1,j,0);
            if (abs(y[i]-y[j]) < d) g.add_clause(i,1,j,1);
        }
    }
    bool f = g.satisfiable();
    if (f){
        auto ans = g.answer();
        vector<ll> a(n);
        rep(i,n){
            if (ans[i]) a[i] = x[i];
            else a[i] = y[i]; 
        }
        PRINT("Yes");
        rep(i,n) PRINT(a[i]);
    }
    else{
        PRINT("No");
    }
}


Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

using ll = long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n) for(ll i=0;i<(n);i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000;
//#define PI 3.14159265359


int main() {
    // input
    ll N;
    cin >> N;
    Vec A(N, 0);
    rep(i, N) {
        cin >> A[i];
        if (A[i] == 0) {
            cout << 0;
            return 0;
        }
    }

    //process
    ll ans = 1;
    ll post_ans = 0;

    rep(i, N) {
        post_ans = ans;
        ans *= A[i];
        if (ans > INF || ans < post_ans) {
            ans = -1;
            break;
        }
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 3560
import sys
from collections import deque
input = sys.stdin.readline

class Node:
    def __init__(self):
        self.color = 0
        self.check = False
        self.link = []

def main():
    N = int(input())

    nodes = [Node() for i in range(N)]
    
    for i in range(N-1):
        u, v, w = map(int, input().split())
        nodes[u-1].link.append((nodes[v-1], w&1))
        nodes[v-1].link.append((nodes[u-1], w&1))
    
    q = deque()
    q.append((nodes[0], 1))
    while len(q) > 0:
        node, color = q.popleft()
        node.color = color
        node.check = True
        for nex, weight in node.link:
            if not nex.check:
                if weight == 0:
                    q.append((nex, color))
                else:
                    q.append((nex, -color))
    
    for i in range(N):
        print((nodes[i].color + 1) // 2)

if __name__ == "__main__":
    main()

Measured memory_bytes: 45544
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC114D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            List<int> primeNumbers = new List<int>();
            for (int i = 2; i <= N; i++) primeNumbers.Add(i);
            for (int i = 0; i < primeNumbers.Count; i++)
            {
                primeNumbers = primeNumbers.Where(x => x == primeNumbers[i] || x % primeNumbers[i] != 0).ToList();
            }
            int[] countDivisors = new int[primeNumbers.Count];
            
            for (int i = 2; i <= N; i++)
            {
                int divisioned = i;
                //約数をカウントして各素数の個数に加える
                for(int j = 0; j <primeNumbers.Count; j++)
                {
                    if (divisioned % primeNumbers[j] == 0)
                    {
                        countDivisors[j]++;
                        divisioned /= primeNumbers[j];
                        j--;
                    }
                }
            }

            //
            int overFive = countDivisors.Where(x => x >= 4).ToArray().Count();
            int overThree = countDivisors.Where(x => x >= 2).ToArray().Count();

            int ans = overFive * (overFive - 1) / 2 * (overThree - 2);

            int overSeventyFive = countDivisors.Where(x => x >= 74).ToArray().Count();

            int overFifeen = countDivisors.Where(x => x >= 14).ToArray().Count();

            int overTwentyFive = countDivisors.Where(x => x >= 24).ToArray().Count();

            ans += overSeventyFive + overFifeen * (overFive - 1) + overTwentyFive * (overThree - 1);

            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>

using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

ll N,K;
int main(){
  cin >> N >> K;
  if (K==1){
    cout << N*N*N << endl;
    return 0;
  }
  ll X=(N/(K/2)+1)/2;
  ll Y=N/K;
  if (K%2==0)cout << X*X*X + Y*Y*Y <<endl;
  else cout <<Y*Y*Y<<endl;
  return 0;
}


Measured memory_bytes: 256
n,q=map(int,input().split())

yoko=[0 for i in range(n+1)]
tate=[0 for i in range(n+1)]
yokobig=n
tatebig=n
ans=0

for _ in range(q):
    a,b=map(int,input().split())
    if a==1:
        if b<yokobig:
            ans+=tatebig-2
            
            for i in range(b,yokobig):
                yoko[i]=tatebig
            yokobig=b
        else:
            ans+=yoko[b]-2
    if a==2:
        if b<tatebig:
            ans+=yokobig-2
            
            for i in range(b,tatebig):
                tate[i]=yokobig
            tatebig=b
        else:
            ans+=tate[b]-2
    #print(ans)
    
print((n-2)**2-ans)

Measured memory_bytes: 94452
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#define DEBUG(x) std::cout << '>' << #x << ':' << x << '\n';
#define PRINTVEC(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i] << ' '; std::cout << '\n';
#define PRINTP(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i].first << ' ' << x[i].second << '\n'; std::cout << '\n';
#define io std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);   
const int INF = 1<<29;
typedef long long ll;
using namespace std;

int main()
{
	io;
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);  
    #endif

    int n,m;
    cin >> n >> m;
    vector<int> v(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        sum += v[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (4 * v[i] * m >= sum)
            ans++;
    }
    cout << (ans >= m ? "Yes" : "No");


    #ifndef ONLINE_JUDGE   
    //std::cout << '\n' << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    #endif
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        int gcd = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (a[i] > max)
                max = a[i];
            if (a[i] < min)
                min = a[i];
            if (a[i] == k) {
                System.out.print("POSSIBLE");
                return;
            }
            if(i==0){
                gcd = a[0];
            }else{
                gcd = gcd(a[i], gcd);
            }
            if (gcd < min)
                min = gcd;
            if (k < max && k%gcd == 0) {
                System.out.print("POSSIBLE");
                return;
            }
        }
        sc.close();
        System.out.print("IMPOSSIBLE");
    }

    public static int gcd(int a, int b) {
        int r = 1;
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }
        while (b > 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}

Measured memory_bytes: 49472
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void d_m_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int power(int n, int x)
{
	if (x == 0)
		return 1;

	int small = power(n, x / 2) % mod;
	small = (small * small) % mod;

	if (1 & x)
		small = (n * small) % mod;

	return small;
}

bool isPowerOfTwo(int n)
{
	return n && (!(n & (n - 1)));
}

int maxHappines(int hap[][3], int n)
{
	int dp[n + 1][3];

	dp[1][0] = hap[1][0];
	dp[1][1] = hap[1][1];
	dp[1][2] = hap[1][2];

	for (int i = 2; i <= n; i++)
	{
		dp[i][0] = hap[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = hap[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = hap[i][2] + max(dp[i - 1][1], dp[i - 1][0]);
	}

	return max(dp[n][0], max(dp[n][1], dp[n][2]));
}


int32_t main()
{
	//d_m_c();

	int n;
	cin >> n;
	int hap[n + 1][3];

	for (int i = 1; i <= n; i++)
	{
		int a, b, c;
		cin >> a >> b >> c;
		hap[i][0] = a;
		hap[i][1] = b;
		hap[i][2] = c;
	}

	cout << maxHappines(hap, n);


	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a;
	cin >> a;
	int b;
	cin >> b;

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
	cout << "Possible" << endl;
	
	else
    cout << "Impossible" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int len1,len2,i;
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    len1=(int)s.size();
    len2=(int)t.size();
    for(i=0;i<min(len1,len2);i++)
        if(s[i]<t[i])
            break;
        else if(t[i]<s[i])
            break;
    if(i<min(len1,len2))
    {
        if(s[i]<t[i])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    else
    {
        if(len1<len2)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


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

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

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

    cout << N/3 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int a[105],tmp[5];
inline int read() {
    register int x=0,f=1;register char s=getchar();
    while(s>'9'||s<'0') {if(s=='-') f=-1;s=getchar();}
    while(s>='0'&&s<='9') {x=x*10+s-'0';s=getchar();}
    return x*f;
}
int main() {
    int n=read(),ans=0;
    for(register int i=1;i<=n;++i) a[i]=read();
    for(register int i=1;i<=n;++i) {
		for(register int j=i+1;j<=n;++j) {
			if(a[i]==a[j]) continue;
            for(register int k=j+1;k<=n;++k) {
            	if(a[i]==a[k]||a[j]==a[k]) continue;
                tmp[0]=a[i],tmp[1]=a[j],tmp[2]=a[k];
                std::sort(tmp,tmp+3);
//                printf("%d %d %d\n",tmp[0],tmp[1],tmp[2]);
                if(tmp[0]+tmp[1]>tmp[2]&&tmp[1]-tmp[0]<tmp[2]&&tmp[2]-tmp[1]<tmp[0]&&tmp[2]-tmp[0]<tmp[1]) ++ans;//,printf("%d %d %d\n",i,j,k);
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1600
object Main extends App {
  import java.{ util => ju }
  import scala.annotation._
  import scala.collection._
  import scala.collection.{ mutable => mu }
  import scala.collection.JavaConverters._
  import scala.math._
  import scala.io.StdIn.readLine

  val sc = new ju.Scanner(System.in)

  val n = sc.nextInt()
  var array = Array.fill[String](n)(sc.next())
  val bubble = bubbleSort(array)
  val selection = selectionSort(array)
  printArray(bubble)
  println("Stable")
  printArray(selection)
  println(if (compareArray(bubble, selection)) "Stable" else "Not stable")

  def bubbleSort(nums: Array[String]): Array[String] = {
    var result = nums.clone()
    val n = result.length
    for (i <- 0 until n) {
      for (j <- n - 1 until i by -1) {
        if (compareString(result(j), result(j - 1))) {
          val bigger = result(j)
          result(j) = result(j - 1)
          result(j - 1) = bigger
        }
      }
    }
    result
  }

  def selectionSort(nums: Array[String]): Array[String] = {
    var result = nums.clone()
    for (i <- 0 until n) {
      var min = i
      for (j <- i to n - 1) {
        if (compareString(result(j), result(min))) {
          min = j
        }
      }
      if (min != i) {
        val bigger = result(min)
        result(min) = result(i)
        result(i) = bigger
      }
    }
    result
  }

  def compareString(s1: String, s2: String): Boolean = {
    s1.charAt(1) < s2.charAt(1)
  }

  def printArray(nums: Array[String]) {
    for (i <- 0 until nums.length - 1) print(nums(i) + " ")
    println(nums.last)
  }

  def compareArray(bubble: Array[String], selection: Array[String]): Boolean = {
    for (i <- 0 until bubble.length) {
      if (!bubble(i).equals(selection(i))) return false
    }
    true
  }
}

Measured memory_bytes: 45252
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int a,b;
  cin >> a >> b;
  
  string s;
  cin >> s;

  REP(i,a+b+1){
    if(i == a){
      if(s[i] != '-'){
      cout << "No" << endl; return 0;
      }
    }
    else if(s[i] < '0' || s[i] > '9'){
      cout << "No" << endl; return 0;
    }
  }
    
    cout << "Yes" << endl;
  
 return 0;
}

Measured memory_bytes: 256
<?php
  fscanf(STDIN,"%d %d",$n,$k);
  for($i=0; $i<$n; $i++){
    $h[] = trim(fgets(STDIN));
  }
  sort($h);
  $sa = 999999999999999;
  for($i=0; $i<=$n-$k; $i++){
    $sa = min($h[$i+($k-1)]-$h[$i],$sa);
  }
  echo $sa."\n";

Measured memory_bytes: 12792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    char c;
    cin >> c;
    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')cout << "vowel" << endl;
    else cout << "consonant" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b,c,k,ans=0;
	int M;
	scanf("%d %d %d",&a,&b,&c);
	scanf("%d",&k);
	if(a>b) M=a;
	else M=b;
	if(c>M) M=c;
	ans=a+b+c-M;
	for(;k>=1;k--) M*=2;
	ans+=M;
	printf("%d",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;


#define ff                first
#define ss                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vi                vector<int>
#define mii               map<int,int>
#define pqb               priority_queue<int>
#define pqs               priority_queue<int,vi,greater<int> >
#define setbits(x)        __builtin_popcountll(x)
#define zrobits(x)        __builtin_ctzll(x)
#define mod               1000000007   //10^9 + 7
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type*arr = new type[n]
#define w(x)              int x;cin>>x;while(x--)
#define ti(n)             int n;cin>>n
#define rep(i,n)          for(int i=0;i<(n);++i)
#define repA(i,a,n)       for(int i=a;i<=(n);++i)
#define repD(i,a,n)       for(int i=a;i>=(n);--i)
#define itr(type,it,x)    for(type it = x.begin();it!=x.end();it++)
#define endl              "\n"
mt19937                  rng(chrono::steady_clock::now().time_since_epoch().count());  // to shuffle an array randomly viz. shuffle(arr,arr+n,rng)

//typedef tree<int , null_type , less<int> , rb_tree_tag, tree_order_statistics_node_update> pbds;  //policy based data structure


void c_p_c() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

struct item
{
  int wt;
  int val;
};

int solve(vector<item> ar, int n, int W)
{
  int dp[n + 1][W + 1];

  for (int w = 0; w <= W; w++)
    dp[1][w] = 0;

  dp[1][ar[1].wt] = ar[1].val;

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

    for (int w = 0; w <= W; w++)
    {
      dp[i][w] = dp[i - 1][w];

      if (ar[i].wt > w)
        continue;

      dp[i][w] = max(dp[i][w], ar[i].val + dp[i - 1][w - ar[i].wt]);
    }

  }

  return *max_element(dp[n], dp[n] + W + 1);
}

int32_t main(int32_t argc, char const *argv[]) {

  c_p_c();

  int n, W;
  cin >> n >> W;

  vector<item> ar(n + 1);

  for (int i = 1; i <= n; ++i)
  {
    cin >> ar[i].wt >> ar[i].val;
  }
  cout << solve(ar, n, W) << endl;


  return 0;
}




Measured memory_bytes: 78336
c=input()

a=["a", "b", "c", "d", "e", "f", "g","h", "i", "j", "k", "l", "m", "n", "o", "p", "q","r","s","t","u","v","w","x","y","z"]

for i in range(len(a)):

    if c==a[i]:

        print(a[i+1])


Measured memory_bytes: 2940
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll A,B,C;
	cin >>A>>B>>C;
	
	//出力
	if (A==B & B==C) printf("Yes\n");
	else printf("No\n");
}


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

int main() {
	int a,b,x;
	
	cin >> a;
	cin >> b;
	cin >> x;
	
	if (x >= a && a + b >= x) {
		printf("YES");
	}else{
		printf("NO");
	}

	return 0;
}

Measured memory_bytes: 256
s=input()
ans=0
l=len(s)
num=2**(l-1)
for i in range(num):
    now=s[0]
    for j in range(l-1):
        if (i>>j)&1==1:
            ans+=eval(now)
            now=s[j+1]
        else:
            now+=s[j+1]
    ans+=eval(now)
print(ans)

Measured memory_bytes: 39408
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

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

    int n, m; cin >> n >> m;
    using Edge = tuple<int, int>;
    vector<Edge> edges(m);
    rep(i, m){
        int a, b; cin >> a >> b;
        a--, b--;
        edges[i] = Edge(a, b);
    }

    UnionFind uf(n);
    ll cur = 1LL * n * (n - 1) / 2;
    vll res(m);
    rrep(i, m){
        res[i] = cur;

        int a, b; tie(a, b) = edges[i];
        if(not uf.findSet(a, b)){
            cur -= uf.size(a) * uf.size(b);
        }

        uf.unionSet(a, b);
    }

    for(auto& e : res){
        cout << e << endl;
    }

    return 0;
}


Measured memory_bytes: 3328
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

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

class AFerrisWheel {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int a,b;
	    in>>a>>b;

	    if(a>=13) out<<b<<endl;
	    else if(6<=a && a<=12) out<<b/2<<endl;
	    else out<<0<<endl;

	}
};


int main() {
	AFerrisWheel solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    long long n, l;
    std::cin >> n >> l;
    std::vector<long long> a(n+2, 0);
    for (long long i = 1; i <= n; i++) {
        std::cin >> a[i];
    }

    auto it = std::adjacent_find(a.begin(), a.end(), [&l](auto a, auto b) { return a + b >= l; });

    if (it == a.end()) {
        std::cout << "Impossible" << std::endl;
        return 0;
    } else {
        std::cout << "Possible" << std::endl;
        auto pivot = it - a.begin();
        for (long long i = 1; i < pivot; i++) std::cout << i << std::endl;
        for (long long i = n - 1; i > pivot; i--) std::cout << i << std::endl;
        if (pivot != n && pivot != 0) std::cout << pivot << std::endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

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

  vector<string> s(n);
  rep(i, n) cin >> s.at(i);

  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  cout << s.size();
  return 0;
}


Measured memory_bytes: 9536
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new int[n];
        var b = new int[n];
        var c = new int[n];
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            a[i] = int.Parse(line[0]);
            b[i] = int.Parse(line[1]);
            c[i] = int.Parse(line[2]);
        }
        var ans = getAns(a, b, c, n);
        Console.WriteLine(ans);
    }
    static long getAns(int[] a, int[] b, int[] c, int n)
    {
        var dp = new long[n, 3];
        dp[0, 0] = a[0]; dp[0, 1] = b[0]; dp[0, 2] = c[0];
        for (int i = 1; i < n; i++)
        {
            dp[i, 0] = Max(dp[i - 1, 1], dp[i - 1, 2]) + a[i];
            dp[i, 1] = Max(dp[i - 1, 0], dp[i - 1, 2]) + b[i];
            dp[i, 2] = Max(dp[i - 1, 0], dp[i - 1, 1]) + c[i];
        }
        return Max(dp[n - 1, 0], Max(dp[n - 1, 1], dp[n - 1, 2]));
    }
}

Measured memory_bytes: 18496
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int a[20],b[20],c[20];
int n;
int ans;
int null = -100;


int main(){
    cin >> n;
    rep(i,n) {cin >> a[i]; a[i]--;}
    rep(i,n) {cin >> b[i];}
    rep(i,n-1) {cin >> c[i];}
    int prev_dish = null;
    rep(i,n){
        int dish = a[i];
        ans += b[dish];
        // cout << b[dish] << endl;
        if(dish == prev_dish + 1){
            ans += c[prev_dish];
            // cout << "c" << c[prev_dish] << endl;
        }
        prev_dish = dish;
    }
    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3576
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int h,w;
    cin >> h >> w;
    vector<string>x(h);
    for(int i=0;i<h;i++){
        cin >> x[i];
    }
    for(int i=1;i<=w+2;i++){
        cout << "#";
    }
    cout<<"\n";
    for(int i=0;i<h;i++){
        cout << "#"<<x[i]<<"#\n";
    }
    for(int i=1;i<=w+2;i++){
        cout << "#";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll INF = 1ll<<50;
const int maxN = 110;
const int maxK = 16;
const int MOD = 1000000007;

vector<int> rd[maxN];     //原来的图 
int vis[maxN][maxN];              //每个节点的数 
char a[maxN];


int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d); 
	int l = max(a,c);
	int r = min(b,d);
	if(l>=r)
		puts("0");
	else
	{
		printf("%d\n",r-l);
	}
	return 0;
} 

Measured memory_bytes: 256
from sys import stdin
def solve():
    n=int(stdin.readline())
    '''ln_n=len(str(n))
    cnt=9
    for i in range(11,n+1):
        s=str(i)
        if s[-1]=='0':
            continue
        ln=len(s)
        if ln==ln_n:
            if ln_n!=2:
                cnt+=int(s[1:-1])
            else:
                if int(s[::-1])<=n:
                    cnt+=1
        else:
            cnt+=10**(ln-2)
    print(cnt)'''
    d={}
    for i in range(1,n+1):
        s=str(i)
        if s[-1]!='0':
            k=(s[0],s[-1])
            d.setdefault(k,0)
            d[k]+=1
    cnt=0
    for i in d:
        for j in d:
            if i[0]==j[1] and i[1]==j[0]:
                cnt+=(d[i]*d[j])
    #print(d)
    print(cnt)
                
solve()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
int main()
{
    uint64_t n{}, k{};
    std::cin >> n >> k;
    std::vector<int> enemy(n);
    for (uint64_t i = 0; i < n; i++) {
        std::cin >> enemy[i];
    }
    // TODO
    if (enemy.size() <= k) {
        std::cout << 0;
        return 0;
    }
    std::nth_element(enemy.begin(), enemy.end() - k, enemy.end());
    std::cout << std::accumulate(enemy.begin(), enemy.end() - k, uint64_t{});
    return 0;
}

Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val l = (1..n).map { sc.nextInt() }

  val sort = l.sorted()
  val list = (0 until n-1).map { sort[it] }
  val max = l.max()!!

  if (max < list.sum()) {
    println("Yes")
    return
  }
  println("No")

}


Measured memory_bytes: 40404