akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException
    {
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        Integer[] data = makeint(br);
        Integer a = data[0], b = data[1], c = data[2];
        if(a < b && b < c){ System.out.println("Yes"); }
        else{ System.out.println("No"); }

    }
    public static void show(Integer[] a){
        int n = a.length;
        for(int i = 0; i < n - 1; i++){ System.out.print(a[i] + " "); }
        System.out.println(a[n - 1]);
    }
    public static Integer[] makeint(BufferedReader br) throws IOException
    {
        String[] str = br.readLine().split(" ");
        int n = str.length;
        Integer[] a = new Integer[n];
        for(int i = 0; i < n; i++){ a[i] = Integer.parseInt(str[i]); }
        return a;
    }
}


Measured memory_bytes: 24424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////



int main(){fastio
    ll h,w;cin>>h>>w;
    ll a[h][w],b[h][w],c[h][w];
    rep(i,0,h-1)rep(j,0,w-1)cin>>a[i][j];
    rep(i,0,h-1)rep(j,0,w-1)cin>>b[i][j];
    rep(i,0,h-1)rep(j,0,w-1)c[i][j]=abs(a[i][j]-b[i][j]);
    ll N=20000;
    bool dp[h][w][2*N];memset(dp,false,sizeof(dp));
    dp[0][0][N+c[0][0]]=dp[0][0][N-c[0][0]]=true;
    rep(i,0,h-1){
        rep(j,0,w-1){
            if(i>=1){
                rep(k,0,2*N-1){
                    if(k-c[i][j]>=0)dp[i][j][k]|=dp[i-1][j][k-c[i][j]];
                    if(k+c[i][j]<=2*N-1)dp[i][j][k]|=dp[i-1][j][k+c[i][j]];
                }
            }
            if(j>=1){
                rep(k,0,2*N-1){
                    if(k-c[i][j]>=0)dp[i][j][k]|=dp[i][j-1][k-c[i][j]];
                    if(k+c[i][j]<=2*N-1)dp[i][j][k]|=dp[i][j-1][k+c[i][j]];
                }
            }
        }
    }
    ll ans=inf;
    rep(k,0,2*N-1){
        if(dp[h-1][w-1][k]){
            Min(ans,abs(k-N));
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


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

typedef long long ll;

using namespace std;

const string no = "No";
const string yes = "Yes";

template<class T>
std::ostream& operator<<(std::ostream& st, const std::pair<T, T>& p) {
  st << "(" << p.first << ", " << p.second << ")";

  return st;
}

template<class T>
std::ostream& operator<<(std::ostream& st, const std::vector<T>& vec) {
  for (const auto& entry : vec) {
    st << entry << " ";
  }

  return st;
}

vector<int> get_multiplies(int n) {
  vector<int> multiplies;

  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      multiplies.push_back(i);
      if (n != i * i) {
        multiplies.push_back(n / i);
      }
    }
  }
  sort(multiplies.begin(), multiplies.end());

  return multiplies;
}

bool can_afford(const vector<int>& arr, int multiply, int k) {
  int n = arr.size();

  vector<pair<int, int> > shifts;
  for (int i = 0; i < n; ++i) {
    int cur_value = arr[i];
    int target_value = (cur_value / multiply) * multiply;

    int diff = cur_value - target_value;
    shifts.emplace_back(diff, multiply - diff);
  }
  sort(shifts.begin(), shifts.end());
  // cout << shifts << endl;

  int sum_negative = 0;
  for (const auto& entry : shifts) {
    sum_negative += entry.second;
  }

  int used_operations = 0;
  for (int i = 0; i < n && used_operations != sum_negative; ++i) {
    const auto& shift = shifts[i];

    used_operations += shift.first;
    sum_negative -= shift.second;
  }

  // cout << "Multiply: " << multiply << endl;
  // cout << "uo/k: " << used_operations << "/" << k << endl;
  return used_operations <= k;
}

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

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

  int sum_value = 0;
  for (const int& entry : arr) {
    sum_value += entry;
  }

  vector<int> multiplies = get_multiplies(sum_value);

  int max_multiply = 1;
  for (const int& multiply : multiplies) {
    if (can_afford(arr, multiply, k)) {
      max_multiply = max(max_multiply, multiply);
    }
  }

  cout << max_multiply << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cntr=0;
    vector<char> col(n);
    rep(i,n){
        col[i] = s[i];
        if(col[i]=='R'){
            cntr++;
        }
    }
    int cntw=n-cntr;
    
    int tmp=0;
    for(int i=0; i<cntr; i++){
        if(col[i]=='W'){
            tmp++;
        }
    }

    cout << min(cntw, tmp) << endl;
}


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	a *= 100; b *= 100;
	vector<bool> water(f + 1);
	water[0] = true;
	REP(i, f)
	{
		if (water[i])
		{
			if (i + a <= f) water[i + a] = true;
			if (i + b <= f) water[i + b] = true;
		}
	}
	vector<bool> sug(f + 1);
	sug[0] = true;
	REP(i, f)
	{
		if (sug[i])
		{
			if (i + c <= f) sug[i + c] = true;
			if (i + d <= f) sug[i + d] = true;
		}
	}
	pii ans(0, 0);
	REP(i, f + 1)
	{
		if (!water[i]) continue;
		REP(j, f + 1)
		{
			if (j / ld(i + j) > e / ld(e + 100) || i + j > f) break;
			if (!sug[j]) continue;
			if (ans.second == 0 || ans.second / ld(ans.first + ans.second) < j / ld(i + j)) ans = pii(i, j);
		}
	}
	cout << ans.first + ans.second << " " << ans.second << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmax(S &a, T b){
  if(a<b){
    a=b;
  }
  return a;
}
int N;
int A[200000];
int main(){
  int i, j, k, mx, tmp;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int FmcKpFmN, Q5VJL1cS, RZTsC2BF, cTE1_r3A, e98WHCEY=0;
    for(Q5VJL1cS=0;Q5VJL1cS<((N)-1)+1;Q5VJL1cS++){
      RZTsC2BF = A[Q5VJL1cS];
      if(e98WHCEY==0 || cTE1_r3A<RZTsC2BF){
        cTE1_r3A = RZTsC2BF;
        e98WHCEY = 1;
        FmcKpFmN = Q5VJL1cS;
      }
    }
    k =FmcKpFmN;
  }
  {
    int WYIGIcGE, xr20shxY;
    if(N==0){
      WYIGIcGE = 0;
    }
    else{
      WYIGIcGE = A[0];
      for(xr20shxY=1;xr20shxY<N;xr20shxY++){
        WYIGIcGE = max_L(WYIGIcGE, A[xr20shxY]);
      }
    }
    mx =WYIGIcGE;
  }
  for(i=0;i<N;i++){
    if(i==k){
      tmp = 0;
      for(j=0;j<N;j++){
        if(j!=k){
          chmax(tmp, A[j]);
        }
      }
      wt_L(tmp);
      wt_L('\n');
    }
    else{
      wt_L(mx);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190715-1

// --- original code ---
// int N, A[2d5];
// {
//   int i, j, k, mx, tmp;
//   rd(N,A(N));
// 
//   k = argmax(A(N));
//   mx = max(A(N));
//   rep(i,N){
//     if(i==k){
//       tmp = 0;
//       rep(j,N) if(j!=k) tmp >?= A[j];
//       wt(tmp);
//     } else {
//       wt(mx);
//     }
//   }
// }


Measured memory_bytes: 2432
ny = input().split(" ")
n = int(ny[0])
y = int(ny[1])

for a in range(n+1):
    for b in range(n -a + 1):
        c = n - a -b
        if a*10000+b*5000+c*1000 == y:
            print("{} {} {}".format(a, b, c))
            exit()
print("-1 -1 -1")

Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,ll> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=2e5+7;
const int mod=1e9+7;
ll quick(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1) ret=ret*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ret;
}
typedef tuple<int,int,int> tp;
ll inv(ll a){return quick(a,mod-2);}
struct D{
    int sz;
    ll zero,one,two;
};
vi G[maxn];
deque<D> dp[maxn];
inline void Merge(deque<D> &a,deque<D>& b)
{
    if(a.size()<b.size()) a.swap(b);
    for(int i=0;i<b.size();i++)
    {
        a[i].two=((a[i].one+a[i].two)%mod*(b[i].one+b[i].two)%mod)+a[i].two*b[i].zero%mod+a[i].zero*b[i].two%mod;
        a[i].two%=mod;
        a[i].one=(a[i].zero*b[i].one%mod+b[i].zero*a[i].one%mod)%mod;
        a[i].zero=a[i].zero*b[i].zero%mod;
        a[i].sz+=b[i].sz;
    }
}
void dfs(int u)
{
    int mx=0;
    for(auto v:G[u])
    {
        dfs(v);
        mx=max(mx,min((int)dp[u].size(),(int)dp[v].size()));
        Merge(dp[u],dp[v]);
    }
    for(auto &v:dp[u])
    {
        if(!mx) break;
        mx--;
        v.zero=(v.zero+v.two)%mod;
        v.two=0;
    }
    dp[u].push_front(D{1,1,1,0});
    //for(auto v:G[u])
      //  dp[u]=(dp[u]+tot*inv((quick(2,sz[v])-dp[v]+mod)%mod)%mod*dp[v]%mod)%mod;
}
int main()
{
    int n;
    cin>>n;
    for(int i=1,p;i<=n;i++)
    {
        cin>>p;
        G[p].push_back(i);
    }
    dfs(0);
    ll ans=0;
    for(auto u:dp[0])
    {
        //dbg(u.zero,u.one,u.sz);
        ans=(ans+u.one*quick(2,n+1-u.sz)%mod)%mod;
    }
    print(ans);
}

Measured memory_bytes: 243188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<pair<ll, ll> > vpr;
    for(ll i=0;i<n;i++){
        ll x, y;
        cin>>x>>y;
        vpr.push_back(make_pair(x, y));
    }

    ll dp[n][k+1];
    memset(dp, 0, sizeof(dp));
    for(ll i=0;i<=k;i++)
        dp[0][i] = 0;
    for(ll i=vpr[0].first;i<=k;i++)
        dp[0][i] = vpr[0].second;
    for(ll i=0;i<n;i++)
        dp[i][0] = 0;
    for(ll i=1;i<n;i++){
        for(ll j=1;j<=k;j++){
            dp[i][j] = dp[i-1][j];
            if(j>=vpr[i].first){
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-vpr[i].first]+vpr[i].second);
            }
        }
    }
    cout<<dp[n-1][k]<<endl;
    return 0;
}


