akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	//?????°
	public static int x;
	//????????????
   public static void solve(){
	   Scanner sc = new Scanner(System.in);
	   x=sc.nextInt();
	   System.out.println(x*x*x);
   }
   public static void main(String[] args) {
		solve();
	}
}

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

const long long MOD = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) noexcept : x((x + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x -= a.x) < 0) x += MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (t == 0) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main(){
  int N, K; cin >> N >> K;
  vector<int> Aplus, Aminus;
  rep(i, N) {
    int A; cin >> A;
    if (A >= 0) Aplus.push_back(A);
    else Aminus.push_back(abs(A));
  }

  if (K == N) {
    mint ans = 1;
    for (int x : Aplus) ans *= x;
    for (int x : Aminus) ans *= x;
    if (Aminus.size() % 2 == 1) ans *= -1;
    cout << ans.x << endl;
    return 0;
  }

  if (Aplus.size() == 0 and K % 2 == 1) {
    sort(Aminus.begin(), Aminus.end());
    mint ans = -1;
    rep(i, K) ans *= Aminus[i];
    cout << ans.x << endl;
    return 0;
  }

  sort(Aplus.rbegin(), Aplus.rend());
  sort(Aminus.rbegin(), Aminus.rend());
  int Nplus = 0, Nminus = 0;
  rep(i, K) {
    if (Nplus == Aplus.size()) Nminus++;
    else if (Nminus == Aminus.size()) Nplus++;
    else if (Aplus[Nplus] >= Aminus[Nminus]) Nplus++;
    else Nminus++;
  }

  if (Nminus % 2 == 1) {
    if (Nplus == Aplus.size()) {
      Nminus++; Nplus--;
    } else if (Nminus == Aminus.size() or Nplus == 0) {
      Nplus++; Nminus--;
    } else {
      if ((long long)Aplus[Nplus] * Aplus[Nplus - 1] > (long long)Aminus[Nminus] * Aminus[Nminus - 1]) {
        Nplus++; Nminus--;
      } else {
        Nminus++; Nplus--;
      }
    }
  }

  mint ans = 1;
  rep(i, Nplus) ans *= Aplus[i];
  rep(i, Nminus) ans *= Aminus[i];
  cout << ans.x << endl;
}



Measured memory_bytes: 4296
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int n,m,result = 1;
  cin >> n >> m;
  if (n==1 && m==0 ){
    cout << 0 << endl;
  }
  else {
  vector<int> vec1(m);
  vector<int> vec2(m);
  for ( int i = 0 ; i < m ; i++ ) {
    cin >> vec1.at(i);
    cin >> vec2.at(i);
  }
  
  for ( int i = 0 ; i < m-1 ; i++ ) {
    for ( int j = i+1 ; j < m ; j++ ) {
      if ( vec1.at(i) == vec1.at(j) ) {
        if (vec2.at(i) != vec2.at(j) ) {
          result = 0;
        }
      }
    }
  }
  
  for ( int i = 0 ; i < m ; i++ ){
    if (vec1.at(i) == 1 && vec2.at(i) == 0 && n!=1) {
      result = 0;
    }
  }
  
  if ( result == 0 ) {
     cout << -1 << endl; 
  }
  else {
    vector<int> ans(n);
    ans.at(0) = 1;
    for (int i = 1 ; i < n ; i++ ) {
      ans.at(i) = 0;
    }
    
    for ( int i = 0 ; i < m ; i++ ) {
      ans.at(vec1.at(i)-1) = vec2.at(i);
    }
    
    
    for ( int i = 0 ; i < n ; i++ ) {
      cout << ans.at(i);
    }
    
    cout << endl;
  }
  }
 }

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;
using std::stack;

using std::min;
using std::max;
using std::sort;
using std::abs;

const int BLACK = 1;
const int WHITE = -1;
const int NONE = 0;

bool dfs(const vector<vector<int>>& g, int s, int t, vector<bool>& visited,
         vector<int>& route) {
    if (s == t) {
        route.push_back(s);
        return true;
    }

    visited[s] = true;
    for (int u : g[s]) {
        if (visited[u]) {
            continue;
        }
        if (dfs(g, u, t, visited, route)) {
            route.push_back(s);
            return true;
        }
    }
    visited[s] = false;

    return false;
}

