akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		System.out.println(str.toUpperCase());
	}
}

Measured memory_bytes: 16856
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long a[] = new long[N];
		for(int i=0;i<N;i++)a[i]=sc.nextInt();
		sc.close();
		
		long max = Long.MIN_VALUE/2;
		long min = Long.MAX_VALUE/2;
		
		long maxP = 0;
		long minP = 0;
		
		for(int i=0;i<N;i++) {
			if(max < a[i]) {
				max = a[i];
				maxP = i;
 			}
			if(min > a[i]) {
				min = a[i];
				minP = i;
			}
		}
		StringBuilder sb = new StringBuilder();
		int cnt = 2*(N-1); //fixed
		sb.append(cnt + "\n");
		if(max + min >= 0) {
			sb.append((maxP+1) + " " + (2) + "\n"); 
			sb.append((maxP+1) + " " + (2) + "\n"); 
			for(int i=2;i<N;i++) {
				sb.append((i) + " " + (i+1) + "\n"); 
				sb.append((i) + " " + (i+1) + "\n"); 
			}
		}
		else {
			sb.append((minP+1) + " " + (N-1) + "\n"); 
			sb.append((minP+1) + " " + (N-1) + "\n");
			for(int i=N-2;i>=1;i--) {
				sb.append((i+1) + " " + (i) + "\n"); 
				sb.append((i+1) + " " + (i) + "\n"); 
			}
		}
		System.out.println(sb.toString());
	}
	
}

Measured memory_bytes: 24020
s = list(input())

cnt = len(s) - 2
ans = 753
num = ""
tmp = 0
for i in range(cnt):
    num += s[i]
    num += s[i+1]
    num += s[i+2]
    tmp = abs(753 - int(num))
    if ans > tmp:
        ans = tmp
    num = ""
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

#define INF 1000000000;
#define NODE 10000;

using namespace std;
int A[100000],B,N,M,T[100],P[100],X[100],ans,sum[100],line[100001];
string S;
int abs(int x){
	if(x<0){
		return -x;
	}
	return x;
}

int min(int x,int y){
	if(x<y)return x;
	return y;
}
int max(int x,int y){
	if(x>y)return x;
	
	return y;
}

int main(){
	cin >>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
		line[A[i]]++;
	}
	ans=1;
	if(N%2==1){
		if(line[0]==1){
			for(int i=2;i<N;i+=2){
				if(line[i]!=2){
					cout<<0<<endl;
					return 0;
				}
				B++;
			}

		}else{
			cout<<0<<endl;
			return 0;
		}


	
	}else{
		for(int i=1;i<N;i+=2){
				if(line[i]!=2){
					cout<<0<<endl;
					return 0;
				}
				B++;
			}
	}
	for(int i=0;i<B;i++){
		ans=2*ans;
		ans=ans%1000000007;
	}

	cout<<ans%1000000007<<endl;


	return 0;
}


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

int main() {
  int q;
  cin >> q;
  set<int> st;
  for (int i = 0; i < q; i++) {
    int cmd, x;
    cin >> cmd >> x;
    if (cmd == 0) {
      st.insert(x);
      cout << st.size() << endl;
    }
    if (cmd == 1) {
      cout << st.count(x) << endl;
    }
    if (cmd == 2) {
      st.erase(x);
    }
  }
}



