akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
using namespace std;
int main(){
	int n;
	int dp[5][51] = {};
	for (int i = 0;i < 10;++i) dp[1][i] = 1;
	for (int i = 2;i < 5;++i) {
		for (int q = 0;q <= 9;++q) {
			for (int p = 0;p <= 9 * i;++p) {
				dp[i][p + q] += dp[i - 1][p];
			}
		}
	}
	while (cin >> n) {
		printf("%d\n", dp[4][n]);
	}
}


Measured memory_bytes: 1144
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    K = int(readline())
    A,B = map(int, readline().split())

    for i in range(A, B+1):
        if i % K == 0:
            print("OK")
            exit()
    
    print("NG")

    


if __name__ == "__main__":
    main()


Measured memory_bytes: 9176
import java.util.*;

public class Main {

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

  private void exec() {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int x = scan.nextInt();

    if (x == a || x > a && x <= a + b) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

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

using namespace std;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    string S;
    cin>>S;
    int ls=S.size();

    if(ls % 2 == 1) {
        cout << "No" << "\n";
    } else{
        int i,j;
        bool is_hitachi= true;
        for (i=0; i<ls ; i+=2)
        {
            if(S[i]!='h' || S[i+1]!='i') {
                is_hitachi = false;
                break;
            }
        }
        if (is_hitachi) {
            cout << "Yes" << "\n";
        } else{
            cout << "No" << "\n";
        }
        
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int NMAX = 100000;

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

  int x[NMAX], y[NMAX], t[NMAX];
  for (int i = 0; i < N; ++i)
    std::cin >> t[i + 1] >> x[i + 1] >> y[i + 1];

  bool yes = true;
  t[0] = x[0] = y[0] = 0;
  for (int i = 1; i <= N; ++i) {
    int dt = t[i] - t[i - 1];
    int dd = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
    if (dt < dd) {
      yes = false;
      break;
    }
    if (dt % 2 != dd % 2) {
      yes = false;
      break;
    }
  }

  std::cout << (yes ? "Yes" : "No") << std::endl;
}


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

bool isprime(int n){
    if(n<2)return false;
    else if(n==2)
        return true;
    else if(n%2==0)
        return false;

    double sqrt_n = sqrt(n);
    for(int i = 3; i < sqrt_n; i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    vector<int> num;
    rep(i,1000){
        int num = n+i;
        if(isprime(num)){
            cout << num << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    A -= 2
    A %= 13
    B -= 2
    B %= 13
    print("Alice" if A > B else "Bob" if B > A else "Draw")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
typedef long long LL;
const int N = 2e5+7 , INF = 0x3f3f3f3f , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
template<typename T1>
T1 gcd(T1 a , T1 b){ return b ? gcd(b,a%b) : a;}

LL p[N] , sum[N];

LL abs_t(LL a){
    return a < 0 ? -a : a;
}

int main(){
#ifdef LOCAL
    freopen("F:\\c++\\in.txt", "r", stdin);
//  freopen("F:\\c++\\out.txt","w",stdout);
#endif
    int n;
    LL ans;
    scanf("%d",&n);
    for(int i = 1 ; i <= n ; i++)   scanf("%lld",p+i) , sum[i] = sum[i-1] + p[i];
    ans = abs_t(sum[n] - sum[1] - sum[1]);
    for(int i = 1 ; i < n ; i++){
        ans = min(ans,abs_t(sum[n] - sum[i] - sum[i]));
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main() {
    int N,M,X;cin >> N >> M >> X;
    int C[N] = {};int A[N][M] = {};
    for (int i = 0;i < N;i++){
        cin >> C[i];
        for (int j = 0;j < M;j++){
            cin >> A[i][j];
        }
    }
    int ans = 1200000;int ansf = 0;
    for (int bit = 0;bit < (1 << N);bit++){
        int sum = 0;int B[M] = {};
        for (int i = 0;i < N;i++){
            if ((bit & (1 << i)) == 0) continue;
            sum += C[i];
            for (int j = 0;j < M;j++){
                B[j] += A[i][j];
            }
        }
        int flag = 0;
        for (int i = 0;i < M;i++){
            if (B[i] < X) flag = 1;
        }
        if (flag == 1) continue;
        else {
            ans = min(ans,sum);
            ansf = 1;
        }
    }
    if (ansf == 0) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

#define ALL(V) (V).begin(),(V).end()

using namespace std;

typedef pair<int,int> ii_t;

#define MAX 100010
#define RMAX 1000
char is_prime[MAX];
#define PMAX 100000
int prime[PMAX];
#define SKL (998244353)

int main() {

    int n, k ;
    cin >> n >> k;
    vector<int> left(k);
    vector<int> right(k);
    vector<long long> summin(k, 0);
    for (int i=0;i<k;i++) {
        cin >> left[i] >> right[i];
    }
    vector<long long> sumlist(n+1, 0);
    sumlist[1] = 1;
    for (int i=2;i<=n;i++) {
        for (int j=0;j<k;j++) {
            if (i - left[j] >= 0) {
                summin[j] += sumlist[i - left[j]];
                summin[j] %= SKL;
            }
            if (i - right[j]-1 >= 0) {
                summin[j] += SKL;
                summin[j] -= sumlist[i - right[j]-1];
                summin[j] %= SKL;
            }
        }
        for (int j=0;j<k;j++) {
            sumlist[i] += summin[j];
            sumlist[i] %= SKL;
        }
        // cerr << "i=" << i << " " << sumlist[i] << endl;
    }
    cout << (sumlist[n] % SKL) << endl;
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back

int main() {
    ll N, K, cnt;
    cnt = 0;
    cin >> N >> K;
    while(N > 0) {
        N /= K;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){
   
    int x,y;cin>>x>>y;

    int ans=0;
    if(x==1&&y==1)ans+=400000;
    // else{
        if(x==1)ans+=300000;
        else if(x==2)ans+=200000;
        else if(x==3)ans+=100000;

        if(y==1)ans+=300000;
        else if(y==2)ans+=200000;
        else if(y==3)ans+=100000;
    // }

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

Measured memory_bytes: 256
def f(h, w):
    t = [list(map(int, input().split())) for _ in range(h)]
    i = j = 0
    dj = 1
    ans = []
    ido = 0
    while i < h:
        if t[i][j] % 2:
            if ido:
                stog[2:4] = [i + 1, j + 1]
                log += [stog]
                ans += log
                ido = 0
            else:
                ido = 1
                stog = [i + 1, j + 1, 0, 0]
                log = []
        else:
            if ido:
                stog[2:4] = [i + 1, j + 1]
                log += [stog]
                stog = [i + 1, j + 1, 0, 0]
        j += dj
        if j == w or j == -1:
            i += 1
            dj *= -1
            j += dj
    print(len(ans))
    for x in ans:
        print(*x)


h, w = map(int, input().split())
f(h, w)


Measured memory_bytes: 30252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
using P = pair<ll,ll>;
const ll mod = 998244353;

template <typename T, typename F>
class SegTree{
  int n; T uni; F f;
  vector<T> dat;
public:
  SegTree(int _n, F f, T uni) : f(f), uni(uni) {
    n = 1;
    while(n < _n) n *= 2;
    dat = vector<T>(2*n,uni);
  }
  void set(int k, const T x) {
    dat[k+n] = x;
  }
  void build() {
    for(int i = n-1; i >= 0; i--) {
      dat[i] = f(dat[2*i],dat[2*i+1]);
    }
  }
  void update(int k, T x) {
    k += n;
    dat[k] = x;
    while(k >>= 1){
      dat[k] = f(dat[2*k],dat[2*k+1]);
    }
  }
  T query(int a, int b) {
    T l = uni, r = uni;
    for(a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if(a & 1) l = f(l,dat[a++]);
      if(b & 1) r = f(dat[--b],r);
    }
    return f(l,r);
  }
};

int main(){
  int n;
  cin >> n;
  P p[n]; ll x[n];
  rep(i,n) cin >> p[i].first >> p[i].second;
  sort(p,p+n);
  rep(i,n) x[i] = p[i].first;
  auto f = [](ll a, ll b){return max(a,b);};
  SegTree<ll,decltype(f)> st(n,f,-1);
  rep(i,n) st.set(i,i);
  st.build();
  vector<int> c(n);
  for(int i = n-2; i >= 0; i--) {
    int b = lower_bound(x,x+n,x[i]+p[i].second) - x;
    st.update(i,st.query(i,b));
  }
  vector<ll> dp(n+1,1);
  dp[n-1] = 2;
  for(int i = n-2; i >= 0; i--) dp[i] = (dp[i+1] + dp[st.query(i,i+1)+1]) % mod;
  cout << dp[0] << endl;
  return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int main() {
	int n = ri();
	int a[n];
	int cnt[4] = { 0 }, sum = 0;
	for (int i = 0; i < n; i++) a[i] = ri(), cnt[a[i]]++, sum += a[i];
	double dp[n + 1][n + 1][n + 1]; // 3, 2, 1
	for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) dp[i][j][k] = 0;
	dp[cnt[3]][cnt[2]][cnt[1]] = 1;
	for (int i = n; i >= 0; i--) {
		for (int j = n; j >= 0; j--) {
			for (int k = n; k >= 0; k--) {
				if (dp[i][j][k] < 1e-15) continue;
				if (i) dp[i - 1][j + 1][k] += dp[i][j][k] * i / (i + j + k);
				if (j) dp[i][j - 1][k + 1] += dp[i][j][k] * j / (i + j + k);
				if (k) dp[i][j][k - 1] += dp[i][j][k] * k / (i + j + k);
			}
		}
	}
	double res = sum;
	for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) {
		if (!i && !j && !k) continue;
		if (i + j + k > n) continue;
		double p = (double) (n - i - j - k) / n;
		res += dp[i][j][k] * p / (1 - p);
	}
	printf("%.11f\n", res);
	return 0;
}


Measured memory_bytes: 213248
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


set<int> solve(int l, int r, string s) {
	int depth = 0;
	set<int> res;
	bool noop = true;
	REP(i, l, r - 1) {
		if (s[i] == '(') depth++;
		else if (s[i] == ')') depth--;
		else if (depth == 0) if (!isdigit(s[i])) {
			noop = false;
			set<int> ls = solve(l, i, s);
			set<int> rs = solve(i + 1, r, s);
			if (s[i] == '+') tr(j, ls) tr(k, rs) res.insert(*j + *k);
			if (s[i] == '-') tr(j, ls) tr(k, rs) res.insert(*j - *k);
			if (s[i] == '*') tr(j, ls) tr(k, rs) res.insert(*j * *k);
			if (s[i] == '/') tr(j, ls) tr(k, rs) if (*k != 0) res.insert(*j / *k);
		}
	}
	if (noop) {
		if (s[l] == '(') {
			res = solve(l + 1, r - 1, s);
		}
		if (isdigit(s[l])) {
			int num = 0;
			REP(i, l, r - 1) num = num * 10 + s[i] - '0';
			res.insert(num);
		}
	}
	return res;
}

int main() {
	for (string s; cin >> s, s != "#"; ) {
		cout << solve(0, s.size(), s).size() << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)

count_use = 0
while count_use < m:
    max_a = heapq.heappop(a)
    max_a = -1*((-1*max_a)//2)
    #print(max_a)
    heapq.heappush(a, max_a)
    count_use += 1

print((-1)*sum(a))

Measured memory_bytes: 73324
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[]o=new int[100001];
        int[]e=new int[100001];
        for(int i=0;i<n;i+=2){
            o[sc.nextInt()]++;
            e[sc.nextInt()]++;
        }
        int maxe=0;
        int max2e=0;
        int maxo=0;
        int max2o=0;
        int eind=0;
        int oind=0;
        boolean b=false,b1=false;
        for(int i=0;i<100001;i++){
            if(maxe<=e[i]){
                max2e=maxe;
                maxe=e[i];
                eind=i;
            }
        }
        for(int i=0;i<100001;i++){
            if(maxo<=o[i]){
                max2o=maxo;
                maxo=o[i];
                oind=i;
            }
        }if(oind==eind){
            Arrays.sort(e);
            Arrays.sort(o);
            
        System.out.println(Math.min(n-o[100000]-e[99999],n-o[99999]-e[100000]));
        }
        else{
            System.out.println(n-maxo-maxe);
        }
    }
}

Measured memory_bytes: 50904
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010

int main(){
	IOS;
	ll n;cin>>n;
	ll a[n],s=0;rep(i,0,n)cin>>a[i],s+=a[i];
	ll ans=inf;
	ll m;cin>>m;
	rep(i,0,m){
		ll p,x;cin>>p>>x;
		p--;ans=s-a[p]+x;
	cout<<ans<<"\n";
	}
	
	
	
	return 0;
}



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

int main() {
  int m; cin >> m;
  while(m--) {
    string s; cin >> s;
    set<string> v;
    for(int i = 1; i < s.size(); ++i) {
      for(int a = 0; a < 2; ++a) {
        for(int b = 0; b < 2; ++b) {
          string t = s.substr(0, i);
          string u = s.substr(i);
          if(a) reverse(t.begin(), t.end());
          if(b) reverse(u.begin(), u.end());
          v.insert(t + u);
          v.insert(u + t);
        }
      }
    }
    cout << v.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 1292
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	string S;
	cin >> S;

	int saidai = 0;
	int kari = 0;
	rep(i, S.size()) {
		if (S[i] == 'I') kari++;
		else kari--;
		saidai = max(saidai, kari);
	}

	co(saidai);

	Would you please return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll mp[111111];

long long mod_pow(ll a,ll b){
	long long ret = 1;
	long long c = a;
	for(int i = 0;i <= 60;i++){
		if(b & (1LL << i))ret = (ret * c) % MOD;
		c = (c * c) % MOD;
	}
	return ret;
}

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

	ll n;cin >> n;
	ll ma = 0;
	REP(i, n){
		ll a;cin >> a;
		mp[a]++;
		ma = max(ma, a);

		if(i == 0){
			if(a != 0){
				cout << 0 << endl;
				return 0;
			}
		}
		else{
			if(a == 0){
				cout << 0 << endl;
				return 0;
			}
		}
	}

	ll ans = 1;
	REP(i, ma){
		ll tmp = mod_pow(mp[i], mp[i+1]);
		ans = ans * tmp % MOD;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
int main()
{
    ios::sync_with_stdio(false);
    int n ;cin >> n;
    ll ans = 0;
    for (int i = 1 ; i <= n ; i++){
        if (i%3 != 0 && i % 5 != 0)
            ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b=num)
{
    return ((a%b)+b)%b;
}
bool prime[200000];
vll v;
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            v.push(p);
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m=num) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
bool my(pll p1,pll p2)
{
    if(p1.f<p2.f) return true;
    if(p1.f==p2.f && p1.s<p2.s) return true;
    return false;
}
bool isprime(ll n)
{
    REP(i,2,sqrt(n))
    {
        if(n%i==0)
        return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll h,n,sum=0;
   cin>>h>>n;
   REP(i,0,n)
   {
       ll a;
       cin>>a;
       sum+=a;
   }
   if(sum>=h)
   cout<<"Yes\n";
   else
   cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	if(a <= 8 and b <= 8) printf("Yay!\n");
	else printf(":(\n");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#define Maxn 1000
int mp[Maxn+5][Maxn+5];
int main(){
	int n,m,a,b;
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(int i=1;i<=b;i++){
		for(int j=1;j<=a;j++){
			mp[i][j]=1;
		}
	}
	for(int i=b+1;i<=n;i++){
		for(int j=a+1;j<=m;j++){
			mp[i][j]=1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			printf("%d",mp[i][j]);
		}
		puts("");
	}
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  int sum = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'o') {
    	sum ++;
    }
  }
  
  cout << 700 + 100 * sum << endl;
    
  return 0;
}

Measured memory_bytes: 3628
N=int(input())
L=list(map(int,input().split()))
if L==sorted(L):
	print("YES")
	exit(0)
for i in range(N):
	for j in range(i+1,N):
		t=L[::]
		t[i],t[j]=t[j],t[i]
		if t==sorted(t):
			print("YES")
			exit(0)
else:
	print("NO")

Measured memory_bytes: 3064
def abc158d_string_formation():
    from collections import deque
    s = deque(list(input()))
    q = int(input())
    flip = 0
    for _ in range(q):
        query = list(input().split())
        if query[0] == '1':
            flip = 1-flip
        elif query[1] == '1':
            if flip == 0:
                s.appendleft(query[2])
            else:
                s.append(query[2])
        else:
            if flip == 0:
                s.append(query[2])
            else:
                s.appendleft(query[2])
    if flip == 1:
        s = ''.join(reversed(s))
    else:
        s = ''.join(s)
    print(s)
abc158d_string_formation()

Measured memory_bytes: 103532
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [a,b,c,x,y] <- getParms
  print $ f a b c x y

f :: Int -> Int -> Int -> Int -> Int -> Int
f a b c x y
  | 2*c < a + b = 2*c*min x y + min (g a b x y)
                                    (2*c*abs (x-y))
  | otherwise   = a*x + b*y
  where
    g a b x y
      | x < y     = (y-x)*b
      | otherwise = (x-y)*a

Measured memory_bytes: 380
def main():
    a, b, x = map(int, input().split())

    result = False
    for i in range(0, b+1):
        if a + i == x:
            result = True
            break
    
    if result:
        print('YES')
    else:
        print('NO')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9104
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <array>
#include <valarray>

using namespace std;

int main()
{
    int N;
    scanf("%d\n", &N);
    vector<int> P(N);
    for (int i = 0; i < N; ++i){
        int Pi;
        scanf("%d", &Pi); --Pi; getchar();
        P[i] = Pi;
    }

    vector<int> A(N);
    for (int i = 0; i < N; ++i) A[i] = i + 1;
    auto plusA = [&](int n, int plus){
        if (n == 0) return;
        for (int i = n; i < N; ++i) A[i] += plus;
    };
    vector<int> B(N);
    for (int i = 1; i <= N; ++i) B[N - i] = i;
    auto plusB = [&](int n, int plus){
        if (n == N - 1) return;
        for (int i = 0; i <= n; ++i) B[i] += plus;
    };
    for (int i = 1; i < N; ++i){
        const int Ch = A[P[i - 1]] + B[P[i - 1]];
        const int Ci = A[P[i]] + B[P[i]];
        if (Ch < Ci) continue;
        const int plus = Ch - Ci + 1;
        plusA(P[i], plus);
        plusB(P[i], plus);
    }
    for (int i = 0; i < N; ++i){
        printf("%d", A[i]);
        if (i == N - 1) puts(""); else printf(" ");
    }
    for (int i = 0; i < N; ++i){
        printf("%d", B[i]);
        if (i == N - 1) puts(""); else printf(" ");
    }
}


Measured memory_bytes: 896
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	L := readInt()
	R := readInt()
	res := 2019

	if R-L >= 2019 {
		res = 0
	} else {
		for i := L; i < R; i++ {
			for j := i + 1; j < R+1; j++ {
				calc := (i * j) % 2019
				if res > calc {
					res = calc
				}
			}
		}
	}
	fmt.Println(res)
}

/*-----------------------------------------*/

func checkError(err error) {
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

func read() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	res, err := strconv.Atoi(read())
	checkError(err)
	return res
}

func min(a int, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

func max(a int, b int) int {
	return int(math.Max(float64(a), float64(b)))
}

func pow(a int, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func sqrt(a int) float64 {
	return math.Sqrt(float64(a))
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

template<typename T> bool chmin(T &a,const T b){if(a>b){a=b; return true;}return false;}
template<typename T> bool chmax(T &a,const T b){if(a<b){a=b; return true;}return false;}

int main(){
    int N, K; cin >> N >> K;
    vi A(N);
    for(auto &x : A) cin >> x;

    ll sum=0;
    for(int i=0; i<N; i++) sum+=A[i];

    vi div;
    for(int i=1; i*i<=sum; i++){
        if(sum%i == 0){
            div.push_back(i);
            if(i != sum/i) div.push_back(sum/i);
        }
    }
    int ans=0;
    for(auto d : div){
        vi tmp;
        for(int i=0; i<N; i++) tmp.push_back(A[i]%d);
        sort(all(tmp));
        vi s1(N+1, 0), s2(N+2, 0);
        for(int i=0; i<N; i++){
            s1[i+1]=s1[i]+tmp[i];
            s2[N-i]=s2[N-i+1]+(d-tmp[N-i-1]);
        }
        bool ok=false;
        for(int i=0; i<=N; i++){
            if(s1[i] == s2[i+1] && s1[i] <= K) ok=true;
        }
        if(ok) chmax(ans, d);
    }
    cout << ans << endl;
    return 0;
}

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

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

	int counter = 0;

	if (s[0] == '1')++counter;
	if (s[1] == '1')++counter;
	if (s[2] == '1')++counter;

	cout << counter << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

const int MAX_N = 200050;
std::string S;

int main(int argc, char **argv) {
    std::cin >> S;

    long long acw = 0;
    long long ret = 0;

    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'B') {
            acw++;
        } else {
            ret = ret + acw;
        }
    }

    std::cout << ret << std::endl;
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
ll bg = 1000000007;
ll ans(ll A[], ll n, ll k) 
{ 
    // sorting given input array 
    sort(A, A + n); 
  
    // variable to store final product of all element 
    // of sub-sequence of size k 
    ll product = 1; 
  
    // CASE I 
    // If max element is 0 and 
    // k is odd then max product will be 0 
    if (A[n - 1] == 0 && (k & 1)) 
        return 0; 
  
    // CASE II 
    // If all elements are negative and 
    // k is odd then max product will be 
    // product of rightmost-subarray of size k 
    if (A[n - 1] <= 0 && (k & 1)) { 
        for (ll i = n - 1; i >= n - k; i--) 
            product = (bg + (product*A[i])%bg)%bg; 
        return product; 
    } 
  
    // else 
    // i is current left pointer index 
    ll i = 0; 
  
    // j is current right pointer index 
    ll j = n - 1; 
  
    // CASE III 
    // if k is odd and rightmost element in 
    // sorted array is positive then it 
    // must come in subsequence 
    // Multiplying A[j] with product and 
    // correspondingly changing j 
    if (k & 1) { 
        product = ((product*A[j])%bg+bg)%bg; 
        j--; 
        k--; 
    } 
  
    // CASE IV 
    // Now k is even 
    // Now we deal with pairs 
    // Each time a pair is multiplied to product 
    // ie.. two elements are added to subsequence each time 
    // Effectively k becomes half 
    // Hence, k >> 1 means k /= 2 
    k = k/2;
  
    // Now finding k corresponding pairs 
    // to get maximum possible value of product 
    for (ll itr = 0; itr < k; itr++) { 
  
        // product from left pointers 
        ll left_product = ((A[i] * A[i + 1])%bg+bg)%bg; 
  
        // product from right pointers 
        ll right_product = ((A[j] * A[j - 1])%bg+bg)%bg; 
        ll l1 =(A[i] * A[i + 1]),r1 = (A[j] * A[j - 1]) ;
        // Taking the max product from two choices 
        // Correspondingly changing the pointer's position 
        if (l1 >= r1) { 
            product = ((product*left_product)%bg+bg)%bg;  
            i += 2; 
        } 
        else { 
            product = ((product*right_product)%bg+bg)%bg;
            j -= 2; 
        } 
    } 
  
    // Finally return product 
    return product; 
} 
int main()
{
	ll t;
	t = 1;
	while(t--)
	{
		ll k,i,j,n,m;
		cin>>n>>k;
		ll arr[n];
		for(i=0;i<n;i++)
		   cin>>arr[i];
		ll fin = ans(arr,n,k); 
		cout<<fin<<endl;   
	}
	return 0;
} 

Measured memory_bytes: 5140
//
// Created by Akifumi Ohata on 2017/10/04.
//


#include<iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

using ll =  long long int;

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

    int N, M;

    ll MOD=1000000007;


    cin >> N;

    
    if(N==1){
        
        cout<< 1 << endl;
        return 0;
    }
    vector<pair<int,int>> Array;
    for(int n=N;n>=1;n=n-1){
        if(n%2==0){
            Array.emplace_back(0,n);
        }
    }

    for( pair<int,int> &p : Array){

        int tmp=p.second;
        int dev_time=0;
        while (tmp%2==0){

            tmp/=2;
            dev_time++;
        }

        p.first=dev_time;
    }

      std::vector<pair<int,int>>::iterator iter = std::max_element(Array.begin(), Array.end());
      size_t index = static_cast<size_t>(std::distance(Array.begin(), iter));



    cout  << Array[index].second << endl ;

    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC170D
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine().Trim());
            int max_i = (int)1e6 + 2;
            int[] x = new int[max_i];
            bool[] f = new bool[max_i];
            var t = Console.ReadLine().Trim().Split(' ');
            for(int i=0;i<N;i++) { 
                x[ int.Parse(t[i]) ]++;
                f[ int.Parse(t[i]) ] = true;
            }
            int ans = 0;
            for(int i=0; i<max_i;i++){
                if(x[i] > 0) {
                    if(x[i] == 1 && f[i]) ans++;
                    for(int j=i; j<max_i;j += i) f[j] = false;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 49508
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int h1 = sc.nextInt();
		int m1 = sc.nextInt();
		int h2 = sc.nextInt();
		int m2 = sc.nextInt();
		int k = sc.nextInt();
		int minuteWidth = h2 * 60 + m2 - (h1 * 60 + m1);
		int ans = minuteWidth - k;
		System.out.println(ans);
	}

}


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

using ll=long long;
#define int ll
#define upto(a,b,i) for(int i=(a),b_=(b);i<=b_;++i)
#define uptil(a,b,i) for(int i=(a),b_=(b);i<b_;++i)
#define downto(a,b,i) for(int i=(a),b_=(b);i>=b_;--i)
#define downtil(a,b,i) for(int i=(a),b_=(b);i>b_;--i)
#define times(n,i) uptil(0,n,i)
#define rtimes(n,i) downto((n)-1,0,i)
#define sp << " "
#define ln << endl

int gcd(int c, int d) {
  if(d == 0) return c;
  return gcd(d, c % d);
}

int lcm(int c, int d) {
  return c / gcd(c, d) * d;
}

void solve() {
  int A,B,C,D; cin >> A>>B>>C>>D;
  cerr <<
    (B - B / C - B / D + B / lcm(C, D)) sp <<
    (A-1 - (A-1) / C - (A-1) / D + (A-1) / lcm(C, D)) ln;
  cout <<
    (B - B / C - B / D + B / lcm(C, D)) -
    (A-1 - (A-1) / C - (A-1) / D + (A-1) / lcm(C, D)) ln;
}

signed main() {
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(10);
  solve();
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <algorithm>
#include <cstdio>

#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  long long n;
  while (cin >> n) {
    long long div = n;
    for (long long i = 2; i < 1000000; i++) {
      if (i * i > n) break;
      if (n % i == 0) div = n / i;
    }
    int res = 0;
    while (div) {
      res++;
      div /= 10;
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func nextString() string {
	stdInScanner.Scan()
	return stdInScanner.Text()
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	S := nextString()

	if 65 <= S[0] && S[0] <= 90 {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}
}


Measured memory_bytes: 1772
a,b,c,d,e,f = map(int,input().split())
a,b = max(a,b),min(a,b)
c,d = max(c,d),min(c,d)
mcons = 0
ans = ""
for ia in range(f//(a*100)+1):
    for ib in range((f-ia*100*a)//(b*100)+1):
        water = a*100*ia+b*100*ib
        sglim = min(water//100*e,f-water)
        for ic in range(sglim//c+1):
            for i_d in range((sglim-c*ic)//d+1):
                if water>0:
                    suger = c*ic+d*i_d
                    cons = suger/(suger+water)
                    mcons = max(cons,mcons)
                    if mcons == cons:
                        ans = [water+suger,suger]
print(" ".join(list(map(str,ans))))

Measured memory_bytes: 42348
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define lu unsigned long long int
#define pi pair<ll, ll>
#define pll pair<ll, ll>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define vll ve<ll>
#define vpl ve<pll>
#define lr(n) for(ll i = 0; i < n; i++)
#define ltr(i, l, r) for (ll i = l; i <= r; i++)
#define rtl(i, l, r) for (ll i = r; i >= l; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define be begin
#define sz(a) (ll)(a.size())
#define con continue
#define ret return
#define endl "\n"
const ll INF = 1e18;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

// ll gcd(ll a, ll b){
// 	return b == 0 ? a : gcd(b, a % b);
// }

ll mod = 1e9+7;

ll mult(ll x, ll y){
    ll rem=1;
    while(y){
        if(y&1){
            rem=(rem*x)%mod;
        }
        x=(x*x)%mod;
        y>>=1;
    }
    return rem;
}


void solve(ll T){
	ll n;
	cin>>n;
	if(n == 1){
		cout << "0\n";
		return;
	}
	ll ans = mult(10, n) - 2*mult(9, n) + mult(8, n);
	ans%=mod;
	ans=(ans+4*mod)%mod;
	cout << ans << "\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// std::cout << std::unitbuf;
	ll T=1;
	// cin>>T;
	for(ll t=1;t<=T;t++){
		solve(t);
	}
	return 0;
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0; i < N; i++) {
        cin >> X[i];
    }

    ll ans = 1LL << 60;
    for(int p = 1; p <= 100; p++) {
        ll sum = 0;
        for(int i = 0; i < N; i++) {
            sum += (X[i] - p) * (X[i] - p);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;


}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;

map< ll, int > prime_factor(ll n) {
  map< ll, int > res;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}

int main(){
  int x;
  cin >> x;
  map<ll, int> sum;

  for (int i = 1; i <= x; i++) {
    auto tmp = prime_factor(i);
    for (auto e : tmp) sum[e.first] += e.second;
  }

  vector<int> dp(77);
  dp[1] = 1;

  for (auto e : sum) {
    vector<int> ndp(77);
    for (int i = 0; i < 76; i++) {
      for (int j = 0; j <= e.second; j++) {
        ndp[min(76, i * (j + 1))] += dp[i];
      }
    }
    swap(dp, ndp);
  }
  cout << dp[75] << endl;
  return 0;
}

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

using namespace std;

#define MAX 100005
#define NIL -1

struct Node {
	int parent, left, right;
};

Node *rootedTreeArray;
int *depthArray;

void Print (int id) {
	printf("node %d: ",id);
	printf ("parent = %d, ", rootedTreeArray[id].parent);
	printf("depth = %d, ", depthArray[id]);

	if (rootedTreeArray[id].parent == NIL) {
		printf("root, ");
	}
	else if (rootedTreeArray[id].left == NIL) {
		printf("leaf, ");
	}
	else {
		printf("internal node, ");
	}

	printf("[");

	for (int i = 0, c = rootedTreeArray[id].left; c != NIL; i++, c = rootedTreeArray[c].right) {
		if(i) printf(", ");
		printf("%d", c);
	}

	printf("]\n");

}

void Recursive (int id, int parentDepth) {
	depthArray[id] = parentDepth;
	if (rootedTreeArray[id].right != NIL) {
		Recursive(rootedTreeArray[id].right, parentDepth);
	}
	if (rootedTreeArray[id].left != NIL) {
		Recursive(rootedTreeArray[id].left, parentDepth + 1);
	}
}

void Initializing (int n) {
	rootedTreeArray = new Node[n];
	depthArray = new int[n];

	for (int i = 0; i < n; i++) {
		rootedTreeArray[i].parent = rootedTreeArray[i].left = rootedTreeArray[i].right = NIL;
	}
}

void Scanning (int n) {
	int id, number, left;
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &id, &number);

		for (int j = 0; j < number; j++) {
			int child;
			scanf("%d", &child);

			if (j == 0) {
				rootedTreeArray[id].left = child;
			}
			else {
				rootedTreeArray[left].right = child;
			}

			left = child;
			rootedTreeArray[child].parent = id;
		}

	}
}
int main () {
	int n, root;

	scanf("%d", &n);

	Initializing(n);

	Scanning(n);

	for (int i = 0; i < n; i++) {
		if (rootedTreeArray[i].parent == NIL) {
			root = i;
		}
	}

	Recursive(root , 0);

	for (int i = 0; i < n; i++) {
		Print(i);
	}


	return 0;
}


Measured memory_bytes: 7880
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a, b, c] <- getIntList
    putStrLn $ solve a b c

solve a b c | a == b && b == c = "No"
            | a /= b && b /= c && c /= a = "No"
            | otherwise = "Yes"

Measured memory_bytes: 508
lk i (t:ts) =
  let (j,v) = t
  in
    if j == i
    then v
    else lk i ts

up :: Int -> Int -> [(Int,Int)] -> [(Int,Int)]
up i w (t:ts) =
  let (j,v) = t
  in
    if j == i
    then (j,w):ts
    else t:(up i w ts)

mapok tbl [] = tbl
mapok tbl (ok:oks) =
  let [a,b,c,d] = ok
      t' = up c 1 $ up b 1 $ up a 1 tbl
  in
    mapok t' oks

mapng tbl [] = tbl
mapng tbl (ng:ngs) =
  let [a,b,c,_] = ng
      va = lk a tbl
      vb = lk b tbl
      vc = lk c tbl
      t' = if va == 1 && vb == 1
           then up c 0 tbl
           else if va == 1 && vc == 1
                then up b 0 tbl 
                else if vb == 1 && vc == 1
                     then up a 0 tbl
                     else tbl
  in
    mapng t' ngs

ans' n l =
  let tbl = zip [1..n] $ repeat 2
      ok = filter (\ [a,b,c,d] -> d == 1) l
      ng = filter (\ [a,b,c,d] -> d == 0) l
      t1 = mapok tbl ok
      t2 = mapng t1  ng
  in
    map snd t2

ans ([0,0,0]:_) = []
ans ([a,b,c]:[n]:x) =
  let d = take n x
      r = drop n x
  in
    (ans' (a+b+c) d) ++ (ans r)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ print o

Measured memory_bytes: 6756
N=int(input())
K=120
M=2*K+1
ls=[i-K for i in range(M)]
pow5=[n**5 for n in ls]
f=0
for i in range(M):
  for j in range(i,M):
    if pow5[j]-pow5[i]==N:
      print(*[ls[j],ls[i]])
      f=1
      break
  if f==1:
    break
      


Measured memory_bytes: 9192
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

namespace My_Math{
	#define N 100000

	int fac[N+100],invfac[N+100];

	int add(int x,int y) {return x+y>=maxd?x+y-maxd:x+y;}
	int dec(int x,int y) {return x<y?x-y+maxd:x-y;}
	int mul(int x,int y) {return 1ll*x*y%maxd;}
	ll qpow(ll x,int y)
	{
		ll ans=1;
		while (y)
		{
			if (y&1) ans=mul(ans,x);
			x=mul(x,x);y>>=1;
		}
		return ans;
	}
	int Inv(int x) {return qpow(x,maxd-2);}

	int C(int n,int m)
	{
		if ((n<m) || (n<0) || (m<0)) return 0;
		return mul(mul(fac[n],invfac[m]),invfac[n-m]);
	}

	void math_init()
	{
		fac[0]=invfac[0]=1;
		rep(i,1,N) fac[i]=mul(fac[i-1],i);
		invfac[N]=Inv(fac[N]);
		per(i,N-1,1) invfac[i]=mul(invfac[i+1],i+1);
	}
	#undef N
}
using namespace My_Math;

int main()
{
	int x=read(),y=read(),z=read();
	swap(x,y);swap(x,z);
	printf("%d %d %d\n",x,y,z);
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(map(int, [input() for _ in range(n)]))
if sum(s) % 10 == 0:
  while sum(s) % 10 == 0 and len(s) > 0:
    s = sorted(s)
    i = 0
    while s[i] % 10 == 0 and i + 1 < len(s):
      i += 1
    del s[i]
  print(sum(s))
else:
  print(sum(s))

Measured memory_bytes: 3064
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 x = sc.nextInt();
		
		if(x * 2 <= a * a * b) {
			
			double ans =Math.toDegrees(Math.atan2(b * b * a, x * 2));
			System.out.println(ans);
		}
		
		else {
			double X = Math.pow(a, 3);
			double Y = ((a* a * b) - x) * 2; 
			
			
			double ans =Math.toDegrees(Math.atan2(Y, X));
			System.out.println(ans);
		}
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){



ll int N;
cin >> N;

string S;
cin >> S;

ll int i = 0;
while(i != N){
	if(S[i] == S[i+1]){
		S.erase(i,1);
	}
	else{
		i += 1;
	}
	
	N = S.size();
}
cout << N;







	return 0;

}



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

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

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



int main(){
    bool flag=true;
    ll ans=0,sum=0;
    int n,d,add=1,count=0;
    cin >>d>>n;

    int num=0;

    if(d == 0){
        add=1;
        while(1){
            num += add;
            if(num%100 == 0)continue;
            count++;
            if(count == n)break;
        }
        
    }else if(d == 1){
        add=100;
        
        while(1){
            
            num += add;
            if(num%10000 == 0)continue;
            count++;
            if(count == n)break;
        }

    }else{
        add=10000;
        while(1){
            num+=add;
            if(num % 1000000  == 0)continue;
            count++;
            if(count == n)break;
        }
    }
    



    //cout <<fixed<<setprecision(16)<< << endl;
    cout << num << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256