Measured memory_bytes: 78336
import java.util.Scanner

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val s = scanner.nextLine()
    println(solve(s))
}

fun solve(s: String): Int {
    var zero: Int = 0
    var one: Int = 0

    for (c in s) {
        if (c == '0') {
            zero++
        } else {
            one++
        }
    }

    return Math.min(one, zero) * 2
}


Measured memory_bytes: 33908
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

int dp[50][500][500];

int main(){
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> a(n), b(n), c(n);
    REP(i,0,n){
        cin >> a[i] >> b[i] >> c[i];
    }

    REP(i,0,50){
        REP(j,0,500){
            REP(k,0,500){
                dp[i][j][k] = 5000;
            }
        }
    }
    dp[0][0][0] = 0;

    REP(i,0,45){
        REP(j,0,450){
            REP(k,0,450){
                dp[i + 1][j][k] = dp[i][j][k];
                if (j < a[i] || k < b[i]) continue;
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
            }
        }
    }

    int ans = 5000;
    REP(i,0,500){
        REP(j,0,500){
            if (i != 0 && j != 0 && i * y == j * x){
                ans = min(ans, dp[n][i][j]);
            }
        }
    }

    if (ans == 5000) cout << -1 << endl;
    else cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 49024
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
	int x; cin >> x;
	if (x == 7 || x == 5 || x == 3) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    string t;
    int cnt = 0;
    cin >> t;
    while (cin >> s) {
        transform(s.begin(), s.end(), s.begin(), ::tolower);
        if (s == t)
            cnt++;
    }
    cout << cnt << "\n";
}

