akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>

using namespace std;

typedef complex<double> P;

const double EPS = 1e-8;

double dot(P a, P b){
  return real(conj(a) * b);
}

double cross(P a, P b){
	return imag(conj(a) * b);
}

double getArea(P a, P b, P c){
	return abs(cross(c - a, c - b) / 2);
}

P rotate(P p, double dir, P o = P(0, 0)){
  P res;
  dir = M_PI * dir / 180.0;
  p -= o;
  res.real() = p.real() * cos(dir) - p.imag() * sin(dir);
  res.imag() = p.real() * sin(dir) + p.imag() * cos(dir);
  res += o;
  return res;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(P p0, P p1, P p2){
  P a = p1 - p0;
  P b = p2 - p0;
  if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if(cross(a, b) < -EPS) return CLOCKWISE;
  if(dot(a, b) < -EPS) return ONLINE_BACK;
  if(norm(a) < norm(b)) return ONLINE_FRONT;
  return ON_SEGMENT;
}

int main(){
	double r, x, y;
	int n;
	cin >> r >> x >> y >> n;
	vector<int> p(n);
	for(int i=0;i<n;i++) cin >> p[i];
	vector<P> d(n+1);
	d[0] = P(0, r);
	for(int i=0;i<n;i++){
		d[i+1] = rotate(d[i], -p[i] * 3.6);
	}
	for(int i=0;i<n;i++){
		double a = getArea(P(0, 0), d[i], d[i+1]);
		double b = r * r * M_PI * p[i] / 100;
		double c;
		if(ccw(P(0, 0), d[i], d[i+1]) == CLOCKWISE) c = b - a;
		else c = b + a;
		if(ccw(P(x, y), d[i], d[i+1]) == CLOCKWISE) c += getArea(P(x, y), d[i], d[i+1]);
		else c -= getArea(P(x, y), d[i], d[i+1]);
		if(i) cout << ' ';
		cout << floor(c * 100 / b);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1304
n = list(map(int,input()))
if (n[-1] == 2 or n[-1] == 4 or n[-1] == 5 or n[-1] == 7 or n[-1] == 9):
    print('hon')
elif (n[-1] == 0 or n[-1] == 1 or n[-1] == 6 or n[-1] == 8):
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
const int MOD = 9;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s; cin >> s;
    int tot = 0;
    for (int i = 0; i < s.size(); i++) {
        tot += s[i]-'0';
    }
    if (tot%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

typedef long long int ll;
typedef pair<ll,ll> P;
//cout<<fixed<<setprecision(15);

vector<ll>v;

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        ll tmp;
        cin>>tmp;
        v.push_back(tmp);
    }
    sort(v.begin(),v.end(),greater<int>());
    ll ans=v[0];
    for(int i=2;i<n;i++){
        ans+=v[i/2];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5344
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

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

int main(){
  int A,B;
  cin>>A>>B;
  if(A-1>B){
    cout<<A*2-1<<endl;
  }
  else if (B-1>A){
    cout<<B*2-1<<endl;
  }
  else{
    cout<<A+B<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 100004
#define INF 1e9+7

using namespace std;

ll n,k,ar[N],first,ans=INF;

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n >> k;

    first = -1;

    rep(i,0,n)
    {
        cin >> ar[i];

        if(ar[i] < 0)
            first = i;
    }

    if(k == 0)
        ans = 0;

    if(first + k < n && first+k >= 0)
        ans = ar[first+k];

    for(int i = first;i >= 0;i--)
    {
        if(i+k-1>=n)
            continue;

        if(ar[i+k - 1] < 0)
        {
            ans = min(ans,-ar[i]);

            break;
        }

        ans = min(ans,min(-ar[i],ar[i+k-1])-ar[i]+ar[i+k-1]);
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    x=LI()
    
    #区間を固定して考える．i番目の区間に対して，i番目のスライムが通過する確率は1
    #i-1番目のスライムの確率は1/2，i-2番目のスライムは1/3...
    
    diff=[0]*(N-1)
    for i in range(N-1):
        diff[i]=x[i+1]-x[i]
    
    p1=[1]*N
    for i in range(N-1):
        p1[i+1]=(p1[i]*(i+1))%mod#1から順にNまでかける
        
    a=[0]*N
    for i in range(N):
        #　a[i]は　mod下での　1/(i+1)
        a[i]=pow(i+1,mod-2,mod)
        
        
    S=[0]*(N+1)
    for i in range(N):
        S[i+1]=(S[i]+a[i])%mod
        
    ans=0
    for i in range(N-1):
        ans=(ans+S[i+1]*diff[i]*p1[-1])%mod
        
    print(ans)
    
    
    
    

main()


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

using namespace std;
using  ll = long long;
#define rep(i,n) for (int i = 1; i <= (n); ++i)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}

const double PI = 3.1415926535;

int main(){
  double r;
  std::cin >> r;

  printf("%.8lf\n", r*2*PI);
  return 0;
}


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

using namespace std;

typedef long long int ll;

const ll N=1e6+1;

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

ll fact[N];
bool prime[N];

void sieve(){
    for(ll i=2;i<N;i++){
        if(prime[i]==true){
            for(ll j=i*i;j<=N;j+=i){
                prime[j]=false;
                fact[j]=i;
            }
        }
    }
}

int main(){
    string n;
    cin>>n;
    ll sum=0;
    for(int i=0;i<n.size();i++)
        sum+=n[i]-'0';
    if(sum%9==0) cout<<"Yes \n";
    else cout<<"No \n";
    return 0;
}


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

int main(){
    int N;
    int K;
    cin >> N >> K;
    unordered_set<int> s;
    int x;
    for(int i=0; i<K; i++){
        cin >> x;
        s.insert(x);
    }
    bool dp[100010] = {0};
    for(int i=1; i<100000; i++){
        if(i <= 9){
            if(s.find(i) == s.end()){
                dp[i] = true;
            }
        }else{
            if(dp[i/10] && s.find(to_string(i).back()-'0') == s.end()){
                dp[i] = true;
            }
        }
    }
    for(int i=N; i<100000; i++){
        if(dp[i]){
            cout << i;
            return EXIT_SUCCESS;
        }
    }
    return EXIT_FAILURE;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main()
{
    int n,a,b,c;
    cin>>n;
    a=n/3;b=n/5;c=n/15;
   cout<<n*(n+1)/2-(3*a*(a+1)/2+5*b*(b+1)/2-15*c*(c+1)/2)<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

/*================================================
	Dijkstra
================================================*/
typedef int COST_TYPE;
#define NMAX (201)
#define INF (100000000)
vector<pair<COST_TYPE, int> > G[NMAX];
COST_TYPE cost[NMAX];
bool done[NMAX] = { false };

void dijkstra(int root)
{
	priority_queue<pair<COST_TYPE, int>, vector<pair<COST_TYPE, int> >, greater<pair<COST_TYPE, int> > > PQ;
	pair<COST_TYPE, int> current;	/* first: cost, second: index */
	COST_TYPE next_cost;
	int current_index, next_index;

	rep(i, NMAX) {
		done[i] = false;
		cost[i] = INF;
	}

	cost[root] = 0;
	PQ.push(make_pair(0, root));

	while (!PQ.empty()) {
		current = PQ.top();
		PQ.pop();

		current_index = current.second;

		if (done[current_index]) continue;
		done[current_index] = true;

		rep(i, G[current_index].size()) {
			next_index = G[current_index][i].second;
			next_cost = G[current_index][i].first;

			if ((!done[next_index])
				&& (cost[next_index] > cost[current_index] + (COST_TYPE)next_cost)) {
				cost[next_index] = cost[current_index] + (COST_TYPE)next_cost;
				PQ.push(make_pair(cost[next_index], next_index));
			}
		}
	}
}

int N, M, R, A, B, C, ans = INF;
int r[8];
int d[8][8];
#define p(a, b) make_pair(a, b)

int solve(int sum, int current, int visit_end)
{
	int ret = INF;

	if (visit_end == ((1 << R) - 1)) ret = sum;

	rep(i, R) {
		if ((visit_end & (1 << i)) == 0) {
			ret = min(ret, solve(sum + d[current][i], i, visit_end | (1 << i)));
		}
	}

	return ret;
}

int main()
{
	cin >> N >> M >> R;
	rep(i, R) cin >> r[i];
	rep(i, M) {
		cin >> A >> B >> C;
		G[A].push_back(p(C, B));
		G[B].push_back(p(C, A));
	}

	rep(i, R) {
		dijkstra(r[i]);
		rep(j, R) d[i][j] = cost[r[j]];
	}

	rep(i, R) ans = min(ans, solve(0, i, 1 << i));

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long A, B, C, D;
  cin >> A >> B >> C >> D;

  long start = max(A, C);
  long end = min(B, D);

  long ans = max(0l, end - start);

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

char A[4] = {'A', 'C', 'G', 'T'};

int main() {
    string S;
    cin >> S;
    ll ans = 0;
    ll m = 0;
    REP(i, S.length()) {
        bool e = false;
        REP(j, 4) {
            if (S[i] == A[j])
                e = true;
        }
        if (!e) {
            m = 0;
            continue;
        }
        m++;
        ans = std::max(m, ans);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(A, B) << " " << max(0, A + B - N) << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
N=input()
B=0
B=len(N)
B=B-1
#print(B,N)
if N[B]=='2' or N[B]=='4' or N[B]=='5' or N[B]=='7' or N[B]=='9':
    print('hon')
elif N[B]=='0' or N[B]=='1' or N[B]=='6' or N[B]=='8':
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9128
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

ll K_is_small(ll A, ll K) {
  if (A < K) return 0;
  if (A % K == 0) return A / K;
  ll diff = A / K + 1;
  ll rest = A % K;
  ll d = max(1LL, rest / diff) * diff;
  return K_is_small(A - d, K);
}

void solve(ll N, vector<ll> A, vector<ll> K) {
  ll grundy = 0;
  REP(i,N) {
    ll nim = K_is_small(A[i], K[i]);
    grundy = grundy ^ nim;
    // cout << nim << endl;
  }
  if (grundy > 0) cout << "Takahashi" << endl;
  else cout << "Aoki" << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> K(N-1+1);
	vector<ll> A(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &A[i]);
	  scanf("%lld", &K[i]);
	}
	solve(N, A, K);
	return 0;
}


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

int main(){
    bool judge = true;
    while(true){
        int H,W;
        cin >> H >> W ;
        if ( H == 0 && W == 0) {
            judge = false;
            break;
        }
        else{
            for ( int i = 0 ; i < H ; i++ ){
                for ( int j = 0 ; j < W ; j++ ){
                    char ans;
                    if ( i % 2 == 0 ){
                        if( j % 2 == 0) ans = '#';
                        else ans = '.';
                    }     
                    else {
                        if ( j % 2 == 0 ) ans = '.';
                        else ans = '#';
                    }
                    cout << ans;
                } 
                cout << endl;
            }
            cout << endl;
        }       
    }
}


Measured memory_bytes: 3112
#include <stdio.h> 
#include <ctype.h> 
#include <string.h> 
 
 
int main(){ 
    char search[21], word[21]; 
    int count=0; 
    int i; 
      
    scanf("%s", search); 
    while(1){ 
        scanf(" %s", word); 
        if(strcmp(word, "END_OF_TEXT")==0)break; 
        for(i=0;word[i]!='\0';i++){ 
            word[i]=tolower(word[i]); 
        } 
        if(strcmp(word, search)==0){ 
            count++; 
        } 
    } 
    printf("%d\n", count); 
 
 
    return 0; 
}


Measured memory_bytes: 2068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{

    class Program
    {
        static void Main(string[] args)
        {
            int[] rc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int r = rc[0];
            int c = rc[1];
            int[][] graph = new int[r][];
            for(int i = 0; i < r; i++)
            {
                graph[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }
            int[,] newgraph = new int[r + 1, c + 1];
            for(int i = 0; i < r; i++)
            {
                for(int j = 0; j < c; j++)
                {
                    newgraph[i, j] = graph[i][j];
                }
            }
            for(int i = 0; i < r; i++)
            {
                for(int j = 0; j < c; j++)
                {
                    newgraph[i, c] += newgraph[i, j];
                }
            }
            for(int j = 0; j < c+1; j++)
            {
                for(int i = 0; i < r; i++)
                {
                    newgraph[r, j] += newgraph[i, j];
                }
            }
            for (int i = 0; i < r + 1; i++)
            {
                for (int j = 0; j < c + 1; j++)
                {
                    if (j != c)
                    {
                        Console.Write("{0} ", newgraph[i, j]);
                    }
                    else
                    {
                        Console.WriteLine(newgraph[i,j]);
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 9920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define TYPE int
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}

int main(void){
	int n=in(),i,l[200],ans=0;
	rep(i,2*n)l[i]=in();
	sort(l,2*n);
	rep(i,n)ans+=l[2*i];
	print(ans);
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  long long ans = 0;
  map<vector<char>, int> mp;
  for (int i = 0; i < n; ++i) {
    vector<char> c(10);
    for (int j = 0; j < 10; ++j) cin >> c[j];
    sort(c.begin(), c.end());
    ans += mp[c];
    ++mp[c];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 11264
import java.util.Scanner;
     
    public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            if(A<=C && C<=B)  System.out.println("Yes");
            else System.out.println("No");
        }
    }

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

int main() {

  long long int in_0, in_1, in_2;
  char in_c;

  long long int ans_0 = 0;
  long long int ans_1 = 0;

  while( cin >> in_0 >> in_c >> in_1 >> in_c >> in_2 ) {
    if ( in_0 * in_0 + in_1 * in_1 == in_2 * in_2 ) {
      ans_0++;
    }
    if ( in_0 == in_1 ) {
      ans_1++;
    }
  }
  cout << ans_0 << endl << ans_1 << endl;

  return 0;

}

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

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned long long uInt;
typedef unsigned uint;

int main(void) {
    int a;
    cin >> a;

    cout << a + a * a + a * a * a << endl;

    return 0;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws Exception {
        String S = br.readLine().trim();
        int l, r;
        int count = 0;
        l = (S.length() + 1) / 2 - 1;
        r = S.length() / 2;
        //中央の文字がどのくらい連続しているか
        for (int n = 0; n <= 1; n++) {
            l = (S.length() + 1) / 2 - 1;
            r = S.length() / 2;
            while (l >= 0) {
                if (S.charAt(l) == '0'+n && S.charAt(r) == '0'+n){
                    count += 2;
                    l--;
                    r++;
                }
                else break;
            }
        }
        //中央の項の修正
        if (S.length() % 2 == 1) count--;
        count += (S.length() - count) / 2;
        System.out.println(count);
    }


    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    static void array_sout(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }

    static void array_sout(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }
}

Measured memory_bytes: 23252
n, k = [int(i) for i in input().split(" ")]
s = input()
r = []

if s[0] == "0":
    r.append(0)

c = 1
for i in range(1, n):
    if s[i - 1] == s[i]:
        c += 1
    else:
        r.append(c)
        c = 1
    
if s[n - 1] == "0":
    r.append(c)
    r.append(0)
else:
    r.append(c)

if (len(r) - 1) // 2 <= k:
    print(n)
else:
    rs = [0] * (len(r) + 1)
    for i in range(1, len(r) + 1):
        rs[i] = rs[i - 1] + r[i - 1]
    s_max = 0
    m = 0
    while m + 2 * k + 1 < len(rs):
        if s_max < rs[m + 2 * k + 1] - rs[m]:
            s_max = rs[m + 2 * k + 1] - rs[m]
        m += 2
    print(s_max)

Measured memory_bytes: 7932
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define ll long long

int main(void){
    int ans = -1;
    int n;
    cin >> n;

    for(int i = 1;i <= 50000;++i){
        if(floor((double)i*1.08) == n){
            ans = i;
            break;
        }
    }

    if(ans == -1){
        cout << ":(" << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def bomb(x,y):
    s=M[y]
    if s[x]=="0":return
    M[y]=s[:x]+"0"+s[x+1:]
    R=[-3,-2,-1,1,2,3]
    for e in R:
        bomb(x+e,y)
        bomb(x,y+e)
    return

A=range(14)
B=range(3,11)
M=["0"*14 for i in A]
z="000"
N=range(input())
for i in N:
    s=raw_input()
    for j in B:
        M[j]=z+raw_input()+z
    x=input()+2
    y=input()+2
    bomb(x,y)
    print "Data %d:" %(i+1)
    for j in B:
        print M[j][3:-3]

Measured memory_bytes: 4288
#include <iostream>
#include <queue>
#include <string>
#include <cstring>
#include <map>
using namespace std;

typedef pair<int,int> pii;
int mp[1001][1001];
int turn[1001][1001];
pii target[10];

int main() {
    int h,w,n,x,y;
    string s;
    cin>>h>>w>>n;

    for(int i=0; i<h; ++i) {
        cin>>s;
        for(int j=0; j<w; ++j) {
            if(s[j] == 'X') mp[i][j] = -1;
            else if('1' <= s[j] && s[j] <= '9') {
                mp[i][j] = s[j] - '0';
                target[s[j]-'0'] = pii(j,i);
            } else if(s[j] == 'S') y = i,x = j;
            else mp[i][j] = 0;
        }
    }

    int dx[4] = {0,1,0,-1};
    int dy[4] = {1,0,-1,0};
    int ans = 0;
    for(int i=0; i<n; ++i) {
        memset(turn, -1, sizeof(turn));
        turn[y][x] = 0;
        pii tar = target[i+1];
        queue<pii> q;
        q.push(pii(x,y));

        while(!q.empty()) {
            pii now = q.front(); q.pop();
            if(now.first == tar.first && now.second == tar.second) {
                ans += turn[now.second][now.first];
                x = now.first, y = now.second;
                break;
            }

            for(int k=0; k<4; ++k) {
                int nx = now.first + dx[k], ny = now.second + dy[k];
                if(nx < 0 || nx > w-1 || ny < 0 || ny > h-1) continue;
                if(mp[ny][nx] == -1) continue;
                if(turn[ny][nx] != -1) continue;
                turn[ny][nx] = turn[now.second][now.first]+1;
                q.push(pii(nx,ny));
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 8724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int prime[200005] = {};
void seive()
{
    prime[1] = 1;
    for(int i = 2; i <= sqrt(200005); i++)
    {
        for(int j = i * i; j <= 200005; j += i)
        {
            prime[j] = 1;
        }
    }
}
int main()
{
    string a, t;
    cin >> a >> t;
    cout <<t<<a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,S;
  cin >> K >> S;
  int ans=0;
  for (int i=0;i<K+1;i++){
    for (int j=0;j<K+1;j++){
      int k=S-i-j;
      if (k>=0&&k<=K){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[][][] data = new int[4][3][10];
		
		for(int i = 0; i < n; i++) {
			int b = stdIn.nextInt();
			int f = stdIn.nextInt();
			int r = stdIn.nextInt();
			int v = stdIn.nextInt();
			
			data[b-1][f-1][r-1] += v;
		}
		
		for(int i = 0; i < 4; i++) {
			for(int j = 0; j < 3; j++) {
				for(int k = 0; k < 10; k++) {
					System.out.print(" " + data[i][j][k]);
				}
				System.out.println();
			}
			if(i != 3) {
			System.out.println("####################");
			}
		}
	}

}



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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, M, Q;
    cin >> N >> M >> Q;
    vector<ll> R(M), L(M), p(Q), q(Q);
    map<pair<ll, ll>, ll> tMap;
    REP(i, M)
    {
        cin >> L[i] >> R[i];
        L[i]--; 
        R[i]--;
        pair<ll, ll> p = make_pair(L[i], R[i]);
        tMap[p]++;
    } 
    REP(i, Q)
    {
        cin >> p[i] >> q[i];
        p[i]--;
        q[i]--;
    }
    vector<ll> sumT[N];
    REP(i, N)
    {
        vector<ll> sumS(N);
        pair<ll, ll> p = make_pair(i, 0);
        sumS[0] = tMap.find(p) != tMap.end() ? tMap[p] : 0;
        REP(j, N - 1)
        {
            sumS[j + 1] = sumS[j];
            pair<ll, ll> q = make_pair(i, j + 1);
            sumS[j + 1] += tMap.find(q) != tMap.end() ? tMap[q] : 0;
        }
        sumT[i] = sumS;
    }
    REP(i, Q)
    {
        ll ans = 0;
        for (ll j = p[i]; j <= q[i]; ++j)
        {
            if (p[i] == 0) 
            {
                ans += sumT[j][q[i]];
            }
            else
            {
                ans += sumT[j][q[i]] - sumT[j][p[i] - 1];
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 13824
//submitted by HimJ
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define deb(...)
#endif


const int mxn=1e5+1;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  ll t=1;
  //cin>>t;
    while(t--){
            int a,b;
    cin>>a>>b;
    for(int i=1;i<=3;i++)
    {
        if((a*b*i)%2)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";


    }
  return 0;
  }



Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b, A, B, i, gcd, lcm;
	while(scanf("%d %d", &a, &b) != EOF){
		A = a, B = b;
		
		while(a != b){
			if(a < b){
				b -= a;
			} else {
				a -= b;
			}
		}
		gcd = a;
		
		lcm = gcd * (A/a) * (B/b);
		printf("%d %d\n", gcd, lcm);
	}
	return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		scan.close();
		if(a==b) {
			if(b!=c)System.out.println("2");
			else System.out.println("1");
		}else {
			if(a==c)System.out.println("2");
			else if(c==b)System.out.println("2");
			else System.out.println("3");
		}
	}
}

Measured memory_bytes: 24916
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ans = 1
def prime_factor(num):
    prime_factor = collections.defaultdict(int)
    for i in range(2,int(num**0.5)+1):
        while num%i==0:
            prime_factor[i] += 1
            num //= i
    if num>1:
        prime_factor[num]=1
    return prime_factor
def nCr(n,r,mod):
    comb_count = 1
    for i in range(r):
        comb_count *= n-i
        comb_count %= mod
    for i in range(1,r+1):
        comb_count *= pow(i,mod-2,mod)
        comb_count %= mod
    return comb_count
for v in prime_factor(M).values():
    ans *= nCr(v+N-1,v,10**9+7)
    ans %= 10**9+7
print(ans)


Measured memory_bytes: 3436
#include <iostream>
#include <stack>
#include <map>
#include <string>

using namespace std;

int main()
{
        map<char, int> roman;
        roman['I'] = 1;
        roman['V'] = 5;
        roman['X'] = 10;
        roman['L'] = 50;
        roman['C'] = 100;
        roman['D'] = 500;
        roman['M'] = 1000;
        string str;

        while (cin >> str) {
                stack<int> st;
                int tmp, ans = 0;
                for (unsigned int i = 0; i < str.length(); i++) {
                        if (!st.empty() && (roman[str[i]] > st.top())) {
                                tmp = roman[str[i]] - st.top();
                                st.pop();
                                st.push(tmp);
                        } else {
                                st.push(roman[str[i]]);
                        }
                }
                while (!st.empty()) {
                        ans += st.top();
                        st.pop();
                }

                cout << ans << endl;
        }

        return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int>a(n);
  int sum = 0;
  rep(i,n) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  vector<int>b(m);
  rep(i,m) b[i] = a[i];
  sort(b.begin(),b.end());
  if( b[0]*4*m  >= sum) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

#define INF 1LL << 60
#define REP(i, n) for (int i = 0; i < n; i++)

const int nMax = 3005;

string s, t;
int dp[nMax][nMax] = {0};

string solve() {
    REP(i, s.length()) {
        REP(j, t.length()) {
            if (s[i] == t[j]) {
                dp[i+1][j+1] = dp[i][j] + 1;
            } else {
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
            }
        }
    }
    
    int i = s.length();
    int j = t.length();

    string res = "";
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i-1][j]) i--;
        else if (dp[i][j] == dp[i][j-1]) j--;
        else {
            res = s[i-1] + res;
            i--; j--;
        }
    }
    return res;
}

int main() {
    cin >> s >> t;
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1000100107;
signed main() {
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n-1] << " ";
    int cnt = INF;
    int ans = 0;
    for(int i = 0; i < n-1; i++) {
        if(cnt >= abs(a[n-1]/2-a[i])) {
            cnt = abs(a[n-1]/2-a[i]);
            ans = a[i];
        }
    }
    cout << ans << endl;
}


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


int N,M;
int D[1001],C[1001];
int i,j;
int dp[1001][1001];

int f(int i,int j){
	if(dp[i][j]>=0) return dp[i][j];
	int tukare;
	if(i==N) return 0;
	else if(j-i==M-N) return tukare=f(i+1,j+1)+D[i]*C[j];
	else 		 {if(f(i,j+1)<f(i+1,j+1)+D[i]*C[j]) tukare=f(i,j+1);
			  else				    tukare=f(i+1,j+1)+D[i]*C[j];
			 }
	return dp[i][j]=tukare;
}

int main(void){
	scanf("%d %d",&N,&M);
	for(i=0;i<N;i++){
		scanf("%d",&D[i]);
	}
	for(j=0;j<M;j++){
		scanf("%d",&C[j]);
	}
	memset(dp,-1,sizeof(dp));
	printf("%d\n",f(0,0));
	return 0;
}

Measured memory_bytes: 4584
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
//		  System.setIn(A086.class.getResourceAsStream("nyuryoku.txt"));
		  Scanner in = new Scanner(System.in);
		  int a = in.nextInt();
		  int b = in.nextInt();
 
		  int c = a * b;

		  if(c % 2 == 0) {
			  System.out.println("Even");
		  } else {
			  System.out.println("Odd");
		  }
		  in.close();
	}
}

Measured memory_bytes: 21844
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("btr-bb-exclusive")

#include <bits/stdc++.h>

#define _CRT_DISABLE_PERFCRIT_LOCKS
#define _USE_MATH_DEFINES
#define rall(a)      a.rbegin(), a.rend()
#define all(a)       a.begin(), a.end()
// #define int          long long
#define pb           push_back
#define pf           push_front
#define eb           emplace_back 
#define vi           vector<int>
#define vvi          vector<vi>
#define pii          pair<int, int>
#define fi           first
#define se           second
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define per(i, a, n) for (int i = n - 1; i >= a; --i)
#define unique(v)    v.erase(unique(v.begin(), v.end()), v.end());

using namespace std;

signed main() {
    int n; cin >> n;
    cout << (n == 0 ? 1 : 0);
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long

#define INF 999999999

using namespace std;

// input
string s1;
string s2;

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

    cin >> s1;
    cin >> s2;

    bool flag = false;

    int size =  s1.size();

    for(int i = 0;i < size;i++){
        string comp_str = s1.substr(i,s1.size()) + s1.substr(0,i);
        if(s2 == comp_str){
            flag = true;
            break;
        }
        
    }

    string ans = (flag) ? "Yes":"No";
    cout << ans << "\n";
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll int a,b,c,k;
    cin>>a>>b>>c>>k;
   ll int sum = 0;
    if(k <= a){
        sum += k;
    }
    else if(k<=(a+b) && k > a){
        sum += a;
    }
    else if(k <=(a+b+c) && k > (a+b)){
        sum += a;
        k = k -(a+b);
        sum -= k;

    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3652
let s = stdin.ReadLine()
let k = stdin.ReadLine() |> int64
if k > 100L then
    s.ToCharArray() |> Seq.find(fun x  -> x<>'1') |> stdout.WriteLine
else
    s.ToCharArray().[0 .. if int k - 1 <= s.Length - 1 then int k - 1 else s.Length - 1] |> Seq.tryFind (fun x  -> x<>'1') 
    |> function Some(v) -> v | None -> '1' 
    |> stdout.WriteLine

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define mid (l+r)/2
const int INF = 0x3f3f3f3f, MAXN = 200005;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
int N, h[MAXN];
ll seg[4*MAXN], a[MAXN];
void update (int p, ll v, int rt, int l, int r){
	if (l==p&&r==p){
		seg[rt] = max(seg[rt], v);
		return;
	}
	if (p<=mid) update (p, v, 2*rt, l, mid);
	else update (p, v, 2*rt+1, mid+1, r);
	seg[rt] = max(seg[2*rt], seg[2*rt+1]);
}
ll query (int ql, int qr, int rt, int l, int r){
	if (qr==0) return 0;
	if (ql==l&&qr==r) return seg[rt];
	if (qr<=mid) return query (ql, qr, 2*rt, l, mid);
	else if (ql>mid) return query (ql, qr, 2*rt+1, mid+1, r);
	else return max(query(ql, mid, 2*rt, l, mid), query(mid+1, qr, 2*rt+1, mid+1, r));
}
int main(){
	//ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	scanf("%d", &N);
	for (int i = 1; i<=N; i++) scanf("%d", &h[i]);
	for (int i = 1; i<=N; i++) scanf("%lld", &a[i]);
	for (int i = 1; i<=N; i++) update (h[i], a[i]+query(1, h[i]-1, 1, 1, N), 1, 1, N);
	printf("%lld\n", seg[1]);
}


Measured memory_bytes: 8832
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll sol(ll i,ll n,ll rc,ll bc,ll gc,vector<ll> &v,vector<ll> &dp)
{
    if(i==n)
    {
        return 1;
    }
    if(dp[i]!=-1)
    {
        return dp[i];
    }
    ll ans=0;
    if(v[i]==rc)
    {
        ans = (ans+sol(i+1,n,rc+1,bc,gc,v,dp))%M;
    }
    if(v[i]==bc)
    {
        ans = (ans+sol(i+1,n,rc,bc+1,gc,v,dp))%M;
    }
    if(v[i]==gc)
    {
        ans = (ans+sol(i+1,n,rc,bc,gc+1,v,dp))%M;
    }
    return dp[i]=ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(auto &x:v)
    {
        cin>>x;
    }
    vector<ll> dp(n+1,-1);
    ll ans = sol(0,n,0,0,0,v,dp);
    cout<<ans;
    return 0;
}



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

using namespace std;

int main()
{
    string S;
    cin >> S;

    if(S.at(0) == S.at(1) && S.at(1) == S.at(2) && S.at(2) == S.at(3))
        cout << "No" << endl;
    else if(S.at(0) == S.at(1) && S.at(2) == S.at(3))
        cout << "Yes" << endl;
    else if(S.at(0) == S.at(2) && S.at(1) == S.at(3))
        cout << "Yes" << endl;
    else if(S.at(0) == S.at(3) && S.at(1) == S.at(2))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

        return 0;
    
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  int n;
  while(cin>>n,n){
    vector<pair<int,int> > top(2,mp(0,0)), worst(2,mp(INT_MAX,0));

    REP(i,n){
      int num; cin>>num;
      int total = 0;
      REP(j,4){
	int m, s; cin>>m>>s;
	s += 60 * m;
	total += s;
      }
      pair<int,int> tmp = mp(total,num);

      if(top[1].f < tmp.f){
	top[1] = tmp;
	if(top[1].f > top[0].f)
	  swap(top[1],top[0]);
      }

      if(worst[1].f > tmp.f){
	worst[1] = tmp;
	if(worst[1].f < worst[0].f)
	  swap(worst[1], worst[0]);
      }

    }
    cout << worst[0].s << endl;
    cout << worst[1].s << endl;
    cout << top[1].s << endl;
  }
  return 0;
}

Measured memory_bytes: 908
#include<iostream>

int main()
{
	int a = 1;
	int num1;
	char operate;
	int num2;
	int ans;


	while (a){
		std::cin >> num1 >> operate >> num2;

		if (operate == '+'){
			ans = num1 + num2;
			std::cout << ans << '\n';
		}
		else if (operate == '-'){
			ans = num1 - num2;
			std::cout << ans << '\n';
		}
		else if (operate == '*'){
			ans = num1 * num2;
			std::cout << ans << '\n';
		}
		else if (operate == '/'){
			ans = num1 / num2;
			std::cout << ans << '\n';
		}
		else if (operate == '?'){
			break;
		}
	}
}


Measured memory_bytes: 3080
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
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();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(long long s){
    int cnt=0;
    if(s==1||s==2||s==4){
        cout<<4<<endl;
        return;
    }
    while(s!=4){
        if(s%2==0){
            s/=2;
        }
        else{
            s=3*s+1;
        }
        cnt++;
    }
    cout<<cnt+4<<endl;
}

int main(){
    long long s;
    scanf("%lld",&s);
    solve(s);
    return 0;
}


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

int main(){
    long long int a, b, c;
    cin >> a >> b >> c;
    if(c - a - b <= 0){
        cout << "No" << endl;
        return 0;
    }
    
    if(4*a*b < (c - a - b)*(c - a - b)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3616
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e8)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n;
	cin>>n;
	vector<int>cnt(n+1),cnt1(n+1);
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		cnt[a]++;
	}
	for(int i=1;i<=n;i++)cnt1[cnt[i]]++;
	vector<int>pref(n+1),prefx(n+1);
	prefx[0] = cnt1[0];
	for(int i=1;i<=n;i++)pref[i]=pref[i-1]+cnt1[i]*i;
	for(int i=1;i<=n;i++)prefx[i]=prefx[i-1]+cnt1[i];
	vector<int>f(n+1,0);
	for(int i=1;i<=n;i++){
		f[i] = (pref[i]+i*(prefx[n]-prefx[i]))/i;
	}
	vector<int>ans(n+1);
	for(int i=1;i<=n;i++){
		ans[f[i]] = max(ans[f[i]],i);
	}
	for(int i=n-1;i>0;i--)ans[i] = max(ans[i],ans[i+1]);
	for(int i=1;i<=n;i++)cout<<ans[i]<<'\n';
}



Measured memory_bytes: 10352