akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define BUF 1e5
#define INF 1 << 30
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

int main() {
    cin >> N;
    vector<int> a(N + 1), b;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    vector<int> ca(a);
    for (int i = 2; i <= N + 1; i++) {
        for (int j = N / (i - 1); j > N / i; j--) {
            int tmp = a[j];
            for (int k = 2; k < i; k++) {
                tmp += ca[j * k];
            }
            tmp %= 2;
            if (tmp == 1) {
                ca[j] = 1;
                b.push_back(j);
                ans++;
            } else {
                ca[j] = 0;
            }
        }
    }
    cout << b.size() << endl;
    for (int i = 0; i < b.size(); i++) {
        if (b[i])
            cout << b[i];
        if (i != b.size() - 1)
            cout << " ";
    }
}

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int e,y;
    cin>>e>>y;
    if(e==0){
      if(y>1988){
        cout<<"H"<<y-1988<<endl;
      }
      else if(y>1925){
             cout<<"S"<<y-1925<<endl;
      }
      else if(y>1911){
             cout<<"T"<<y-1911<<endl;
      }
      else if(y>1867){
             cout<<"M"<<y-1867<<endl;
      }
    }
    if(e==1){
      cout<<y+1867<<endl;
    }
    if(e==2){
      cout<<y+1911<<endl;
    }
    if(e==3){
      cout<<y+1925<<endl;
    }
    if(e==4){
      cout<<y+1988<<endl;
    }
}


Measured memory_bytes: 3104
#include <iostream>

using namespace std;

long A[200000], B[200000];

int main(){
    int N;
    cin >> N;
    for(int i = 0;i < N+1; i++){
        cin >> A[i];
    }
    for(int i = 0;i < N; i++){
        cin >> B[i];
    }
    long ans = 0;
    for(int i = 0; i < N; i++){
        long tmp = min(A[i], B[i]);
        ans += tmp;
        B[i] -= tmp;
        tmp = min(A[i+1], B[i]);
        A[i+1] -= tmp;
        ans += tmp;
    }
    cout << ans << endl;
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){


	int n; cin >> n;

	vector < vector <int> > g(n), c(n);


	int u, v, w;
	for(int i = 0; i < n - 1; i++){
		cin >> u >> v >> w;
		u--;
		v--;
		g[u].push_back(v);
		g[v].push_back(u);

		c[u].push_back(w);
		c[v].push_back(w);
	}


	const int INF = 1e18;

	vector <int> d(n, INF);

	d[0] = 0;


	queue <int> q;
	q.push(0);



	while(!q.empty()){

		int v = q.front(); q.pop();


		for(int i = 0; i < g[v].size(); i++){
			int to = g[v][i], len = c[v][i];
			if(d[to] > d[v] + len){
				d[to] = d[v] + len;
				q.push(to);
			}
		}

	}


	for(int i = 0; i < n; i++){
		cout << d[i] % 2 << endl;
	}


	return 0;
}

Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF = 2e9
#define LINF = 1e18
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << "=" << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO")
#define Yes(n) cout << ((n) ? "Yes" : "No")

int main(){

    int k;
    string s;

    cin >> k >> s;

    if(s.length() <= k)cout << s << endl;
    else {
        rep(i, k)cout << s[i];
        cout << "..." << endl;
    }

}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 5999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

vector<int> s;

int main() {
	int n;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	if (n % 2 == 1) {
		for (int i = n - 1; i >= 0; i -= 2) cout << s[i] << " ";
		for (int i = 1; i < n - 2; i += 2) cout << s[i] << " ";
		if(n > 2)cout << s[n - 2] << endl;
	}
	else {
		for (int i = n - 1; i > 0; i -= 2) cout << s[i] << " ";
		for (int i = 0; i < n - 2; i += 2) cout << s[i] << " ";
		if (n > 1)cout << s[n - 2] << endl;
	}
}