Measured memory_bytes: 3156
#include <stdio.h>

main(){
  int n, q, committee[50][100], quorum[100], i, j, temp, max, date[101], ans;

  while(1){
    scanf("%d %d", &n, &q);
    if(n==0 && q==0) break;

    for(i=0;i<n;i++){
      scanf("%d", &temp);
      if(temp==0){
	committee[i][0]=-1;
	continue;
      }

      for(j=0;j<temp;j++){
	scanf("%d", &committee[i][j]);
      }
      committee[i][j]=-1;
    }

    for(i=0;i<101;i++){
      date[i]=0;
    }

    for(i=0;i<n;i++){
      for(j=0;;j++){
	if(committee[i][j]==-1) break;
	date[committee[i][j]]++;
      }
    }

    max=-1;
    ans=0;
    for(i=0;i<101;i++){
      if(max<date[i]){
	max=date[i];
	ans=i;
      }
    }
    if(max>=q) printf("%d\n", ans);
    else printf("0\n");
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


long long H;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> H;

	if(H == 1){
		printf("1\n");
		return 0;
	}

	long long h = H, monster = 1, c = 1;
	while(true){
		h = h / 2;
		if(h == 0){
			break;
		}
		c *= 2;
		monster = monster + c;
	}
	printf("%lld\n", monster);
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
inline ll ii(){ ll x; cin >> x; return x; }
inline string is(){ string x; cin >> x; return x; }
inline ld id(){ ld x; cin >> x; return x; }
inline void oi(ll x){ cout << x; }
inline void od(ld x){ cout << fixed << setprecision(10) << x; }
inline void os(string x){ cout << x; }
inline void oe(){ cout << endl; }
inline void oie(ll x){ oi(x); oe(); }
inline void ode(ld x){ od(x); oe(); }
inline void ose(string x){ os(x); oe(); }
inline void maxin(ll &a, ll b){ a=max(a,b); }
inline void minin(ll &a, ll b){ a=min(a,b); }

int main(){
    ll a=ii(), b=ii(), c=ii(), d=ii();
    ll ret=LLONG_MIN;
    maxin(ret, a*c);
    maxin(ret, a*d);
    maxin(ret, b*c);
    maxin(ret, b*d);
    oie(ret);
    return 0;
}


Measured memory_bytes: 3632
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	vector<int> a;
	REP(i, 3) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	sort(a.begin(), a.end());
	cout << ((a[0] + a[1] == a[2]) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int H, W, h, w;

  std::cin >> H >> W >> h >> w;

  std::cout << (H - h) * (W - w) << std::endl;

  return 0;
}


Measured memory_bytes: 256
"""
1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2   flag = 1 // 逆の隣接要素が存在する
3   while flag
4     flag = 0
5     for j が N-1 から 1 まで
6       if A[j] < A[j-1]
7         A[j] と A[j-1] を交換
8         flag = 1
"""


def bubble_sort(lists, n):
    flag = 1
    x = 0
    while flag:
        flag = 0
        for j in range(n - 1, 0, -1):
            if lists[j] < lists[j - 1]:
                lists[j], lists[j - 1] = lists[j - 1], lists[j]
                x += 1
                flag = 1

    return lists, x


def main():
    N = int(input())
    lists = list(map(int, input().split(' ')))
    lists_answer, x = bubble_sort(lists, N)
    print(' '.join(map(str, lists_answer)))
    print(x)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5608
package main

import "fmt"

func main() {
	var a, b, c int

	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)

	cnt := 0
	for i := a; i <= b; i++ {
		if c%i == 0 {
			cnt++
		}
	}
	fmt.Println(cnt)
}



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

using namespace std;

int main(){ 
 string T; cin >> T;
  
  deque<char> S;
  for(int i = 0; i < (int) T.size(); i++){
    S.push_back( T[i]);}
  
  if( (int) S.size() == 1){ cout << 0 << endl; return 0;}
  
  bool flag = true; int cnt = 0;
  
  if( S.front() != S.back()){
    if( S.front() == 'x'){ S.push_back('x'); cnt++;}
    else if( S.back() == 'x'){ S.push_front('x'); cnt++;}
    else{ flag = false;}
  }
  
  while( S.front() == S.back() && flag){
    //両方削る
    S.erase(S.begin()); S.erase( S.end());
    
    if( (int ) S.size() == 0 || (int) S.size() == 1){ break;}
    
    if( S.front() != S.back()){
      if( S.front() == 'x'){
        S.push_back('x'); cnt++;}
      else if( S.back() == 'x'){
        S.push_front('x'); cnt++;}
      else{ flag = false; break;} }
    
  }
  
  if( flag ){ cout << cnt << endl;} else{ cout<< -1 <<endl;} return 0;}

Measured memory_bytes: 512
# include <bits/stdc++.h>
    # define 	ll 		long long
    using namespace std;
    const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
    const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
    int read(){
    	int tmp = 0, fh = 1; char ch = getchar();
    	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
    	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
    	return tmp * fh;
    }
    const int P = 1e9 + 7, N = 210;
    int n, h[N];
    ll f[N][2][2][2], g0[2][2][2], g1[2][2][2], use[N];
    ll power(ll x, int y){
    	ll i = x; x = 1;
    	while (y > 0){
    		if (y % 2 == 1) x = x * i % P;
    		i = i * i % P;
    		y /= 2;
    	}
    	return x;
    }
    int main(){
    //	freopen(".in", "r", stdin);
    //	freopen(".out", "w", stdout);
    	n = read();
    	for (int i = 1; i <= n; i++) h[i] = read(); 
    	h[++n] = 1;
    	int las = inf, lim, tmp, cnt = 0;
    	while (cnt < n){
    		lim = -1;
    		for (int j = 1; j <= n; j++)
    			if (use[j] == 0) 
    				lim = max(h[j], lim);
    		tmp = las - lim;
    		for (int j = 1; j <= n; j++){
    			if (use[j] == 2) continue;
    			if (use[j] == 0){
    				if (h[j] < lim) continue;
    				use[j] = 1;
    				f[j][0][0][0] = f[j][0][1][1] = 1;
    				cnt++;
    			}
    			else if (use[j] == 1){
    				f[j][0][0][0] = f[j][0][1][1] = (f[j][0][1][1] + f[j][0][0][0]) * power(2, tmp - 1) % P;
    				f[j][0][0][1] = f[j][0][1][0] = (f[j][0][0][1] + f[j][0][1][0]) * power(2, tmp - 1) % P;
    				if (tmp % 2 == 1){
    					swap(f[j][1][0][0], f[j][1][1][1]);
    					swap(f[j][1][0][1], f[j][1][1][0]);
    				}
    			}
    			if (j != 1 && use[j - 1] != 0){
    				use[j] = 2;
    				int k = j - 1;
    				while (use[k] == 2) k--;
    				for (int t0 = 0; t0 <= 1; t0++)
    					for (int t1 = 0; t1 <= 1; t1++)
    						for (int t2 = 0; t2 <= 1; t2++)
    							g0[t0][t1][t2] = f[k][t0][t1][t2], g1[t0][t1][t2] = f[j][t0][t1][t2];
    				for (int t0 = 0; t0 <= 1; t0++)
    					for (int t1 = 0; t1 <= 1; t1++){
    						f[k][0][t0][t1] = (g0[0][t0][1] * g1[0][0][t1] + g0[0][t0][0] * g1[0][1][t1]) % P;
    						f[k][1][t0][t1] = ((g0[1][t0][1] + g0[1][t0][0]) * (g1[1][0][t1] + g1[1][1][t1] + g1[0][0][t1] + g1[0][1][t1])) % P;
    						f[k][1][t0][t1] = (f[k][1][t0][t1] + (g0[0][t0][1] + g0[0][t0][0]) * (g1[1][0][t1] + g1[1][1][t1])) % P;
    						f[k][1][t0][t1] = (f[k][1][t0][t1] + g0[0][t0][1] * g1[0][1][t1] + g0[0][t0][0] * g1[0][0][t1]) % P;
    					}
    			}
    		}
    		las = lim; 
    	}
    	ll ans = 0;
    	for (int t0 = 0; t0 <= 1; t0++)
    		for (int t1 = 0; t1 <= 1; t1++)
    			ans = (ans + f[1][0][t0][t1] + f[1][1][t0][t1]) % P;
    	printf("%lld\n", 1ll * ans * power(2, P - 2) % P);
    	return 0;
    }

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

int main()
{
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
            ans++;
    }
    cout<<ans;
    return 0;
}


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