void bfs(int n, const vector<vector<int>>& g, vector<int>& mark, int color) {
    queue<int> q;
    for (int i = 0; i < n; i++) {
        if (mark[i] == color) {
            q.push(i);
            mark[i] = NONE;
        }
    }
    while (!q.empty()) {
        const int v = q.front();
        q.pop();

        if (mark[v] != NONE) {
            continue;
        }
        mark[v] = color;

        for (int u : g[v]) {
            if (mark[u] != NONE) {
                continue;
            }
            q.push(u);
        }
    }
}

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

    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    vector<int> route;
    vector<bool> visited(n);
    dfs(g, 0, n - 1, visited, route);

    const int route_size = route.size();
    vector<int> mark(n, NONE);
    for (int i = 0; i < route_size; i++) {
        mark[route[i]] = BLACK;
    }
    for (int i = 0; i < route_size / 2; i++) {
        mark[route[i]] = WHITE;
    }

    bfs(n, g, mark, BLACK);
    bfs(n, g, mark, WHITE);

    int bcnt = count(mark.begin(), mark.end(), BLACK);
    int wcnt = count(mark.begin(), mark.end(), WHITE);
    /*
    for(int i = 0; i < n; i++){
        cout << mark[i] << " ";
    }
    cout << endl;
    for(int i = 0; i < route.size(); i++){
        cout << route[i] << " ";
    }
    cout << endl;
    cout << bcnt << " " << wcnt << endl;
    */
    cout << (bcnt > wcnt ? "Fennec" : "Snuke") << endl;

    return 0;
}


