akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
s = input()
#開業されたN個要素を受け付ける
#list = [input() for i in range(N)]


if s=="ABC":
    print("ARC")
else:
    print("ABC")


Measured memory_bytes: 9084
#include<iostream>
using namespace std;
#include<stdio.h>

void max_heapify(int* A, int i, int H)
{
    int l = 2 * i, r = 2 * i + 1;
    if(l > H && r > H) return;
    int maxid = i, x;
    if(l <= H) maxid = (A[l] > A[maxid] ? l : maxid);
    if(r <= H) maxid = (A[r] > A[maxid] ? r : maxid);
    if(maxid == i) return;
    x = A[maxid]; A[maxid] = A[i]; A[i] = x;
    max_heapify(A, maxid, H);
}

void BuildMaxHeap(int* A, int H)
{
    for(int i = H / 2; i > 0; i--) max_heapify(A, i, H);
    return;
}

int main()
{
    int *A;
    int i, H;
    scanf("%d", &H);
    A = new int[H + 1];
    for(i = 1; i <= H; i++) scanf("%d", &A[i]);
    BuildMaxHeap(A, H);
    for(i = 1; i <= H; i++) printf(" %d", A[i]);
    printf("\n");
    delete [] A;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;


int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int n,k;
    cin>>n>>k;
    vector<int> p(n),c(n);
    for(auto & a : p) cin>>a,a--;
    for(auto & a : c) cin>>a;
    ll ans = -inf;
    for(int i=0;i<n;++i){
           int cur = i;
    ll sum = 0;
     int count = 0;
    while(1){
        cur = p[cur];
        sum += c[cur];
        count++;
        if(cur == i)break;
    }
        ll csum = 0;
        int cnt = 0;
        cur = i;
        while(1){
            cnt++;
            cur = p[cur];
            csum += c[cur];
            if(cnt > k) break;
            ll num = (k - cnt)/count;
            ll score = csum + max(0ll,sum)*num;
            ans = max(ans,score);
            if(cur == i) break;
        }
    }
    cout << ans << endl;
    return 0;
    
}

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