int main(){
    int A, B, H, M;
    std::cin >> A >> B >> H >> M;
    
    double hour_angle = M_PI * ((double)H * 30.0 + (double)M / 2.0 ) / 180.0;
    double minute_angle = M_PI * ((double)M * 6.0 ) / 180.0;
    
    double hour_x = A * std::cos(hour_angle);
    double hour_y = A * std::sin(hour_angle);
    double minute_x = B * std::cos(minute_angle);
    double minute_y = B * std::sin(minute_angle);
    
    double x_dist = std::abs(hour_x - minute_x);
    double y_dist = std::abs(hour_y - minute_y);
    
    double ans = std::sqrt(x_dist * x_dist + y_dist * y_dist);
    
    std::cout << std::fixed << std::setprecision(15) << ans << std::endl;
    
    return 0;
}



Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  vi a(n);
  rep(i,n) {
    int tmp; cin >> tmp; --tmp;
    a[tmp] = i+1;
  }
  rep(i,n) {
    cout << a[i];
    if (i != n-1) cout << ' ';
    else cout << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, X = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    A.sort()
    ans = 0
    for a in A:
        if X >= a:
            ans += 1
            X -= a

    if X != 0 and ans == N:
        ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
n=gets.chomp.to_i
h=gets.chomp.split.map(&:to_i)
miz = 0
loop do
  100.times{begin;h.shift if h[0] == 0 ||h[0].negative?;h.pop if h[-1] == 0 ||h[-1].negative?;rescue;end}
  h.size==0? break : miz+=h.join(",").scan(/(,0|,-\d+){1,}/).size+1
  h.map!{|a|a-1}
end
puts miz

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

#define ll long long
#define pb push_back
#define mod 1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define dbg(x) cout<<#x<<" = "<<x<<'\n';

ll isPrime(ll x) {ll i, flag = 1; if(x == 0 || x == 1) flag = 0; for(i = 2; i<=sqrt(x); i++) { if(x%i == 0) {flag = 0; break;}} return flag;}
ll power(ll x, ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}

void solve()
{
  int x;
  cin>>x;
  if(x==0)
    cout<<"1"<<endl;
  else
  {
    cout<<"0"<<endl;
  }
  
}  
   
 

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  int tc=1;
  //cin>>tc;
  while(tc--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> a(q), b(q), c(q), d(q);
    for (int i = 0; i < q; ++i) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--, b[i]--;
    }
    vector<int> A;
    lint ret                          = 0;
    function<void(vector<int> &)> dfs = [&](vector<int> &A) {
        if ((int)A.size() == n) {
            lint temp = 0;
            for (int i = 0; i < q; ++i) {
                if (A[b[i]] - A[a[i]] == c[i])
                    temp += d[i];
            }
            chmax(ret, temp);
        } else {
            for (int i = A.back(); i <= m; ++i) {
                A.push_back(i);
                dfs(A);
                A.pop_back();
            }
        }
    };
    for (int i = 1; i <= m; ++i) {
        A.push_back(i);
        dfs(A);
        A.pop_back();
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.BufferUnderflowException;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  private void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int MAX_INPUT_SIZE = 2_000_000;
      PriorityQueue queue = new PriorityQueue(MAX_INPUT_SIZE);
      boolean isContinue = true;
      String[] order;
      StringBuilder buf = new StringBuilder(MAX_INPUT_SIZE*5);

      while(isContinue) {
        order = br.readLine().split(" ");

        switch( order[0] ) {
          case "insert" :
            queue.insert(Integer.parseInt(order[1]));
            break;
          case "extract" :
            buf.append( queue.extract() ).append("\n");
            break;
          case "end" :
            buf.setLength(buf.length()-1);
            isContinue = false;
            break;
          default :
        }
      }

      System.out.println(buf);

    } catch(IOException e) {
      System.out.println("IOException!");
    } catch(ArrayIndexOutOfBoundsException e) {
      System.out.println("heap index out of bounds!");
    } catch(BufferUnderflowException e) {
      System.out.println("heap underflow!");
    } catch(IllegalArgumentException e) {
      System.out.println("new key is smaler than current key!");
    }
  }
}