Measured memory_bytes: 3060
def resolve():
	n = int(input())
	seq = list(map(int, input().split()))
	s_seq = sorted(seq)
	med = s_seq[(n+1)//2]
	for i in range(n):
		if seq[i] >= med:
			print(s_seq[(n+1)//2-1])
		else:
			print(med)
resolve()

Measured memory_bytes: 93780
one = []

menu = [int(input()) for i in range(5)]

for i in range(5):
    one.append(10 - menu[i] % 10)

for i in range(5):
    if one[i] == 10:
        one[i] = 0

total = 0
cnt = 0
for i in range(5):
    if cnt == 0 and one[i] == max(one):
        total += menu[i]
        cnt = 1
    else:
        total += menu[i]
        total += one[i]

print(total)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,x,n) for(int i=x;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int H,W;cin>>H>>W;
        if(H+W==0) break;
        vector<vector<int>> S(H,vector<int>(W));
        
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cin>>S[i][j];
            }
        }
        
        int ans=0;
        
        for(int a=2;a<H;a++){
            for(int b=2;b<W;b++){
                for(int i=0;i+a<H;i++){
                    for(int j=0;j+b<W;j++){
                        int mi=INF,ma=0;
                        for(int x=i;x<=i+a;x++){
                            mi=min(mi,S[x][j]);
                            mi=min(mi,S[x][j+b]);
                        }
                        for(int y=j;y<=j+b;y++){
                            mi=min(mi,S[i][y]);
                            mi=min(mi,S[i+a][y]);
                        }
                        
                        for(int x=i+1;x<i+a;x++){
                            for(int y=j+1;y<j+b;y++){
                                ma=max(ma,S[x][y]);
                            }
                        }
                        
                        if(mi>ma){
                            int sum=0;
                            
                            for(int x=i+1;x<i+a;x++){
                                for(int y=j+1;y<j+b;y++){
                                    sum+=mi-S[x][y];
                                }
                            }
                            
                            ans=max(ans,sum);
                        }
                    }
                }
            }
        }
        
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3156
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  char v[2][3];
  for (int r = 0; r < 2; ++r) {
    for (int c = 0; c < 3; ++c) {
      std::cin >> v[r][c];
    }
  }

  if (v[0][0] == v[1][2] &&
      v[0][2] == v[1][0] &&
      v[0][1] == v[1][1]) std::cout << "YES" << std::endl;
  else                    std::cout << "NO" << std::endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>
//#define PROBLEM "problem_name.h"
//#include PROBLEM
//#include <message.h>
//#include <spcppl/dgcj.h>

using namespace std;

class A {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, a, b;
		in >> n >> a >> b;
		if ((a - b) % 2) {
			out << "Borys";
		} else {
			out << "Alice";
		}
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	A solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
	out << std::fixed;
	out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int n,d[105][3];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)	scanf("%d %d",&d[i][1],&d[i][2]);
	for(int i=3;i<=n;++i)
	{
		if(d[i][1]==d[i][2] && d[i-1][1]==d[i-1][2] && d[i-2][1]==d[i-2][2])	return puts("Yes")&0;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 3168
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
	Scanner sc =new Scanner(System.in);
	int n=sc.nextInt();
	int	a=sc.nextInt();
	int b=sc.nextInt();
	int min=a*n;
	if(b>=min)
		{
		System.out.println(min);
		}
	else
		{
		System.out.println(b);
		}
    }
}

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

using namespace std;

