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

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] p = new int[m];
        String[] s = new String[m];
        for(int i = 0; i < m; i++){
            p[i] = scan.nextInt();
            s[i] = scan.next();
        }
        boolean[] isAc = new boolean[n];
        int ac = 0;
        int[] wa = new int[n];
        for(int i = 0; i < m; i++){
            if(s[i].equals("AC") && !isAc[p[i] - 1]){
                isAc[p[i] - 1] = true;
                ac++;
            }else if(s[i].equals("WA") && !isAc[p[i] - 1]){
                wa[p[i] - 1]++;
            }
        }
        for(int i = 0; i < m; i++) if(!isAc[p[i] - 1]) wa[p[i] - 1] = 0;
        int outWa = 0;
        for(int i = 0; i < n; i++){
            outWa += wa[i];
        }
        System.out.println(ac + " " + outWa);
        scan.close();
    }
}


Measured memory_bytes: 56652
while True:
    line = input()
    if line == "0 0":
        break
    lst = list(map(int, line.split()))
    n = lst[0]
    x = lst[1]
    #print(n, x)
    count = 0
    for i in range(1, n-1):
        for j in range(1, n):
            for k in range(1, n+1):
                if i != j != k:
                    if i < j < k:
                        if (i + j + k) == x:
                            count += 1
    print(count)



Measured memory_bytes: 5596
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,vector<ll> > P;
typedef pair<P,ll>Q;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
int main(void){
    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 mid = 0;
    if(a[n-1]%2==0)mid = a[n-1]/2;
    else mid = (a[n-1]-1)/2;
    int second = a[0];
    if(n%2==0){
        int delta = A(a[0]-mid);
        for(int i=1;i<n-1;i++){
            int d = A(a[i]-mid);
            if(delta>d){
                delta = d;
                second = a[i];
            }
        }
    }
    else{
        int delta = A(a[0]-mid);
        for(int i=1;i<n-1;i++){
            if(a[i]==mid || a[i] ==mid+1){
                second = a[i];
                delta = 0;
                break;
            }
            else{
                int d = A(a[i]-mid);
                if(delta>d){
                    delta = d;
                    second = a[i];
                }
            }
        }
    }
    cout<<second<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;


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

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>

using namespace std;
typedef long long ll;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	bool ans = abs(A - B) % 2 == 0;
	cout << (ans ? "Alice" : "Borys") << endl;
	return 0;
}


Measured memory_bytes: 256
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl;
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl;
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl;
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl;
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl;
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_da].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 100010;

void MAIN() {

    ll  n;
    cin >> n;
    if (n % 2) {
        cout << "0\n";
        return;
    }
    ll s = 0;
    n /= 2;
    while (n) {
        n /= 5;
        s += n;
    }
    cout << s << '\n';

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(

    )";
    MAIN();
    return 0;
}


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

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) (x&(-x))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pr;

const ll inf = 2e18;
const int N = 3e6 + 10;
const int maxn = 200020;
const ll mod = 1e9 + 7;

int a[maxn],n;
ll sum[maxn],cnt0[maxn],cnt1[maxn],cnt2[maxn],mn2[maxn],mn[maxn];