class PriorityQueue {

  int[] heap;
  int tail;

  public PriorityQueue(int size) {
    heap = new int[size+1];
    tail = 0;
  }

  public void insert(int key) {
    heap[++tail] = Integer.MIN_VALUE;
    heapIncreaseKey(tail, key);
  }
  public int extract() {
    return heapExtractMax();
  }

  private void heapIncreaseKey(int id, int key) {
    if( key < heap[id] ) throw new IllegalArgumentException();

    int t;
    heap[id] = key;
    while( (id > 1) && (heap[parent(id)] < heap[id]) ){
      t = heap[id]; heap[id] = heap[parent(id)]; heap[parent(id)] = t;
      id = parent(id);
    }
  }
  private int heapExtractMax() {
    if(tail < 1) throw new BufferUnderflowException();

    int max = heap[1];
    heap[1] = heap[tail--];
    maxHeapify(1);

    return max;
  }
  private void maxHeapify(int id) {
    int t,left,right,largest;
    left  = nodeLeft(id);
    right = nodeRight(id);

    if( (left <= tail) && (heap[left] > heap[id]) )
      largest = left;
    else
      largest = id;
    if( (right <= tail) && (heap[right] > heap[largest]) )
      largest = right;

    if( largest != id ) {
      t = heap[id]; heap[id] = heap[largest]; heap[largest] = t;

      maxHeapify(largest);
    }
  }
  private int parent(int id) {
    return id/2;
  }
  private int nodeLeft(int id) {
    return id*2;
  }
  private int nodeRight(int id) {
    return id*2+1;
  }
}


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