int main(){

    int n,t;
    cin >> n >> t;
    int m=10000,tt,tc;
    for(int i=0;i<n;i++){
        cin >> tc >> tt;
        if(tt<=t){
            m=min(tc,m);
        }
    }
    if(m==10000){
        cout << "TLE" << endl;
    }else{
        cout << m << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<(int)n;i++)
const ll INF = (1LL<<60);

template <typename T>
struct BIT{
    int n;
    vector<T> d;

    BIT(int sz){
        n = sz+10;
        d.assign(n,0);
    }

    void add(int i, T x){

        while(i<=n){
            d[i] += x;
            i += i&-i;
        }
    }

    T getSum(int i){
        T ret = 0;

        while(i>0){
            ret += d[i];
            i -= i&-i;
        }
        return ret;
    }
};

int main(){
    int n,q; cin >> n >> q;
    vector<int> c(n);
    rep(i,n){
        int ci;
        cin >> ci;
        c[i] = ci;
    }
    vector<P> Q(q);
    rep(i,q){
        int r,l; cin >> l >> r;
        Q[i] = make_pair(r,l);
    }
    auto rl = Q;
    sort(rl.begin(),rl.end());
    vector<int> lastap(n);
    BIT<int> bit(n);
    int R=0;
    map<P,int> ans;
    rep(i,q){
        int r = rl[i].first, l = rl[i].second;
        for(int j=R;j<r;j++){
            if(lastap[c[j]]) bit.add(lastap[c[j]],-1);
            bit.add(j+1,1);
            lastap[c[j]] = j+1;
        }
        R = r;
        ans[make_pair(r,l)] = bit.getSum(r)-bit.getSum(l-1);     
    }
    rep(i,q){
        cout << ans[make_pair(Q[i].first,Q[i].second)] << endl;
    }
}

Measured memory_bytes: 56544
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	const int SIZE = 1000;
	int a[SIZE] ={};
	int b[SIZE] ={};
	int c[SIZE] ={};
	int num;
	cin >> num;
	for(int i = 0; i < num; i++)
		{
			cin >> a[i] >>b[i]>>c[i];
		}
	for(int i = 0; i < num; i++)
	{
		if(pow(a[i],2)==pow(b[i],2) + pow(c[i],2))
			cout << "YES"<< endl;
		else if(pow(b[i],2)==pow(c[i],2) + pow(a[i],2))
			cout << "YES"<< endl;
		else if(pow(c[i],2)==pow(a[i],2) + pow(b[i],2))
			cout << "YES"<< endl;
		else{cout << "NO" <<endl;}
	}
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,s,t,d[100000];
  vector<int>l[100000];
  cin>>n>>m;
  for(int i=0;i<n;i++)d[i]=-1;
  for(int i=0;i<m;i++){
    cin>>s>>t;
    l[s].push_back(t);
    l[t].push_back(s);
  }
  queue<int> q;
  for(int i=0;i<n;i++){
    if(d[i]==-1){
      q.push(i);
      while(!q.empty()){
	int from=q.front();
	q.pop();
	if(d[from]==-1){
	  d[from]=i;
	  for(int j=0;j<l[from].size();j++)q.push(l[from][j]); 
	}
      }
    }    
  }
  int Q;
  cin>>Q;
  for(int i=0;i<Q;i++){
    cin>>s>>t;
    if(d[s]==d[t])cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void) {
  int m, f, b;
  cin >> m >> f >> b;

  if (m >= b) {
    cout << 0 << endl;
  } else if (m + f >= b) {
    cout << b - m << endl;
  } else {
    cout << "NA\n";
  }

  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);


int main(){
  int n;
  cin >> n;
  cout << (n*n*n) << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  long long int a,s=0;
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&a);
    s+=a;
  }
  s/=n;
  printf("%lld\n",s);
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
long double a,b;
  cin>>a>>b;
  double ret=0;
  for(int i=1;i<=a;i++){
    double tmp=1.0/a;
    int now=i;
    while(now<b){
      now*=2;
      tmp/=2;
    }
    ret+=tmp;
  }
  printf("%.12f\n",ret);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = 0;
    rep(i, n-1)
    {
        if(a[i] == a[i+1])
        {
            ans++;
            i++;
        }
    }
    cout << ans << endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
    ll w, h, n;
    cin >> w >> h >> n;
    ll u, d, r, l;
    u = h; d = 0; r = w; l = 0;
    rep(i, n) {
        ll x, y, a;
        cin >> x >> y >> a;
        if(a == 1) {
            l = max(l, x);
        } else if(a == 2) {
            r = min(r, x);
        } else if(a == 3) {
            d = max(d, y);
        } else {
            u = min(u, y);
        }
    }
    ll ans = (r - l) * (u - d);
    if(r - l < 0 || u - d < 0) ans = 0;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n, t; cin >> n >> t;
	int out = (int)mod;
	rep(i, n) {
		int a, b; cin >> a >> b;
		if (b <= t) {
			out = min(out, a);
		}
	}
  if(out==(int)mod)cout<<"TLE"<<endl;
  else{
	cout << out << endl;
  }
	return 0;
}


Measured memory_bytes: 256
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
 
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;

int main(){
    FAST_IO ;
    bigint N ; cin >> N ;
    bigint ans = 0 ;
    map<bigint , bigint > m ;
    int arr[N] ;
    for( int i = 0 ; i < N ; i++ ){
        cin >> arr[i] ;
        m[arr[i]]++ ;
    }
    for( auto x : m ){
        if( x.second < 2 )
            continue ;
        ans += ( x.second * ( x.second - 1 ) ) / 2 ;
    }
    for( int i = 0 ; i < N ; i++ ){
        bigint sum = ans ;
        if( m[arr[i]] < 2 )
            cout << sum << endl ;
        else{
            bigint x = m[arr[i]] ;
            sum -= (x * ( x - 1 )) / 2 ;
            x -- ;
            if( x < 2 )
                cout << sum << endl ;
            else
                cout << sum + ( x * ( x - 1 )) / 2 << endl ;
        }
    }
    return 0 ;
}


