akhauriyash/Code-Regression huggingface dataset:
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x)
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

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


    //start from here

    readb(a, b); readb(c, d);

    int t = 0;

    while(a > 0 && c > 0)
    {
    	if(t == 0) c -= b;
    	else a -= d;

    	t = !t;
    }

    if(a > 0) cout << "Yes";
    else cout << "No";

    return 0;
}


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

long double A, B, H, M;
long double angle;

int main(){
  cin >> A >> B >> H >> M;
  angle = (30 * H) + (30 * M / 60) - (6 * M);
  if (angle > 180) angle -= 360;
  long double radian;
  radian = (angle / 180) * M_PI;
  long double ans;
  ans = sqrtl((A*A + B*B) - (2*A*B*cosl(radian)));
  cout << fixed << setprecision(20);
  cout << ans << endl;
}


Measured memory_bytes: 4152
# max を求めたい
# 小さいものを先に足して行くことを繰り返す
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = a[0]/(2**n) # a[0]/(2**(n-1))が実際に足したい値なので、差分を先に足しておく
for i in range(n):
  ans += a[i]/(2**(n-i))
print(ans)


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll K;

int main() {
    cin >> K;
    cout << (K / 2) * (K / 2 + K % 2) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int x[100];
int y[100];
int r[100];
int main(){
    int a;
    while(scanf("%d",&a),a){
        for(int i=0;i<a;i++)scanf("%d%d%d",x+i,y+i,r+i);
        int b;
        scanf("%d",&b);
        for(int i=0;i<b;i++){
            int c,d,e,f;
            scanf("%d%d%d%d",&c,&d,&e,&f);
            bool ok=false;
            for(int j=0;j<a;j++){
                if((c-x[j])*(c-x[j])+(d-y[j])*(d-y[j])>=r[j]*r[j]||(e-x[j])*(e-x[j])+(f-y[j])*(f-y[j])>=r[j]*r[j]){
                    if((e-c)*(x[j]-c)+(f-d)*(y[j]-d)<0){
                        if((x[j]-c)*(x[j]-c)+(y[j]-d)*(y[j]-d)<=r[j]*r[j])ok=true;
                    }else{
                        if((e-c)*(x[j]-c)+(f-d)*(y[j]-d)>(e-c)*(e-c)+(f-d)*(f-d)){
                            if((x[j]-e)*(x[j]-e)+(y[j]-f)*(y[j]-f)<=r[j]*r[j])ok=true;
                        }else{
                            if((x[j]-c)*(x[j]-c)+(y[j]-d)*(y[j]-d)-((e-c)*(x[j]-c)+(f-d)*(y[j]-d))*((e-c)*(x[j]-c)+(f-d)*(y[j]-d))/((e-c)*(e-c)+(f-d)*(f-d))<=r[j]*r[j])ok=true;
                        }
                    }
                }
            }
            if(ok)printf("Safe\n");
            else printf("Danger\n");
        }
    }
}

Measured memory_bytes: 1012
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s); sin>>v; return v;}
template<class T> inline string toString(T x) {ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);