int main(){
	int N,K;
	cin >> N >> K;
	int answer = 1;
	for(int i=0;i<N;i++){
		if(answer*2 > answer + K){
			answer += K;
		}else{
			answer *= 2;
		}
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 256
import re


def update(d, k, v):
    if k in d:
        d[k] = max(d[k], v)
    else:
        d[k] = v


rep_zeros = re.compile('0{2,}')

n = input()
s = input().strip('0')
ans = 0

for ps in re.split(rep_zeros, s):
    fs = ps.split('0')
    lfs = len(fs)
    if lfs == 1:
        continue
    ls = list(map(len, fs))
    pl = {ls[0]: 0}
    for cc in ls[1:]:
        nl = {}
        for pc, a in pl.items():
            update(nl, cc, a)
            if pc == 0:
                continue
            if cc == 1:
                update(nl, 0, a + pc)
            else:
                update(nl, 0, a + cc)
                update(nl, 1, a + cc - 1)
                if cc > 1:
                    update(nl, cc - 1, a + pc)
        pl = nl
    ans += max(pl.values())

print(ans)


Measured memory_bytes: 6952
#include <iostream>
using namespace std;
int main(){
    int N,dig,sum=0,a;
    cin >> N;
    a = N;
    while(N){
        dig = N%10;
        sum = sum+dig;
        N = N/10;
    }
    if(a%sum==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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


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

int main() {
  int N;
  cin >> N;
  
  vector<int> div_num(N + 1);
  for (int i = 1; i < N + 1; i++) {
    div_num.at(i) = 1;
  }

  long long sum = 1;
  long long prod;
  for (long long k = 2; k < N + 1; k++) {
    prod = k;
    while (prod < N + 1) {
      div_num.at(prod)++;
      prod += k;
    }
    sum += k * div_num.at(k);
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 42332
n = int(input())
lst = list(map(int,input().split()))
x = sum(lst)%((10**9 + 7)*2)
y = x**2%((10**9 + 7)*2)
z = 0
for i in range(n):
    z = (z + (lst[i]%((10**9 + 7)*2))**2)%((10**9 + 7)*2)
ans = int((y - z)%((10**9 + 7)*2)/2)
print(ans)


Measured memory_bytes: 31604
#include <stdio.h>

int main(void)
{
	int x1,y1,x2,y2;
	scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
	printf("%d %d %d %d\n",x2-y2+y1,y2+x2-x1,x1+y1-y2,y1+x2-x1);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;

ll powmod(ll x,ll n,ll mod){
    if(n == 0)return 1;
    if(n%2)return x*powmod(x*x%mod,n/2,mod)%mod;
    return powmod(x*x%mod,n/2,mod)%mod;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll k; cin >> k;
    if(k%2 == 0 || k%5 == 0){
        cout << -1 << endl;
        return 0;
    }
    ll res = 1;
    ll a = 7;
    while(a % k != 0){
        a += 7 * powmod(10,res,k) % k;
        a %= k;
        res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main(){
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	int n, count = 0;
	cin >> n;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			for (int k = 1; k <= n; k++){
				count++;
			}
		}
	}
	cout << count;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    int cnt[100];
    for(int i=0;i<=100;i++){
        cnt[i]=0;
    }
    int K,A;
    for(int i=0;i<N;i++){
        cin >> K;
        for(int j=0;j<K;j++){
            cin >> A;
            cnt[A]++;
        }
    }
    int ans=0;
    for(int i=0;i<100;i++){
        if(cnt[i]==N){
            ans++;
        }
    }
    cout << ans << endl;
}

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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string S; cin >> S;

  vector<bool> appear(26);
  if (S.size() < 26) {
    cout << S;
    for (char c : S) appear.at(c - 'a') = true;
    for (int i = 0; i < 26; i++) {
      if (appear.at(i)) continue;
      cout << (char)('a' + i) << endl;
      return 0;
    }
    assert(false);
  }else {
    for (int i = 24; i >= 0; i--) {
      if (S.at(i+1) < S.at(i)) continue;
      cout << S.substr(0, i);
      for (int j = 25; j > i; j--) {
	if (S.at(j) < S.at(i)) continue;
	cout << S.at(j) << endl;
	return 0;
      }
      assert(false);
    }
    cout << "-1\n";
    return 0;
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int cnt = 0;

    for(int i = 0; i < S.length(); i++) {
        if(S[i] == 'x') {
            cnt++;
        }
    }

    if(cnt > 7) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

int main(){
  unsigned long X;
  std::cin >> X;
  unsigned long fifhund = X/500ul;
  unsigned long remainder = X%500ul;
  unsigned long fif = remainder/5ul;
  std::cout << fifhund * 1000ul + fif * 5ul << std::endl;
  return 0;
}

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

#define int long long
#define pb push_back
#define F first
#define S second

typedef pair<int, int> PII;

signed main(){
    int N;
    cin>>N;
    int dp[N];
    int h[N];
    for(int i=0; i<N; i++){
        cin>>h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i=2; i<N; i++){
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout<<dp[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int n = vs[0];
			int w = vs[1];

			long[] dp = new long[100009];
			dp[0] = 0;
			for (int i = 1; i < dp.Length; i++) {
				dp[i] = w + 1;
			}
			for (int i = 0; i < n; i++) {
				long[] obj = Console.ReadLine().Split().Select(long.Parse).ToArray();
				for (int j = dp.Length - 1; j >= 0; j--) {
					if (j - obj[1] >= 0) {
						dp[j] = Math.Min(dp[j], dp[j - obj[1]] + obj[0]);
					} else {
						dp[j] = Math.Min(dp[j], obj[0]);
					}
				}
			}
			for (int i = dp.Length - 1; i >= 0; i--) {
				if (dp[i] <= w) {
					Console.WriteLine(i);
					break;
				}
			}
		}
	}
}

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

int main(){
  ll q,h,s,d;
  ll n;
  cin>>q>>h>>s>>d;
  cin>>n;

  ll a=min(q*4,min(h*2,s));
  if(a*2<=d){
    cout<<a*n<<endl;
  }
  else{
    if(n%2==0){
      cout<<d*n/2<<endl;
    }
    else{
      cout<<d*(n/2)+a<<endl;
    }
  }
  return(0);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=200000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

class Point{
public:
	long long x;
	long long y;
	long long dis;
	Point(long long _x,long long _y,long long _dis){
		x=_x;
		y=_y;
		dis=_dis;
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long a,b;
	cin>>a>>b;
	if(a<=9&&b<=9){
		cout<<a*b<<endl;
	}else cout<<-1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int H, W, A[2000][2000], l, r, MAX, MIN;

int main(){
	cin >> H >> W;
	MIN = intmax;
	for (int i = 0; i != H; ++i)
		for (int j = 0; j != W; ++j) {
			cin >> A[i][j];
			MAX = max(MAX, A[i][j]);
			MIN = min(MIN, A[i][j]);
		}
	l = -1;
	r = MAX;
	while (l + 1 != r) {
		int k = (l + r) / 2, R;
		bool b;
	/*	cout << k << endl;
		for (int i = 0; i != H; ++i) {
			for (int j = 0; j != W; ++j) {
				if (MIN + k < A[i][j] && A[i][j] < MAX - k)
					cout << 'E' << sp;
				else if (A[i][j] < MAX - k)
					cout << 0 << sp;
				else if (MIN + k < A[i][j])
					cout << 2 << sp;
				else
					cout << 1 << sp;
			}
			cout << endl;
		}*/
		b = true;
		R = intmax;
		for (int i = 0; i != H; ++i) {
			bool B = false;
			int RR, LL;
			RR = W;
			LL = -1;
			for (int j = 0; j != W; ++j) {
				if (MIN + k < A[i][j]) {
					B = true;
					RR = min(RR, j - 1);
				}
				if (A[i][j] < MAX - k) {
					LL = j;
					if (B) {
						b = false;
						break;
					}
				}
			}
			if (R < LL)
				b = false;
			if (!b)
				break;
			R = min(R, RR);
		}
		if (!b) {
			b = true;
			R = -1;
			for (int i = 0; i != H; ++i) {
				bool B = false;
				int RR, LL;
				RR = -1;
				LL = W;
				for (int j = W - 1; j != -1; --j) {
					if (MIN + k < A[i][j]) {
						B = true;
						RR = max(RR, j + 1);
					}
					if (A[i][j] < MAX - k) {
						LL = j;
						if (B) {
							b = false;
							break;
						}
					}
				}
				if (R > LL)
					b = false;
				if (!b)
					break;
				R = max(R, RR);
			}
			if (!b) {
				b = true;
				R = intmax;
				for (int i = H - 1; i != -1; --i) {
					bool B = false;
					int RR, LL;
					RR = W;
					LL = -1;
					for (int j = 0; j != W; ++j) {
						if (MIN + k < A[i][j]) {
							B = true;
							RR = min(RR, j - 1);
						}
						if (A[i][j] < MAX - k) {
							LL = j;
							if (B) {
								b = false;
								break;
							}
						}
					}
					if (R < LL)
						b = false;
					if (!b)
						break;
					R = min(R, RR);
				}
				if (!b) {
					b = true;
					R = -1;
					for (int i = H - 1; i != -1; --i) {
						bool B = false;
						int RR, LL;
						RR = -1;
						LL = W;
						for (int j = W - 1; j != -1; --j) {
							if (MIN + k < A[i][j]) {
								B = true;
								RR = max(RR, j + 1);
							}
							if (A[i][j] < MAX - k) {
								LL = j;
								if (B) {
									b = false;
									break;
								}
							}
						}
						if (R > LL)
							b = false;
						if (!b)
							break;
						R = max(R, RR);
					}
				}
			}
		}
		if (b)
			r = k;
		else
			l = k;
	}
	cout << r << endl;
}


Measured memory_bytes: 18704
n,q = map(int,input().split())
str = input()
q = int(q)
dic = {}

for j in range(len(str)):
  if (j > 0):
    if (str[j-1] == 'A' and str[j] == 'C'):
      dic[j] = dic[j-1] + 1
    else:
      dic[j] = dic[j-1]
  else:
    dic[j] = 0

for i in range(q):
  s,e = map(int,input().split())
  ans = dic[e-1] - dic[s-1]
  print(ans)

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<int> A;
    cin >> n;
    A.assign(n, 0);
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        A[p-1]++;
    }
    for (auto a: A)
        cout << a << '\n';
    return 0;
}


Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
#define N 1000003
#define LL long long
#define mod 998244353

int n;
char s[10];

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for (int i=1;i<=n;i++){
		if (i%2==1 && s[i]=='L'){
			puts("No");
			return 0;
		}
		if (i%2==0 && s[i]=='R'){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;



int main() {
    

    ll n,m;
    cin >> n >> m;
    if(n==m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define ll long long
#define fm_t  ll t;cin>>t;while(t--)
#define fr(i,a,b) for( ll i=a;i<b;i++)
#define fr1(i,n,a) for( ll i=n-1;i>=a;i--)
#define sz(x) (ll)(x).size()
#define all(v)  (v).begin(), (v).end()
#define Sort(x) sort(x.begin(),x.end())
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
const ll mod = 998244353;
#define Mod 1000000007

#define inf 1e18
#define ld long double
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll >
#define pi pair<ll, ll>
#define ppi pair<pair<ll, ll>, ll>
#define ump unordered_map<ll,ll>
#define pri priority_queue< pair<ll,ll> , vector< pair<ll,ll> >, greater< pair<ll,ll> > >
void ingraph(vl graph[], ll m){ll x, y;fr(i,0,m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)

//setprecision(10)
//greater<int>()
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}


ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll modinv(ll a){
    return modpower(a,mod-2);
}   
 


int main()
{
      
  fast;
  ll n,d;
  cin>>n>>d;
  ll ans=0;
  fr(i,0,n)
  {
    ll x,y;
    cin>>x>>y;
    if(x*x+y*y<=d*d)
      ans++;
  }

  cout<<ans<<endl;
    
//cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<char> F, G;
  bool rev = false;
  rep(_, q) {
    int t;
    cin >> t;
    if(t==1) {
      rev = !rev;
      continue;
    }
    int f;
    char c;
    cin >> f >> c;
    if (f==1) {
      if (!rev) {
        F.push_back(c);
      } else {
        G.push_back(c);
      }
    } else {
      if (rev) {
        F.push_back(c);
      } else {
        G.push_back(c);
      }
    }
  }
  if (rev) {
    reverse(s.begin(), s.end());
    swap(F, G);
  }
  reverse(F.begin(), F.end());
  for (auto c : F) cout << c;
  cout << s;
  for (auto c : G) cout << c;
  cout << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    bool a = 0;
    rep(i, 25) {
        rep(j, 15) {
            if(4 * i + 7 * j == n) {
                a = 1;
                break;
            }
        }
        if(a) break;
    }
    if(a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main{

	public static void main(String args[]) throws IOException {
		Scanner scan = new Scanner(System.in);
		int ans = 0;

		int a = scan.nextInt();
		int n = scan.nextInt();
		int m = scan.nextInt();

		
		for(long i = a + a == 0? 1 : 0; Math.pow(i, n) <= m && Math.pow(i, n) >= 0;i++) {

			long num2 = (long)Math.pow(i, n);
			
			
			long y = Dudeney(num2);
			long x = (int) Math.pow(y + a,n);
			
			if(num2 == x) {
				ans++;
			}
		}
		System.out.println(ans);

		scan.close();
	}

	public static long Dudeney(long num) {
		int Ans = 0;

		while(num != 0) {
			Ans += num%10;
			num /= 10;
		}

		return Ans;
	}
}



Measured memory_bytes: 26352
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int res = 0;
    for(int i=0; i<s.length();){
        int j = i;
        while(j<s.length() && s[j]==s[i])
            j++;
        res++;
        i = j;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include <math.h>   
int main(){
 
while(1){
  int n,i,cnt=0,sw=1,sosuu[1000000],t;
  if(scanf("%d\n", &n) == EOF)break;
  if(n<=1){
      cnt=0;
    }else{
    sosuu[cnt]=2;
    cnt=cnt+1;  
    for(i=3;i<=n;i+=2){
      sw=1;
      for(t=0;t<cnt&&sosuu[t]*sosuu[t]<=i;t++){
        if(i%sosuu[t] == 0){
          sw=0;
          break;
        }

      }
      if(sw==1){
         sosuu[cnt]=i;
         cnt=cnt+1;
      }
   }
   }  
printf("%d\n", cnt);
}   
    return 0;
}

Measured memory_bytes: 912
#include<stdio.h>
#include<stdlib.h>

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


struct Node *root, *NIL;

void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z= (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
  }

  z->parent = y;
  if(y == NIL)root = z;
  else{
    if(z->key < y->key){
      y->left = z;
    }
    else y->right = z;
  }
}

void inorder(struct Node *u){
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if (u == NIL)return;
  printf(" %d" ,u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n ,i ,x;
  char com[10];

  scanf("%d",&n);
  
  for (i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }else if (com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}




















Measured memory_bytes: 25144
#include <bits/stdc++.h>
using namespace std;
map<int,int> cnt;

int main(){
    int N;
    int ans = 0;
    cin >> N;
    for(int i = 1; i <= N; i++)
    {
        int A;
        cin >> A;
        cnt[A]=1-cnt[A];
        if(cnt[A]==0) ans--;
        else ans++;
    }
    cout << ans << endl;
}


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

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

	sort(d.begin(), d.end(), greater<int>());

	int cnt = 1;
	int bottom = d.at(0);
	for(int i=1; i<N; i++){
		if(bottom > d.at(i)){
			cnt++;
			bottom = d.at(i);
		}
		else{
			continue;
		}
	}

	cout << cnt << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long

signed main(){
    int N;
    cin >> N;
    vector<int> diviser;

    for(int i=1;i*i<=N;i++){
        if(N % i == 0){
            diviser.emplace_back(i);
            if(i*i != N) diviser.emplace_back(N/i);
        }
    }

    sort(diviser.begin(),diviser.end());

    if(diviser.size() == 2) cout << 1 << " " << 1 << endl;
    else {
        vector<bool> possible(diviser.size()-1,true);
        for(int i=possible.size()-1;i>=0;i--){
            if(!possible[i]) continue;
            for(int j=0;j<i;j++) {
                if(diviser[i] % diviser[j] == 0) possible[j] = false;
            }
        }

        int MIN = 0;
        for(int i=0;i<possible.size();i++) MIN += possible[i];

        cout << MIN << " " << diviser.size() - 1 << endl;
    }
}




Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int N, K;
char s[MAXN];
int main() {
	cin >> N >> K;
	cin >> (s + 1);
	int M = 0, ANS = 0;
	for (int i = 1; i <= N; ++ i)
		if (s[i] != s[i - 1])
			++ M;
		else
			++ ANS;
	if (M == 1) {
		cout << ANS << endl;
		return 0;
	}
	int n1 = min(M / 2, K);
	cout << min(ANS + n1 * 2, N - 1) << endl;
	return 0;
}

Measured memory_bytes: 3740
N = int(input())
Xs = [list(map(int, input().split(" "))) for _ in range(N)]
"""
input = ["2 3 5","2 1 5","1 2 5","3 2 5"]
input = ["0 0 100", "1 1 98"]
input = ["99 1 191", "100 1 192", "99 0 192"]
Xs = [list(map(int, x.split(" "))) for x in input]
"""

Xs.sort(key=lambda x:x[2], reverse=True)


def solv(Xs):
    for x in range(101):
        for y in range(101):
            Cx, Cy, h = tuple(Xs[0])
            H = h + abs(x - Cx) + abs(y - Cy)
            for Cx, Cy, h in Xs:
                if max(H - abs(x - Cx) - abs(y - Cy), 0) != h:
                    break
            else:
                return (x, y, H)


print("%d %d %d" % solv(Xs))


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  string s1, s2;
  cin >> s1 >> s2;

  int len1 = s1.length();

  string s_odd = "", s_even = "";
  REP(i,len1){
    if(i % 2 == 0){
      s_odd = s_odd + s1[i];
    }else{
      s_even = s_even + s1[i];
    }
  }

  int pos1=0, pos2=0;
  bool f = true;
  REP(i, len1){
    if(i % 2 == 0){
      if(s1.substr(pos1, len1-pos1).find(s1[i]) != string::npos){
        pos1 = s1.substr(pos1, len1-pos1).find(s1[i])+1+pos1;
      }else{
        f = false;
        break;
      }
    }else{
       if(s2.substr(pos2, len1-pos2).find(s1[i]) != string::npos){
        pos2 = s2.substr(pos2, len1-pos2).find(s1[i])+1+pos2;
      }else{
        f = false;
        break;
      }   
    }
  }
  if(f){
    cout << "Yes\n";
    return 0;
  }

  pos1=0; pos2=0;
  f = true;
  REP(i, len1){
    if(i % 2 != 0){
      if(s1.substr(pos1, len1-pos1).find(s1[i]) != string::npos){
        pos1 = s1.substr(pos1, len1-pos1).find(s1[i])+1+pos1;
      }else{
        f = false;
        break;
      }
    }else{
       if(s2.substr(pos2, len1-pos2).find(s1[i]) != string::npos){
        pos2 = s2.substr(pos2, len1-pos2).find(s1[i])+1+pos2;
      }else{
        f = false;
        break;
      }   
    }
  }

  if(f){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }
  return 0;
}




Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

struct UnionFind {
  vector<int> data;
  int sz;
  UnionFind(int _sz) : data(_sz, -1) { sz = _sz; }
  bool connect(int x, int y) {
      if ((x = root(x)) == (y = root(y))) return false;
      if (data[x] > data[y]) swap(x, y);
      data[x] += data[y]; data[y] = x; sz--;
      return true;
  }
  bool issame(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
  int size() { return sz; }
};

// youtube editorial
void solve() {
  int N = 100005;
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];

  UnionFind uni(2 * N);
  rep(i, n) uni.connect(x[i], y[i] + N);

  vector<pii> v(2 * N);
  rep(i, N) { v[uni.root(i)].F++; v[uni.root(i + N)].S++; }
  /*
  rep(i, 2 * N) if (uni.root(i) == i && (v[uni.root(i)].F > 1 || v[uni.root(i)].S > 1)) {
    cout << i << " " << v[uni.root(i)] << endl;
  }
  */

  vector<int> table(2 * N);
  rep(i, n) table[uni.root(x[i])]++;

  ll ans = 0;
  rep(i, 2 * N) if (uni.root(i) == i && (v[uni.root(i)].F > 1 || v[uni.root(i)].S > 1)) {
    ans += v[i].F * 1LL * v[i].S - table[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		System.out.println(a/b + " " + a%b + " " + String.format("%.5f",(double)a / b));
	}
}


Measured memory_bytes: 26452
using System;
class takoyaki{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    String[] str = Console.ReadLine().Split(' ');
    int ret = 0;
    for(int i=0; i<n-1; i++){
      for(int j=i+1; j<n; j++){
        ret += int.Parse(str[i])*int.Parse(str[j]);
      }
    }
    Console.WriteLine(ret);
  }
}


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

const int N = 1e5 + 5;
int n, m, p[N], fa[N], ans;

int getfa(int x) {return fa[x] == x ? x : fa[x] = getfa(fa[x]);}

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        int fx = getfa(x), fy = getfa(y);
        if (fx != fy) fa[fx] = fy;
    }
    for (int i = 1; i <= n; i++)
        if (getfa(i) == getfa(p[i])) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
int a[2][100];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<2;i++) {
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        int sum=0;
        for(int j=0;j<=i;j++){
            sum+=a[0][j];
        }
        for(int k=i;k<n;k++){
            sum+=a[1][k];
        }
        ans=max(ans,sum);
    }
    cout << ans<< "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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 gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int x, y;
	cin >> x >> y;
	rep(i, x + 1) {
		int j = x - i;
		int tmp = i * 2 + j * 4;
		if (tmp == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, H, W;
  cin >> N >> H >> W;
  int a, b;
  int ans = 0;
  for(int i = 0; i < N; i++){
    cin >> a >> b;
    if(a >= H && b >= W)ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
x = [None] * N
y = [None] * N
z = [None] * N
r = [None] * N
l = [None] * N
for i in range(N):
    x[i], y[i], z[i], r[i], l[i] = map(int, input().split())

for _ in range(Q):
    ans = 0
    sx, sy, sz, dx, dy, dz = map(int, input().split())
    vx = dx - sx
    vy = dy - sy
    vz = dz - sz
    for i in range(N):
        t = 0
        t += vx * (x[i] - sx)
        t += vy * (y[i] - sy)
        t += vz * (z[i] - sz)
        t /= vx**2 + vy**2 + vz**2
        len2 = 0
        len2 += (sx + vx * t - x[i])**2
        len2 += (sy + vy * t - y[i])**2
        len2 += (sz + vz * t - z[i])**2
        if 0 < t < 1 and len2 <= r[i]**2 + 1e-9:
            ans += l[i]
    print(ans)



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

using namespace std;

int main (){
    string s;
    int n,k;

    cin>>n>>k>>s;

    if(s[k-1]=='A'){
        s[k-1]='a';
    }
    else if(s[k-1]=='B'){
        s[k-1]='b';
    }
    else {
        s[k-1]='c';
    }
    cout<<s;
}


Measured memory_bytes: 3632
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

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

   if((a>9)||(b>9)) cout << -1 << endl;
   else cout << a*b << endl;




   return 0;
}

Measured memory_bytes: 256
H = int(input())
W = int(input())
N = int(input())
if H <= W:
    if N % W == 0:
        print(N // W)
    else:
        print(N // W + 1)
else:
    if N % H == 0:
        print(N //H)
    else:
        print(N //H + 1)





Measured memory_bytes: 38384
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
    using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

int n, w;
int weight[105] = {}, value[105] = {};

int dp[105][10005] = {};

int main()
{
    int a, b, x;
    cin >> a >> b >> x;
    if(a>x || a+b<x){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*; 
public class Main
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int k;
        k=in.nextInt();
        int a,b,i,num;
        a=in.nextInt();
        b=in.nextInt();
        num=a;
        for(i=num;i<=b;i++,num++)
        {
            if(i%k==0)
            {
                System.out.println("OK");
                System.exit(0);
            }
        }
        System.out.println("NG");
    }
}

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

using namespace std;
int n, a[212345];
vector<int> b;
int main()
{
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    cin >> n;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

    for (int i = n - (n%2); i >= 2; i -= 2) b.push_back(a[i]);
    for (int i = 1; i <= n; i += 2) b.push_back(a[i]);
    if (n%2 == 0)
        for (int i = 0; i < n; i++) cout << b[i] << " ";
    else for (int i = n-1; i >= 0; i--) cout << b[i] << " ";
    return 0;
}
/**/


Measured memory_bytes: 3828
#include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

const double PI = 3.14159265358979323846264338327950;
const LL MOD = 1000000007;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int main(void)
{
	int N, L;
	cin >> N >> L;
	string S[100];
	Rep(i, N){
		cin >> S[i];
	}
	sort(S, S+N);
	Rep(i, N){
		cout << S[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long a[1000010];
long long c[1000010];
long long n,K;
bool cmp(long long x,long long y){return x>y;}
bool check(long long lim)
{
	long long i,j,k;
	j=1;
	k=K;
	for(i=1;i<=n;i++)
	{
		k=k-(a[j]>=lim/c[i]?a[j]-lim/c[i]:0);
		if(k<0)return false;
		j++;
	}
	if(k<0)return false;
	else return true;
}
int main()
{
	long long m,i,j,k,l,r,mid,ans;
	scanf("%lld%lld",&n,&K);
	for(i=1;i<=n;i++)
	scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	for(i=1;i<=n;i++)
	scanf("%lld",&c[i]);
	sort(c+1,c+1+n,cmp);
	l=0;r=1ll*a[n]*c[1];
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid))r=mid-1,ans=mid;
		else l=mid+1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5760
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%s", $t);
$e = strlen($s) - 1;
for ($i = 0; $i <= $e; $i++) {
	if ($s == $t) exit('Yes');
	$s = $s[$e] . substr($s, 0, $e);
}
echo 'No';

Measured memory_bytes: 4728
#include <iostream>
#include <vector>
#include <algorithm>
typedef std::pair<long, long> P;
bool pairCompare(const P& firstElof, const P& secondElof)
{
	return firstElof.first < secondElof.first;
}

int main()
{
	long N, M;
	std::cin >> N >> M;
	std::vector<P> v;

	long l1, l2;
	for (long i = 0; i < N; i++)
	{
		std::cin >> l1 >> l2;
		v.push_back(P(l1, l2));
	}
	std::sort(v.begin(), v.end(), pairCompare);
	long result, buf;
	buf = M;
	result = 0;
	for (long i = 0; i < N; i++)
	{
		if (v[i].second < buf)
		{
			result += v[i].first * v[i].second;
		}
		else
		{
			result += v[i].first * buf;
			break;
		}
		buf = buf - v[i].second;
	}

	std::cout << result << "\n";
    return 0;
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

// 約数列挙：nの約数を昇順に返す。
vector<long long> enumDivisors(long long n){
    vector<long long> ret;
    for(long long i=1; i*i<=n; i++){
        if(n%i == 0){
            ret.push_back(i);
            if(n/i != i) ret.push_back(n/i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    Init();
    ll n; cin >> n;
    ll ans = 0;

    {
        // kで割れない場合
        auto eDiv = enumDivisors(n-1);
        ans += (eDiv.size()-1);
    }
    {
        // kで割れる場合
        auto eDiv = enumDivisors(n);
        for(ll i=1; i<eDiv.size(); i++){
            ll tmp = n/eDiv[i];
            while(tmp%eDiv[i] == 0) tmp = tmp/eDiv[i];
            if(tmp%eDiv[i] == 1) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3668
#include "stdio.h"

int main(void){
  int x,y,z,i,j,a;

  scanf("%d", &x);
  for(i = 1; i <= x;i++){
    z = 0;
    a = 0;
    if(i % 3 == 0){
      printf(" %d",i);
      a = 1;
    }
    if(a == 0){
      y = i;
      for(j = i; j <= x; j++){
        if((y == 0) || (z == 1))break;
        if(y % 10 == 3){
          printf(" %d", i);
          z = 1;
        }
        y = y / 10;
      }
    }
  }
  printf("\n");
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(ll i=0;i<n;i++)
#define revf(i,n) for(ll i=n-1;i>=0;i-=2)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define inp(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define outp(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" "
#define outp1(a,n) for(ll i=1;i<n;i++)cout<<a[i]<<" "
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (((a)*(b))/gcd((a),(b)))
#define pb push_back
#define mp make_pair
#define mem(x,n) memset(x,n,sizeof(x))
#define BINSC binary_search
#define BITOUT __builtin_popcount
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define cn cout<<"\n";
int main()
{
     fast;
     ll n,s=0;
     cin>>n;
     ll ar[n];
     inp(ar,n);
     REP(i,1,n)
     {
          if(ar[i-1]>ar[i]){
          s+=ar[i-1]-ar[i];ar[i]=ar[i-1];}
     }
     cout<<s;
}

Measured memory_bytes: 5200
#include<iostream>
#include<algorithm> 
#include<vector>

using namespace std;

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

long int const INF = 100000000000000001;
int const MAX_V = 500;
// (i, j)に辺が存在しないときはINF
long int dp[MAX_V][MAX_V];
int v;

void warshall_floyd(){
    rep(k, v)rep(i, v)rep(j, v){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
    }
}


int main(){
    int m, l;
    cin >> v >> m >> l;
    int a, b;
    long int c;
    rep(i, v)rep(j, v) dp[i][j] = INF;
    rep(i, v) dp[i][i] = 0; 
    rep(i, m) {
        cin >> a >> b >> c;
        a--;
        b--;
        dp[a][b] = c;
        dp[b][a] = c;
    }
    int q;
    cin >> q;
    int s[q], t[q];
    rep(i, q) {
        cin >> s[i] >> t[i];
        s[i]--;
        t[i]--;
    }
    warshall_floyd();
    rep(i, v)rep(j, v) {
        if (i == j) {
            dp[i][j] = 0;
        }else if(dp[i][j] <= l){
            dp[i][j] = 1;
        }else{
            dp[i][j] = INF;
        }
    }
    warshall_floyd();
    // rep(i, v){
    //     rep(j, v) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    rep(i, q) {
        if (dp[s[i]][t[i]] != INF) {
            cout << dp[s[i]][t[i]] - 1 << endl;
        }else{
            cout << -1 << endl;
        }
        
        
    }
    
}

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

namespace AtTest.ABC_138
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int a = ReadInt();
            string s = Read();
            if (a < 3200)
            {
                WriteLine("red");
            }
            else
            {
                WriteLine(s);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
// AOJ 2275: Fox Number
// 2017.12.11 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

#define MAX  707106			// sqrt(10^12/2)
char tbl[MAX+1];

int sz;						// max sz = 57084, prime[0] = 2, prime[57083] = 707099
int prime[57100] = {  		// prime[146] = 853, prime[147] = 857
  2, 3,  5,  7, 11, 13, 17, 19, 23, 29, 
 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 
 73, 79, 83, 89, 97,101,103,107,109,113, 
127,131,137,139,149,151,157,163,167,173,
179,181,191,193,197,199,211,223,227,229, 
233,239,241,251,257,263,269,271,277,281, 
283,293,307,311,313,317,331,337,347,349, 
353,359,367,373,379,383,389,397,401,409, 
419,421,431,433,439,443,449,457,461,463, 
467,479,487,491,499,503,509,521,523,541, 
547,557,563,569,571,577,587,593,599,601, 
607,613,617,619,631,641,643,647,653,659, 
661,673,677,683,691,701,709,719,727,733, 
739,743,751,757,761,769,773,787,797,809, 
811,821,823,827,829,839,853 };

void sieve()
{
	int i, j, k;

	for (i = 1; i < 147; i++) {
		k = prime[i];
		for (j = k*k; j < MAX; j += k) tbl[j] = 1;
	}
	for (sz = 146, i = 853; i <= MAX; i += 2) if (!tbl[i]) prime[sz++] = i;
//	printf("sz %d, prime[%d]=%d\n", sz, sz-1, prime[sz-1]);
//	        sz 57084, prime[57083]=707099
}

int base[1000002];
int idx [1000002];
long long pp[41];		// 2^40 = 1099511627776 >= 10^12

int bsch(int x)
{
	int m, l = 0, r = sz;

    while (l < r) {
        m = (l + r) >> 1;
		if (prime[m] == x) return m;
        if (prime[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()
{
	int i, k, p, ans;
	long long A, B, a, b, j, n;

	sieve();

	scanf("%lld%lld", &A, &B);
	a = A-B, b = A+B;
	if (b <= 1) { puts("0"); return 0; }
	if (a <= 1) a = 2;

	ans = (int)(b-a+1);

	sz = bsch((int)sqrt((double)(b >> 1)));
	memset(idx, 1, sizeof(idx));
	for (i = 0; i <= sz; i++) {
		p = prime[i];
		k = 1; for (j = p; j <= b; j *= p) pp[k++] = j;
		while (--k) {
			j = pp[k], n = j*(1+(a-1)/j);
			for (; n <= b; n += j) {
				int x = (int)(n-a);
				if (!idx[x] || base[x] == p) continue;
				if (idx[x] < k) idx[x] = 0, ans--;
				else base[x] = p, idx[x] = k;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10508