Measured memory_bytes: 12256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int D = Integer.parseInt(sc.next());
            int T = Integer.parseInt(sc.next());
            int S = Integer.parseInt(sc.next());

            System.out.println(S* T >= D ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 35616
import java.util.Scanner;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s1 = sc.next();
    String s2 = sc.next();
    String s3 = sc.next();
    s1 = s1.toUpperCase();
    s2 = s2.toUpperCase();
    s3 = s3.toUpperCase();
    char c1 = s1.charAt(0);
    char c2 = s2.charAt(0);
    char c3 = s3.charAt(0);

    System.out.print(c1);
    System.out.print(c2);
    System.out.println(c3);
  }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

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

ll n, a, b, c, d;

// dp[i] = iにするための最小コスト
map<ll,ll> dp; 

ll q(ll k){
    if(dp.count(k)) return dp[k];

    ll a1 = k%2 *d + a + q(k/2);
    ll a2 = (2-k%2)%2 *d + a + q((k+1)/2);

    ll b1 = k%3 *d + b + q(k/3);
    ll b2 = (3-k%3)%3 *d + b + q((k+2)/3); 
    
    ll c1 = k%5 *d + c + q(k/5);
    ll c2 = (5-k%5)%5 *d + c + q((k+4)/5);

    ll hog = min({a1,a2,b1,b2,c1,c2});

    if((ld)k>(ld)hog/(ld)d) dp[k] = hog;
    else dp[k] = k*d;

    return dp[k];
}



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

    ll t;
    cin >> t;
    REP(i,t){
        cin >> n >> a >> b >> c >> d;
        dp.clear();
        dp[0] = 0;
        dp[1] = d;
        cout << q(n) <<endl;
    }

    
    return 0;
}



Measured memory_bytes: 4444
n, p = map(int, input().split())
ex_list = []
max_ex = (1, n)
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(2, int(p**(1/2)+1)):
        cnt = 0
        while p % i == 0:
            p /= i
            cnt += 1
        if cnt > 1:
            ex_list.append((i, cnt))
            if cnt >= n:
                ans *= i ** int(cnt / n)
print(ans)

Measured memory_bytes: 3188
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
  int ans = 0;
  int a;
  cin >> a;
  rep(i,3) {
    ans += a%2;
    a /= 2;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

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

ll n;
ll mp[5555];
vector<vector<int>> v(5555);
ll dp1[5555][5555];
ll dp2[5555][5555];
ll tmp1[5555];
ll tmp2[5555];
ll subNum[5555];

void dfs(int node, int pre){
	//cout << "in dfs " << node << " " << pre << endl;
	subNum[node] = 1;
	
	if(mp[node] > 0)dp1[node][0] = mp[node];
	dp2[node][0] = mp[node];
	
	REP(i,v[node].size())if(v[node][i] != pre){
		int now = v[node][i];
		dfs(now, node);
		
		REP(j,subNum[node] + subNum[now] + 1){
			tmp1[j] = LLINF;
			tmp2[j] = LLINF;
		}
		//cout << "  " << now << " " << subNum[node] << " " << subNum[now] << endl;
		REP(j,subNum[node]){
			REP(k,subNum[now]){
				if(dp1[now][k] != LLINF || dp2[now][k] < 0){
					//cout << "    " << j << " " << now << " " << k << " " << dp1[node][k] << endl;
					tmp1[j+k+1] = min(tmp1[j+k+1],dp1[node][j]);
					tmp2[j+k+1] = min(tmp2[j+k+1],dp2[node][j]);
				}
				
				tmp1[j+k] = min(tmp1[j+k],dp1[node][j] + dp1[now][k]);
				tmp2[j+k] = min(tmp2[j+k],dp1[node][j] + dp2[now][k]);
				tmp2[j+k] = min(tmp2[j+k],dp2[node][j] + dp1[now][k]);
				tmp2[j+k] = min(tmp2[j+k],dp2[node][j] + dp2[now][k]);
			}
		}
		
		subNum[node] += subNum[now];
		REP(j,subNum[node]){
			dp1[node][j] = tmp1[j];
			dp2[node][j] = tmp2[j];
		}
	}
	//cout << "out dfs " << node << " " << pre << endl;
}

int main(){
	
	REP(i,5555){
		REP(j,5555){
			dp1[i][j] = LLINF;
			dp2[i][j] = LLINF;
		}
	}	
	
	cin >> n;
	REP(i,n)cin >> mp[i];
	REP(i,n-1){
		int a, b;cin >> a >> b;
		a--;b--;
		v[a].PB(b);
		v[b].PB(a);
	}
	
	dfs(0, -1);
	
	//SHOW2d(dp1,n+1,n+1);
	//SHOW2d(dp2,n+1,n+1);
	
	for(int i = 0;i <= n;i++){
		if(dp1[0][i] != LLINF){
			cout << i << endl;
			return 0;
		}
		if(dp2[0][i] < 0){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 483328
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
 
int main(){
    fast;
    ll n;
    cin >> n;
    ld ans = 2*n*3.14;
    cout << ans;
    return 0;
}
//                                     #!!{*[$um1t_Kum@r]*}!!#

Measured memory_bytes: 3780
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author teiwa
 */
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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            List<List<Integer>> A = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                List<Integer> tmp = new ArrayList<>();
                tmp.add(in.nextInt());
                tmp.add(in.nextInt());
                A.add(tmp);
            }
            A.sort(Comparator.comparing(a -> a.get(0)));

            long buyNum = 0;
            long budget = 0;
            for (int i = 0; i < A.size(); i++) {
                if (buyNum == M) {
                    break;
                }
                long price = A.get(i).get(0);
                long upperBuyingNum = A.get(i).get(1);
                // 上限いっぱい購入
                if (buyNum + upperBuyingNum <= M) {
                    buyNum += upperBuyingNum;
                    budget += price * upperBuyingNum;
                } else {
                    while (buyNum < M) {
                        buyNum++;
                        budget += price;
                    }
                }
            }

            if (buyNum == M) {
                out.println(budget);
            }
        }

    }
}