int main(){
	scanf("%d",&n);
	rep(i,1,n){
	   	scanf("%d",&a[i]) , sum[i] = a[i] + sum[i - 1];
		cnt0[i] = cnt0[i - 1];
		cnt2[i] = cnt2[i - 1];
		cnt1[i] = cnt1[i - 1];
		if ( a[i] % 2 == 0 ){
			if ( a[i] ) cnt2[i]++;
			else cnt0[i]++;
		}
		else cnt1[i]++;
	}
	memset(mn,0x3f,sizeof(mn));
	memset(mn2,0x3f,sizeof(mn));

	ll premn = inf , postmn = inf;
	rep(i,1,n + 1){
		premn = min(premn,sum[i - 1] - cnt1[i - 1] - 2 * cnt0[i - 1]);
		mn[i] = min(mn[i - 1],premn + cnt0[i - 1] * 2 + cnt1[i - 1] - cnt0[i - 1] - cnt2[i - 1]);
	}
	repd(i,n,1){
		postmn = min(postmn,sum[n] - sum[i] + cnt0[i] * 2 + cnt1[i]);
		mn2[i] = min(mn2[i + 1],postmn + cnt0[i] + cnt2[i] - cnt0[i] * 2 - cnt1[i]);
	}
	ll ans = inf;
	rep(i,1,n) ans = min(ans,mn[i + 1] + mn2[i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 10368
<?php
class main {
    function run () {
        fscanf(STDIN, "%d %d", $n, $m);
        $ans = 0;
        if ($n > $m / 2) {
            $ans = floor($m / 2);
        } else {
            $ans = $n + floor(($m-$n*2)/4);
        }
        echo $ans;
    }
}

$obj = new main();
$obj->run();

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N; cin >> N;
  vector<int> H(N); REP(i, N) cin >> H[i];

  int ans = 1;
  REP(i, N) {
    if(i == 0) continue;

    for(int k = 0; k < i; ++k) {
      if(H[i] < H[k]) break;
      if(k == i - 1) ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const x = parseInt(args[0][0], 10)
	const y = parseInt(args[0][1], 10)
	console.log(x + y / 2)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

const int INF=1e18;

signed main()
{
    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }

    vector<vector<int> > dp(N+1,vector<int>(2));
    for(int i=0;i<=N;i++) for(int j=0;j<2;j++){
        dp[i][j]=-INF;
    }
    dp[0][0]=0;

    for(int i=0;i<N;i++){
        dp[i+1][0]=max(a[i]+dp[i][0],-a[i]+dp[i][1]);
        if(i+1<N){
            dp[i+1][1]=max(-a[i]+dp[i][0],a[i]+dp[i][1]);
        }
    }
    cout<<max(dp[N][0],dp[N][1])<<endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m,d; cin >> n >> m >> d;
    long double ans = 2*(n-d)*(m-1);
    if(d==0) ans /=2;
    ans /= n*n;
    cout << fixed << setprecision(15) << ans << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	ll D, G; cin >> D >> G;
	VL p(D), c(D);
	REP(i, D) cin >> p[i] >> c[i];

	ll N = 1 << D;
	ll ans = LINF;
	REP(i, N) {
		VB flg(D, false);
		REP(j, D) if (i & 1 << j) flg[j] = true;
		ll sum = 0, cnt = 0;
		REP(j, D) if (flg[j]) {
			sum += p[j] * 100 * (j + 1);
			sum += c[j];
			cnt += p[j];
		}

		if (sum >= G) {
			ans = min(ans, cnt);
			continue;
		}

		for (int j = D - 1; j >= 0; --j) {
			if (!flg[j]) {
				for (int k = 0; k < p[j] - 1; ++k) {
					sum += 100 * (j + 1);
					cnt++;
					if (sum >= G) {
						ans = min(ans, cnt);
						break;
					}
				}
			}
			if (sum >= G) {
				ans = min(ans, cnt);
				break;
			}
		}
	}
	cout << ans << endl;
		
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
long long Mod = 1000000007, res, po[11];
long long Pow(long long a, long long b) {
	long long r = 1;
	while (b) {
		if (b & 1)r = r*a%Mod;
		a = a*a%Mod;
		b >>= 1;
	}
	return r;
}
int S[25100000];
int main() {
	int n, i, j, k;
	po[0] = 1;
	for (i = 0; i < 10; i++)po[i + 1] = po[i] * 10;
	scanf("%d", &n);
	int M = n / 8;
	for (i = 1; i <= M; i++) {
		int t = n / i;
		if (t*i != n) res=(res+1)%Mod;
		else {
			res = (res + 9*Pow(10, t - 1) - i + 1 + Mod)%Mod;
		}
	}
	int pv = 0, pp = 0;
	for (i = 1; i <= 25000000; i++) {
		S[i] = S[i - 1];
		if (po[pv] <= i)pv++;
		S[i] += pv;
		while (S[i] - S[pp] > n)pp++;
		if (S[i] - S[pp] == n && pp < 9999999)res++;
	}
	res %= Mod;
	printf("%lld\n", res);
}

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

int main() {
  int N;
  cin >> N;
  vector<int> list(N);
  for (int i = 0; i < N; i++) {
    cin >> list.at(i);
  }
  
  int ans = 0;
  for(int j = 0; j < N; j++) {
    if (j % 2 == 0 && list.at(j) % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3600
# coding: utf-8
# import numpy as np
import sys
import math

def _read():
    for i in sys.stdin:
        yield map(int, i.split())

def _round(decimal):
    rounded = round(decimal * 1000) / 1000
    if rounded == -0.0:
        rounded = +0.0
    return rounded

for d in _read():
    [a,b,c,d,e,f] = map(float, d)
    dat = a * e - b * d
    x = (c * e - b * f) / dat
    y = (a * f - c * d) / dat
    [x, y] = map(_round, [x, y])

    print "%1.3f %1.3f" % (x, y)

Measured memory_bytes: 4384
import scala.util.control.Breaks._

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val line = Seq.fill(2)(sc.nextInt)
    val (n, x) = (line(0), line(1))
    val ls = Seq.fill(n)(sc.nextInt)

    var y = 0
    var count = 1
    breakable {
      for (l <- ls) {
        y += l
        if (y > x) {
          break
        }
        count += 1
      }
    }
    println(count)
  }
}

Measured memory_bytes: 25680
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;


int main(){

    int a,b;
    cin >> a >> b;

    cout << (a + b + 1) / 2 << endl;

    return 0;
}


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

using namespace std;

int n;
int H, W;
const char unit = '#';


void solve(){
   
    return;
}

int main(){
    while(1){
        cin >> H >> W;
        if(!(H|W)){ break;}
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout << unit;
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3112
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0124
"""
import sys
from operator import itemgetter


def solve(data):
    result = []
    for name, win, lose, draw in data:
        score = win * 3 + draw * 1
        result.append([name, score])
    result.sort(key=itemgetter(1), reverse=True)
    return result


def main(args):
    first_data_set = True
    while True:
        n = int(input())
        if n == 0:
            break
        data = []
        for _ in range(n):
            name, win, lose, draw = input().split()
            data.append([name, int(win), int(lose), int(draw)])
        result = solve(data)
        
        if first_data_set:
            first_data_set = False
        else:
            print()
        for r in result:
            print(','.join(map(str, r)))


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7768
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        new Program().Solve(new ConsoleInput(Console.In, ' '));
    }

    public void Solve(ConsoleInput cin)
    {
        var a = cin.ReadIntArray(2);
        var n = a[0];
        var m = a[1];

        if (n == m)
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }

        ReadKey();
    }
}

public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}

Measured memory_bytes: 11220
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int x, y; cin >> x >> y;
	int ans = 2 * 1e9;
	if (x < y) ans = min(ans, y - x);
	if (-x <= y) ans = min(ans, y + x + 1);
	if (x <= -y) ans = min(ans, -y - x + 1);
	if (-x <= -y) ans = min(ans, -y + x + 2);
	cout << ans << endl;
}

Measured memory_bytes: 3636
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>

#include <random>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}


#ifdef _getchar_nolock
#else
#define _getchar_nolock getchar_unlocked
#endif

//#define solvsh
//#define multi

#ifdef solvsh
#else

ll mod = 1e4 + 7;

ll add(ll a, ll b){
    return (a + b) % mod;
}
ll ml(ll a, ll b) {
    return (a * b) % mod;
}

ll sub(ll a, ll b) {
    return add(a, mod - b);
}

ll b_p(ll b, ll p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p ^ 1));
    ll v = ml(b, p >> 1);
    return ml(v, v);
}
const int MAXN = 1e6 + 12;

int cntdiv[MAXN];

void solve() {


    for (int i = 1; i < MAXN; ++ i) {
        for (int j = i; j < MAXN; j += i) {
            cntdiv[j]++;
        }
    }

    int n;
    cin >> n;
    --n;

    int answr = 0;

    for (int i = 1; i <= n; ++i) {
        answr += cntdiv[i];
    }

    cout << answr;
}

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
        solve();
        i++;
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    //        gen();
    multisolve();
#else
    solve();
//    gen();
#endif
//    time_calc();
}


Measured memory_bytes: 7572
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int max = *max_element(a.begin(), a.end());
	int min = *min_element(a.begin(), a.end());
	cout << max - min << endl;
	return 0;
}

Measured memory_bytes: 256
n, k, *W = map(int, open(0).read().split())
left, right = 1000000000, max(W) - 1


def check(M):
    L = [W[0]]
    for i in range(1, n):
        if L[-1] + W[i] <= M:
            L[-1] += W[i]
        else:
            L.append(W[i])
    return len(L) <= k


while left - right > 1:
    m = (left + right) // 2
    if check(m):
        left = m
    else:
        right = m
print(left)



Measured memory_bytes: 16360
/*|In The Name Of Allah|*/
//This Month Will Be Expert ISA
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

const int mod = 1e9+7;

int main(){
    int a , b;
    cin >> a >> b;
    if(a * 500 >= b){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (auto& i : a) cin >> i;
    int c = 1, cnt = 0;
    while (c != 2 && cnt <= N) {
        c = a[c - 1];
        cnt++;
    }
    cout << (cnt > N ? -1 : cnt) << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define drep(i, a, b) for(int i = (a), i##_end_ = (b); i >= i##_end_; --i)
#define clar(a, b) memset((a), (b), sizeof(a))
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long LL;
typedef long double LD;
int read() {
	char ch = getchar();
	int x = 0, flag = 1;
	for (;!isdigit(ch); ch = getchar()) if (ch == '-') flag *= -1;
	for (;isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
	return x * flag;
}
void write(int x) {
	if (x < 0) putchar('-'), x = -x;
	if (x >= 10) write(x / 10);
	putchar(x % 10 + 48);
}

const int Maxn = 5009, Mod = 1e9 + 7;
struct edge {
	int to, nxt;
}g[Maxn << 1];
int n, head[Maxn], e;
int fac[Maxn], invFac[Maxn];

LL fpm(LL base, LL tims) {
	LL r = 1;
	while (tims) {
		if (tims & 1) r = 1ll * r * base % Mod;
		base = 1ll * base * base % Mod;
		tims >>= 1;
	}
	return r;
}

void add(int u, int v) {
	g[++e] = (edge){v, head[u]}, head[u] = e;
}

void init() {
	clar(head, -1); e = 0;
	n = read();
	rep (i, 2, n) {
		int u = read(), v = read();
		add(u, v), add(v, u);
	}

	fac[0] = 1;
	rep (i, 1, n + 2) fac[i] = fac[i - 1] * 1ll * i % Mod;
	invFac[n + 2] = fpm(fac[n + 2], Mod - 2);
	drep (i, n + 1, 0) invFac[i] = invFac[i + 1] * (i + 1ll) % Mod;
}

int size[Maxn];
void dfsPre(int u, int pa) {
	size[u] = 1;
	for (int i = head[u]; ~i; i = g[i].nxt) {
		int v = g[i].to;
		if (v != pa) {
			dfsPre(v, u);
			size[u] += size[v];
		}
	}
}

int cen, branch, flag;
void dfsRt(int u, int pa) {
	int	bbs = size[1] - size[u];
	for (int i = head[u]; ~i; i = g[i].nxt) {
		int v = g[i].to;
		if (v != pa) {
			dfsRt(v, u);
			bbs = max(bbs, size[v]);
		}
	}
	if (bbs < branch) branch = bbs, cen = u, flag = 0;
	else if (bbs == branch) flag = 1; 
}

LL C(int n, int m) {
	return (n < m) ? 0 : (fac[n] * 1ll * invFac[m] % Mod * invFac[n - m] % Mod);
}

LL dp[2][Maxn], s[Maxn];

void solve() {
	dfsPre(1, 0); branch = INT_MAX; dfsRt(1, 0);
	if (flag) {
		cout << fac[n / 2] * 1ll * fac[n / 2] % Mod << endl;
		return ;
	}
	rep (i, 1, n) size[i] = 0;
	dfsPre(cen, 0);
	int deg = 0, sum = 0;
	for (int i = head[cen]; ~i; i = g[i].nxt) s[++deg] = size[g[i].to];
	dp[0][0] = 1;
	rep (i, 1, deg) {
		clar(dp[i & 1], 0);
		drep (j, (sum += s[i]), 0) {
			LL &res = dp[i & 1][j]; 
			rep (k, 0, min(1ll * j, s[i])) 
				(res += dp[(i & 1) ^ 1][j - k] * 1ll * C(s[i], k) % Mod * C(s[i], k) % Mod * fac[k] % Mod) %= Mod;
		}
	}
	LL ans = fac[n];
	rep (i, 1, n - 1) {
		LL res = ((dp[deg & 1][i] * ((i & 1) ? -1ll : 1ll) * fac[n - i] % Mod) + Mod) % Mod;
		(ans += res) %= Mod;
	}
	cout << ans << endl;
}

int main() {
//	freopen("bosky.in", "r", stdin);
//	freopen("bosky.out", "w", stdout);

	init();
	solve();

#ifdef Qrsikno
	debug("\nRunning time: %.3lf(s)\n", clock() * 1.0 / CLOCKS_PER_SEC);
#endif
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin >> N;
  int minusCount = 0;
  LL mi = LLONG_MAX;
  VEC<LL> A(N);
  LL sum = 0;
  REP(i, 0, N) {
    cin >> A[i];
    sum += abs(A[i]);
    mi = min(mi, abs(A[i]));
    if (A[i] < 0) {
      minusCount++;
    }
  }
  LL ans = minusCount % 2 == 0 ? sum : sum - 2 * mi;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt()+2;
		int[]x=new int[n];
		for(int i=1;i<n-1;++i)
			x[i]=s.nextInt();

		int[]d=new int[n-1];
		for(int i=0;i<n-1;++i)
			d[i]=Math.abs(x[i+1]-x[i]);
		
		int dsum=Arrays.stream(d).sum();
		
		System.err.println(Arrays.toString(x));
		System.err.println(Arrays.toString(d));
		System.err.println(dsum);
		
		for(int i=1;i<n-1;++i)
			System.out.println(dsum-d[i-1]-d[i]+Math.abs(x[i+1]-x[i-1]));
	}
}


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

using namespace std;

vector <double> adj;

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        double a;
        cin >> a;
        adj.push_back(a);
    }
    sort(adj.begin(), adj.end());
    double sum = (adj[0] + adj[1])/2;
    for (int i = 2; i < adj.size(); i++){
        double sk = sum;
        sk += adj[i];
        sk /= 2;
        sum = sk;
    }
    cout << sum << endl;
    return 0;
}

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

using namespace std;

int a[100];

int main()
{
    int N, M;

    cin >> N >> M;

    for (int i = 0; i < N;i++)
    {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++)
        {
            int M;
            cin >> M;
            M--;
            a[M]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < M;i++)
    {
        if(a[i] == N)
        {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector< string > a, b;
  for (int i = 0; i < n; ++i) {
    string l;
    cin >> l;
    a.push_back(l);
  }
  for (int i = 0; i < m; ++i) {
    string l;
    cin >> l;
    b.push_back(l);
  }
  for (int i = 0; i <= n-m; ++i) {
    for (int j = 0; j <= n-m; ++j) {
      bool isin = true;
      for (int k = 0; k < m; ++k) {
        if (a[i+k].substr(j, m) != b[k]) {
          isin = false;
          break;
        }
      }
      if (isin) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

L = [0] * M
R = [0] * M


LR = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())

ans = min(R) - max(L) 
if ans >=0:
    print(ans + 1)
    
else:
    print(0)
    
#print(max(L))
#print(min(R))

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000000


int main(){
    cin.sync_with_stdio(false);
    int n;
    while(cin >> n, n) {
        string a[n];
        rep(i, n) cin >> a[i];
        int maxi = MAX_N + 2, mini = -MAX_N - 2;
        rep(i, n) {
            if (a[i][0] == 'x') {
                if (0 < i) {
                    if (a[i - 1][0] == 'x') {
                        maxi = -MAX_N, mini = MAX_N;
                        break;
                    }
                    if (i % 2) maxch(mini, stoi(a[i - 1]) + 1);
                    else minch(maxi, stoi(a[i - 1]) - 1);
                }
                if (i < n - 1) {
                    if (a[i + 1][0] == 'x') {
                        maxi = -MAX_N, mini = MAX_N;
                        break;
                    }
                    if (i % 2) maxch(mini, stoi(a[i + 1]) + 1);
                    else minch(maxi, stoi(a[i + 1]) - 1);
                }
            } else {
                int p = stoi(a[i]);
                if (0 < i && a[i - 1][0] != 'x') {
                    int q = stoi(a[i - 1]);
                    if ((i % 2 && p <= q) || (!(i % 2) && p >= q)) {
                        maxi = -MAX_N, mini = MAX_N;
                        break;
                    }
                }
                if (i < n - 1 && a[i + 1][0] != 'x') {
                    int q = stoi(a[i + 1]);
                    if ((i % 2 && p <= q) || (!(i % 2) && p >= q)) {
                        maxi = -MAX_N, mini = MAX_N;
                        break;
                    }
                }
            }
        }

        if (maxi < mini) cout << "none" << endl;
        else if (maxi > mini) cout << "ambiguous" << endl;
        else cout << maxi << endl;
    }

    return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
#include <sstream>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(), vecto.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
using ll = long long;

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

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

void ans(bool qus)
{
    if (qus == true)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
}

void Ans(bool qust)
{
    if (qust == true)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
}

using namespace std;

/////////////////////////////////////////

signed main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n){
        cin >> vec.at(i);
    }
    vector<int> vec2(n);
    rep(i,n){
        vec2.at(vec.at(i) -1) = i +1;
    }
    rep(i, n) {
        cout << vec2.at(i) << " ";
    }
}

Measured memory_bytes: 1536
loop do
  m,f,r = gets.split.map(&:to_i)
  exit(0) if [m,f,r].all?{|x| x==-1}

  case
  when m==-1 || f==-1
    puts ?F
  when m+f>=80
    puts ?A
  when m+f>=65
    puts ?B
  when m+f>=50
    puts ?C
  when m+f>=30
    if r>=50
      puts ?C
    else
      puts ?D
    end
  else
    puts ?F
  end
end

Measured memory_bytes: 8640
#include<stdio.h>
#include<string.h>
int main()
{
	int c;
	char str[1024];
	gets(str);
	for(c=0;c<strlen(str);c++){
		if(strncmp(&str[c],"apple",5)==0){
			str[c]='p';
			str[c+1]='e';
			str[c+2]='a';
			str[c+3]='c';
			str[c+4]='h';
		}else if(strncmp(&str[c],"peach",5)==0){
			str[c]='a';
			str[c+1]='p';
			str[c+2]='p';
			str[c+3]='l';
			str[c+4]='e';
		}
	}
	printf("%s\n",str);
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (ll i = 0; i < (ll)s.size(); i++) {
    char c = s[i];
    if (c == delimiter) {
      vs.push_back(sub);
      sub.clear();
    } else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }


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

  std::string s, t;
  std::cin >> s >> t;
  ll N = s.size();

  bool judge = false;
  std::string x = s;
  for (ll i = 0; i < N; i++) {
    x = std::string(1, x[N-1]) + x.substr(0, N-1);
    if (x == t) judge = true;
  }

  if (judge) print("Yes");
  else print("No");
  return 0;
}


Measured memory_bytes: 256
fn main() {
    // unimplemented!();
    let n_vec: Vec<String> = read_vec();
    let n: usize = n_vec[0].parse().unwrap();
    let mut input: Vec<String> = vec![];
    for _ in 0..n {
        let res_vec: Vec<String> = read_vec();
        input.push(res_vec[0].to_owned());
    }
    let result_code: Vec<String> = vec![
        "AC".to_string(),
        "WA".to_string(),
        "TLE".to_string(),
        "RE".to_string()
    ];
    let mut count: Vec<i32> = vec![0,0,0,0];
    for i in 0..n {
        if input[i] == result_code[0] {
             count[0] += 1;
        } else if input[i] == result_code[1] {
            count[1] += 1;
        } else if input[i] == result_code[2] {
            count[2] += 1;
        } else if input[i] == result_code[3] {
            count[3] += 1;
        }
    }
    for i in 0..4 {
        println!("{} x {}", result_code[i], count[i]);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

// fn read() -> String {
//     let mut s = String::new();
//     std::io::stdin().read_line(&mut s).ok();
//     s
// }

Measured memory_bytes: 7484
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll x;
    cin >> x;
    map<ll, ll> m;
    for (ll i = 1; i <= 1000000; i++) {
        m[(ll)pow(i, 5)] = i;
    }
    for (ll b = -1000000; b <= 1000000; b++) {
        ll z = (ll)pow(b, 5) + x;
        // cout << z << endl;
        if (m.count(z)) {
            cout << m[z] << " " << b << endl;
            return;
        }
    }
}


Measured memory_bytes: 4672
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
int n,m,k,ok;

signed main()
{
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);swap(a,c);
    cout<<a<<' '<<b<<' '<<c<<endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    reverse(s.begin(), s.end());
    ve<int> b(n+1);
    rep(i,n) b[i] = s[i] - '0';
    b[n] = 0;
    rep(i,n){
        if(b[i] >= 6 || (b[i] == 5 && b[i+1] >= 5)){
            b[i] = 10 - b[i];
            b[i+1]++;
        }
    }
    ll ans = 0;
    rep(i,n+1) ans += b[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8136
n=int(input())
tans=1
aans=1
for i in range(n):
  t,a = map(int,input().split())
  tt=(tans+t-1)//t
  at=(aans+a-1)//a
  mt=max([tt,at])
  tans=t*mt
  aans=a*mt
print(tans+aans)

Measured memory_bytes: 38768
#include<stdio.h>

int main(void){
    int num[10];
    int temp;
    int i,j;
    for(i=0;i<10;i++){
        scanf("%d",&num[i]);
    }
    
    for(i=0;i<10;i++){
        for(j=0;j<9;j++){
            if(num[j]<num[j+1]){
                temp=num[j];
                num[j]=num[j+1];
                num[j+1]=temp;
            }
        }
    }
    for(i=0;i<3;i++){
        printf("%d\n",num[i]);
    }
}


Measured memory_bytes: 2052
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);

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

	LL ans = 1;
	for (char c = 'a'; c <= 'z'; c++) {
		LL cnt = count(all(s), c);
		ans = (ans*(cnt + 1) % mod);
	}
	Cout(ans - 1);
}

Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	a := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(read, &a[i])
	}
	sort.Float64s(a)

	ans := (a[0] + a[1]) / 2
	for i := 2; i < n; i++ {
		ans = (ans + a[i]) / 2
	}
	fmt.Fprintln(write, ans)
}


Measured memory_bytes: 640