akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll a,b;
    cin >> a >> b;
    if((a+b)%2)cout <<"IMPOSSIBLE";else cout << (a+b)/2;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = list(input())
E = S.count('E')
ans = []
prev = E
pS = 'E'
for i in range(N):
  if S[i] == 'W':
    current = prev
  elif S[i] == 'E':
    current = prev - 1
  if pS == 'W':
    current += 1
  ans.append(current)
  prev = current
  pS = S[i]
print(min(ans))


Measured memory_bytes: 17536
D=*0..N=gets.to_i;C=2,i=1;$<.map{|l|a,b=l.split.map &:to_i;D[a],D[b]=D[b],D[a];[a,b].map{|j|D[j]<2&&i=j};C<<D[i-1]<<D[i+1]};p (C-[0,N+1]|$*).size

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

typedef long long ll;
const int N = 300100;

struct edge{
	int ne, to;
}e[N];
int he[N], du[N], vis[N], tot = 0, n, m, ban[N], exist[N];

void add(int x, int y){
	e[++tot].ne = he[x];
	he[x] = tot;
	e[tot].to = y;
}

void dfs(int x, int fa){
	int i, y;
	vis[x] = 1;
	exist[x] = 1;
	for (i = he[x]; i; i = e[i].ne){
		y = e[i].to;
		if (y != fa){
			if (!vis[y]){
				dfs(y, x);
			}
			else if (exist[y]){
				printf("%d %d\n", x, y);
				du[x] ^= 1;
			}
		}
	}
	if (x == 1){
		return;
	}
	if (du[x]){
		printf("%d %d\n", x, fa);
		du[x] ^= 1;
	}
	else{
		printf("%d %d\n", fa, x);
		du[fa] ^= 1;
	}
	exist[x] = 0;
}

int main(){
	//freopen("a.in", "r", stdin);
	//freopen("a.out", "w", stdout);
	int i, j, k, x, y;
	scanf("%d%d", &n, &m);
	if (m % 2 != 0){
		printf("-1\n");
		return 0;
	}
	for (i = 1; i <= m; i++){
		scanf("%d%d", &x, &y);
		add(x, y);
		add(y, x);
	}
	dfs(1, 0);
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll N = 110, V = 1e5 + 10, inF = 1e16;

ll n, bag, dp[N][V];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> bag;
	fill(dp[0] + 1, dp[0] + V, inF);
	for (int i = 1; i <= n; i++) {
		int w, v;
		cin >> w >> v;
		for (int j = V - 1; j; j--)
			dp[i][j] = min({dp[i - 1][j], (j < V - 1? dp[i][j + 1]: inF), (dp[i - 1][max(0, j - v)] + w)});
	}
	cout << upper_bound(dp[n], dp[n] + V, bag) - dp[n] - 1;
}


Measured memory_bytes: 80256
N = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(N-1):
  if i+1 == p[i]:
    p[i],p[i+1] = p[i+1],p[i]
    count += 1
  if i+2 == p[i+1] and i == N-2:
    count += 1

print(count)

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

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(A: int, B: int, C: int):
    a = A
    for _ in range(1000):
        if a%B == C:
            print(YES)
            return
        a += A

    print(NO)
    return


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
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
int	n, m, ans;
int main()
{	
	while (~scanf("%d%d", &m, &n))
	{
		ans = 1;
		for (int i = sqrt(n); i >= 1; i--)
		{
			if (n % i == 0)
			{
				if (i >= m)
					ans = max(ans, n / i);
				if (n / i >= m)
					ans = max(ans, i); 
			}
		}
		printf("%d\n", ans);
	}
}

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

int main() {
  long A,B,C;
  int X,Y;
  cin >> A >> B >> C >> X >> Y;
  long min_p=1000000000;
  for (int c=0;c<=max(X,Y);c++) {
    min_p = min(min_p, A*max(0, (X-c)) + B*max(0, (Y-c)) +2*C*c);
  }
  cout << min_p << endl;
}

Measured memory_bytes: 256
import sys
texts=sys.stdin.read()

alpha = ['A','B','C','D','E','F','G','H','I',
         'J','K','L','M','N','O','P','Q',
         'R','S','T','U','V','W','X','Y','Z']

for i in range(len(alpha)):
    ans = texts.count(alpha[i])
    ans += texts.count(alpha[i].lower())
    print(alpha[i].lower() + ' ' + ':' + ' ' + str(ans))
    ans = 0



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