int gcd(int a, int b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}

int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	set<int> waters, sugars;

	int imax = F / 100 / B + 1;
	for (int i = 0; i <= imax; i++) {
		int water = 100 * B * i;
		int jmax = min(gcd(A, B) * B, (F - water) / 100 / A + 1);
		for (int j = 0; j <= jmax; j++) {
			if (water <= F && water > 0) waters.insert(water);
			water += 100 * A;
		}
	}
	imax = F / D + 1;
	for (int i = 0; i <= imax; i++) {
		int sugar = D * i;
		int jmax = min(gcd(C, D) * D, (F - sugar) / C + 1);
		for (int j = 0; j <= jmax; j++) {
			if (sugar <= F) sugars.insert(sugar);
			sugar += C;
		}
	}

	int max_sugar = 0;
	int max_water = 0;
	double max_noudo = -1.0;
	for (int water : waters) {
		for (int sugar : sugars) {
			if (water + sugar > F) break;
			double noudo = sugar * 100.0 / (1.0 * sugar + 1.0 * water);
			if (sugar > E* water / 100) break;
			if (max_noudo < noudo) {
				max_noudo = noudo;
				max_water = water;
				max_sugar = sugar;
			}
		}
	}

	cout << max_water + max_sugar << " " << max_sugar;
}

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

using namespace std;

int main(){
        int n, m;
        cin>>n>>m;
        if(n==1&&m==1){
                cout<<1<<endl;
        }
        else if(n==1){
                cout<<m-2<<endl;
        }
        else if(m==1){
                cout<<n-2<<endl;
        }
        else{
                cout<<(long long)(n-2)*(m-2)<<endl;
        }
        return 0;
}


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

int main(void) {
  int N;
  cin >> N;
  vector<long long> T(N);
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }
  long long lcm = 1;
  for (int i = 0; i < N; i++) {
    lcm = lcm / __gcd(lcm, T[i]) * T[i];
  }
  cout << lcm << endl;
  return 0;
}

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