Measured memory_bytes: 100876
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
    if 500*i > x:
        break;
    else:
        for j in range(b+1):
            if 500*i+100*j > x:
                break;
            elif (x-500*i-100*j)/50 <= c:
                ans += 1
print(ans)


Measured memory_bytes: 3060
#include <cstdio>

char a[105],b[105],c[105];

inline int _min(register char a,register char b,register char c)
{
	register int ans=(a!=b)+(a!=c),a1=(a!=c)+(b!=c);
	if(a1<ans)
		ans=a1;
	a1=(a!=b)+(b!=c);
	if(a1<ans)
		ans=a1;
	return ans;
}

int main()
{
	int N;scanf("%d",&N);
	scanf("%s%s%s",&a[1],&b[1],&c[1]);
	register int ans=0;
	for(register int i=1;i<=N;i++)
		ans+=_min(a[i],b[i],c[i]);
	printf("%d\n",ans);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int n,m,i;
  scanf("%d%d", &n, &m);
  int l,r,lmax=0,rmin=n;
  for(i=0;i<m;i++){
    scanf("%d%d", &l,&r);
    if(l>lmax) lmax=l;
    if(rmin>r) rmin=r;
  }
  int ans=rmin-lmax+1;
  if(ans<0) ans=0;
  printf("%d", ans);
}

Measured memory_bytes: 128
from sys import stdin

N = int(stdin.readline().rstrip())
X = [int(x) for x in stdin.readline().rstrip().split()]

def solve(X, i):
    Y = [(x - i) ** 2 for x in X]
    return sum(Y)

minv = 10**9
bv = minv+1
i = 0
while minv < bv:
    bv = minv
    v = solve(X, i)
    i += 1
    if minv > v:
        minv = v
print(minv)

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