bool paired(vector<pii> &cards,int from){
	if(cards[from].second==cards[from+1].second&&cards[from+2].second==cards[from+1].second){
		if(cards[from+2].first+2==cards[from+1].first+1&&cards[from+1].first+1==cards[from].first){
			return true;
		}else if(cards[from].first==cards[from+1].first&&cards[from+2].first==cards[from+1].first){
			return true;
		}else{
			return false;
		}
	}else{
		return false;
	}
}
int main(){
	int t;
	cin>>t;
	REP(test,t){
		vector<pii> cards(9);
		REP(i,9){
			cin>>cards[i].first;
		}
		REP(i,9){
			char c;
			cin>>c;
			cards[i].second=c;
		}
		sort(ALL(cards));
		bool flag=false;
		do{
			if(paired(cards,0)&&paired(cards,3)&&paired(cards,6)){
				flag=true;
				break;
			}
		}while(next_permutation(ALL(cards)));
		cout<<(flag?1:0)<<endl;
	}
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define ci const int&
using namespace std;
int n,x[100010],tg;
char c[100010];
long long ans,s[100010],ss,ns;
void getc(char&x){
	x=getchar();
	while(x!='+'&&x!='-')x=getchar();
}
int main(){
	scanf("%d",&n),scanf("%d",&s[1]);
	for(int i=2;i<=n;++i)getc(c[i]),scanf("%d",&x[i]),s[i]=s[i-1]+(c[i]=='-'?-1:1)*x[i];
	ans=s[n];
	for(int i=n;i>=2;--i){
		ns+=x[i];
		if(c[i]=='-')ans=max(ans,s[i-1]+ss-ns),ss+=ns,ns=0;
	}
	printf("%lld",ans);
	return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 k,a,b;
    cin >> k >> a >> b;
    for(int32 i = a; i <= b; ++i){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>

int main() {
  char O[64], E[64];
  scanf("%s %s", O, E);

  for (int i=0; O[i]; ++i) {
    if (E[i]) {
      printf("%c%c", O[i], E[i]);
    } else {
      printf("%c", O[i]);
      break;
    }
  }

  printf("\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,A,B;
    cin >>N>>A>>B;
    vector<ll>a(N),b(N),c(N);
    rep(i,N){
        cin>>a[i]>>b[i]>>c[i];
    }

    vector<vector<vector<ll>>>dp(N+1,vector<vector<ll>>(405,vector<ll>(405,INF)));
    dp[0][0][0]=0;
    rep(i,N){
        rep(j,403){
            rep(k,403){
                if(j-a[i]>=0 && k-b[i]>=0){
                    dp[i+1][j][k]=min({dp[i][j][k],dp[i][j-a[i]][k-b[i]]+c[i]});
                }else{
                    dp[i+1][j][k]=dp[i][j][k];
                }
            }
        }
    }
    /*rep(i,N){
        if(ans==INF){
        cout<<-1<<endl;
        }else{
            cout << ans << endl;
        }
    }*/
    ll ans=INF;
    rep2(i,N){
        if(A*i>402||B*i>402)break;
        chmin(ans,dp[N][A*i][B*i]);
    }
    if(ans==INF){
        cout<<-1<<endl;
    }else{
        cout << ans << endl;
    }
    


    return 0;
    

}

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

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

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

int a[100010];
int b[100010];
//0が羊で1が狼
bool sheep_wolf(int c, int d, string s){
    int i,n;
    n = s.size();
    a[0] = c;
    a[1] = d;
    for(i=0;i<n;i++){
        if(s[i]=='o'){
            b[i] = 0;
        }else{
            b[i] = 1;
        }
    }

    for(i=2;i<n;i++){
        a[i] = a[i-1]^a[i-2]^b[i-1];
    }

    if(a[1]==a[n-1]^a[0]^b[0] && a[0]==a[n-1]^a[n-2]^b[n-1]){
        return true;
    }

    return false;
}


int main(){
    int i,j,k,n;
    string s;
    cin >> n;
    cin >> s;
    for(i=0;i<=1;i++){
        for(j=0;j<=1;j++){
            if(sheep_wolf(i,j,s)){
                for(k=0;k<n;k++){
                    if(a[k]){
                        cout <<"W" ;
                    }else{
                        cout <<"S" ;
                    }
                }
                cout << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}

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

using namespace std;

typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int K = 0;
  cin >> K;
  vector<string> v1;
  for (int i = 0; i < (int)s.size(); ++i) {
    for (int len = 1; len <= K; ++len) {
      v1.push_back(s.substr(i, len));
    }
  }

  sort(v1.begin(), v1.end());
  vector<string> v2(v1.begin(), unique(v1.begin(), v1.end()));
  printf("%s\n", v2[K - 1].c_str());

  return 0;
}


Measured memory_bytes: 1788
n, p = map(int, input().split())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

p_nums = factorization(p)

ans = 1

for i, j in p_nums:
    if j >= n:
        ans *= i ** (j // n)
print(ans)


Measured memory_bytes: 9412
import java.util.Scanner;

public class Main {

    public String multiple(int a)
    {
        for(int i = 1; i <= 9; i++)
        {
            float divisor = (float) a / (float) i;
            if(divisor == Math.round(divisor) && divisor >= 1 && divisor <= 9)
            {
                return "Yes";
            }
        }

        return "No";

    }

    public static void main(String args[]) {
        int a;
        Scanner sc = new Scanner(System.in);
        Main m = new Main();
        a = sc.nextInt();
        System.out.print(m.multiple(a));
    }
}

Measured memory_bytes: 22736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
 if(N%11==0){
   cout<<2*(N/11)<<endl;
 }

  else if(N%11>=7){
cout<<2*(N/11)+2<<endl;
  }
  else{
    cout<<2*(N/11)+1<<endl;
  }

}

  

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll, int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

ll v[N];

void solve(){
	int n;
	ll x = 0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	for(int i = 0; i < n; i+=2){
		x ^= (v[i] ^ v[i+1]);
	}
	for(int i = 0; i < n; i++){
		cout << (v[i] ^ x) <<  " ";
	}cout << endl;
}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 5172
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
int n;
string c;
int main(){
	scanf("%d", &n);
	cin >> c;
	int red = 0, blue = 0;
	for (int i = 0; i < n; i++){
		if (c[i] == 'R'){
			red++;
		} else {
			blue++;
		}
	}
	if (red > blue) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    c = 0
    for i in range(N):
        for j in range(i):
            if A[i] == A[j]:
                continue
            for k in range(j):
                if A[k] == A[i] or A[k] == A[j]:
                    continue
                if A[j] + A[k] > A[i]:
                    c += 1

    return c

print(main())


Measured memory_bytes: 9188
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>
#include <set>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d\n",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };


int main(void) {

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if ((abs(a - c) <= d) || ((abs(a - b) <= d) &&( abs(b - c) <= d))) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String[] args){
        PrintWriter out=new PrintWriter(System.out);
        Scanner ir=new Scanner(System.in);
        for(;;){
            int d=ir.nextInt();
            int w=ir.nextInt();
            if(d==0&&w==0){
                break;
            }
            int[][] e=new int[d][w];
            for(int i=0;i<d;i++){
                for(int j=0;j<w;j++){
                    e[i][j]=ir.nextInt();
                }
            }
            int res=0;
            for(int i=0;i<d;i++){
                for(int j=0;j<w;j++){
                    for(int k=i+2;k<d;k++){
                        for(int l=j+2;l<w;l++){
                            int ma=0;
                            int mi=10;
                            int tot=0;
                            for(int m=i;m<=k;m++){
                                for(int n=j;n<=l;n++){
                                    if(m==i||m==k||n==j||n==l){
                                        mi=Math.min(mi,e[m][n]);
                                    }
                                    else{
                                        ma=Math.max(ma,e[m][n]);
                                        tot+=e[m][n];
                                    }
                                }
                            }
                            if(mi>ma){
                                res=Math.max(res,(k-i-1)*(l-j-1)*mi-tot);
                            }
                        }
                    }
                }
            }
            out.println(res);
        }
        out.flush();
    }
}


Measured memory_bytes: 39180
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){

  int e;
  while (cin >> e, e) {
    int min = e;
    for (int z=0; z*z*z<=e; z++) {
      for (int y=0; y*y<=e-z*z*z; y++) {
        int x = e - z*z*z - y*y;
        if (x + y + z < min) { min = x + y + z; }
      }
    }
    cout << min << endl;
  }

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1164
import math
import copy
import numpy as np

N = int(input())
As = input().split()
A = [0 for i in range(N)]
for i in range(N):
  A[i] = int(As[i])

# relabel A's elements
A_unique = list(set(A))
num_unique = len(A_unique)
to_unique = {}
for i,a in enumerate(A_unique):
  to_unique[a] = i
for i in range(N):
  A[i] = to_unique[A[i]]

# count number of each label appearing
counts = [0 for i in range(num_unique)]
for _,A_i in enumerate(A):
  counts[A_i] += 1
answer_total = 0
for count in counts:
  answer_total += int(count*(count-1)/2)

spoiler = [-1 for i in range(num_unique)]
for k in range(N):
  if spoiler[A[k]]<0:
    answer_k = answer_total - (counts[A[k]]-1)
    spoiler[A[k]] = answer_k
  else:
    answer_k = spoiler[A[k]]
  print(answer_k)


Measured memory_bytes: 53060
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;




int main(){
  unsigned int X;
  cin >> X;

  // TODO: use bitset?
  vector<bool> xs(X, 0);

  unsigned int sqrtX = (unsigned int) sqrt(2 * X);

  for (unsigned int i = 2; i < sqrtX; ++i) {
    for (unsigned int j = 0; j < X; ++j) {
      if ((X + j) % i == 0) {
	xs[j] = 1;
      }
    }
  }

  auto val = find(xs.begin(), xs.end(), 0);
  unsigned int prime = X + (unsigned int)(val - xs.begin());
  cout << prime << endl;
}


Measured memory_bytes: 888
/*

*/
#include<bits/stdc++.h>
#include<iostream>

using namespace std;

#define boost ios::sync_with_stdio(0);cin.tie(0);
#define forn(i,n) for ( int i=0 ; i < n ; i++ )
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define lb lower_bound
#define ub upper_bound
#define vi vector<int >
#define pii pair<int, int>
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SQ(a) (a)*(a)
#define ll long long
#define lli long long int
#define ull unsigned long long
#define endl '\n'
#define Pi(a) printf("%d\n",a);
#define debug2(a,b) printf("%d\t%d\n",a,b);
#define debug1(a) printf("%d\n",a);
#define Si(a) scanf("%d",&a);
#define mod 1000000007
#define w(n) while(n--)

int main()
{
	//freopen ("f.in","r",stdin);
 	//freopen ("f.out","w",stdout);
	boost
	//code
	ll N,M,a,b;
	cin >> N >> M;
	ll ans =1;
	for(ll i=1;i*i<=M;i++){
		if(M%i==0){
			a = i;
			b = M/i;
			if(a>=N) ans=max(ans,b);
			if(b>=N) ans=max(ans,a);
		}
	}
	cout << ans << endl;
	return 0;

}
/*
-> check for array out of bounds & array declaired before size input(runtime error)
-> check for int overflow, use ll
-> check for corner cases like 0
-> check for j++ in while loop for every case
-> use boost except for interactive problems
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        a--;
    }
    return ans;
}
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll e = b/c-(a+c-1)/c+1;
    ll f = b/d-(a+d-1)/d+1;
    ll l = c*d/__gcd(c,d);
    ll g = b/l-(a+l-1)/l+1;
    cout << b-a+1-e-f+g << endl;
}


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

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
typedef pair<ll, ll> P;

const int MAX = 700000;
static const ll MOD = 1000000007;
//static const ll INF = 100000000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll X, Y, answer;
    ll move_a = 0, move_b = 0;

    COMinit();

    // input
    cin >> X >> Y;

    // process
    if (X <= Y) {
        move_a = X;
        while ((move_a * 2) + move_b > Y) {
            move_a -= 2;
            move_b++;
        }
    } else {
        move_b = Y;
        while (move_a + (move_b * 2) > X) {
            move_b -= 2;
            move_a++;
        }
    }

    if (move_a + (move_b * 2) == X && (move_a * 2) + move_b == Y) {
        answer = COM(move_a + move_b, move_a);
//        answer %= MOD;
//        if (answer < 0) {
//            answer += MOD;
//        }
        cout << answer << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

int main() {
 
	int m, d;
	cin >> m >> d;
	int days = 0;
	for (int month=1; month<m+1; month++) {
		for (int day=1; day<d+1; day++) {
			int last = day % 10;
			int first = (day / 10) % 10;
			if (first >= 2 && last >= 2) {
				if (first * last == month) {
					days++;
				}
			}
		}
	}
	cout << days;
	
	
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
ll C(int x,int y){
    int i;ll ans=1;
    for(i=1;i<=y;i++) ans=ans*(x+1-i)/i;
    return ans;
}
int main(){
    int n,p,i,x,s0=0,s1=0;
    ll ans=1,ans2=0;
    scanf("%d%d",&n,&p);
    for(i=1;i<=n;i++){
        scanf("%d",&x);
        if(x&1) s1++;
        else s0++;
    }
    for(i=1;i<=s0;i++) ans*=2;
    if(p==0){
        for(i=0;i<=s1;i+=2) ans2+=C(s1,i);
    }
    else{
        for(i=1;i<=s1;i+=2) ans2+=C(s1,i);
    }
    printf("%lld\n",ans*ans2);
    return 0;
}


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

ll repeatpow(ll n, ll p, ll m){
  if(p==0) return 1;
  if(p%2==0){
    ll t=repeatpow(n, p/2, m);
    return t*t%m;
  }
  return n*repeatpow(n, p-1, m)%m;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll mod=1000000007;
  ll sum=repeatpow(2, n, mod)-1;
  ll ax=1, ay=1, bx=1, by=1;
  for(ll i=1; i<=a; i++){
    ax=ax*(n-i+1)%mod;
    ay=ay*i%mod;
  }
  for(ll i=1; i<=b; i++){
    bx=bx*(n-i+1)%mod;
    by=by*i%mod;
  }
  ll ayinv=repeatpow(ay, mod-2, mod)%mod;
  ll byinv=repeatpow(by, mod-2, mod)%mod;
  ll asum=ax*ayinv%mod, bsum=bx*byinv%mod;
  ll ans=(sum-asum-bsum)%mod;
  if(ans<0) ans+=mod;
  cout <<ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int count=0;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]!=b[i])
        {
            count++;
        }
    }
    cout<<count;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

string L;
ll dp[MAX_N][2];

ll dfs(ll k = 0, bool tight = true) {
    if(k >= L.length()) {
        return 1;
    }

    ll& res = dp[k][(tight ? 1 : 0)];
    if(~res) { return res; }
    res = 0;

    if(L[k] == '1') {
        // もし 1 なら、 (1, 0), (0, 0), (0, 1) が作れる
        // (1, 0), (0, 1) の場合は tight = true
        if(tight) {
            res += dfs(k+1, true);     // (1, 0)
            res %= MOD;
            res += dfs(k+1, true);     // (0, 1)
            res %= MOD;
            res += dfs(k+1, false);    // (0, 0)
            res %= MOD;
        }
        else {
            res += dfs(k+1, false);     // (1, 0)
            res %= MOD;
            res += dfs(k+1, false);     // (0, 1)
            res %= MOD;
            res += dfs(k+1, false);     // (0, 0)
            res %= MOD;
        }
    }
    else {
        if(tight) {
            // (0, 0) しか作れない
            res += dfs(k+1, true);     // (0, 0)
            res %= MOD;
        }
        else {
            res += dfs(k+1, false);     // (1, 0)
            res %= MOD;
            res += dfs(k+1, false);     // (0, 1)
            res %= MOD;
            res += dfs(k+1, false);     // (0, 0)
            res %= MOD;
        }
    }
    return res;
}

signed main()
{
    cin >> L;
    MINUS(dp);
    ll ans = dfs();
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

int main(){
  double n;
  std::cin >> n;
  std::priority_queue<double, std::vector<double>, std::greater<double> > q;
  // std::priority_queue<double> q;
  // std::vector<double> v(n);
  for (double i = 0; i < n; i++)
  {
    double a;
    std::cin >> a;
    q.push(a);
  }
  // long long sum = 0;
  while(q.size()>=2)
  {
    double greatest = q.top();q.pop();
    double second_greatest = q.top();q.pop();
    double combined = (greatest+second_greatest)*0.5;
    q.push(combined);
    // sum += combined;
  }
  // for (double i = 1; i < n; i++)
  // {
  //   sum += (v[i]+v[i-1])*0.5;
  // }
  // std::cout << q.size() << std::endl;
  std::cout << q.top() << std::endl;


}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

B, C = [0]*Q, [0]*Q
for i in range(Q):
    B[i], C[i] = list(map(int, input().split()))

bucket = [0]*100001
for i in A:
    bucket[i] += 1

sum = sum(A)

for i in range(Q):
    sum += (C[i] - B[i]) * bucket[B[i]]
    bucket[C[i]] += bucket[B[i]]
    bucket[B[i]] = 0
    print(sum)

Measured memory_bytes: 22072
import sys
import math


def main():
    inp = [int(line)  for line in sys.stdin.readlines()]
    sorted_list = sorted(inp, key=lambda x: (x - 1)% 10)
    min = sorted_list.pop(0)
    sorted_list = [math.ceil(x * 0.1) * 10 for x in sorted_list]
    print(sum(sorted_list) + min)

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 3060
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	ans = 0
	for i in range(1, N + 1):
		ans += i * (N + 1 - i)
	# print(ans)

	for i in range(N - 1):
		u, v = list(sorted(getlist()))
		ans -= u * (N + 1 - v)

	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 68716
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.nextInt() + in.nextInt() / 2);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 21588
from collections import Counter
a = input()
b_list = list(map(int, input().split()))

counter = Counter(b_list)
ans = 0

for num, count in counter.most_common():
  if num == count:
    pass
  else:
    if num < count:
      ans += count - num
    elif num > count:
      ans += count
print(ans)
    


Measured memory_bytes: 21232
import java.util.Scanner;

public class Main { 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		String result = "";
		if("A".equals(line)) {
			result = "T";
		}else if("T".equals(line)) {
			result = "A";
		}else if("C".equals(line)) {
			result = "G";
		}else if("G".equals(line)) {
			result = "C";
		}
			


		
		
		System.out.println(result);

		
		
		
	}
}
	
	

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 1e9+7;

int MAXN = 1e5 + 10;
vll fact (MAXN);
vll invfact (MAXN);
vll pow2(MAXN);
vll inv (MAXN);

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        res %= MOD;
        a = a * a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}

ll inverse(ll n) {
    return binpow(n, MOD-2);
}

ll choose(ll n, ll k) {
	if (k < 0 || k > n) return 0;
    return fact[n] * invfact[k] % MOD * invfact[n-k] % MOD;
}

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

	fact[0] = 1;
    FOR(i, 1, MAXN) fact[i] = fact[i-1] * i % MOD;

    inv[1] = 1;
    FOR(i, 2, MAXN) inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;

    invfact[0] = 1;
    FOR(i, 1, MAXN) invfact[i] = invfact[i-1] * inv[i] % MOD;

	int N; cin >> N;

	int i1, i2;
	vi arr (N + 1);
	vi seen (N, -1);

	F0R(i, N+1) {
		cin >> arr[i]; --arr[i];
		if (seen[arr[i]] != -1) {
			i1 = seen[arr[i]];
			i2 = i;
		}
		seen[arr[i]] = i;
	}

	FOR(i, 1, N+1) {
		ll res = 0;

		// use none
		res += choose(N - 1, i);

		// use either 
		res += 2 * (choose(N - 1, i - 1) - choose(N - i2 + i1, i - 1) + MOD);
		res += choose(N - i2 +  i1, i - 1);

		// use both
		res += choose(N - 1, i - 2);
		res %= MOD;
		print(res);
		
	}
	print(1);
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a * b % 2 == 0){
    cout << "Even" << endl;
  }
  
  if (a * b % 2 == 1){
    cout << "Odd" << endl;
  }
  
}
  

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,m;
    cin>>n>>m;
    int ansl=1,ansr=n;
    for (int i = 0; i < m; i++)
    {
        int l,r;
        cin>>l>>r;
        ansl=max(ansl,l);
        ansr=min(ansr,r);
    }
    cout<<max(0,ansr-ansl+1)<<endl;;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int l,r,d;
	cin>>l>>r>>d;
	l=(l+d-1)/d;
	r=r/d;
	if(l>r)cout<<0<<endl;
	else cout<<r-l+1<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

std::vector<ll> divisors( ll x )
{
  std::vector<ll> ret;

  for( ll i = 1; i*i <= x; ++i ) if( x % i == 0 )
  {
    ret.emplace_back( i );

    if( i != x/i )
      ret.emplace_back( x/i );
  }

  return ret;
}

ll N;
ll ans;

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

  repi( i, 1, N+1 ) if( i&1 )
  {
    auto ds = divisors(i);

    if( ds.size() == 8 )
      ++ans;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    rep(i,n) {
        if (s[i] != 'A' && s[i] != 'G' && s[i] != 'C' && s[i] != 'T') continue;
        int j = i+1;
        while (j < n) {
            if (s[j] != 'A' && s[j] != 'G' && s[j] != 'C' && s[j] != 'T')  break;
            j++;
        }
        chmax(ans, j - i);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a < 1200) {
			System.out.println("ABC");
		}else {
			System.out.println("ARC");
		}
	}

}

Measured memory_bytes: 21332
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n,a;
    cin >> n >> a;
    int arr[n],sum=0;
    fff(i,n) {
    cin >> arr[i];
    }
    sort(arr,arr+n);
    
    fff(i,(n-a))
    sum+=arr[i];
    
    cout << sum << endl;
    
    
	return 0;
    
}

Measured memory_bytes: 10496
#include<iostream>
long n,k,a=0,i,j,m=1e9+7,v[2<<20];main(){for(std::cin>>n>>k;i<n;i++)for(j=0;j<n;j++){std::cin>>v[j];if(i==j)continue;if(v[i]>v[j])(a+=k*(k-1)/2+(i<j?k:0))%=m;}std::cout<<a;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 999999999ll
#define MIN -999999999ll

int main() {
  ll x,y;
  cin>>x>>y;
  cout<<__gcd(x,y)<<endl;
}


Measured memory_bytes: 3076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Main me = new Main();
		System.out.println(me.fact(Integer.parseInt(in.readLine())));
	}
	private long fact(long n){
		if(n==0)
			return 1;
		else
			return n*fact(n-1);
	}
}

Measured memory_bytes: 16860
n = int(raw_input().strip())
a = map(int, raw_input().strip().split())
a.sort()


def validate(a, n):
	if n & 1 == 0:
		s = 0
		p = 1
	else:
		s = 1
		p = 2
		if a[0] != 0:
			return False
	for i in range(s, n, 2):
		if a[i] != a[i + 1]:
			return False
	return True


if not validate(a, n):
	print 0
else:
	print (1 << (n >> 1)) % int(1e9 + 7)


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

using namespace std;

const int MAX_N = 100;

vector<int> G[MAX_N];
int color[MAX_N];
deque<int> L;
bool flag;	//????????????

void visit(int u)
{
	if(color[u] == 0){
		flag = true;	//DAG??§??????
		return;
	}
	if(color[u] == 1){
		return;
	}
	color[u] = 0;
	for(int i=0;i<G[u].size();i++){
		visit(G[u][i]);
	}
	color[u] = 1;
	L.push_front(u);
}

int main()
{
	int n;
	int m;
	cin >> n >> m;
	for(int i=0;i<m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		G[u].push_back(v);
	}
	for(int i=0;i<n;i++){
		color[i] = -1;
	}
	for(int i=0;i<n;i++){
		if(color[i] == -1){
			flag = false;
			visit(i);
		}
		if(flag){
			break;
		}
	}
	if(flag){
		cout << "1\n";
	}else{
		cout << "0\n";
	}
}

Measured memory_bytes: 3224
n = int(input())
w = [input() for _ in range(n)]
if len(w) != len(set(w)):
  print("No")
  quit()
  
for i in range(n-1):
  if w[i][-1] == w[i+1][0]:
    continue
  else:
    print("No")
    quit()
print("Yes")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,ans;
	cin >> a >> b >> c;
	int g[3]={a,b,c};
	sort(g,g+3);
	ans=g[2]-g[1];
	g[0] += ans;
	int d=g[2]-g[0];	
	if(d%2 == 0)
		ans += d/2;
	else
		ans += (d+3)/2;
	cout << ans;
	return 0;
} 

Measured memory_bytes: 256