int main() {
  int n, k, c = 0;
  cin >> n >> k;
  while(n > 0){
    n /= k;
    ++c;
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int h,w, m;
set<pair<int, int> > st;
map<int, ll> ros, cols;
// vector<pair<int, int> > targets;
int main()
{
    FIO
    cin>>h>>w>>m;

    for(int i  = 0 ; i<m ; i++)
    {
        int tr, tc; cin>>tr>>tc;
        tr--, tc--;
        ros[tr]++; cols[tc]++;
        st.insert({tr, tc});
    }
    vector<pair<ll, int> > rs, cs;
    for(auto p : ros)
        rs.push_back({p.second, p.first});
    for(auto c : cols)
        cs.push_back({c.second, c.first});
    sort(rs.begin(), rs.end(), greater<pair<ll, int> > ());
    sort(cs.begin(), cs.end(), greater<pair<ll, int> > ());
    ll numofmxros = 0, numofmxcols = 0;
    multiset<int> str, stc;
    for(auto x : rs)
    {
        if(x.first != rs[0].first)
            break;
        numofmxros++;
        str.insert(x.second);
    }
    for(auto x : cs)
    {
        if(x.first != cs[0].first)
            break;
        numofmxcols++;
        stc.insert(x.second);
    }
    ll mx = rs[0].first + cs[0].first;
    // for(int i = 0 ; i< (int) rs.size() ; i++)
    // {
    //     ll tmpmx = -1;
    //     // cout<<"row: "<<i<<" "<<rs[i].first<<" "<<rs[i].second<<endl;
    //     for(int j = 0 ; j < (int) cs.size(); j++)
    //     {
    //         // cout<<"col:" <<j<<" "<<cs[j].first<<" "<<cs[j].second<<endl;
    //         tmpmx = max(tmpmx, rs[i].first + cs[j].first - (int)(st.count({rs[i].second, cs[j].second}))); 
    //     }
    //     if(tmpmx <= mx)
    //         break;
    //     mx = tmpmx;
    // }
    // cout<<mx<<endl;
    ll numofOptions = numofmxcols * numofmxros;
    for(auto target : st)
    {
        if(stc.count(target.second) && str.count(target.first))
            numofOptions--;
    }
    numofOptions ? cout<<mx : cout<<mx-1;
    return 0;
}

Measured memory_bytes: 92276
n = int(input())
name = [0]*5
for i in range(n):
  s = input()
  if s[0] == "M":
    name[0] += 1
  if s[0] == "A":
    name[1] += 1
  if s[0] == "R":
    name[2] += 1
  if s[0] == "C":
    name[3] += 1
  if s[0] == "H":
    name[4] += 1

ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += name[i]*name[j]*name[k]
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int n, a, b, i, j, k, m;
pair<double, double> str[105];
bool cmp(const pair<double, double> a, const pair<double, double> b) {
	return atan2(a.second, a.first) < atan2(b.second, b.first);
}
int main() {
	double x, y;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		cin >> str[i].first >> str[i].second;
	}
	sort(str, str + n, cmp);
	double ans = 0;
	for (i = 0; i < n; i++) {
		x = str[i].first; y = str[i].second;
		ans = max(ans, x * x + y * y);
		for (j = (i + 1) % n; j != i; j = (j + 1) % n) {
			x += str[j].first; y += str[j].second;
			ans = max(ans, x * x + y * y);
		}
	}
	printf("%.10lf", sqrt(ans));
}

Measured memory_bytes: 384
def main():
    n = int(input())
    a = list(map(int, input().split()))
    d = [[j, i, -1, -1] for i, j in enumerate(a)]
    ans = 0
    for i in range(1, 2**n):
        t1, t2, t3, t4 = d[i]
        for j in range(len(bin(i))-2):
            t5, t6, t7, t8 = d[i & ~(1 << j)]
            if t5 > t1:
                t1, t2, t3, t4 = t5, t6, t1, t2
            elif t5 > t3:
                if t6 != t2:
                    t3, t4 = t5, t6
                    continue
            if t7 > t3:
                t3, t4 = t7, t8
        d[i] = [t1, t2, t3, t4]
        ans = max(ans, t1+t3)
        print(ans)


main()

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

typedef long long ll;
const int MAX_N = 100;

ll GCD(ll a, ll b) {
	if (a > b) std::swap(a, b);
	if(a == 0) return b;
	else return GCD(b % a, a);
}

ll LCM(ll a, ll b) {
	return a / GCD(a, b) * b;
}

int main() {
	int N;
	ll T[MAX_N];

	std::cin >> N;
	for(int i = 0; i < N; ++i) {
		std::cin >> T[i];
	}

	ll a = T[0];
	for(int i = 1; i < N; ++i) {
		a = LCM(a, T[i]);
	}

	std::cout << a << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
int main(){
    int h,w,k;
    cin>>h>>w>>k;
    vector<string>s(h);
    rep(i,h) cin>>s[i];
    int ans=0;
    rep(is,1<<h)rep(js,1<<w){
    int cnt=0;
    rep(i,h)rep(j,w){
        if(is>>i&1)continue;
        if(js>>j&1)continue;
        if(s[i][j]=='#')cnt++;
    }
    if(cnt==k){
        ans++;
    }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define Mod 1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }
    }
}

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

    map<ll,vector<ll> > vec;
    ll H[n];
    for(i=0;i<n;i++)
    {
        cin>>H[i];
    }
    ll u,v;
    for(i=0;i<m;i++)
    {
        cin>>u>>v;
        vec[u].push_back(v);
        vec[v].push_back(u);
    }
    ll ans=0,j;
    for(i=0;i<n;i++)
    {
        ll d=H[i];
        ll ok=1;
        for(j=0;j<vec[i+1].size();j++)
        {

            if(H[vec[i+1][j]-1]>=d)
            {
                ok=0;
                break;
            }
        }

        ans+=ok;
    }
     cout<<ans;

}