int main(){
  vector<int> A(3);
  cin >> A.at(0) >> A.at(1) >> A.at(2);
  sort(A.begin(),A.end());
  if(A.at(0) == 5&&A.at(1) == 5&&A.at(2) == 7){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int cnt;
  cin>>cnt;
  int dst=0;
  int tmp;
  int* idx=new int(cnt);
 for(int i=0;i<cnt;i++){
   idx[i]=0;
	cin>>tmp;
   for(int j=0;j<=i;j++){
   if(idx[j] == tmp)break;
   if(idx[j] == 0){
     idx[j]=tmp;
     dst++;
     break;
   }
   }// for
   
 }// for
  
  cout << dst << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque

H, W = map(int, input().split())
s = ["X" * (W+2)] + ["X" + input() + "X" for _ in range(H)] + ["X" * (W+2)]
visited = [[-1 for _ in range(W+2)] for _ in range(H+2)]

DH = [1, 0, -1, 0]
DW = [0, 1, 0, -1]

ans = 0
def bfs(start, num):
	global ans
	dot, sharp = 0, 0
	que = deque([start])
	#visited = [[False for _ in [0]*(W+2)] for _ in [0]*(H+2)]
	visited[start[0]][start[1]] = num
	#cur = s[start[0]][start[1]]
	while que:
		label = que.pop()
		h, w = label[0], label[1]
		if s[h][w] == ".":
			dot += 1
		elif s[h][w] == "#":
			sharp += 1
		#if s[start[0]][start[1]] != s[h][w] and W*start[0]+start[1] < W*h+w:
			#ans += 1
		for dh, dw in zip(DH, DW):
			if s[h][w] == ".":
				if s[h+dh][w+dw] == "#" and visited[h+dh][w+dw] == -1:
					que.appendleft([h+dh, w+dw])
					visited[h+dh][w+dw] = num
			elif s[h][w] == "#":
				if s[h+dh][w+dw] == "." and visited[h+dh][w+dw] == -1:
					que.appendleft([h+dh, w+dw])
					visited[h+dh][w+dw] = num
	#del que, visited
	return dot*sharp

k = 0
for i in range(1, H+1):
	for j in range(1, W+1):
		if visited[i][j] == -1:
			ans += bfs([i, j], k)

print(ans)

Measured memory_bytes: 51932
#[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()));
        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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        m: usize,
        mut ab: [(usize, usize); n]
    }

    ab.sort_by(|x, y| x.0.cmp(&y.0));

    let mut counter = 0;
    let mut ans = 0;
    for shop in ab.iter() {
        if shop.1 >= m - counter {
            ans += shop.0 * (m - counter);
            println!("{}", ans);
            return;
        }

        counter += shop.1;
        ans += shop.0 * shop.1;
    }
}


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

using namespace std;
typedef long long ll;

template<class T>
void chmax(T &x, T y) { if (x < y) x = y; }

const int N = 2010;
ll dp[N][N];

int main() {
    int n;
    cin >> n;
    vector<pair<ll, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.rbegin(), a.rend());
    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n - i; j++) {
            if (!i && !j) continue;
            if (i) chmax(dp[i][j], dp[i - 1][j] + a[i + j - 1].first * (a[i + j - 1].second - i + 1));
            if (j) chmax(dp[i][j], dp[i][j - 1] + a[i + j - 1].first * (n - j - a[i + j - 1].second));
            if (i + j == n) chmax(ans, dp[i][j]);
        }
    }
    cout << ans << "\n";
}


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

const int MAX_N = 2 * 10e5;

int N;
int A[MAX_N];

void Main() {
  cin >> N;
  rep(i, N) {
    cin >> A[i];
  }

  int ans = 0;
  int m = INF;

  rep(i, N) {
    m = min(m, A[i]);
    if (A[i] <= m) {
      ans++;
    }
  }

  cout << ans << endl;
}

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

Measured memory_bytes: 1024
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        BigInteger[] a = new BigInteger[n];
        BigInteger sum = BigInteger.ZERO;
        BigInteger sum2 = BigInteger.ZERO;
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextBigInteger();
            BigInteger tmp = a[i].multiply(a[i]);
            sum2 = sum2.add(tmp);
            sum = sum.add(a[i]);
        }
        BigInteger ans = BigInteger.ZERO;
        BigInteger tmp = sum.multiply(sum);
        BigInteger tmp2 = tmp.subtract(sum2);
        BigInteger tmp3 = tmp2.divide(new BigInteger("2"));
        ans = tmp3.mod(new BigInteger("1000000007"));
        System.out.println(ans);
    }
}

Measured memory_bytes: 73048
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));