Measured memory_bytes: 12452
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			for (;;) {
				String input = reader.readLine();
				String[] array = input.split(" ");
				int n = Integer.parseInt(array[0]);
				int x = Integer.parseInt(array[1]);
				
				if (n == 0 && x == 0) {
					break;
				}
				int count = 0;
				for (int i = 1; i <= n - 2; i++) {
					for (int j = i + 1; j <= n - 1; j++) {
						for (int k = j + 1; k <= n; k++) {
							if ((i + j + k) == x) {
								count++;
							}
						}
					}
				}
				System.out.println(count);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 25008
#include <bits/stdc++.h>
    #define hell                         1000000007 
    #define M                            1000000007
    #define Maxi                      10000000000000000
        #define lcm(a,b)                     (a*b)/__gcd(a,b)
        #define ll                           long long

        #define vll                          vector<ll>
        #define vi                           vector<long long>
        #define pll                          vector< pair<ll,ll> >
        #define pb                           push_back
        //#define mp                           make_pair
        #define all(v)                       v.begin(),v.end()
        #define lbnd                         lower_bound
        #define ubnd                         upper_bound
        #define bs                           binary_search
        #define F                            first
        #define S                            second
        #define rep(i,a,b)                   for(i=a;i<b;i++)
        #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
        #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
        #define ret(x)                       return cout<<x,0;
        #define dbg(x)                       cout << #x << " is " << x << endl;
        //#define endl                           '\n'
     
     
        // Debug //
     
        #define trace(x)                 cerr << #x << ": " << x << endl;
        #define trace1(x)                cerr << #x << ": " << x << endl;
        #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
        #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
        #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
        #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
        #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


    using namespace std;
    
    int main()
    {

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

           ll n;
           cin>>n;

           ll i,j;
           vector<string>v;
           for(i=0;i<n;i++)
           {
            string s;
            cin>>s;
            v.pb(s);
           }
           map<string,ll>m1;

           ll ans=0;
           for(i=n-1;i>=0;i--)
           {
            string s;
            s=v[i];
            sort(all(s));


            if(m1.find(s)==m1.end())
            {
              m1[s]=1;
            }
            else
            {
              ans+=m1[s];
              m1[s]++;
            }
           }
           cout<<ans<<endl;


          return 0;


  }

  

Measured memory_bytes: 16628
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_bacm
#define mp mame_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    if (a+b+c >= 22) cout << "bust\n";
    else cout << "win\n";
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

int main(){
  vector<int> x(4,0);
  REP(i,4) cin>>x.at(i);
  if(x.at(0)+x.at(1)>x.at(2)+x.at(3)) cout<<"Left";
  else if(x.at(0)+x.at(1)==x.at(2)+x.at(3)) cout<<"Balanced";
  else cout<<"Right";
}

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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

signed main () {
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, m;

  string a, b;

  cin >> a >> b;

  n = a.size(), m = b.size();

  a = '#' + a;
  b = '#' + b;

  vector<vector<int> > dp(n + 1, vector<int>(m + 1, 0));

  int gt = 0;
  for(int i = 1; i <= n; i++) {
  	for(int j = 1; j <= m; j++) {
  		if(a[i] == b[j]) {
  			dp[i][j] = dp[i-1][j - 1] + 1;
  			gt = max(gt, dp[i][j]);
  		} else {
  			dp[i][j] = max(dp[i - 1][j], dp[i][j-1]);
  		}
  		// cerr << dp[i][j] << ' ';
  	}
  	// cerr << endl;x
  }

  int i = n, j = m;
  string ans = "";
  while(i > 0 && j > 0) {
  	if(a[i] == b[j]) {
  		ans.insert(ans.begin(), a[i]);
  		i--, j--;
  	} else if(dp[i-1][j] > dp[i][j-1]) {
  		i--;
  	} else {
  		j--;
  	}
  }

  cout << ans << endl;

}

Measured memory_bytes: 70784
def main():
  n,m = map(int,input().split())
  A = [int(input()) for _ in range(n)]
  V = [0 for _ in range(n)]
  M = 0
  ans = 0
  for i in range(m):
    b = int(input())
    for j in range(n):
      if A[j] <= b:
        V[j] += 1
        if M < V[j]:
          M += 1
          ans = j
        break
  print(ans + 1)

main()


Measured memory_bytes: 5620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

typedef vector<pair<char, int> >::const_iterator vitr;

vector<pair<char, int> > v;

int solve(vitr& it) {
	char c = it->first;
	int h = it->second;
	++it;
	if (isdigit(c)) return c - '0';
	int res = (c == '+' ? 0 : 1);
	while (it != v.end() && h + 1 == it->second) {
		if (c == '*') res *= solve(it);
		else res += solve(it);
	}
	return res;
}

int main() {
	int n;
	while (cin >> n, n) {
		v.clear();
		for (int i = 0; i < n; ++i) {
			string s; cin >> s;
			v.push_back(make_pair(s[s.size() - 1], s.size() - 1));
		}
		vitr begin = v.begin();
		cout << solve(begin) << endl;
	}

	return 0;
}


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

const int INF = 1001001001;

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n);
    rep(sv, n){
        vector<int> dist(n, INF);
        queue<int> q;
        auto push = [&](int v, int d){
            if(dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv, 0);
        while (!q.empty()){//全部たどる
            int v = q.front(); q.pop();
            int d = dist[v];
            if(v-1 >= 0) push(v-1, d+1);
            if(v+1 < n) push(v+1, d+1);
            if(v == x) push(y, d+1);
            if(v == y) push(x, d+1);
        }
        rep(i, n) ans[dist[i]]++;
    }
    rep(i, n) ans[i]/=2;
    for(int i = 1; i <= n-1; i++){
        cout << ans[i] << endl;
    }

    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, ans;

int DFS(ll num, bool T, bool F, bool S){
  if (num > N) return 0;
  if (T && F && S) ans++;

  DFS(num*10+3, true, F, S);
  DFS(num*10+5, T, true, S);
  DFS(num*10+7, T, F, true);

  return 0;
}

int main(){
  cin >> N;
  DFS(0, 0, 0, 0);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3600
N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
h = []
for i in range(N):
    if i == 0:
        h.append(1)
    elif i == N - 1:
        h.append(1)
    else:
        if T[i] > T[i - 1]:
            h.append(1)
            if T[i] > A[i]:
                h[i] = 0
                break
        elif A[i] > A[i + 1]:
            h.append(1)
            if A[i] > T[i]:
                h[i] = 0
                break
        else:
            h.append(min([A[i], T[i]]))

if max(T) != max(A):
    h.append(0)
    
cnt = 1
for i in range(len(h)):
    cnt *= h[i]
    cnt %= 1000000007
                     
print(cnt % 1000000007)

Measured memory_bytes: 19136
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int64 gcd(int64 a, int64 b) {
  while (b) {
    int64 c = a;
    a = b;
    b = c % b;
  }
  return a;
}

int main() {
  int64 a, b;
  cin >> a >> b;
  int64 ret = a / gcd(a, b) * b;
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import sys 
fin = sys.stdin.readline

N, M, Q = [int(elem) for elem in fin().split()]
trains = [[int(elem) - 1 for elem in fin().split()] for _ in range(M)]
queries = [[int(elem) - 1 for elem in fin().split()] for _ in range(Q)]

map_2D = [[0] * N for _ in range(N)]
for l, r in trains:
    map_2D[l][r] += 1

cuml_1D = [[0] * N for _ in range(N)]
# vertical
for j in range(N):
    cuml_sum = 0
    for i in reversed(range(j + 1)):
        cuml_sum += map_2D[i][j]
        cuml_1D[i][j] = cuml_sum

cuml_2D = [[0] * N for _ in range(N)]
# horizontal
for i in range(N):
    cuml_sum = 0
    for j in range(N):
        cuml_sum += cuml_1D[i][j]
        cuml_2D[i][j] = cuml_sum

for p, q in queries:
    print(cuml_2D[p][q])


Measured memory_bytes: 103132
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    vector<ll> num(4);
    for (ll i = 0; i < 3; i++) {
        ll a, b;
        cin >> a >> b;
        num[a - 1]++;
        num[b - 1]++;
    }

    ll odd = 0;
    for (ll i = 0; i < 4; i++) {
        if (num[i] % 2 == 1) {
            odd++;
        }
    }

    cout << (odd == 2 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <unordered_map>

using namespace std;

typedef long long ll;

void solve() {
	string s;
	cin >> s;
	cout << s.substr(0, 3);
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3656
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	long double a, b, c; cin >> a >> b >> c;
	//if(LDBL_EPSILON+sqrt(a)+LDBL_EPSILON+sqrt(b) < LDBL_EPSILON+sqrt(c)){
	if(c-a-b >= 0 && 4*a*b< (c-a-b)*(c-a-b)){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 998244353;

int main() {
    string s;
    cin >> s;
    Int res = 1;
    Int n = s.size();
    string pre = "";
    pre += s[0];
    for (Int i = 1; i < n; i++) {
      //  dump(pre);
       if (pre.size() == 1) {
           if (pre[0] == s[i]) {
               if (i == n - 1) {
                   break;
               }
               else {
                   pre = "";
                   pre += s[i];
                   pre += s[i + 1];
                   i++;
                   res++;
               }
           }
           else {
               pre = "";
               pre += s[i];
               res++;
           }
       }
       else {
           pre = "";
           pre += s[i];
           res++;
       }
    }
    dump(res);
    return 0;
}

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

int main(){
	int a,b,x,y;

	while(std::cin >> a >> b){

		if(a == 0 && b == 0){
			break;
		}

		std::vector< std::vector<int> > road(a,std::vector<int>(b,1));
		int num = 0;

		std::cin >> num;

		for(int i=0; i<num; ++i){
			std::cin >> x >> y;
			road.at(x-1).at(y-1) = 0;
		}

		for(int i=0; i<a; ++i){
			for(int j=0; j<b; ++j){

				//start point & point under construction
				if(road.at(i).at(j) != 0 && (i+j) != 0){
					if(i == 0){
						if(road.at(i).at(j-1) != 0){
							road.at(i).at(j) = road.at(i).at(j-1);
						}else{
							road.at(i).at(j) = 0;
						}
					}else if(j == 0){
						if(road.at(i-1).at(j) != 0){
							road.at(i).at(j) = road.at(i-1).at(j);
						}else{
							road.at(i).at(j) = 0;
						}
					}else{
						road.at(i).at(j) = road.at(i).at(j-1) + road.at(i-1).at(j);
					}
				}

			}
		}

		std::cout << road.at(a-1).at(b-1) << std::endl;
	}

}

Measured memory_bytes: 1216
#include <cstdio>

using namespace std;

int a, b, ans;

int main() {

	scanf("%d %d", &a, &b);
	ans = b;
	for (int i = 0; i < a - 1; i++) {
		ans = ans * (b - 1);
	} 

	printf("%d", ans);
}

Measured memory_bytes: 128
/* * 5_20_A.cpp
 *
 *  Created on: 2017/05/20
 *      Author: 16k1117
 */

#include<iostream>

using namespace std;

int judge(int n){

	if(n == 1 || n == 3 || n == 5 || n == 7 || n == 10 || n == 12 || n == 8){
		return 0;
	}
	if(n == 4 || n == 6 || n == 9 || n == 11){
		return 1;
	}
	if(n == 2){
		return 2;
	}
	return 100;

}

int main(){

	int x, y, xtf, ytf;
	cin >> x;
	cin >> y;

	xtf = judge(x);
	ytf = judge(y);

	if(xtf == ytf){
		cout << "Yes";
	}
	else{
		cout << "No";

	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int main(){
  int n;  cin >> n;
  vector<int> v(n);
  rep(i,0,n){
    cin >> v[i];
  }
  map<int,int> gu,ki;
  rep(i,0,n){
    (i%2 ? ki[v[i]]++ : gu[v[i]]++);
  }
  priority_queue<P> kiq,guq;
  for(auto ite=begin(ki) ; ite!=end(ki);ite++){
    kiq.push(mp(ite->se, ite->fi));
  }
  for(auto ite=begin(gu) ; ite!=end(gu);ite++){
    guq.push(mp(ite->se, ite->fi));
  }
  int ans = 0;
  P kix = kiq.top(), gux = guq.top();
  if(kiq.top().se!=guq.top().se){
    ans = n - kix.fi - gux.fi;
  }else{
    kiq.pop();  guq.pop();
    ans = n - kix.fi - max(kiq.top().fi, guq.top().fi);
    if(!kiq.size() || !guq.size()){
      ans = n - kix.fi;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7668
#include <iostream>

using namespace std;

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

	int m;
	if (a < c) {
		m = a;
		a = c;
		c = m;
	}
	if (a - c < d) {
		cout << "Yes" << endl;
	} else if (a - b < d) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    int d = 0;
    for_(i,0,10000000) {
        d = ((d * 10) % K + (7 % K)) % K;
        if (d == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(int arg_start,int arg_end,int arg_value){
		start = arg_start;
		end = arg_end;
		value = arg_value;
	}
	int start,end,value;
};


int main(){

	int N,M,Limit;
	scanf("%d %d %d",&N,&M,&Limit);

	vector<Info> V[5];

	int youbi,start,renzoku,value;
	for(int loop = 0; loop < M; loop++){
		scanf("%d %d %d %d",&youbi,&start,&renzoku,&value);
		V[youbi].push_back(Info(start,start+renzoku-1,value));
	}

	int dp[5][N+1];
	for(int i = 0; i <= 4; i++){
		for(int k = 0; k <= N; k++){
			dp[i][k] = 0;
		}
	}

	for(int day = 0; day <= 4; day++){

		int maximum[N+1];
		for(int i = 0; i <= N; i++)maximum[i] = 0;

		int range_dp[N+1][N+1][N+1];
		for(int left = 1; left <= N; left++){
			for(int right = 1; right <= N; right++){
				for(int num = 0; num <= N; num++){
					range_dp[left][right][num] = 0;
				}
			}
		}

		for(int i = 0; i < V[day].size(); i++){
			if(range_dp[V[day][i].start][V[day][i].end][1] < V[day][i].value){
				range_dp[V[day][i].start][V[day][i].end][1] = V[day][i].value;
				maximum[1] = max(maximum[1],V[day][i].value);
			}
		}

		for(int length = 2; length <= N; length++){
			for(int left = 1; left+length-1 <= N; left++){
				int right = left+length-1;

				for(int mid = left; mid <= right-1;mid++){
					for(int a = 0; a <= N; a++){
						for(int b = 0; b <= N; b++){
							if(a+b > N)continue;

							range_dp[left][right][a+b] = max(range_dp[left][right][a+b],range_dp[left][mid][a]+range_dp[mid+1][right][b]);
							maximum[a+b] = max(maximum[a+b],range_dp[left][right][a+b]);
						}
					}
				}
			}
		}

		for(int i = 0; i <= N; i++){
			dp[day][i] = maximum[i];
		}
	}

	int ans = 0;

	for(int a = 0; a <= N; a++){
		for(int b = 0; b <= N; b++){
			for(int c = 0; c <= N; c++){
				for(int d = 0; d <= N; d++){
					for(int e = 0; e <= N; e++){
						if(a+b+c+d+e <= Limit){
							ans = max(ans,dp[0][a]+dp[1][b]+dp[2][c]+dp[3][d]+dp[4][e]);
						}
					}
				}
			}
		}
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3200
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
	int i, j;
	char k[3];
	scanf("%[^\n]", k);
	sscanf(k, "%d %d", &i, &j);
	printf("%d", i*j - i - j + 1);

	return 0;
}

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

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

Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional> 
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <bitset>
#include <string.h>
#include <stdio.h>
#include <limits.h>
#include <array>
#include <utility>
#include <memory>
#include <future>
#include <array>
//#include <unordered_map>

using namespace std;

#define STR(X) #X

#define ABS(a)      ((a>0)?a:-(a))
#define MIN(a,b)    ((a<b)?(a):(b))
#define MAX(a,b)    ((a<b)?(b):(a))
#define FOR(i,a,n)    for ( int i = (a); i < (n); ++i)
#define FOR_(i,a,n)		for ( int i = (a); i >= (n); --i)
#define FORI(n)        for(int i = 0; i < n; ++i)
#define MEMS(a,b)    memset(a,b,sizeof(a))

#define MP(p1, p2)      std::make_pair(p1, p2)
#define RNG(container)  container.begin(), container.end()

using LL = long long;
using ULL = unsigned long long;
using UI = unsigned int;
using UC = unsigned char;
using VI = std::vector<int>;
using SI = std::set<int>;

using PI = std::pair<int, int>;
using PL = std::pair<LL, LL>;

constexpr LL		MOD = 1000000009;
constexpr double    EXP = 2.7182818284590452;
constexpr double    Pi = 3.1415926535;
constexpr long double    EPS = 1e-4;
constexpr int		INF = 1000 * 1000 * 1001;
constexpr long long	INFL = (LL)INF * (LL)INF;

inline LL gcd(LL a, LL b)
{
    if (a < b) swap(a, b);

    while (b != 0)
    {
        a %= b;
        swap(a, b);
    }

    return a;
}

inline LL lcm(LL a, LL b)
{
    return (a / gcd(a, b)) * b;
}

LL extgcd(LL a, LL b, LL & x, LL & y)
{
    if (a == 0)
    {
        x = 0; y = 1;
        return b;
    }

    LL x11, y11;
    LL d = extgcd(b % a, a, x11, y11);
    x = y11 - (b / a) * x11;
    y = x11;
    return d;
}

ULL poww(ULL v, ULL p, ULL mod)
{
    if (p == 0) return 1;

    if (p & 1)
    {
        return (poww(v, p - 1, mod) * v) % mod;
    }
    else
    {
        ULL t = poww(v, p / 2, mod);
        return (t * t) % mod;
    }
}

constexpr ULL L31018 = 3000000000000000000L;
constexpr ULL L1018 = 1000000000000000000L;

//////////////////
//////////////////

int const MAXN = 5000006;

void accept()
{
    ULL h, w;
    cin >> h >> w;

    if (h == 1 || w == 1)
    {
        cout << 1;
        return;
    }

    ULL const greaterRows = (h + 1) / 2;
    ULL const lowerRows = h - greaterRows;

    cout << greaterRows * ((w + 1) / 2) + lowerRows * (w / 2);
}

//		||
//		||
//     \||/
//    \\||//
//   \\\\////
//    \\\///
//     \\//
//      \/

int main(void)
{

#ifdef DEBUG
    LL startTime = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //	freopen("I.in", "r", stdin);
    //	freopen("cinema.out", "w", stdout);
#endif

    accept();

#ifdef DEBUG
    printf("\n\n\t TIME: %.5lf", double((clock() - startTime)) / 1000.0f); /// CLOCKS_PER_SEC));
#endif
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std;

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    if(n%2==0){
        cout << 0.5 ENDL;
    }else{
        cout << fixed << setprecision(10);
        cout << (double)((n+1)/2)/n ENDL;
    }
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

const int MAX_N = (int)1e5 + 5;
const lint MOD = (lint)1e9 + 7;
int dist[MAX_N];
int N, K;
lint fact[MAX_N], fact_inv[MAX_N];
vector<int> G[MAX_N];

lint bfs(int s){
    dist[s] = 0;
    lint res = 1;
    queue<pii> q;
    q.push(pii(s, K));
    while(!q.empty()){
        int r = q.front().first;
        lint c = q.front().second, x = max(K-dist[r]-1, K-2);
        q.pop();
        res = res * c % MOD;
        for(auto u : G[r]){
            if(dist[u]==-1){
                dist[u] = dist[r] + 1;
                q.push(pii(u, x--));
            }
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    cin>>N>>K;
    for(int i=0;i<N-1;i++){
        int a, b;
        cin>>a>>b, a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i=0;i<N;i++)dist[i] = -1;
    cout<<bfs(0)<<endl;
    return 0;
}

Measured memory_bytes: 8952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//输入
		int N = sc.nextInt();
		int[] arr = new int[N];
		for(int i=0;i<arr.length;i++)
		{
			arr[i]=sc.nextInt();
		}
		
		for(int a=0;a<arr.length;a++)
		{
			if(a==arr.length-1)
			{
				System.out.print(arr[a]);
			}
			else
			{
				System.out.print(arr[a]+" ");
			}
		}
		
		System.out.println();
		
		insertionSort(arr);
		
	}
	
	public static void insertionSort(int[] arr)
	{
		int i,j,v;
		for(i=1;i<arr.length;i++)
		{
			v = arr[i];  //取出未排序的
			j = i-1;  //已排序的最后一个
			while(j>=0&&arr[j]>v) //已排序中大于
			{
				arr[j+1] = arr[j];
				j--;
			}
			
			arr[j+1] = v;
			
			for(int a=0;a<arr.length;a++)
			{
				if(a==arr.length-1)
				{
					System.out.print(arr[a]);
				}
				else
				{
					System.out.print(arr[a]+" ");
				}
			}
			
			System.out.println();
			
		}
		
	}
}



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

int main(){
    int n;
    cin >> n;
    int ans=0;
    ans = n%10;
    if(ans==2||ans==4||ans==5||ans==7||ans==9){
        cout << "hon" << endl;
    }
    else if(ans==0||ans==1||ans==6||ans==8){
        cout << "pon" << endl;
    }
    else if(ans==3){
        cout << "bon" << endl;
    }
    return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  string s;cin>>s;
  int a=700;
  rep(j,0,3){
    if(s[j]=='o')a+=100;
  }
  cout<<a<<endl;
}


Measured memory_bytes: 256
#define NDEBUG
#include <cassert>

template <class Monoid, template <class> class Container> class segment_tree {
public:
	using value_structure = Monoid;
	using value_type = typename value_structure::value_type;
	using container_type = Container<value_type>;
	using const_reference = typename container_type::const_reference;
	using size_type = typename container_type::size_type;

private:
	size_type size_, capacity;
	container_type c;
	static size_type getsize(const size_type size) {
		size_type ret = 1;
		while (ret < size)
			ret <<= 1;
		return ret;
	}
	void recalc(const size_type index) {
		c[index] = value_structure::operation(c[index << 1], c[index << 1 | 1]);
	}

public:
	segment_tree() : size_(0), capacity(0), c() {}
	explicit segment_tree(const size_type size)
		: size_(size), capacity(getsize(size_)),
		c(capacity << 1, value_structure::identity()) {}

	bool empty() const { return !size_; }
	size_type size() const { return size_; }

	const_reference operator[](const size_type index) const {
		assert(index < size());
		return c[index + capacity];
	}
	value_type fold(size_type first, size_type last) const {
		assert(first <= last);
		assert(first <= size());
		assert(last <= size());
		value_type ret_l = value_structure::identity(),
			ret_r = value_structure::identity();
		for (first += capacity, last += capacity; first < last;
			first >>= 1, last >>= 1) {
			if (first & 1)
				ret_l = value_structure::operation(ret_l, c[first++]);
			if (last & 1)
				ret_r = value_structure::operation(c[last - 1], ret_r);
		}
		return value_structure::operation(ret_l, ret_r);
	}
	template <class F> size_type search(const F &f) const {
		if (f(value_structure::identity()))
			return 0;
		if (!f(c[1]))
			return size() + 1;
		value_type acc = value_structure::identity();
		size_type i = 1;
		while (i < capacity)
			if (!f(value_structure::operation(acc, c[i <<= 1])))
				acc = value_structure::operation(acc, c[i++]);
		return i - capacity + 1;
	}

	void update(size_type index, const value_type &value) {
		assert(index < size());
		index += capacity;
		c[index] = value;
		while (index >>= 1)
			recalc(index);
	}
};

#include <algorithm>
#include <limits>
template <class T> class min_monoid {
public:
	using value_type = T;
	static value_type operation(const value_type &x, const value_type &y) {
		return ::std::min(x, y);
	}
	static value_type identity() {
		return 2147483647;
	}
	static value_type reverse(const value_type &x) { return x; }
};

#include <cstdio>
#include <vector>

template<class T> using vec_alias = ::std::vector<T>;

int main() {
	using uint = unsigned int;

	uint n, q;
	scanf("%u%u", &n, &q);

	segment_tree<min_monoid<uint>, vec_alias> seg(n);

	while (q--) {
		uint c, x, y;
		scanf("%u%u%u", &c, &x, &y);

		if (c)
			printf("%u\n", seg.fold(x, y + 1));
		else
			seg.update(x, y);
	}

	return 0;
}



Measured memory_bytes: 3392
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	even, odd := make(map[int]int), make(map[int]int)
	e, o := 0, 0
	for i := 0; i < n; i++ {
		var k int
		fmt.Scan(&k)
		if i % 2 == 0 {
			o++
			odd[k] = odd[k] + 1
		} else {
			e++
			even[k] = even[k] + 1
		}
	}
	pair1, pair2 := make(PairList, 0), make(PairList, 0)
	pair1, pair2 = append(pair1, Pair{0, 0}), append(pair2, Pair{0, 0})
	for k, v := range even {
		pair1 = append(pair1, Pair{k ,v})
	}
	for k, v := range odd {
		pair2 = append(pair2, Pair{k ,v})
	}
	sort.Sort(pair1); sort.Sort(pair2)
	if pair1[0].Key != pair2[0].Key {
		fmt.Println(e - pair1[0].Value + o - pair2[0].Value)
	} else {
		v1, v2 := e - pair1[1].Value + o - pair2[0].Value, e - pair1[0].Value + o - pair2[1].Value
		if v1 > v2 {
			fmt.Println(v2)
		} else {
			fmt.Println(v1)
		}
	}
}

type Pair struct {
	Key int
	Value int
}

type PairList []Pair

func (p PairList) Len() int { return len(p) }
func (p PairList) Less(i, j int) bool { return p[i].Value > p[j].Value }
func (p PairList) Swap(i, j int){ p[i], p[j] = p[j], p[i] }


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

int main(){
  int a, b;
  string s;
  cin >> a >> b;
  
  if (a <= 8 && b <= 8){
    s = "Yay!";
  } else{
    s = ":\(";
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


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

    string s; cin >> s;
    string t; cin >> t;

    int ans = 0;
    for(int i=0; i<3; ++i) if(s[i] == t[i]) ++ans;

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}


int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,n,m,k,x,y=0,ans=1;
    string str,s="",t,u;
    int a1,a2,a3,a4,a5;
    for (int i = 0; i < 5; ++i) {
        cin>>a;
        if(a==0){cout<<i+1;
        return 0;}
    }




    cout<<endl;
    return 0;
}




Measured memory_bytes: 3648
alpha = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

while 1:
    n = int(input())
    if n == 0:
        break
    K = list(map(int, input().split()))
    S = list(input())

    ans = ""
    for i, s in enumerate(S):
        diff = K[i % len(K)]
        if diff <= 0:
            num = 52 + diff
        else:
            num = diff
        ans += alpha[alpha.index(s)-num]

    print(ans)



Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> D(N-1+1);
	map<ll, ll> m;
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&D[i]);
		m[D[i]]++;
	}
	if (m[0] != 1 || D[0] != 0) {
		cout << "0" << endl;
		return 0;
	}
	ll res = 1;
	rep(i, N-1) {
		rep(j, m[i+1]) {
			res = (res*m[i])%mod;
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 7296
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << n*n*n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

// 1. 各行の左端から順に見ていく。
// 1. 奇数なら右に1つ移す
// 1. 最後以外はすべて偶数にできる
// 1. 最後の列に同様の処理を行う

int main() {
  IN(H);
  IN(W);

  vector<vector<int>> A(H, vector<int>(W, 0));
  REP(i, H) {
    REP(j, W) {
      cin >> A[i][j];
    }
  }
  int n = 0;
  stringstream ans;
  REP(i, H) {
    REP(j, W-1) {
      if (A[i][j] % 2 == 1) {
        ans << i+1 << " " << j+1 << " " << i+1 << " " << j+2 << endl;
        ++n;
        --A[i][j];
        ++A[i][j+1];
      }
    }
  }
  REP(i, H-1) {
    if (A[i][W-1] % 2 == 1) {
        ans << i+1 << " " << W << " " << i+2 << " " << W << endl;
        ++n;
        --A[i][W-1];
        ++A[i+1][W-1];
    }
  }
  OUT(n);
  OUT(ans.str());

  return 0;
}


Measured memory_bytes: 6920
import sys
from heapq import heapify, heappop, heappush
from collections import defaultdict
finput=lambda :sys.stdin.readline().strip()

def main():
    n,a,b=map(int,finput().split())
    h=[int(finput()) for _ in range(n)]
    gs=lambda a,b:a//b+(a%b>0)
    def enough(t):
        s=sum([gs(max(x-t*b,0),a-b) for x in h])
        if s<=t:
            return True
        else:
            return False
    l=max(h)//b+1
    t=0
    while l>0:
        t=t+l//2
        if enough(t):
            t=t-l//2
            l=l//2
        else:
            t+=1
            l=l-l//2
    print(t)

if __name__=='__main__':
    main()



Measured memory_bytes: 17272
import java.io.*;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next();
        String t = fs.next();
        int a = fs.nextInt();
        int b = fs.nextInt();
        String u = fs.next();

        System.out.print( u.equals(s) ? a - 1 : a );
        System.out.print(" ");
        System.out.print( u.equals(t) ? b - 1 : b );

    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

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


Measured memory_bytes: 21204
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
int cucut=3000;
int sqcut=100010;
set<ll> sqofp;
ll a[111111];
int primechk[101000];
ll norm[111111];
ll part[111111];
map<pair<ll, ll>, int> fin;
ll ans;
bool exist1;
int n;

void preprocess(void)
{
	ll i;
	for(i=2 ; i<=sqcut ; i++)
	{
		primechk[i]=1;
	}
	ll j;
	for(i=2 ; i<=sqcut ; i++)
	{
		if(primechk[i]==1)
		{
			sqofp.insert(i*i);
			for(j=2 ; i*j<=sqcut ; j++)
			{
				primechk[i*j]=0;
			}
		}	
	}
}

ll getnorm(ll x)
{
	ll i;
	for(i=2 ; i<=cucut ; i++)
	{
		if(primechk[i]==1)
		{
			while(x%(i*i*i)==0)
			{
				x=x/(i*i*i);
			}
		}
	}
	return x;
}

ll getpart(ll x)
{
	ll temp=x;
	ll ret=1;
	for(ll i=2 ; i*i*i<=temp; i++)
	{
		int cnt=0;
		if(primechk[i]==1)
		{
			while(x%i==0)
			{
				x=x/i;
				cnt++;
			}
			if(cnt%3==1)
			{
				ret*=(i*i);
			}
			else if(cnt%3==2)
			{
				ret*=i;
			}
		}
	}
	if(sqofp.lower_bound(x)==sqofp.upper_bound(x))
	{
		ret*=(x*x);
	}
	else
	{
		ret*=(ll)sqrt(x);
	}
	return ret;
}

int main(void)
{
	//freopen("15.txt","r",stdin);
	cin>>n;
	int i, j;
	preprocess();
	for(i=1 ; i<=n ; i++)
	{
		scanf("%lld",&a[i]);
		norm[i]=getnorm(a[i]);
		part[i]=getpart(a[i]);
		if(part[i]==1 && exist1==false)
		{
			ans++; exist1=true;
		}
		else if(part[i]!=1)
		{
			fin[make_pair(part[i],norm[i])]++;
		}
	}
	for(map<pair<ll,ll>, int>::iterator it1=fin.begin() ; it1!=fin.end() ; it1++)
	{
		map<pair<ll,ll>, int>::iterator it2=fin.find(make_pair(it1->first.second,it1->first.first));
		if(it2==fin.end()) ans+=it1->second;
		else if(it1->second==it2->second)
		{
			if(it1->first.first>it2->first.first)
			{
				ans+=it1->second;
			}
		}
		else if(it1->second>it2->second)
		{
			ans+=it1->second;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 9852