Measured memory_bytes: 16120
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int l[10], v1, v2, x;
    double d, t;
    
    while (~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", l, l+1, l+2, l+3, l+4, l+5, l+6, l+7, l+8, l+9, &v1, &v2)) {
        x = 0;
        rep(i, 10)
            x += l[i];
        t = (double)x / (v1+v2);
        d = (double)v1 * t;
        x = 0;
        rep(i, 10) {
            x += l[i];
            if (x >= d) {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 1208
N = int(input())
s = input()
t = input()
for i in range(N):
    ok = 1
    for j in range(N-i):
        if s[i+j] != t[j]:
            ok = 0
            break
    if ok == 1:
        ans = N+i
        break
if ok == 0:
    ans = 2*N
print(ans)


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

int main(void) {
    int A, B, y1, y2, a=-1;

    cin >> A >> B;

    for(int i=0; i<=10000; i++){
        y1 = i * 0.08;
        y2 = i * 0.1;
        if(y1 != 0 && y1 == A && B == y2){
            a = i;
            break;
        }
    }

    cout << a;

    return 0;
}

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

int main(){
  int N;
  cin >> N;
  ll ans = 0;
  ll t = 0;
  vector<ll> a(N+1);
  vector<ll> kmin(N+2);
  vector<ll> kmax(N+2);
  REP(i,N+1) cin >> a[i];

  kmin[0] = 1;
  kmax[0] = 1;
  kmin[N+1] = 0;
  kmax[N+1] = 0;
  // 下から順に、深さi にありうる頂点数の最大と最小を求める
  for (int i=N; i>=0; i--) {
    kmin[i] = a[i] + (kmin[i+1]+1)/2;
    kmax[i] = a[i] + kmax[i+1];
//    cout << i << " : " << kmin[i] << " " << kmax[i] << endl;
  }
  
  // 上から順に、深さi にありうる頂点数の最大と最小を求める
  // 先ほど下から順で求めておいた最大最小と比較し、範囲を絞る
  bool ng = false;
  if ((kmin[0] > 1) || (kmax[0] < 1)) {
    cout << "-1" << endl;
    return 0;
  } else if ( N != 0 ) {
    kmin[0] = 1;
    kmax[0] = 1;
    for (int i=1; i<=N; i++) {
      ll cmax = (kmax[i-1] - a[i-1]) * 2;
      ll cmin = kmin[i-1] - a[i-1];
//      cout << i << " : " << kmin[i] << " " << kmax[i] << endl;
//      cout <<  "  : " << cmin << " " << cmax << endl;
      if ( (cmax < kmin[i]) || (cmin > kmax[i]) ) {
        cout << "-1" << endl;
        ng = true;
        return 0;
      }
      kmax[i] = min(kmax[i], cmax);
      kmin[i] = max(kmin[i], cmin);
    }
  }
//  REP(i,N+1)
//    cout << i << " : " << kmin[i] << " " << kmax[i] << endl;
  REP(i,N+1) {
    ans += kmax[i];
  }
  cout << ans << endl;
}




Measured memory_bytes: 5616
def getxy(P,x,y,ans):
	for dy in range(m):
		for dx in range(m):
			if P[dy][dx] > -1:
				xy = [x+dx+1,y+dy+1]
				if ans == "NA" or xy[1] < ans[1] or (xy[1] == ans[1] and xy[0] < ans[0]):
					return xy
				else:
					return ans

# try-except is necessary
while 1:
	try:
		n,m = map(int,raw_input().split())
		if n == 0: break
		S = [map(int,raw_input().split()) for i in range(n)]
		P = [map(int,raw_input().split()) for i in range(m)]

		ans = "NA"
		for rot in range(4):
			if S == P:
				ans = getxy(P,0,0,ans)
			for y in range(n-m+1):
				for x in range(n-m+1):
					flag = 0
					for dy in range(m):
						for dx in range(m):
							if P[dy][dx] > -1 and S[y+dy][x+dx] - P[dy][dx] != 0:
								flag = 1
								break
						if flag == 1: break
					if flag == 0:
						ans = getxy(P,x,y,ans)
						break
				if flag == 0: break
			P = [[P[j][i] for j in range(m-1,-1,-1)] for i in range(m)]
		print ans if ans == "NA" else " ".join(map(str,ans))
	except:
		pass

Measured memory_bytes: 4536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    string a,b;cin>>a>>b;
    int num = stoi(b)+stoi(a)*pow(10, b.size());
    if((int)sqrt(num)==sqrt(num))co("Yes");
    else co("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	ll n,a[10010],ans=0;
	bool f=false;
	cin>>n;
	REP(i,n){
		cin>>a[i];
		if(a[i]%2==0){
			f=true;
		}
	}
	if(!f){
		cout<<0<<endl;
		return 0;
	}
	REP(i,n){
		ll k=a[i];
		ll count=0;
		if(a[i]%2==0){
			while(k%2==0){
				k/=2;
				count++;
			}
		}
		ans+=count;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
long long n, m;
int main() {
    cin >> n >> m;
    if (n > m) swap(n, m);
    if (n >= 3 && m >= 3) {
        cout << n * m - 2 * (n - 2) - 2 * (m - 2) - 4;
        return 0;
    }
    if (n == 1 && m == 1) {
        cout << 1;
        return 0;
    }
    if (n == 1) {
        cout << m - 2;
        return 0;
    }
    if (n == 2 && m == 2) {
        cout << 0;
        return 0;
    }
    cout << 0;
    return 0;
}


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

using namespace std;

const int N = 1e5 + 10, M = N * 2, S = 1e7 + 10;

#define x first
#define y second
typedef long long ll;
typedef pair<int,int> pii;

int t;
int ne[15];
string ans[4], x;

int main()
{
    ans[1] = "hon", ans[2] = "pon", ans[3] = "bon";
    ne[2] = ne[4] = ne[5] = ne[7] = ne[9] = 1;
    ne[0] = ne[1] = ne[6] = ne[8] = 2;
    ne[3] = 3;
    
    int res;
    cin >> x;
    char c = x.back();
    res = ne[c - '0'];
    cout << ans[res] << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);


int main(){
	int n, f;
	cin>>n>>f;
	map<pair<string, string>, int > m;
	rep(i, n){
		int a;
		cin>>a;
		vector<string> s;
		string t;
		rep(i, a){
			cin>>t;
			s.pb(t);
		}
		sort(all(s));
		rep(i, a) rep(j, i) m[{s[j], s[i]}]++;
	}
	vector<pair<string, string> > v;
	for(auto & p : m) {
		if(p.se >= f) v.push_back(p.fi);
	}
	sort(all(v));
	cout<<v.size()<<endl;
	for(auto& p : v) cout<<p.fi << " " << p.se<<endl;
}
 

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

int main() {
  int a = 0;
  int b = 0;
  int n = 0;
  int p1 = 0;
  int p2 = 0;
  
  cin >> n >> a >> b;
  p1 = a*n;
  p2 = b;
  cout << min(p1,p2) << endl;
}



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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main()
{
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N, M; cin >> N >> M;
    vector<int> S(N), T(M);
    for (int i = 0; i < N; ++i) cin >> S[i];
    for (int i = 0; i < M; ++i) cin >> T[i];

    mint dp[2100][2100];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= M; ++j) {
            if (i-1 >= 0 && j-1 >= 0 && S[i-1] == T[j-1]){
                dp[i][j] += dp[i-1][j-1];
            }
            if (i-1 >= 0){
                dp[i][j] += dp[i-1][j];
            }
            if (j-1 >= 0){
                dp[i][j] += dp[i][j-1];
            }
            if (i-1 >= 0 && j-1 >= 0){
                dp[i][j] -= dp[i-1][j-1];
            }
        }
    }
    cout << dp[N][M] << endl;
    return 0;
}


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

int n;
struct stu
{
	int a;
	int b;
}s[100010];

int cmp(stu& x, stu& y)
{
	return x.a < y.a;
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> s[i].a;
		s[i].b = i;
	}
	sort(s + 1, s + n + 1, cmp);
	for (int i = 1; i <= n; i++)
	{
		cout << s[i].b << " ";
	}
	return 0;
}

Measured memory_bytes: 1536
s = int(input())
a =[s]
for i in range(1, 10**6):
    if a[i-1] % 2 == 0:
        a.append(a[i-1] // 2)
    else:
        a.append(3*a[i-1] + 1)
    if a[-1] in a[:-1]:
        print(i+1)
        break

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class BComparingStrings {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt();
            if (a < b) {
                for (int i = 0; i < b; i++)
                    w.print(a);
            } else {
                for (int i = 0; i < a; i++)
                    w.print(b);
            }
            w.println();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// #define MULTIPLE_TEST_CASES
void solve() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
}

signed main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t = 1;

#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n=s.size();
    ll k;
    cin >> k;
    ll ans=0;
    char c = s[0];
    bool all_same = true;
    for(auto a : s){
        if (c!=a){
            all_same = false;
            break;
        }
    }
    if(all_same){
        ans = (n*k)/2;
        cout << ans << endl;
        return 0;
    }
    if(s[0]!=s[n-1]){
        ll ren=0;
        char prev = s[0];
        for(auto a : s){
            if (a==prev){
                ren+=1;
            }
            else{
                // d(ren)
                ans+=(ren/2)*k;
                prev=a;
                ren=1;
            }
        }
        ans+=(ren/2)*k;
        cout << ans << endl;
        return 0;
    }
    else{
        ll len_l, len_r;
        char l=s[0], r=s[n-1];
        int i=0;
        while(s[i+1]==l){
            i++;
        }
        len_l = i+1;
        i=n-1;
        while(s[i-1]==r){
            i--;
        }
        len_r = n-i;
        dd(len_l, len_r)
        ll ren=0;
        char prev = s[len_l];
        for(int i=len_l; i<n-len_r; i++){
            d(i)
            char a = s[i];
            if (a==prev){
                ren+=1;
            }
            else{
                ans+=(ren/2)*k;
                prev=a;
                ren=1;
            }
        }
        ans+=(ren/2)*k;
        ans+=1ll*((len_r+len_l)/2)*(k-1) + len_l/2+len_r/2;
        d(ans)

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;
 
int main()
{
  char ch;
  while(1){
    scanf("%c",&ch); //scanf???' '???????????????
    if(ch=='\n') break;
    if(islower(ch)!=0){ //?°???????????????°true
      ch=toupper(ch); //?°?????????? ??§??????
      cout << ch;
    }else if(isupper(ch)!=0){ //??§??????????????°true
      ch=tolower(ch); //??§????????? ?°???????
      cout << ch;
    }else{
      cout << ch;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1148
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    long long X, K, D; cin >> X >> K >> D;
    long long x;
    long long ans;
    if (X >= 0) {
        x = X % D;
        if (X / D > K) {
            ans = X - D * K;
        }
        else {
            K -= X / D;
            if (K&1) ans = abs(x - D);
            else ans = x;
        }
    }
    else {
        x = -(-X % D);
        if ((x-X) / D > K) {
            ans = abs(X + D * K);
        }
        else {
            K -= (x-X) / D;
            if (K&1) ans = x + D;
            else ans = abs(x);
        }
    }

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int M = (int)1e+6;

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

    int n;
    cin >> n;

    vector<int> a(n), b(M + 1), c(M + 1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[a[i]]++;
    }
    for (int j = 1; j <= M; j++) {
        if (!b[j]) continue;
        for (int k = j; k <= M; k += j) {
            c[k] += b[j];
        }
    }

    int r = 0;
    for (int i = 0; i < n; i++) {
        r += c[a[i]] == 1;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 11900
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
	char a[55],s[55];
	char c[155];
	int lena,lens;
	int numa,nums;
	while(~scanf("%s%s",a,s)){
		lena=strlen(a);
		lens=strlen(s);
		numa=0; nums=0;	
		for(int i=0; i<lena+lens; i++){
			if(i%2==0){
				c[i]=a[numa++];
			}
			else{
				c[i]=s[nums++];
			}
		}
		c[lena+lens]='\0';
		printf("%s\n",c);
	}
	return 0;
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n;
int a[N];
LL sum;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++ ) scanf("%d", &a[i]);
	
	LL res = 0;
	for (int i = 1, t = 1; i <= n; i ++ , t *= -1)
	{
		sum += a[i];
		if (sum * t <= 0) res += abs(t - sum), sum = t;
	}
	
	LL ans = 0;
	sum = 0;
	for (int i = 1, t = -1; i <= n; i ++ , t *= -1)
	{
		sum += a[i];
		if (sum * t <= 0) ans += abs(t - sum), sum = t;
	}
	
	printf("%lld\n", min(ans, res));
	return 0;
}

Measured memory_bytes: 640
S = list(input())
first = int("".join(S[:2]))
last = int("".join(S[2:]))
yymm = False
mmyy = False
if first > 0 and first < 13:
  mmyy = True
if last > 0 and last < 13:
  yymm = True
if yymm and mmyy:
  print("AMBIGUOUS")
elif yymm:
  print("YYMM")
elif mmyy:
  print("MMYY")
else:
  print("NA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main()
{
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl;
    else cout<<0<<endl; 
    return 0;
 } 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Double;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {



           
            int number = int.Parse(Console.ReadLine());
            double ans = 0;
            var p = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            double ansans = 0;
            var list = new List<double>();
           // var result = MaxValue;

            for(int i =0;i<100;i++){
                    ans =0;
                     foreach(int k in p){
               ans += (k-i)*(k-i);



                }

                    list.Add(ans);
                     

            }

/*foreach(int m in list){

    Console.WriteLine(m);
}*/


ansans = list.Min();
            Console.WriteLine(ansans);

            
        }
    }
    
}



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

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

long twon(long n, long mod){
    if(n == 0)
        return 1;
    if(n == 1)
        return 2;
    if(n % 2 == 0){
        long temp;
        temp = twon(n/2, mod);
        temp *= temp;
        temp %= mod;
        return temp;
    }else{
        long temp1, temp2;
        temp1 = twon((n+1)/2, mod);
        temp2 = twon((n-1)/2, mod);
        temp1 *= temp2;
        temp1 %= mod;
        return temp1;
    }
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    long mod = 1000000007;
    long ue[200005];
    long shita[200005];
    
    long uea = 1;
    long ueb = 1;
    for(long i = n; i >= n - a + 1; i--){
        uea *= i;
        uea %= mod;
    }
    for(long i = n; i >= n - b + 1; i--){
        ueb *= i;
        ueb %= mod;
    }
    shita[0] = 1;
    REP(i, 200004){
        shita[i+1] = modinv((long)(i+1), mod) * shita[i];
        shita[i+1] %= mod;
    }

    long temp1 = twon(n, mod) - 1;
    long tempa = uea * shita[a];
    tempa %= mod;
    long tempb = ueb * shita[b];
    tempb %= mod;
    temp1 -= tempa;
    if(temp1 < 0)
        temp1 += mod;
    temp1 -= tempb;
    if(temp1 < 0)
        temp1 += mod;
    cout << temp1 << endl;


    return 0;
    
}



Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <string>
using namespace std; using ll=long long; const int INF=1e9+7; using P=pair<int,int>;
const int mx = 2e5;

ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}
int main() {
  ll n,m; cin>>n>>m;
  string s,t; cin>>s>>t;
  ll an=n*m/gcd(n,m);
  ll a=an/n, b=an/m;

  for(int i=0;i<n;i++) {
    if (a*i%b) continue;
    if (s[i] != t[a*i/b]) {
      an=-1; break;
    }
  }
  cout<<an<<endl;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = mod;
  rep(i, 0, max(x, y) + 1){
    ll cost =  c * 2 * i + b * max(0ll, y - i) + a * max(0ll, x - i);
    if(ans > cost) ans = cost;
  } 
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
string s;
int n,l,ans,j;
int main()
{
    cin>>s;
    l=s.size();
    if (s[0]=='B')
    {
        if (s[l-1]=='B')
        {
            for (int i=1; i<l; i++)
            {
                if (s[i-1]=='W' && s[i]=='B') ans+=2;
                //cout<<s[i]<<endl;
            }
        }
        else
        {
            j=0;
            ans=1;
            while (s[j]=='B') j++;
            for (int i=j+1; i<l; i++)
                if (s[i-1]=='W' && s[i]=='B') ans+=2;
        }
    }
    else
    {
        //cout<<s[l-1]<<endl;
        if (s[l-1]=='W')
        {
            //cout<<"xxxxxx"<<endl;
            for (int i=1; i<l; i++)
                if (s[i-1]=='B' && s[i]=='W') ans+=2;
        }
        else
        {
            j=0;
            ans=1;
            while (s[j]=='W') j++;
            for (int i=j+1; i<l; i++)
                if (s[i-1]=='B' && s[i]=='W') ans+=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> Pii;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1000000000
#define rep(i,a,b) for(int i =(a);i<(b);i++)
#define fs first
#define ss second
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

template<typename T, typename U>
static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}

// call by reference is used in x
template<typename T, typename U>
static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
//////////////////////////////////////end of template//////////////////////////////////////

int main(){

   int n;
   cin >> n;
   
   vector<ll> v(n);
   
   for(int i=0;i<n;i++) cin >> v[i];
   
   ll ans = 0;
   
   for(int bit = 0;bit<60;bit++){
	   
	   int c1 = 0;
	   int c0 = 0;
	   ll tmp = (1ll << bit)%MOD;    
	   for(int i =0;i<n;i++){
		   
		   if( (1ll<<bit)&v[i]) c1++;
		   else c0++;
	   }
	   
	   tmp = (tmp%MOD * c0%MOD)%MOD;
	   tmp = (tmp%MOD * c1%MOD)%MOD;
	   ans = (ans%MOD + tmp)%MOD;
   }
   
    cout << ans << endl;
  
}




Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define N 110000
using namespace std;
int x,y,a,b,c,p1,p2,p3,i,minn;
int p[N],q[N],r[N];
long long ans;
bool cmp(int x,int y)
{
	return x>y;
} 
int main()
{
	scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
	for (i=1;i<=a;i++) scanf("%d",&p[i]);
	for (i=1;i<=b;i++) scanf("%d",&q[i]);
	for (i=1;i<=c;i++) scanf("%d",&r[i]);
	sort(p+1,p+a+1,cmp);
	sort(q+1,q+b+1,cmp);
	sort(r+1,r+c+1,cmp);
	for (i=1;i<=x;i++) ans+=p[i];
	for (i=1;i<=y;i++) ans+=q[i];
	p1=x;p2=y;p3=1;
	while ((p1>0||p2>0)&&p3<=c)
	{
		if (p1&&p2)
		{
		   minn=min(p[p1],q[p2]);
		   if (minn<r[p3]) 
		   {
		   ans+=r[p3]-minn;	
		   p3++;
	       } else break;
	       if (minn==p[p1]) p1--;else p2--;
		} else if (p1)
		{
			if (p[p1]<r[p3]) ans+=r[p3]-p[p1],p3++;else
			break;
			p1--;
		} else 
		{
			if (q[p2]<r[p3]) ans+=r[p3]-q[p2],p3++;else 
			break;
			p2--;
		 } 
	}
	printf("%lld",ans);
}


Measured memory_bytes: 5016
#include<iostream>
using namespace std ;
int main()
{
    long long sum=0;
    int n,k;
    cin >> n >> k ;
    for(int i=0;i<k;i++)
    {
        int x ;
        cin >> x ;
        sum+=x;
    }
    if(sum>=n){cout << "Yes" << endl;}
    else{cout << "No"<< endl;}
    return 0 ;
}


Measured memory_bytes: 384
import java.util.Scanner

object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val q = sc.nextInt()
    val ranges = for (_ <- 0 until q) yield Range(sc.nextInt(), sc.nextInt())
    (q, ranges)
  }

  case class Range(min: Int, max: Int) {
  }

  val numMax = 100001
  val isPrimeAsTable: Vector[Boolean] = {
    val n = numMax
    val primeBitmap = Array.fill(n)(true)
    primeBitmap(0) = false
    primeBitmap(1) = false

    for (i <- 2 until Math.sqrt(n).toInt) {
      if (primeBitmap(i)) {
        // i is prime
        val multipleOfI = (2 * i until n).filter(j => j % i == 0)
        multipleOfI.foreach(j => primeBitmap(j) = false)
      }
    }
    primeBitmap.toVector
  }

  def isOdd(n: Int) = n % 2 == 1

  def like2017(n: Int): Boolean = isOdd(n) && isPrimeAsTable(n) && isPrimeAsTable((n + 1) / 2)

  val isLike2017AsTable: Vector[Boolean] = {
    val n = numMax
    (0 until n).map(like2017).toVector
  }

  // cumulativeSum(Vector(a_0,a_1,a_2)) =
  // Vector
  // (0,
  // a_0,
  // a_0 + a_1,
  // a_0 + a_1 + a_2)
  def cumulativeSum[T](a: Vector[T])(implicit num: Numeric[T]): Vector[T] = {
    a.scanLeft(num.zero)(num.plus)
  }

  // countLike2017Until(n) = #{k | k<-{0,1,2...,n-1}, kはlike2017}
  val countLike2017Until: Vector[Int] = cumulativeSum(isLike2017AsTable.map(if (_) 1 else 0))

  def countLike2017(range: Range) = {
    countLike2017Until(range.max + 1) - countLike2017Until(range.min)
  }

  def main(args: Array[String]): Unit = {
    val (_, ranges) = read()
    for (range <- ranges) {
      val result = countLike2017(range)
      println(result)
    }
  }
}

Measured memory_bytes: 110728
#include <bits/stdc++.h>
#define inf 1000000000
#define maxs(x,y) (x = max(x , y))
#define mins(x,y) (x = min(x , y))
using namespace std;
typedef long long int ll;

int main(){
  int N,M,X,Y,i;
  cin >> N >> M >> X >> Y;

  int a[N],b[M];
  for(i=0 ; i<N ; i++){
    cin >> a[i];
  }
  for(i=0 ; i<M ; i++){
    cin >> b[i];
  }

  a[N] = X;
  b[M] = Y;

  sort(a,a+N+1);
  sort(b,b+M+1);

  if(a[N] < b[0]){
    cout << "No War" << endl;
  }else{
    cout << "War" << endl;
  }

}


Measured memory_bytes: 256
N = int(input())
T = [list(map(int, input().split())) for _ in range(N)]
T = sorted(T, key=lambda t: t[1])
for i in range(N-1):
    T[i+1][0] += T[i][0]
# print(T)
print('Yes' if all([T[i][0] <= T[i][1] for i in range(N)]) else 'No')


Measured memory_bytes: 55252
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define F  first
#define S  second
#define ff(i,n) for(i=0;i<n;i++)
ll bg=998244353;
ll power(ll x,ll y)
{
	if(y==0)
		return 1;
	ll h=power(x,y/2)%bg;	
	h=(h*h)%bg;
	if(y%2==1)
	  return (x*h)%bg;
	else
	  return h%bg;  
}
ll modinv(ll m)
{
	return power(m,bg-2)%bg;
}
int main()
{ 
	ll t;
	t=1;
	while(t--)
	{
		ll i,n,s,j;
		cin>>n>>s;
		ll arr[n+1];
		ff(i,n)
		   cin>>arr[i+1];
		ll dp[n+1][s+1];
		ff(i,n+1)
		{
		    ff(j,s+1)
			  dp[i][j]=0;	
		}
		dp[0][0]=1;
		for(i=1;i<=n;i++)
		{
			dp[i][0] = power(2,i)%bg;
			for(j=1;j<=s;j++)	
			{
				dp[i][j]=(dp[i-1][j]*2)%bg;
				if((j-arr[i])>=0)
				  dp[i][j] = (dp[i-1][j-arr[i]] + dp[i][j])%bg;
			}
		}  
		cout<<dp[n][s]; 
	}   
	return 0;
}

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



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<stdio.h>
#include<string.h>
#include<math.h>
#define min(a,b) (a>b?b:a)
int N,M,C[20],x[20005],f,s;
long long res,dp[2][300];
int main()
{
	for(;scanf("%d%d",&N,&M),N+M;)
	{
		res=100000000000;
		memset(dp,0x7f,sizeof(dp));
		for(int i=0;i<M;i++)scanf("%d",&C[i]);
		for(int j=1;j<=N;j++)scanf("%d",&x[j]);
		f=0,s=1;
		dp[f][128]=0;
		for(int i=1;i<=N;i++)
		{
			memset(dp[s],0x7f,sizeof(long long[300]));
			for(int j=0;j<=255;j++)
				for(int k=0;k<M;k++)
				{
					int np=j+C[k],t;
					
					if(np>255)np=255;
					if(np<0)np=0;
					t=(x[i]-np);t*=t;
					dp[s][np]=min(dp[s][np],dp[f][j]+t);
				}
			f=!f;s=!f;
		}
		for(int i=0;i<=255;i++)res=min(res,dp[f][i]);
		printf("%lld\n",res);
	}
	return 0;
}

Measured memory_bytes: 1108
#include <cstdio>
using namespace std;
int main(void){
    // Here your code !
    int W;
    int H;
    int x;
    int y;
    int r;
    
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    
    if (x - r < 0 || x + r > W){
        printf("No\n");
        return 0;
    }
    if (y - r < 0 || y + r > H){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}

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

ll x;
int main() {
    cin>>x;
    for(ll i=-1000;i<=1000;i++)
    {
        for(ll j=-1000;j<=1000;j++)
        {
            if(pow(i,5)-pow(j,5)==x)
            {
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 4080
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e4+5;
const int M = 555;

int n;
vector < int > ar;

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        ar.push_back(x);
    }
    long long ans = 0;
    sort(ar.begin() , ar.end());
    for(int i = n-1; i >= 0; i--){
        for(int j = i - 1; j >= 0; j--){
            auto tmp = lower_bound(ar.begin() , ar.end() , ar[i] + ar[j]);
            long long ng = distance(tmp , ar.end());
            ans += (n - 1 - i) - ng;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;

int n, A[MAX], s;
int B[MAX], T[VMAX + 1];

int solve() {
    int ans = 0;
    
    bool V[MAX];
    for(int i = 0; i < n; i++) {
        B[i] = A[i];
        V[i] = false;
    }
    
    sort(B, B + n);
    for(int i = 0; i < n; i++) T[B[i]] = i;
    for(int i = 0; i < n; i++) {
        if(V[i]) continue;
        int cur = i;
        int S = 0;
        int m = VMAX;
        int an = 0;
        while(1) {
            V[cur] = true;
            an++;
            int v = A[cur];
            m = min(m, v);
            S += v;
            cur = T[v];
            if(V[cur]) break;
        }
        ans += min(S + (an - 2) * m, m + S + (an + 1) * s);
    }
    
    return ans;
}

int main() {
    cin >> n;
    s = VMAX;
    for(int i = 0; i < n; i++) {
        cin >> A[i];
        s = min(s, A[i]);
    }
    int ans = solve();
    cout << ans << endl;
    
    return 0;
}


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

struct sieve {
  int n;
  vector<int> f, primes;
  sieve(int n) : n(n), f(n+1, 0) {
    /* O(n log log n) */
    f[0] = f[1] = -1;
    for(int i=2; i<=n; i++) {
      if(f[i]) continue;
      primes.push_back(i); f[i] = i;
      for(long long k=(long long)i*i; k<=n; k+=i) if(!f[k]) f[k] = i;
    }
  }
  bool is_prime(int x) {return f[x]==x;}
  template <typename T>
  vector<pair<T,int>> factors(T x) {
    assert((long long)n*n >= x);
    vector<pair<T,int>> fc;
    if( x>n ) {
      /* O(sqrt(x)) */
      for (int p : primes) {
        int c = 0;
        while (x%p == 0) x /= p, ++c;
        if (c != 0) fc.emplace_back(p,c);
      }
      if(x!=1) fc.emplace_back(x,1);
    }
    else {
      /* O(log x) */
      while (x != 1) {
        if (fc.back().first == f[x]) { fc.back().second++; }
        else { fc.emplace_back(f[x], 1); }
        x /= f[x];
      }
    }
    return fc;
  }
};

bool is_prime(int n){
  /* O(log n) */
  if(n<=1) return false;
  for(int i=2;i*i<=n;i++) if(n%i==0) return false;
  return true;
}

signed main() {
#if 0
  // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A
  int n;
  cin >> n;
  cout << n << ":";
  sieve s(ceil(sqrt(n)));
  auto factors = s.factors(n);
  for(auto f : factors) for(int i=0; i<f.second; i++) cout << " " << f.first;
  cout << endl;

#elif 0
  // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0009
  const int n_max = 999999;
  sieve s(n_max);
  vector<int> csum(n_max, 0);
  for(int i=2; i<=n_max; i++)
    csum[i] = csum[i-1] + (s.is_prime(i) ? 1 : 0);

  int n;
  while(cin >> n) cout << csum[n] << endl;

#elif 1
  // https://atcoder.jp/contests/abc149/tasks/abc149_c
  int x;
  cin>>x;

  int p=x;
  while(!is_prime(p)) p++;

  cout << p << endl;
#else
  cin >> N;
  sieve s(ceil(sqrt(N)));
  auto factors = s.factor_freq(N);

  int ans = 0;
  for(auto f : factors) {
    int count = f.second;
    int now = 1;
    while(count >= now) {
      ans++;
      count -= now;
      now++;
    }
  }
  cout << ans << endl;
#endif
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
vpll adj[2500*50];
ll d[2500*50],color[2500*50];
int N;
void dijkstra(int st){
	priority_queue<pll> PQ;//辺の長さのオーバーフローに注意！
	rep(i,2500*50){
		d[i]=INFl;
		color[i]=0;
	}
	d[st]=0;
	color[st]=1;
	PQ.push(mp(0,st));
	while(!PQ.empty()){
		pll f=PQ.top();
		PQ.pop();
		int u=f.second;
		color[u]=2;
		if(d[u]< -f.first) continue;
		rep(j,adj[u].size()){
			ll v=adj[u][j].first;
			if(color[v]==2) continue;
			if(d[v]>d[u]+adj[u][j].second){
				d[v]=d[u]+adj[u][j].second;
				PQ.push(mp(-d[v],v));
				color[v]=1;
			}
		}
	}
}
int main(){
	int M;
	ll S;
	int U[101],V[101],A[101];
	ll B[101],C[51],D[51];
	scan(N>>M>>S);
	if(S>=2500) S=2499;
	rep(i,M){
		scan(U[i]>>V[i]>>A[i]>>B[i]);
		U[i]--; V[i]--;
	}
	rep(i,N){
		scan(C[i]>>D[i]);
		rep(s,2499){
			if(s+C[i]<2500)  adj[s*50+i].push_back({(s+C[i])*50+i,D[i]});
			else adj[s*50+i].push_back({2499*50+i,D[i]});
		}
	}
	rep(i,M){
		rep(s,2500){
			if(s>=A[i]){
				adj[s*50+U[i]].push_back({(s-A[i])*50+V[i],B[i]});
				adj[s*50+V[i]].push_back({(s-A[i])*50+U[i],B[i]});
			}
		}
	}
	dijkstra(S*50);
	rep1(i,N-1){
		ll ans=INFl;
		rep(s,2500){
			ans=min(ans,d[s*50+i]);
		}
		prin(ans);
	}
	return 0;
}


Measured memory_bytes: 25120