int main(){
    int N;
    cin >> N;
    vector<pair<ll,ll>> BA(N);
    for(int i = 0; i < N; i++) cin >> BA[i].se >> BA[i].fi;
    ll time = 0;
    bool ok = true;
    sort(all(BA));
    for(int i = 0; i < N; i++){
        time+=BA[i].se;
        if(time > BA[i].fi){
            ok = false;
            break;
        }
    }
    if(ok) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 6424
n,m=map(int,input().split())
WAN=[0]*(n+1)
flags=[0]*(n+1)
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=='AC':
        flags[p]=1
    if s=='WA' and flags[p]==0:
        WAN[p]+=1
ans=0
for i in range(1, n+1):
    if flags[i]==1:
        ans+=WAN[i]
print(sum(flags),ans)

Measured memory_bytes: 4596
#include <stdio.h>
#include <math.h>


int main(int argc, char const *argv[])
{
    int n;
    scanf("%d", &n);

    int a, b, c, d;
    a = n / 1000;
    n -= a*1000;
    b = n / 100;
    n -= b*100;
    c = n / 10;
    n -= c*10;
    d = n;

    if(a==b || b==c || c==d){
        printf("Bad\n");
    }
    else{
        printf("Good\n");
    }

    return 0;
} 

Measured memory_bytes: 128
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


ll sumxor(ll x){
    ll ret = 0;
    vl t(50, 1); FOR(i, 1, 50) t[i] = 2*t[i-1];
    for(ll i = 49; i >= 0; i--){
        if(x < t[i]) continue;
        if(x==2){
            ret += 3; break;
        }
        if(x==3){
            ret += 0; break;
        }
        ret += ((x-t[i]+1)%2) * t[i];
        x -= t[i];
    }
    return ret;
}

int main(){
    ll A, B; cin >> A >> B;
    if(A == B){
        cout << A << endstr;
        return 0;
    }
    ll a_ret = A >= 1 ? sumxor(A-1) : 0;
    ll b_ret = sumxor(B);
    cout << (a_ret ^ b_ret) << endstr;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const ll mod =1000000007;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
vector<ll> maketable(int n){
  vector<ll> v(n+1);
  for(int i=1; i<n+1; i++){
    v.at(i)=modinv(i,mod);
  }
  return v;
}
ll modcombi(ll n, ll k){
  ll ans=1;
  if(k<n-k) k=n-k;
  vector<ll> inv= maketable(n);
  for(int i=n; i>k; i--){
    ans = ans*i%mod;
  }
  for(int i=n-k; i>1; i--){
    ans = ans *inv.at(i)%mod;
  }
  return ans;
}
int main(){
  int n,k;
  cin>>n>>k;
  for(ll i=1; i<=k; i++){
    if(n-k<i-1){
      cout<<0<<endl;
    }
    else{
      cout<<modcombi(k-1,i-1)*modcombi(n-k+1, i)%mod<<endl;;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll h, w;
    cin >> h >> w;
    ll ans = 0;
    if (h==1 || w==1) {
        ans = 1;
    }
    else if (h%2==0 || w%2==0) {
        ans = h*w/2;
    }
    else ans = h*w/2+1;
    
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
	long long int n;
	cin >> n;
	vector<long long int> a(n);
	vector<long long int> b(n);
	for (long long int i = 0; i < n; i++) {
		cin >> a[i];
	}
	b = a;
	for (long long int i = 1; i < n; i++) {
		b[i] += b[i - 1];
	}
	vector<long long int> c;
	c = b;
	long long int bb, cc;
	bb = cc = 0;
	
	long long int bbb, ccc;
	bbb = ccc = 0;
	for (long long int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			if (b[i] + bbb <= 0) {
				bb += 1 - (b[i] + bbb);
				bbb += 1 - (b[i] + bbb);
			}
			if (c[i] + ccc >= 0) {
				cc += 1 + (c[i] + ccc);
				ccc += -1 - (c[i] + ccc);
			}
		}
		else {
			if (b[i] + bbb >= 0) {
				bb += 1 + (b[i] + bbb);
				bbb += -1 - (b[i] + bbb);
			}
			if (c[i] + ccc <= 0) {
				cc += 1 - (c[i] + ccc);
				ccc += 1 - (c[i] + ccc);
			}
		}
	}
	cout << min(bb, cc) << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>

int main()
{
	int N;
	scanf("%d", &N);
	long long int A, B, max = 10000000000;
	while(N--)
	{
		scanf("%ld%ld", &A, &B);
		if(A + B < max)
			max = A + B;
	}
	printf("%ld", max);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void)
{
    int n;
    int a[10000];
    int input;
    int min =  10000000;
    int max = -10000000;
    long sum = 0;

    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> input; 
        sum += input;
        if (input > max)
            max = input;
        if (input < min)
            min = input;
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3104
n1 = int(input())

n2 = [int(i) for i in input().split()]
n3 = [int(i) for i in input().split()]
n4 = [int(i) for i in input().split()]

r1 = 0

for i1 in range(n1):
    r1 += n3[n2[i1] - 1]
    if i1 <= n1 - 2:
        if n2[i1] + 1 == n2[i1 + 1]:
            r1 += n4[n2[i1] - 1]

print(r1)

Measured memory_bytes: 3064
s = input()
K = int(input())
jisho = []
for i in range(1,min(len(s)+1,6)):
    for j in range(0,len(s)-i+1):
        jisho.append(s[j:j+i])
jisho = list(set(jisho))
jisho.sort()

print(jisho[K-1])

Measured memory_bytes: 5068
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////


int main(){
    ll n;cin>>n;
    ll qq[n];rep(i,0,n-1)cin>>qq[i];
    sort(qq,qq+n);
    vector<l_l>v;
    ll pos=0;

ll ans=0;
ll N=35;
    ll po[N];
    po[0]=1;
    rep(i,1,N-1)po[i]=po[i-1]*2;

    while(pos<=n-1){
        ll val=qq[pos];
        ll c=1;
        while(pos<=n-2&&qq[pos+1]==val){
            pos++;
            c++;
        }
        
       v.pb(l_l(val,c));

        pos++;
    }
    /*for(auto x:v){
        cout<<x.first<<" "<<x.second<<endl;
    }*/
    ll t=v.size();


    for(int i=t-1;i>=0;i--){
        l_l qqq=v[i];
        ll val=v[i].first;
        ll c=v[i].second;

        ll q=*lower_bound(po,po+N,val);
        if(q==val){
            ll yes=c/2;
            ans+=yes;
            v[i].second-=yes*2;
        }else{
            ll res=q-val;
            ll posi=lower_bound(v.begin(),v.end(),l_l(res,0))-v.begin();
            if(v[posi].first!=res)continue;
            ll yes=min(v[posi].second,c);
            ans+=yes;
            v[i].second-=yes;
            v[posi].second-=yes;
        }

    }
    cout<<ans<<endl;
    /*for(auto x:v){
        cout<<x.first<<" "<<x.second<<endl;
    }*/
    
    return 0;
} 

Measured memory_bytes: 8048
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i,a,b) for(register int i=a,bbb=b;i<=bbb;++i)
#define repd(i,a,b) for(register int i=a,bbb=b;i>=bbb;--i)
#define reps(s) for(register int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define ce(i,r) i==r?'\n':' '
#define pb push_back 
#define all(x) x.begin(),x.end()
#define gmn(a,b) a=min(a,b)
#define gmx(a,b) a=max(a,b)
#define fi first
#define se second
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef long long ll;
typedef double db;
const ll inf=4e18;
const ll mod=1e9+7;
const int MAX_N=2e3+5;
inline int qi(){
    int f=0,fu=1; char c=getchar();
    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
    return f*fu;
}
inline ll ql(){
	ll f=0;int fu=1; char c=getchar();
    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
    return f*fu;
}
inline db qd(){
    char c=getchar();int flag=1;double ans=0;
    while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
    if(c=='-') flag=-1,c=getchar();
    while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
    if(c=='.'){c=getchar();for(register int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
    return ans*flag;
}
//start!
ll dp[MAX_N];
ll solve(int x)
{
	if(~dp[x]) return dp[x];
	ll res=0;
	repi(i,3,x) res=(res+solve(x-i))%mod;
	return dp[x]=res;
}
int main()
{
	memset(dp,-1,sizeof(dp));
	dp[0]=1,dp[1]=dp[2]=0;
	dp[3]=dp[4]=dp[5]=1;
	printf("%lld\n",(solve(qi())%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int k;
    cin>>k;
    vector<vector<string>> lis(10);
    rep(i,1,10){
        lis[0].push_back(to_string(i));
    }
    int sum=9;
    rep(i,1,10){
        for(string s:lis[i-1]){
            int a=s[s.size()-1]-'0';
            if(sum>114514)
                goto ioi;
            if(a!=0){
                lis[i].push_back(s+char(a-1+'0'));
                sum++;
            }
            lis[i].push_back(s+char(a+'0'));
            sum++;
            if(a!=9){
                lis[i].push_back(s+char(a+1+'0'));
                sum++;
            }
        }
    }
    ioi:
    sort(lis[9].begin(),lis[9].end());
    vector<long long> lunlun_number;
    rep(i,9){
        for(string s:lis[i]){
            lunlun_number.push_back(stoll(s));
        }
    }
    rep(i,40000){
        lunlun_number.push_back(stoll(lis[9][i]));
        sum++;
    }
    sort(lunlun_number.begin(),lunlun_number.end());
    cout<<lunlun_number[k-1]<<endl;
}


Measured memory_bytes: 9080