akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<ll> vll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i, a, b) for(int i = a; i<b; ++i)
#define pb push_back
#define INF 1000000000


int main(){
	IO
	set<string> items;
	int n;
	cin >> n;
	string tmp;
	rep(i, 0, n){
		cin >> tmp;
		items.insert(tmp);
	}

	cout << (int)items.size() << endl;
	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int WWW = 0;WWW < (n);WWW++)cerr << v[WWW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

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

int main(){
	
	int n;cin >> n;
	vector<ll> v(n);
	REP(i,n)cin >> v[i];
	
	ll ans = 0;
	
	int r = 0,l = 0;
	ll now_xor = v[0];
	ll now_sum = v[0];
	
	while(r < n-1){
		while(now_sum == now_xor && r < n-1){
			r++;
			now_sum += v[r];
			now_xor ^= v[r];
		}
		while(now_sum != now_xor && l <= r){
			ans += r - l;
			now_sum -= v[l];
			now_xor ^= v[l];
			l++;
		}
	}
	
	while(l <= r){
		ans += r - l + 1;
		l++;
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
  string a, b;
  cin >> a >> b;
  if(a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

char fi[110][110];
bool ng[110][110];

int main(){
    int h,w;
    cin>>h>>w;
    
    rep(i,h) rep(j,w) cin>>fi[i][j];
    map<int,int> mh,mw;
    rep(i,h){
        bool ok=true;
        rep(j,w){
            if(fi[i][j]=='#') ok=false;
        }
        if(ok){
            rep(j,w) ng[i][j]=true;
        }
    }

    rep(j,w){
        bool ok=true;
        rep(i,h){
            if(fi[i][j]=='#') ok=false;
        }
        if(ok){
            rep(i,h) ng[i][j]=true;
        }
    }

    rep(i,h){
        bool ok1=false;
        rep(j,w){
            if(!ng[i][j]){
                cout<<fi[i][j];
                ok1=true;
            }
        }
        if(ok1) cout<<endl;
    }
}

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

int main(void){
    int n;
    cin >> n;
    vector<int> t(n+1, 0), x(n+1, 0), y(n+1, 0);
    string ans = "Yes";
    for(int i=1; i<=n; i++){
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }
    for(int i=1; i<=n; i++){
        int d = abs(x.at(i) - x.at(i-1)) + abs(y.at(i) - y.at(i-1));
        int dt = t.at(i) - t.at(i-1);
        if(dt < d || dt%2 != d%2){
            ans = "No";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String seisu = sc.next();
        String matubi = "0";
        List<String> list = Arrays.asList(seisu.split(""));
        int index = seisu.length();
        matubi = list.get(index - 1);
        if(matubi.equals("3")){
            System.out.println("bon");
        }else if((matubi.equals("0"))||(matubi.equals("1"))||(matubi.equals("6"))||(matubi.equals("8"))){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }
    }
}


Measured memory_bytes: 35536
#include <stdio.h>

int main(void){
    int k,s;
    int x,y,z;
    int sum = 0;
    int ans = 0;
    scanf("%d %d",&k,&s);
    for(x=0;x<=k;x++){
        for(y=0;y<=k;y++){
            z = s - x - y;
            if(z >= 0 && z <= k) ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        int N = int.Parse(s[0]);
        int M = int.Parse(s[1]);
        string[] A = new string[N];
        for (int i = 0; i < N; i++)
            A[i] = Console.ReadLine();
        string[] B = new string[M];
        for (int i = 0; i < M; i++)
            B[i] = Console.ReadLine();

        bool isOK = false;

        for (int y = 0; y <= N - M; y++)
        {
            for(int x = 0; x <= N - M; x++)
            {
                if (A[y][x] == B[0][0])
                {
                    isOK = true;
                    for(int i = 0; i < M; i++)
                    {
                        if(A[y + i].Substring(x, M) != B[i])
                        {
                            isOK = false;
                            break;
                        }
                    }
                }
                if (isOK) break;
            }
            if (isOK) break;
        }
        Console.WriteLine(isOK ? "Yes" : "No");
   }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k;
	cin >> n >> k;
	ll a = n / k;
	ll ans = pow(a, 3);
	if(k % 2 == 0)
	{
		ll b = (n + k / 2) / k;
		ans += pow(b, 3);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 640
N, K, S = map(int, input().split())
ans = []
n = N-K
for i in range(K):
  ans.append(S)
for i in range(n):
  if S == 10**9:
    ans.append(S-1)
  else:
    ans.append(S+1)
ans=[str(a) for a in ans]
ans=" ".join(ans)

print(ans)

Measured memory_bytes: 14232
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include <iomanip>
#include <bits/stdc++.h>
#include <fstream>
#include <map>
using namespace std;
typedef long long ll;
//#define INF 1000000000000 //10^12:極めて大きい値,∞
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int n,num;
    char mark;
    cin >> n;
    vector<vector<int> > card(4, vector<int> (13,0));
    REP(i,n){
        cin >> mark >> num; 
        if(mark == 'S') card[0][num-1] = 1;
        else if(mark == 'H') card[1][num-1] = 1;
        else if(mark == 'C') card[2][num-1] = 1;
        else card[3][num-1] = 1;
    }
    //cout << "------anser------" << endl;
    REP(i,4){
        REP(j,13){
            if(card[i][j]==0){
                if(i==0) cout << 'S' << ' ' << j+1 << endl;
                else if(i==1) cout << 'H' << ' ' << j+1 << endl;
                else if(i==2) cout << 'C' << ' ' << j+1 << endl;
                else cout << 'D' << ' ' << j+1 <<  endl;
            }
        }
    }

    return 0;
}


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

int main()
{
  string s;
  cin>>s;
  int n=s.length();
  for(int i=0;i<n-1;i++)
    if(s[i]==s[i+1]){cout<<i+1<<" "<<i+2<<endl;return 0;}
  
  for(int i=0;i<n-2;i++)
    if(s[i]==s[i+2]){cout<<i+1<<" "<<i+3<<endl;return 0;
                    }
  
  cout<<"-1 -1\n";
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

char str[201];

int main() {
    fgets(str, 200, stdin);
    
    int len = strlen(str);
    for(int i=0; i<len; ++i) {
        char c = str[i];
        if(c >= 'a' && c <= 'z') {
            char upper = (c - 'a') + 'A';
            printf("%c", upper);
        } else {
            printf("%c", c);
        }
    }
}


Measured memory_bytes: 2028
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector <ll> tree[200008];
ll arr[200009];
int ans[200009];
vector <ll> dp(200009,LLONG_MAX);
void dfs(int cur,int p)
{
    int pos=lower_bound(dp.begin(),dp.end(),arr[cur])-dp.begin();
    ll x=dp[pos];
    dp[pos]=arr[cur];

    for(ll i:tree[cur])
    {
        if(i!=p)
            dfs(i,cur);
    }
    ans[cur]=lower_bound(dp.begin(),dp.end(),LLONG_MAX)-dp.begin();
    dp[pos]=x;


}
int main()
{
    ll i,j,k,l,m,n;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>arr[i];
    for(i=0;i<n-1;i++)
    {
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    dfs(0,-1);
    for(i=0;i<n;i++)
        cout<<ans[i]<<endl;


}


Measured memory_bytes: 32460
n = gets.to_i
f = n.times.map{gets.split.map(&:to_i)}
p = n.times.map{gets.split.map(&:to_i)}
ans = -10**9
for i in 1..1023
  ret = 0
  n.times do |j|
    c = 0
    10.times do |k|
      c += 1 if (i >> k) & 1 == 1 && f[j][k] == 1
    end
    ret += p[j][c]
  end
  ans = ret if ans < ret
end
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
map<int, LL> dp[200002];
int a[200002];
int main(){
    int n;
    scanf("%d", &n);   
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    dp[0][0] = 0;
    for(int i=1;i<=n;i++){
        int mn = i/2, mx = (i+1)/2;
        for(int j=mn;j<=mx;j++){
            dp[i][j] = -1e18;
            for(int k=i-2;k>=max(0, i-5);k--){
                if(dp[k].find(j-1) != dp[k].end()){
                    dp[i][j] = max(dp[i][j], dp[k][j-1] + a[i]);
                }
            }
        }
        for(int j=mn;j<=mx;j++){
            if(dp[i-1].find(j) != dp[i-1].end()){
                dp[i][j] = max(dp[i][j], dp[i-1][j]);
            }
        }
        if(i == 1) dp[i][1] = a[i];
    }
    printf("%lld\n", dp[n][n/2]);
}

Measured memory_bytes: 32696
import java.util.*;
public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int t=a-b;
    if(c-t<=0){
      System.out.println("0");
    }
    if(t<c){
      System.out.println(c-t);
    }
  }
}

Measured memory_bytes: 23636
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



string s;
int main() {
    while (cin >> s) {
        int res = 0;
        stack<char> st;
        for (int i = 0; i < s.size(); ++i) {
            if (st.empty()) st.push(s[i]);
            else {
                char c = st.top();
                if (c == s[i]) st.push(s[i]);
                else {
                    res += 2;
                    st.pop();
                }
            }
        }
        cout << res << endl;
    }
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int startA = sc.nextInt();
        int startB = sc.nextInt();
        int goalA = sc.nextInt();
        int goalB = sc.nextInt();
        String str = sc.next();
        char[] array = new char[n + 1];
        for (int i = 0; i < n; i++) {
            array[i + 1] = str.charAt(i);
        }
        
        String str2 = str.substring(startB - 2, Math.min(n, goalB + 1));
        
        if (str2.contains("...")) {
            if (goalB < goalA) {
                int tmp = startA;
                startA = startB;
                startB = tmp;
            }
        } 
        
        int aIndex = startA;
        int bIndex = startB;
        boolean clear = true;
        boolean stopA = false;
        boolean stopB = false;
        boolean aGoaled = false;
        boolean bGoaled = false;
        
        while (true) {
            // bが動く
            if (!bGoaled) {
                if (bIndex + 2 == goalB || bIndex + 1 == goalB) {
                    bIndex = goalB;
                    bGoaled = true;
                    stopB = true;
                } else if (array[bIndex + 2] == '.' && bIndex + 2 != aIndex) {
                    bIndex += 2;
                    if (!aGoaled) stopA = false;
                } else if (array[bIndex + 1] == '.' && bIndex + 1 != aIndex) {
                    bIndex += 1;
                    if (!aGoaled) stopA = false;
                } else {
                    stopB = true;
                }            
            }

            
            // System.out.println(aIndex + " " + bIndex);
            
            // aが動く
            if (!aGoaled) {
                if (aIndex + 2 == goalA || aIndex + 1 == goalA) {
                    aIndex = goalA;
                    aGoaled = true;
                    stopA = true;
                } else if (array[aIndex + 2] == '.' && aIndex + 2 != bIndex) {
                    aIndex += 2;
                    if (!bGoaled) stopB = false;
                } else if (array[aIndex + 1] == '.' && aIndex + 1 != bIndex) {
                    aIndex += 1;
                    if (!bGoaled) stopB = false;
                } else {
                    stopA = true;
                }            
            }
            
            // System.out.println(aIndex + " " + bIndex);
            
            if (aGoaled && bGoaled) {
                System.out.println("Yes");
                break;
            }
            
            if (stopA && stopB) {
                System.out.println("No");
                break;
            }
            
            
        }
    }
}


Measured memory_bytes: 26568
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination1(int, int);
};
int Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Odds_of_Oddness(void) {

	int N; cin >> N;
	
	cout << setprecision(20) << (double)((N + N % 2) / 2) / (double)N << flush;
	return;
}

void B_Roller_Coaster(void) {

	int N, K; cin >> N >> K;
	vector<int>h(N); for (int& it : h) cin >> it;

	sort(h.begin(), h.end());
	for (int index = 0; index < N; index++) {
		if (h[index] >= K) {
			cout << N - index << flush;
			return;
		}
	}
	cout << 0 << flush;
	return;
}

int main(void) {

	//A_Odds_of_Oddness();
	B_Roller_Coaster();
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,a,b,c,d;
    bool ok=true;
    bool ok_2 = false;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--;b--;c--;d--;
    if(c<d){
        for(int i=a; i<c-1; i++){
            if(s[i] == '#' && s[i+1] == '#') ok=false;
        }
        for(int i=b; i<d-1; i++){
            if(s[i] == '#' && s[i+1] == '#') ok=false;
        }
        ok_2 = true;
    }
    else{
        for(int i=a; i<c-1; i++){
            if(s[i] == '#' && s[i+1] == '#') ok=false;
        }
        for(int i=b; i<d-1; i++){
            if(s[i] == '#' && s[i+1] == '#') ok=false;
        }
        for(int i=b; i<=d; i++){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.') ok_2 =true;
        }
    }
    if(ok&&ok_2) cout << "Yes"<<endl;
    else cout << "No" << endl;
}

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


const int INF = 1001001001;
vector<int> v[100005]; //?
 
int main() {
    int n,m;
    cin >> n >> m;
    //各番号に繋がる要素を集計して辿れるかを探る
    //vector<int> v[100100100];
    int a,b;
    rep(i,m){
        cin >> a >> b;
        a--;b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
       
    
    //0を起点に伸ばしていくbfs
    queue<int> q;
 
    
    vector<int> dist(n,INF);
    vector<int> pre(n,-1);
    dist[0] = 0;
    q.push(0);
    
    while(!q.empty()){
        int me = q.front(); q.pop();
        for(int to : v[me]){
            if(dist[to]!=INF) continue;
            dist[to] = dist[me] + 1;
            pre[to] = me;
            q.push(to);
        }
    }
    
    cout << "Yes" << endl;
    for(int i=1;i<n;i++){
        int ans = pre[i];
        cout << ans+1 << endl;
    }
    
    
    
    
    /*
    vector<P> v(m+1); //first:親ノード、second:1までの経路数
    for(int i=1;i<=m;i++){
        v[i].first = 0;
        v[i].second = 99999999;
    }
    int a,b;
    rep(i,n){
        cin >> a >> b;
        //更新チェック
        if(v[a].first!=1 && v[a].first!=0){
            int node = v[a].first;
            int leng = v[a].second;
            
        }
    }
    
    
    rep(i,n){
        cin >> v[i].first;
        cin >> v[i].second;
    }
    rep(i,n){
        cout << v[i].first << " ";
        cout << v[i].second << endl;
    }
    */
return 0;
}


Measured memory_bytes: 10660
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rItr(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define Itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define setp(n) fixed << setprecision(n)
#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define All(a) (a.begin()),(a.end())
#define rAll(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	vector<pll> ab(n);
	rep(i,n){
		cin>>ab[i].fi>>ab[i].se;
	}
	sort(All(ab));
	ll ans=0;
	rep(i,n){
		if (m==0) break;
		if (ab[i].se<=m){
			m-=ab[i].se;
			ans+=ab[i].fi*ab[i].se;
		}else{
			ans+=ab[i].fi*m;
			m=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

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

class Pair {
	int first;
	int second;
	int pos;

	Pair(int first, int second, int pos) {
		this.first = first;
		this.second = second;
		this.pos = pos;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int D = in.nextInt();
		int G = in.nextInt();
		int d[] = new int[D];
		int c[] = new int[D];
		for (int i = 0; i < D; i++) {
			d[i] = in.nextInt();
			c[i] = in.nextInt();
		}
		int ans = Integer.MAX_VALUE;
		for (int mask = 0; mask < (1 << D); mask++) {
			int sum = 0;
			int rem_max = -1;
			int num = 0;
			for (int i = 0; i < D; i++) {
				if (((mask >> i) & 1) == 1) {
					sum += (100 * (i + 1) * d[i] + c[i]);
					num += d[i];
				} else {
					rem_max = i;
				}
			}
			if (sum < G) {
				int num1 = 100 * (rem_max + 1);
				int need = (G - sum + num1 - 1) / num1;
				if (need > d[rem_max]) {
					continue;
				}
				num += need;
			}
			ans = Math.min(ans, num);
		}
		pw.println(ans);

	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

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

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

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

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


Measured memory_bytes: 23380
#include<bits/stdc++.h>
#define rep(i,a,b) for (LL i=(a); i<=(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 3009;
const int RXD = 1000000007;
int f[maxn][maxn][2];
int n, m, ans;

void add(int &a, int b) {
	a = (a + b) % RXD;
}

int main() {
	scanf("%d%d", &n, &m); n--; m--;
	rep (i, 0, n) f[0][i][i==0] = 1;
	rep (i, 0, m) rep (j, 0, n) rep (k, 0, 1) {
		add(f[i+1][j+1][k], f[i][j][k]);
		add(f[i+1][j][k], (f[i][j][k] * 2) % RXD);
		if (j) add(f[i+1][j-1][k||j==1], f[i][j][k]);
	}
	rep (i, 0, n) add(ans, f[m][i][1]);
	ans = 4LL * ans % RXD;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 70784
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  string s;
  cin >> s;
  int ans = 0;
  rep(i, 0, sz(s) / 2) {
    if (s[i] != s[sz(s) - i - 1]) ans++;
  }

  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
#define mod 1000000007
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	long long int N,M,ans=1;
	cin>>N>>M;
	if(abs(N-M)>=2){
		cout<<0<<endl;
		return 0;
	}
	else if(N==M){
		FOR(i,1,N+1){
			ans*=i;
			ans%=mod;
		}
		ans*=ans;
		ans%=mod;
		ans*=2;
		ans%=mod;
	}
	else{
		FOR(i,1,N+1){
			ans*=i;
			ans%=mod;
		}
		FOR(i,1,M+1){
			ans*=i;
			ans%=mod;
		}
	}
		
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod2 998244353
#pragma GCC optimize("-O2")
#define mod3 127
#define mod 1000000007
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector<vector<int>>
#define v4096 vector<vector<lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli, lli>
#define m32 map<int, int>
#define m64it map<lli, lli>::iterator
#define m32it map<int, int>::iterator
#define fastio                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define ist insert
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define p_q priority_queue
#define min_p_q priority_queue<int, vt<int>, greater<int>>
using namespace std;
using namespace __gnu_pbds;
lli tmod(lli x, lli y)
{
    return (x % y + y) % y;
}
template <typename T>
void DEBUG_ARR(vt<T> a)
{
    f(i, 0, a.size()) cout << a[i] << " ";
    cout << "\n";
}
lli power(lli x, lli y) 
{
    lli res = 1;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;
    }
    if(res<0)res+=mod;
    return res; 
}

int main()
{   
    fastio;
    int h,a;
    cin>>h>>a;
    cout<<(h-1)/a+1<<"\n";
    return 0;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))

a = 0
b = 0

for i in range(n):
    if i % 2 == 0:
        a = a + max(l)
        l.remove(max(l))
    else:
        b = b + max(l)
        l.remove(max(l))
print (a-b)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<algorithm>
#define MAX 100
#define INF 1LL << 32
using namespace std;

int V;
long long D[MAX][MAX];

void warshallFloyd(){
    for(int k = 0; k < V; k++){
        for(int i = 0; i < V; i++){
            if(D[i][k] == INF) continue;
            for(int j = 0; j < V; j++){
                if(D[k][j] == INF) continue;
                D[i][j] = min(D[i][j],D[i][k]+D[k][j]);
            }
        }
    }
}
int main(){
    int E, s, t, d;
    scanf("%d %d",&V,&E);
    
    for(int i = 0; i < V; i++){
        for(int j = 0; j < V; j++){
            if( i == j) D[i][j] = 0;
            else D[i][j] = INF;
        }
    }
    
    for(int i = 0; i < E; i++){
        scanf("%d %d %d", &s, &t, &d);
        D[s][t] = d;
    }
    
    warshallFloyd();
    int flag = 1;
    for(int i = 0; i < V; i++){
        if(D[i][i] < 0) flag = 0;
    }
    
    if(flag == 0) printf("NEGATIVE CYCLE\n");
    else{
        for(int i = 0; i < V; i++){
            for(int j = 0; j < V; j++){
                if(j != 0) cout << " ";
                if (D[i][j] == INF) cout << "INF";
                else cout << D[i][j];
                
            }
            cout << endl;
        }
    }
    return 0;
    
}


Measured memory_bytes: 3296
#include <stdio.h>
#include <string.h>

int main(void){

	int i,j,k,w=0,l=0,n=0;
	char text[1000][33],max[33],len[33];

	while(scanf("%s",text[w])!=EOF){
		if(w==0)text[0][0]+=32;
		if(strlen(text[w])>l){
			strcpy(len,text[w]);
			l=strlen(text[w]);
		}
		w++;
	}

	for(i=0;i<w;i++){
		k=1;
		if(text[i][0]!='*'){
			for(j=i+1;j<w;j++){
				if(strcmp(text[i],text[j])==0){k++;text[j][0]='*';}
			}
			if(k>n){n=k;strcpy(max,text[i]);}
		}
	}

	printf("%s %s\n",max,len);
	return 0;
}

Measured memory_bytes: 576
import java.util.*;
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();
      String ans = "" + s1.charAt(0) + s2.charAt(0) + s3.charAt(0);
      System.out.println(ans.toUpperCase());
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>


void solve(int M, int N, std::vector<std::vector<int>> A) 
{
  std::priority_queue<int> pq;
  long result = 0;
  for(int i = 0; i < M; i++)
  {
    for(const auto& j: A[i])
    {
      pq.push(j);
    }
    if(pq.empty())
    {
      continue;
    }
    result+=pq.top(); pq.pop();
  }
  std::cout << result << std::endl;
  
}
int main(void) {
  int M;
  int N;
  std::cin >> N;
  std::cin >> M;
  std::vector<std::vector<int>> A(M);
  // std::vector<int> B(N);
  // std::vector<data> a(N);
  for(auto i0 = 0; i0 < N; ++i0)
  {
    int a, b;
    std::cin >>a >>b;
    int a_1 = a -1;
    if(a_1>=M)
    {
      continue;
    }
    A[a_1].push_back(b); 
    // std::cin >> a[i0].a;
    // std::cin >> a[i0].b;
  }
  solve(M,N,A);
  return 0;
}


Measured memory_bytes: 10880
# n, T = map(int, input().split())
# t = list(map(int, input().split()))
# ans = 0
# for i in range(1,n):
#     d = t[i] - t[i-1]
#     if d < T:
#         ans = t[i]
#     else:
#         ans += T
# ans += T
# print(ans)

x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
    print("A")
else:
    print("B")


Measured memory_bytes: 2940
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main()
{
	LL N;
	cin >> N;
	vector<LL> T(N);
	vector<bool> Tchange(N);
	vector<LL> A(N);
	vector<bool> Achange(N);
	LL Tmax = 0;
	LL Amax = 0;
	REP(i, N) {
		cin >> T[i];
		if (T[i] > Tmax) {
			Tmax = T[i];
			Tchange[i] = true;
		}
		else {
			Tchange[i] = false;
		}
	}
	REP(i, N) {
		cin >> A[i];
	}
	for(LL i=N-1;i>=0;--i){
		if (A[i] > Amax) {
			Amax = A[i];
			Achange[i] = true;
		}
		else {
			Achange[i] = false;
		}
	}
	LL sum = 1;
	REP(i, N) {
		if (Tchange[i] && Achange[i]) {
			if (T[i] != A[i]) {
				sum = 0; break;
			}
		}
		else
			if (Tchange[i] && !Achange[i]) {
				if (T[i]>A[i]) {
					sum = 0; break;
				}
			}
			else
				if (!Tchange[i] && Achange[i]) {
					if (T[i]<A[i]) {
						sum = 0; break;
					}
				}
				else {
					LL mini = min(T[i], A[i]);
					sum = (sum*mini) % (1000000000 + 7);
				}
	}
	cout << sum << endl;
}

Measured memory_bytes: 1792
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it 💗
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
  
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int main(){
	K_K();
	ll x, y;
	cin >> x >> y;
	if (x == 1 || y == 1)
		rt(1);
	cout << max(1LL, Ceil((x*y), 2));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int N, W[300], dp[300][300];
 
int rec(int l, int r)
{
  if(l >= r) return (0);
  if(~dp[l][r]) return (dp[l][r]);
  int ret = 0;
  if(abs(W[l] - W[r]) <= 1 && rec(l + 1, r - 1) == r - l - 1) ret = r - l + 1;
  else for(int m = l; m < r; m++) ret = max(ret, rec(l, m) + rec(m + 1, r));
  return (dp[l][r] = ret);
}
 
int main()
{
  while(scanf("%d", &N), N) {
    for(int i = 0; i < N; i++) {
      scanf("%d", &W[i]);
    }
    memset(dp, -1, sizeof(dp));
    printf("%d\n", rec(0, N - 1));
  }
}


Measured memory_bytes: 3568
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>

using namespace std;

const static int N = 3;
const static int N2 = 9;

struct Puzzle{
  int f[N2];
  int space;
  string path;

  bool operator < (const Puzzle &p) const{
    for(int i=0; i<N2; ++i){
      if(f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

const static int dx[4] = {-1, 0, 1, 0};
const static int dy[4] = {0, -1, 0, 1};
const static char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p){
  for(int i=0; i<N2; ++i)
    if(p.f[i] != (i+1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while(!Q.empty()){
    u = Q.front();
    Q.pop();
    if(isTarget(u)) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for(int r=0; r<4; ++r){
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if(!V[v]){
	V[v] = true;
	v.path += dir[r];
	Q.push(v);
      }
    }
  }

  return "unsolvable";
}

int main(){
  Puzzle in;

  for(int i=0; i<N2; ++i){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space =i;
    }
  }

  string ans = bfs(in);
  cout << ans.size() << endl;



  return 0;
}



Measured memory_bytes: 30652
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define ROOP() while (true)

#define MOD 1000000007

int N;
string s,t;
map<char, vector<int> > deguti;
int dp[100000];
int memo[100000];

int main(){
    
	cin >> N >> s >> t;
	string alpha = "abcdefghijklmnopqrstuvwxyz";
	vector<int> none;
	for(int i=0; i<alpha.size(); i++){
		deguti[alpha[i]] = none;
	}
	for(int i=0; i<N; i++){
		deguti[t[i]].push_back(i);
		dp[i] = -1;
	}

    //DPの初期化
	dp[N-1] = 1;
	memo[N-1] = dp[N-1];
    //DPの計算処理
	for(int i=N-2; i>=0; i--){
		auto itr = upper_bound(deguti[s[i]].begin(), deguti[s[i]].end(), i);
		if(itr == deguti[s[i]].end()) dp[i] = 0;
		else dp[i] = memo[*itr];

		itr = upper_bound(deguti[t[i]].begin(), deguti[t[i]].end(), i);
		if(itr == deguti[t[i]].end()) memo[i] = dp[i];
		else memo[i] = (dp[i] + memo[*itr]) % MOD;
	}
	cout << dp[0] << endl;
    
    return 0;
}



Measured memory_bytes: 4468
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readString() -> String {
    return readLine()!
}

func readLines(times: Int) -> [String] {
    var array = [String]()
    for _ in 0..<times {
        array.append(readLine()!)
    }
    return array
}

func readSeparatedStrings() -> [String] {
    return readLine()!.split(separator: " ").map {String($0)}
}

func readStringToStrings() -> [String] {
    return readLine()!.map{String($0)}
}

func readSeparatedInts() -> [Int] {
    return readLine()!.split(separator: " ").map {Int($0)!}
}
func readSeparatedDouble() -> [Double] {
    return readLine()!.split(separator: " ").map {Double($0)!}
}

// 二進数に変換
func convertIntToRadix2(n: Int, radix: Int = 2) -> String {
    return String(n, radix: radix)
}

//配列を逆順にする reverced ソートする　sorted
//最初数文字取得 prefix


let N = readStringToStrings().map {Int($0)!}.reduce(0, +)

if N.isMultiple(of: 9) {
    print("Yes")
} else {
    print("No")
}



Measured memory_bytes: 16816
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  ll x, a, b = 0;
  double t;
  cin >> x;

  rep(i, 1000){
    rep(j, 1000){
      if(pow(i, 5) + pow(j, 5) == x){
        cout << i << " " << 0-j << endl;
        return 0;
      }
      if(pow(i, 5) - pow(j, 5) == x){
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

}


Measured memory_bytes: 4004
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N, v, a = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> v;
    if (v % 2 == 1) a++;
  }

  cout << (a % 2 == 1 ? "NO" : "YES") << endl;
  return 0;
}


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

using namespace std;

#define x first
#define y second

int getArea(int x1, int y1, int x2, int y2, int x3, int y3) {
    return abs((x1-x2)*(y3-y2)-(x3-x2)*(y1-y2));
}

int main() {
    ios::sync_with_stdio(false);

    int n;
    while (cin >> n, n) {
        map<int, bool> has;

        vector<pair<int,int> > co(n);
        for (int i=0; i<n; ++i) {
            cin >> co[i].x >> co[i].y;
            has[co[i].x+10000*co[i].y] = true;
        }
        sort(co.begin(), co.end());

        int area = 0, mxhyp = 0;
        for (int i=0; i<(int)co.size(); ++i) {
            for (int j=(int)co.size()-1; j>=i+1; --j) {
                int dx = co[j].x - co[i].x;
                int dy = co[j].y - co[i].y;
                if (mxhyp < dx * dx + dy * dy) {
                    int x3 = co[j].x - dy;
                    int y3 = co[j].y + dx;
                    int x4 = co[i].x - dy;
                    int y4 = co[i].y + dx;
                    if (has.count(x3+10000*y3) && has.count(x4+10000*y4)) {
                        area = max(area, getArea(co[i].x, co[i].y, co[j].x, co[j].y, x3, y3));
                        mxhyp = dx * dx + dy * dy;
                    }
                }
            }
        }
        cout << area << endl;
    }
    return 0;
}

Measured memory_bytes: 1368
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

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

    cout << a*b << endl;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

int main(void)
{
	char S[100];
	scanf("%s\n",S);
	int tbl[26];
	memset(tbl,0,sizeof(tbl));
	char *p = S;
	while (*p){
		int index = (*p)-'a';
		if (tbl[index]>0){
			printf("no\n");
			return 0;
		}
		tbl[index]++;
		p++;
	}
	printf("yes\n");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using ll = long long;
using PAIR = pair<int, int>;
using Graph = vector<vector<int>>;
const ll INF = (1LL << 60);
const double pi=acos(-1.0);
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/
/******** User-defined Function *******/
int f(int n){
    if(n==0) return 1;
    return f(n)*f(n-1);
}
/**************************************/
/********** Main()  function **********/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> p(n),q(n),r(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    rep(i,n) r[i] = i+1;


    int a=0,b=0;
    int j = 1;
    bool flag_a = true;
    bool flag_b = true;
    do{

        int cnt = 0;
        if(flag_a){
            rep(i,n){
                if(r[i]==p[i]) cnt++;
            }
            if(cnt==n) a = j;
        }


        cnt = 0;
        if(flag_b){
            rep(i,n){
                if(r[i]==q[i]) cnt++;
            }
            if(cnt==n) b = j;
        }

        j++;

    }while(next_permutation(all(r)));

    cout << abs(a-b) << endl;

}
/********  Main() Ends Here *************/


Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<functional>
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(c.begin(),c.end()),c.end())
#define pb push_back
using namespace std;
//typedef __int64 ll;
typedef long long int ll;
ll mod=100000007;
int comb[2003][2003];
void Comb(int c){
	for(int i=0;i<c;i++){
		for(int j=0;j<c;j++){
			comb[i][j]=0;
		}
	}
	comb[0][0]=1;
	for(int i=1;i<c;i++){
		comb[i][0]=1;
		for(int j=1;j<i+1;j++){
			comb[i][j]=comb[i-1][j]+comb[i-1][j-1];
			comb[i][j]%= mod;
		}
	}
}
int main(){
	int r,c,x1,y1,x2,y2;
	Comb(2002);
	while(cin>>r>>c>>x1>>y1>>x2>>y2){
		r--;c--;
		int a[]={abs(x1-x2),abs(x1-r)+1+x2,abs(x2-r)+1+x1};
		int b[]={abs(y1-y2),abs(y1-c)+1+y2,abs(y2-c)+1+y1};
		int sa=5000,sb=5000;
		for(int i=0;i<3;i++){
			sa=min(sa,a[i]);
			sb=min(sb,b[i]);
			//cout<<"    "<<a[i]<<" "<<b[i]<<endl;
		}
		int ca=0,cb=0;
		for(int i=0;i<3;i++){
			if(a[i]==sa)
				ca++;
			if(b[i]==sb)
				cb++;
		}
		int x=ca*cb%mod;
		ll ans=(ll)(comb[sa+sb][sa])*(ll)x%mod;
		cout<<ans<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 16824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pb push_back
const int N = 2e5+5;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; 
    cin>>n; 
    cout<<(n+1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {
  private static int N;
  private static int W;
  private static int[] weight;
  private static int[] value;
  private static int[][] dp;

  private static int calc() {
    for (int i = 1; i <= N; i++) {
      for (int j = 1; j <= W; j++) {
        if (j < weight[i]) {
          dp[i][j] = dp[i - 1][j];
        } else {
          dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - weight[i]] + value[i]);
        }
      }
    }

    return dp[N][W];
  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    N = in.nextInt();
    W = in.nextInt();

    value = new int[N + 1];
    weight = new int[N + 1];

    // init
    value[0] = 0;
    weight[0] = 0;
    for (int i = 1; i <= N; i++) {
      value[i] = in.nextInt();
      weight[i] = in.nextInt();
    }

    dp = new int[N + 1][W + 1];
    for (int i = 0; i <= N; i++) {
      dp[i][0] = 0;
    }
    for (int j = 0; j <= W; j++) {
      dp[0][j] = 0;
    }

    int result = calc();
    System.out.println(result);
  }
}

Measured memory_bytes: 30892