Measured memory_bytes: 15692
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n = int(input().strip())
    S=set()
    for i in range(n):
        s = input().strip()
        S.add(s)
    print(len(S))

if __name__ == '__main__':
    main()

Measured memory_bytes: 97492
#include <bits/stdc++.h>
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define for(index,first,num) for(int index=(int)first;index<(int)num;index++)
using namespace std ;
typedef long long ll;
 
int main(){
    int r;cin>>r;
    cout<<3*r*r;
      
}

Measured memory_bytes: 3632
import sys
def input():
	return sys.stdin.readline()[:-1]
n, s = map(int, input().split())
a = list(map(int, input().split()))
MOD = 998244353
dp = [0 for _ in range(3001)]
dp[0] = 1
ans = 0
for i in range(n):
	for j in range(s, a[i]-1, -1):
		dp[j] += dp[j-a[i]]
		dp[j] %= MOD
	dp[a[i]] += i
	dp[a[i]] %= MOD
	ans += dp[s]
	ans %= MOD
print(ans)

Measured memory_bytes: 42544
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>
#include <iomanip>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
typedef vector<vector<pint> > Graph;


int main(){
    int n,k;
    cin >> n >> k;
    double result = 0.0;
    rep(i,n){
	if(k <= i+1){
	    result += 1;
	    continue;
	}
	else{
	    double tmp = (double)k/(i+1);
	    int rp = ceil(log2(tmp));
	    result += pow(0.5,rp);
	}
    }
    result /= (double)n;
    cout << setprecision(9) << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll H,W;
	cin >> H >> W;
	ll a[H][W];
	vector<ll> x1,x2,x3,x4;
	FOR(i,0,H)FOR(j,0,W)cin>>a[i][j];
	FOR(i,0,H){
		FOR(j,0,W-1){
			if(a[i][j]&1){
				x1.push_back(i+1);
				x2.push_back(j+1);
				x3.push_back(i+1);
				x4.push_back(j+2);
				a[i][j+1]++;
			}
		}
	}
	FOR(i,0,H-1){
		if(a[i][W-1]&1){
			x1.push_back(i+1);
			x2.push_back(W);
			x3.push_back(i+2);
			x4.push_back(W);
			a[i+1][W-1]++;
		}
	}
	cout << x1.size() << endl;
	FOR(i,0,x1.size()){
		cout << x1[i] << " " << x2[i] << " " << x3[i] << " " << x4[i] << endl; 
	}
}


Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y,Z;
  cin >> X >> Y >> Z;
  int cnt = 0;
  X-=Z;
  while(X>=Y+Z){
    X-=Y+Z;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define all(v) v.begin(),v.end()
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

class Solver {
  public:
    int N;
    vector<int> P, D;
    vector<vector<pii>> E;
    int dfs(int now, int prev) {
        int res = 0;
        for(pii e : E[now]) if(e.first != prev and E[e.first].size() > 1) {
            set_max(res, dfs(e.first, now) + e.second);
        }
        return res;
    }
    bool solve() {
        int N; cin >> N;
        if(N == 0) return false;
        P.resize(N - 1); D.resize(N - 1); cin >> P >> D;
        E.resize(N);
        rep(i, N - 1) {
            E[i + 1].emplace_back(P[i] - 1, D[i]);
            E[P[i] - 1].emplace_back(i + 1, D[i]);
        }
        vector<int> candidates;
        rep(i, N) if(E[i].size() == 1) candidates.push_back(E[i][0].first);

        ll dec1 = 0;
        for(int c : candidates) set_max<ll>(dec1, dfs(c, -1));
        ll dec2 = 0;
        rep(i, N) if(E[i].size() == 1) dec2 += E[i][0].second;

        cout << accumulate(all(D), 0LL) * 3 - dec1 - dec2 * 2 << endl;
        
        return true;
    }
};

int main() {
    while(Solver().solve());
    return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

vector<int> sum(100005, 0);
vector<bool> prime(100005, true);

int main(){
  int Q;
  cin >> Q;
  vector<int> l(Q), r(Q);
  REP(i, Q){
    cin >> l[i] >> r[i];
  }
  
  FOR(i, 2, 100001){
    sum[i] = sum[i-1];
    if(prime[i]){
      if(i % 2 && prime[(i+1)/2]){
        sum[i]++;
      }
    }
    else{
      continue;
    }
    for(int j = 2; j *i <= 100000; j++){
      prime[i*j] = false;
    }
  }
  

  REP(i, Q){
    cout << sum[r[i]] - sum[l[i]-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
N = int(input())
V_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))
value_list = [x-y for (x,y) in zip(V_list,C_list)]

ans = 0
for i in value_list:
    if i>0:
        ans += i

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mid(l,r) ((l+r)/2)    
using namespace std;

const int N=1e5+5;

int32_t main(){
	string s;
	cin>>s;
	int n=s.size();
	int ans=0;
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[n-i-1])
			ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256