int N, M, Q;
vector<int> a, b, c, d;
int sum;

void dfs(vector<int> A)
{
  if ((N + 1) == A.size())
  {
    int score = 0;
    rep(i, Q)
    {
      if (c[i] == A[b[i]] - A[a[i]])
      {
        score += d[i];
      }
    }
    
    sum = max(sum, score);
    
    return;
  }
  
  A.push_back(A.back());
  while (A.back() <= M){
    dfs(A);
    A.back()++;
  }
}

int main()
{
  cin >> N >> M >> Q;
  
  a = b = c = d = vector<int>(Q);
  
  rep(i, Q)
  {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  
  dfs(vector<int>(1, 1));
  
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3612
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskB
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int T = 1;
            while (T-- > 0)
            {
                solveOne(in, out);
            }
        }

        private void solveOne(Scanner in, PrintWriter out)
        {
            String S = in.next(), T = in.next();

            long ans = Integer.MAX_VALUE;

            for (int idx = 0; idx + T.length() - 1 < S.length(); idx++)
            {
                int diff = 0;
                for (int idx2 = 0; idx2 < T.length(); idx2++)
                {
                    if (S.charAt(idx + idx2) != T.charAt(idx2)) diff++;
                }
                ans = Math.min(ans, diff);
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 27072
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s.at(2) == s.at(3) && s.at(4) == s.at(5)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

bool flag = false;
void dfs(string s){
	if(s.size() < 3) return;
	if(s == "ABC"){
		// cout << s << endl;
		flag = true; return;
	}
	static string b[] = {"A", "B", "C"};
	rep(k, 3){
		string t = s;
		bool f = false;
		int cnt = 0;
		rep(i, t.size()){
			if(i < t.size() - 2 && t[i] == 'A' && t[i + 1] == 'B' && t[i + 2] == 'C'){
				f = true;
				t.replace(i, 3, b[k]);
			}else if(t[i] == "ABC"[k]){
				cnt++;
			}
		}
		if(f && cnt == 0){
			// cout << t << endl;
			dfs(t);
		}
	}
	return;
}

int main(void){
	string s; cin >> s;
	dfs(s);
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 15788
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int a, b;
	cin >> a >> b;
	cout << a * b << "\n";

	return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const int MOD = 1000000007;


int main() {
	fastio();
	int n;
	cin >> n;
	int d = n % 10;
	switch(d) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon\n";
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon\n";
		break;
	case 3:
		cout << "bon\n";
		break;
	}
	return 0;
}



Measured memory_bytes: 3656
M, D = gets.split(' ').map(&:to_i)
d10Max = D / 10
d1Max = D < 10 ? D : 9

cnt = 0
(4..M).to_a.each do |m|
  (2..d10Max).to_a.each do |d10|
    (2..d1Max).to_a.each do |d1|
      break if d10 * 10 + d1 > D
      if d1 * d10 == m 
        cnt += 1 
      end
    end
  end
end
puts cnt


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    vector<int> A(n);
    ll X[202020] = {0};
    rep(i, n){
        cin >> A[i];
        X[A[i]]++;
    }
    ll cnt = 0;
    rep(i, 202020) {
        cnt += X[i] * (X[i] - 1) / 2;
    }
    rep(i, n) {
        cout << cnt - X[A[i]] + 1 << endl;
    }
}

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

Measured memory_bytes: 5576
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(void){
	while(1){
		int n; cin >> n;
		if(!n) break;
		char ch[101];
		for(int i=0; i<n; i++){
			cin >> ch[i];
		}
		ch[n] = '\0';

		int ma=0; int ma_j=0;
		int next_ma=0, next_ma_j=0;
		int sum[30] ={0};
		for(int i=0; i<n; i++){
			for(int j=0; j<30; j++){
				if(j==ch[i]-'A'){
					sum[j]++;
					if(ma<sum[j]){
						if(ma_j!=j){
							next_ma=ma;
							next_ma_j=ma_j;
						}
						ma=sum[j];
						ma_j=j;
					}
					else if(next_ma<sum[j]){
						next_ma=sum[j];
						next_ma_j=j;
					}
				}
			}

			if(ma>n/2){
				cout << (char)(ma_j+'A') << " " << i+1 << endl;
				break;
			}
			if(ma != next_ma && next_ma+n-i-1<ma){
				cout << (char)(ma_j+'A') << " " << i+1 << endl;
				break;
			}
			if(ma==next_ma && i==n-1){
				cout <<"TIE" << endl;
				break;
			}
		}
		//cout << ch << endl;





	}
	return 0;
}


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

int main() {
  int N,n;
  n=0;
  cin >> N;
  vector<int>V(N);
  vector<int>C(N);
  for(int i=0;i<N;i++){
    cin >> V.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> C.at(i);
  }
  for(int i=0;i<N;i++){
    if(V.at(i)>C.at(i)){
      n = n+V.at(i)-C.at(i);
    }
  }
    cout << n << endl;
}



Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	string tmp;
	FOR(i, 0, h) {
		FOR(j, 0, w) {
			cin >> tmp;
			if (tmp == "snuke") {
				printf("%c%d\n", (char)('A' + j), i+1);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
def get_divisor(n):
	divisors = []
	for i in range(1,int(n**0.5)+1) :
		if n%i == 0:
			divisors.append(i)
			if i != n//i  :
				divisors.append(n//i)
	return divisors

n = int(input())
count = 0
if n < 105 :
	pass
else :
	for i in range(105,n+1) :
		if i%2 != 0 :
			if len(get_divisor(i)) == 8:
				count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int n,t,k,a[1005],minid;
ld minn=1e100;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> t >> k;
	rep(n) cin >> a[i];
	rep(n) if(abs(t-a[i]*0.006-k)<minn){
		minn=abs(t-a[i]*0.006-k);
		minid=i;
	}
	print1(minid+1);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()
 
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;
 
int N, M, L;
int dp[6][300][41][1 << 9];
 
struct S {
  int a, k, t;
  S(int a_, int k_, int t_) {
    a = a_; k = k_; t = t_;
  }
};
 
vector<S> D[5];
 
int dfs(int d, int n, int l, int bit) {
  //cout << d << " " << n << " " << l << " " << bit << endl;;
  if ( d == 5 || l == 0 ) return 0;
  if ( D[d].size() == n ) return dfs(d+1, 0, l, 0);
  if ( dp[d][n][l][bit] ) return dp[d][n][l][bit];
 
  int ret = dfs(d, n+1, l, bit);
  int a = D[d][n].a, k = D[d][n].k, t = D[d][n].t;
  bool flag = true;
  for ( int i = a; i < a+k; i++ ) {
    if ( bit & (1 << i) ) {
      flag = false;
      break;
    }
  }
   
  if ( flag ) {
    int nbit = bit;
    for ( int i = a; i < a+k; i++ ) {
      nbit |= (1 << i);   
    }
    ret = max(ret, dfs(d, n+1, l-1, nbit) + t);
  }
 
  return dp[d][n][l][bit] = ret;
}
 
 
signed main() {
  cin >> N >> M >> L;
 
  Rep(i, M) {
    int d, a, k, t;
    cin >> d >> a >> k >> t;
    a--;
    D[d].pb(S(a, k, t));
  }
  //cout << endl;
  cout << dfs(0, 0, L, 0) << endl;
}

Measured memory_bytes: 28948
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const input = stdin.split('\n')[0]

const arr = input.split('')

let count = 0
let res = 0

arr.map(el => {
  if (el === 'A' || el === 'C' || el === 'G' || el === 'T') {
    count++
  } else {
    count = 0
  }

  if (count > res) {
    res = count
  }
})

console.log(res)


Measured memory_bytes: 7372
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>

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 chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
const int MAX = 10000;
class shuturyoku_unko {
public:
	char C[MAX * 4];
	constexpr shuturyoku_unko() : C() {
		rep(i, MAX) {
			int X = i;
			rep(j, 4) {
				C[i * 4 + 3 - j] = '0' + X % 10;
				X /= 10;
			}
		}
	}
};
constexpr shuturyoku_unko f;
const int dm = 1 << 17;
char *dn = cn, * di = dn, * owad = dn + dm - 20;
inline void putint(int X) {
	if (owad < di) {
		fwrite(dn, 1, di - dn, stdout);
		di = dn;
	}
	if (X >= 10000) {
		if (X >= 100000) {
			memcpy(di, f.C + X / 10000 * 4 + 2, 2);
			memcpy(di + 2, f.C + X % 10000 * 4, 4);
			di += 6;
		}
		else {
			memcpy(di, f.C + X / 10000 * 4 + 3, 1);
			memcpy(di + 1, f.C + X % 10000 * 4, 4);
			di += 5;
		}
	}
	else {
		if (X >= 1000) memcpy(di, f.C + X * 4, 4), di += 4;
		else if (X >= 100) memcpy(di, f.C + X * 4 + 1, 3), di += 3;
		else if (X >= 10) memcpy(di, f.C + X * 4 + 2, 2), di += 2;
		else memcpy(di, f.C + X * 4 + 3, 1), di += 1;
	}
	*di++ = '\n';
}
const int bm = 500001;
int BIT[bm];
void add(int A) {
	while (A > 0) {
		BIT[A]++;
		A -= A & -A;
	}
}
int query(int A) {
	int ret = 0;
	while (A < bm) {
		ret += BIT[A];
		A += A & -A;
	}
	return ret;
}
int L[500001], R[500001], C[500001], ne[500001];
int are[500001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), Q = getint();
	rep1(i, N) C[i] = getint();
	rep1(i, Q) {
		L[i] = getint();
		int r = getint();
		ne[i] = R[r];
		R[r] = i;
	}
	rep1(i, N) {
		if (are[C[i]]) add(are[C[i]]);
		are[C[i]] = i;
		
		for (int r = R[i]; r; r = ne[r]) {
			L[r] = i - L[r] - query(L[r]) + 1;
		}
	}

	rep1(i, Q) putint(L[i]);
	fwrite(dn, 1, di - dn, stdout);


	Would you please return 0;
}

Measured memory_bytes: 14984
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n,a,b;
  cin>>n>>a>>b;

  if((b-a)%2==1) cout << "Borys" << endl;
  else cout << "Alice" << endl;

  return 0;
}


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


using namespace std;

int main()
{
    char a,b;

    cin >> a >> b;

    if(a == 'H') 
    {
        if(b == 'H')
        {
            cout << "H";
        }

        else
        {
            cout << "D";
        }
        
    }
    
    else
    {
        if(b == 'H')
        {
            cout << "D";
        }

        else
        {
            cout << "H";
        }
        
    }
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	
	typedef long long ll;
	#define pi 3.14159265 
	#define EPS 1e-8
	
	#define mod 5000000
	#define fi first
	#define se second
	#define mp make_pair
	#define pb push_back
	#define endl "\n"

	const ll INF=(ll)3e17;
	
	
	
	int main()
	{
		 ios_base::sync_with_stdio(false);
		 cin.tie(NULL);
		 
		int r;
		cin>>r;
		double area=2*pi*r*1.0;
		printf("%0.10f",area);
	}


Measured memory_bytes: 3768
# Author: cr4zjh0bp
# Created: Thu Mar  5 16:04:44 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n,k=na()
s=ns()

p,q=[0]*2
for i in range(n-1):
    if s[i]==s[i+1]:
        p+=1
    else:
        q+=1

if 2*k>=q:
    print(p+q)
else:
    print(p+2*k)


Measured memory_bytes: 3316
using System;

class Program
{
    static void Main()
    {
            int w, h, x,y,r;
            string inp = Console.ReadLine();
            string[] data = inp.Split(' ');
            w = int.Parse(data[0]);
            h = int.Parse(data[1]);
            x = int.Parse(data[2]);
            y = int.Parse(data[3]);
            r = int.Parse(data[4]);
            if (x >= -100 && x <= 100 && y >= -100 && y <= 100)
            {
                if (w > 0 && w <= 100 && h > 0 && h <= 100 && r > 0 && r <= 100)
                {
                    if (w >= x + r && h >= y + r&&0 <= x - r && 0 <= y - r)
                    {
                   
                        
                            Console.WriteLine("Yes");
                        
                    }
                    else
                    {
                        Console.WriteLine("No");
                    }
                }
            }
    }
}


Measured memory_bytes: 8984
a,b = (int(i) for i in input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
def is_prime(n):
  for p in range(2, n):
    if n % p == 0:
      return False
  return True

cnt = 0

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
list = prime_factorize(gcd(a,b))

print(len(set(list))+1)

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

using namespace std;

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

  int N; cin>>N;
  vector<int> A(N); for (auto& a : A) cin>>a;

  constexpr int MOD = 1000000007;
  int dp[3] = {};
  int ans = 1;
  for (auto a : A) {
    int cnt = 0;
    for (auto v : dp)
      if (v == a)
        cnt++;
    ans = (long)ans * cnt % MOD;
    for (auto& v : dp)
      if (v == a) {
        v++;
        break;
      }
    cerr << ans << endl;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define N 100010
void solve()
{
    int n,k;
    cin>>n>>k;
    vector<int>flags(n+1);
    for(int i=0;i<k;i++)
    {
        int d;
        cin>>d;
        for(int j=0;j<d;j++)
        {
            int z;
            cin>>z;
            flags[z]=1;
        }
        
    }
    int count=0;
    for(int i=1;i<=n;i++)
    {
        if(flags[i]==0)
        count++;
    }
    cout<<count<<endl;
    
}

int main()
{
    solve();
}

Measured memory_bytes: 3596
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    string s;
    cin>>s;
    vector<ll> A(2);
    A[0]=(s[0]-'0')*10+s[1]-'0';
    A[1]=(s[2]-'0')*10+s[3]-'0';
    vector<vector<bool>> X(2,vector<bool>(2,false));
    for(int i=0;i<2;i++){
        if(A[i]<=12 && A[i]>0){X[i][0]=true;}
    }
    if(!X[0][0] && !X[1][0]){cout<<"NA"<<endl;}
    else if(X[0][0] && !X[1][0]){cout<<"MMYY"<<endl;}
    else if(!X[0][0] && X[1][0]){cout<<"YYMM"<<endl;}
    else{cout<<"AMBIGUOUS"<<endl;}
    
    
    return 0;
}


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


public class Main {


  private void solve(InputReader in, PrintWriter out) {
    int n = in.nextInt();
    if (n == 1){
      out.println("Hello World");
    }else {
      int a = in.nextInt();
      int b = in.nextInt();
      out.println(a + b);
    }

  }

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

  private void run() {
    try (
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }


  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }


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

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {

    }
  }

}


Measured memory_bytes: 23252
package main

import (
	"fmt"
)

func main() {
	var a int
	fmt.Scan(&a)

	table := make(map[int]int)

	for i := 1; i < 10; i++ {
		for v := 1; v < 10; v++ {
			table[i*v] = 1
		}
	}
	if _, f := table[a]; f {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

int main()
{
    int  K, N;
    cin >> K >> N;

    vector<int> A(N);

    int i;

    for (int i = 0; i < N; ++i) {
        cin >> A.at(i);
    }

    vector<int> T(N);

    for (i = 0; i < N-1; ++i) {
        T.at(i) = A.at(i + 1) - A.at(i);
    }

    T.at(N-1) = K+A.at(0) - A.at(N - 1);

    int ans = K - T.at(0);

    for (i = 1; i < N; ++i) {
        ans = min(ans, K-T.at(i));
    }

    cout << ans << endl;

}

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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    ll a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;

    if(abs(b-a) <= t*(v-w))
        pri("YES");
    else
        pri("NO");
    return 0;
}


Measured memory_bytes: 3636
N = int(input())
# 最後の数字+1以下じゃないとだめ
# abc -> 次はa,b,c,d

dic = ["a","b","c","d","e","f","g","h","i","j"]

strs = ["a"]
cnt = 1
while cnt < N:
    tmps = []
    for s in strs:
        for i,d in enumerate(dic[::-1]):
            if d in s:
                ind = len(dic)-i-1
                break
        # print(s,ind,dic[i])
        for i in range(ind+2):
            tmps.append(s+dic[i])
    cnt += 1
    strs = tmps[:]
for s in strs:
    print(s)

Measured memory_bytes: 13820
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main()
{
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    string s = "";
    for(int i = 0; i < w; i++){
        if(i < a){
            s += "1";
        }else{
            s += "0";
        }
    }
    string t = "";
    for(int i = 0; i < w; i++){
        if(s[i] == '0'){
            t += "1";
        }else{
            t += "0";
        }
    }
    for(int i = 0; i < h; i++){
        if(i < b){
            cout << s << endl;
        }else{
            cout << t << endl;
        }
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
struct edge{
    ll from,to,coin;
};
vl to[2550],rto[2550];
ll n,m,p;
vector<edge> g(5500);
ll dist[2550];
bool reachFrom1[2550];
bool reachToN[2550];
bool ok[2550];
void dfs(ll v,ll last){
    if(reachFrom1[v]) return;
    reachFrom1[v]=true;
    for(auto nxt:to[v]){
        if(last==nxt)continue;
        dfs(nxt,v);
    }
}
void rdfs(ll v,ll last){
    if(reachToN[v]) return;
    reachToN[v]=true;
    for(auto nxt:rto[v]){
        if(last==nxt)continue;
        rdfs(nxt,v);
    }
}
bool loop(){
    rep(i,2550) dist[i]=INF;
    dist[0]=0;
    bool update=true;
    int cnt=0;
    while(update){
        update=false;
        for(int i=0;i<m;i++){
            edge e=g[i];
            if(!ok[e.from]) continue;
            if(!ok[e.to]) continue;
            if(dist[e.from]!=INF&&dist[e.to]>dist[e.from]+e.coin){
                dist[e.to]=dist[e.from]+e.coin;
                update=true;
            }
        }
        cnt++;
        if(cnt>n) return true;
    }
    return false;
}
int main(){
    cin>>n>>m>>p;
    rep(i,m){
        ll a,b,c;cin>>a>>b>>c;
        a--;b--;
        c-=p;
        c=-c;
        g[i].from=a;g[i].to=b;g[i].coin=c;
        to[a].push_back(b);
        rto[b].push_back(a);
    }
    dfs(0,-1);
    rdfs(n-1,-1);
    rep(i,n) ok[i]=reachFrom1[i]&reachToN[i];
    if(loop()) cout<<-1<<endl;
    else{
        ll ans=-dist[n-1];
        ans=max(ans,0ll);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 768
def base10(x,n):
  x_dumy = x
  out = ''
  while x_dumy > 0:
    out = str(x_dumy%n)+out
    x_dumy = int(x_dumy/n)
  return len(out)

A = list(map(int, input().split()))
print(base10(A[0],A[1]))


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, m, q = map(int, input().split())

train = [[0 for _ in range(n)] for __ in range(n)]

for _ in range(m):
    l, r = map(int, input().split())
    train[l-1][r-1] += 1

ans = [[0 for _ in range(n+1)] for __ in range(n+1)]

for i in range(n):
    for j in range(1, n+1):
        ans[i+1][j] = ans[i][j] + train[i][j-1]

for j in range(n):
    for i in range(n+1):
        ans[i][j+1] = ans[i][j+1] + ans[i][j]

for __ in range(q):
    p, q = map(int, input().split())
    print(ans[q][q] - ans[q][p-1] - ans[p-1][q] + ans[p-1][p-1])


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

void up_down(int w) {
  for(int i=0;i<w+2;i++){
    cout<<'#';
  }
  cout<<endl;
}

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  
  int l=1, count=0, ans=-1;
  for(int i=0;i<n;i++){
    l=a.at(l-1);
    count++;
    if(l==2){
      ans=count;
      break;
    }
  }
  cout<<ans<<endl;
}

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

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

	int count = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '1')
		{
			count++;
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        q: usize,
        edges: [(usize, usize); n-1],
        points: [(usize, i64); q]
    }
    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    for (a, b) in edges {
        graph[a-1].push(b-1);
        graph[b-1].push(a-1);
    }
    let mut add_values: Vec<i64> = vec![0; n];
    for (v, p) in points {
        add_values[v-1] += p;
    }
    let mut total_points: Vec<i64> = vec![0; n];
    let mut dist: Vec<bool> = vec![false; n];
    let mut que: VecDeque<usize> = VecDeque::new();
    dist[0] = true;
    que.push_front(0);
    while !que.is_empty() {
        let p = match que.pop_front() {
            Some(x) => x,
            _ => 0
        };
        total_points[p] += add_values[p];
        for v in &graph[p] {
            if dist[*v] {continue;}
            dist[*v] = true;
            total_points[*v] += total_points[p];
            que.push_front(*v);
        }
    }
    let a: Vec<String> = total_points.iter().map(|x| x.to_string()).collect();
    println!("{}", a.join(" "));
}


Measured memory_bytes: 36988
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,a,b;
	cin>>n>>a>>b;
	vector<ll> v(n);
	for(int i = 0,j; i<n; i++)
		cin>>v[i];

	long low = 0 , high = *max_element(v.begin(),v.end()); 
	while(low<high)
	{
		long mid = low + (high-low)/2;
		ll y = a-b;
		ll t = mid*b;
		int i = 0;
		ll p=0;
		for(int i = 0 ; i<n ; i++)
		{
			ll r=0;
			if(v[i]>t)
				r = ceil(double(v[i]-t)/y);
			p+=r;
		}
		if(p<=mid)
			high = mid;
		else
			low = mid+1;
	}
	cout<<low<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>

using namespace std;

int k, x;

void solve() {
    scanf("%d %d", &k, &x);
    for (int i=-k+1; i<k; i++) {
        if (-1000000<=x-i || (x+i<=1000000)) printf("%d ", i+x); 
    }
    printf("\n");
}

int main() {
    solve();

    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int cnt[300005],q[300005],n;
bool check(int p,int x){
	int t=upper_bound(cnt+1,cnt+n+1,x)-cnt-1;
	RE (q[t]+(n-t)*x>=p*x);
}
signed main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	int x;
	cin>>n;
	FOR(i,1,n){
		cin>>x;cnt[x]++;
	}
	sort(cnt+1,cnt+n+1);
	FOR(i,1,n)q[i]=q[i-1]+cnt[i];
	int ans=n-1;
	cout<<n<<'\n';
	FOR(i,2,n){
		while(!check(i,ans))ans--;
		cout<<ans<<'\n';
	}
	RE 0;
}





Measured memory_bytes: 5632
import java.util.*;
public class Main {
	public static int process(int k) {
		if(k >= 400 && k < 600) {
			return 8;
		}
		else if(k >= 600 && k < 800) {
			return 7;
		}
		else if(k >= 800 && k < 1000) {
			return 6;
		}
		else if(k >= 1000 && k < 1200) {
			return 5;
		}
		else if(k >= 1200 && k < 1400) {
			return 4;
		}
		else if(k >= 1400 && k < 1600) {
			return 3;
		}
		else if(k >= 1600 && k < 1800) {
			return 2;
		}
		else if(k >= 1800 && k < 2000) {
			return 1;
		}
		return -1;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		
		System.out.println(process(t));
	}
}

Measured memory_bytes: 35628
#include<bits/stdc++.h>
using namespace std;
int main(){
long long x;
cin>>x;
long long a,b;
for(long long i=-2000;i<=2000;i++){
  for(long long j=i+1;j<=2000;j++){
    if(pow(j,5)-pow(i,5)==x){
      a=j;
      b=i;
      break;
    }
  }
}
cout<<a<<' '<<b<<endl;

return 0;
}

Measured memory_bytes: 4228
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] a = sc.IntArray();

        int[] bit = new int[32];

        foreach (int num in a)
        {
            int number = num;
            for (int i = 0; i < 32; i++)
            {
                bit[i] += number % 2;
                number /= 2;
            }
        }

        bool ok = true;

        for (int i = 0; i < 32; i++)
        {
            if (bit[i] % 2 != 0)
            {
                ok = false;
            }
        }

        string answer = ok ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 21344
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		char ch = sc.next().charAt(0);
		if(ch == 'A') {
			System.out.println("T");
		}
		else if(ch == 'T') {
			System.out.println("A");
		}
		else if(ch == 'C') {
			System.out.println("G");
		}
		else {
			System.out.println("C");
		}
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define ll long long 
#define P pair<ll, ll>
using namespace std;

int main(){
    int n; 
    cin >> n;
    vector<P>vec(n);
    for(int i=0;i<n;i++){
        ll a, b;
        cin >> a >> b;
        P p;
        p.first = b;
        p.second = a;
        vec[i] = p;
    }
    sort(vec.begin(), vec.end());

    ll t = 0;
    for(int i=0;i<n;i++){
        ll b = vec[i].first;
        ll a = vec[i].second;
        if(t+a <= b) t += a;
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}

Measured memory_bytes: 6424
import java.util.*;
public class Main {
 public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	long a=sc.nextLong();
	long b=sc.nextLong();
	
	long c=GCD(a,b);
	
	List<Long> p = new LinkedList<Long>();
	p.add(1L);
	long tmp=1,ii=2;
	while(!isPrime(c)){
		for(long i=ii;i<=c/2;i++){
			if(c%i==0){
				c=c/i;
				if(tmp!=i)p.add(i);
				tmp=i; ii=tmp;
				break;
			}
		}
	}if(p.indexOf(c)==-1)p.add(c);

	System.out.println(p.size());
 }
 
  public static boolean isPrime(long n){//素数かどうか
	if(n<3)return n>0?true:false;
    long m=n/2;
	if(m<2)return true;
	if(n%m==0)return false;
	m=(long)Math.floor(Math.sqrt((double)n));
	while(m>2){
		if(n%m==0)return false;
		m--;
	}
	return true;
  }
  
  public static long GCD(long x,long y){//最大公約数
	 long tmp;
	 if(y>x){tmp=x;x=y;y=tmp;}
     while((tmp=x%y)!=0){x=y;y=tmp;}
	 return y;
 }

}

Measured memory_bytes: 23764
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    long long n,sum = 0,max = -1000000,min = 1000000,a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        sum += a;
        if(max < a)max = a;
        if(min > a)min = a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void bubbleSort(vector<string> &v) {
    for (int i=1; i<(int)v.size(); ++i) {
        for (int j=v.size()-1; j>=i; --j) {
            if (v[j-1][1] > v[j][1]) {
                swap(v[j-1], v[j]);
            }
        }
    }
}
void selectionSort(vector<string> &v) {
    for (int i=0; i<(int)v.size()-1; ++i) {
        int mini = i;
        for (int j=i+1; j<(int)v.size(); ++j) {
            if (v[mini][1] > v[j][1]) {
                mini = j;
            }
        }
        swap(v[i], v[mini]);
    }
}
int main() {
    int n; cin >> n;
    vector<string> cards;
    for (int i=0; i<n; ++i) {
        string tmp; cin >> tmp;
        cards.push_back(tmp);
    }

    vector<string> cards_copy1 = cards;
    bubbleSort(cards_copy1);
    for (int i=0; i<(int)cards_copy1.size(); ++i) {
        if (i == 0) {
            cout << cards_copy1[i];
        } else {
            cout << " " << cards_copy1[i];
        }
    }
    cout << "\nStable\n";

    vector<string> cards_copy2 = cards;
    selectionSort(cards_copy2);
    for (int i=0; i<(int)cards_copy2.size(); ++i) {
        if (i == 0) {
            cout << cards_copy2[i];
        } else {
            cout << " " << cards_copy2[i];
        }
    }
    if (cards_copy2 == cards_copy1) {
        cout << "\nStable\n";
    } else {
        cout << "\nNot stable\n";
    }

    return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
 
/*************************** MACROS **************************/
#define itn int
#define ld long double
#define ll long long  
#define ull unsigned long long
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define rloop(i,x,y) for(ll i=x;i>=y;i--)
#define W(x) while(x--)
#define pll pair< ll,ll >
#define vpll vector< pll >
#define pqll priority_queue<ll>
#define pqpll priority_queue<pll>
#define MOD 1000000007
#define MOD1 998244353
#define MIN_LL -1e18
#define MAX_LL 1e18
#define MAX_INT 1e9
#define MIN_INT -1e9
#define Line cout<<"\n**************************\n\n";
 
 
using namespace std;
 
/*************************** VARIABLES **************************/
 
bool br1,br2,br;

ll n,k,x,y,z,mini,maxi,l,ind,ini,sum,t,len,r,q,imini,w;

string s,s1,s2;


/**************************** FXNS ****************************/

ll a[(int)1e6],b[(int)1e6],c[(int)1e6];

void solve(){

	cin>>n;

	loop(i,0,n)cin>>a[i];

	loop(i,0,n)cin>>b[i];

	loop(i,0,n-1)cin>>c[i];


	loop(i,0,n){

		// cout<<"@  "<<i<<" "<<sum<<endl;

		sum += b[a[i]-1];

		if(i && a[i] == a[i-1]+1)sum += c[a[i-1]-1];

		// cout<<"@* "<<i<<" "<<sum<<endl;

	}

	cout<<sum<<endl;

}
 
/*************************** MAIN ****************************/
 
 int main(){


	/*#ifndef ONLINE_JUDGE
	        freopen("inputNaNtxt", "rt", stdin);
	        freopen("output.txt", "wt", stdout);
	#endif*/
 
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
 
    solve();

	return 0;
}

Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    long int a[n];
    for(int i = 0; i < n; i++)
    {
        scanf("%ld", &a[i]);
    }

    sort(a,a+n,greater<int>());
    // for(int i = 0; i < n; i++)
    // {
    //     printf("%d\n", a[i]);
    // }
    long int length[2]={0,0};
    int idx = 0;
    long int num = a[0];
    int flag = 0;
    for(int i = 1; i < n; i++){
        if (flag == 1) {
            num = a[i];
            flag = 0;
        }
        else if (num == a[i]) {
            length[idx] = num;
            idx++;
            flag = 1;
            if (idx > 1){
                long int ans = length[0] * length[1];
                cout << ans << "\n";
                return 0;
            }
        }
        num = a[i];
        // cout << length[0] << " " << length[1] << "\n";
    }
    cout << 0 << "\n";
    
}

Measured memory_bytes: 1024