akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n;
  cin >> n;
  int64_t cnt = 0;
  for(int i=1;i <= n;i++){
    int64_t c = 0;
    for(int j=1;j <= i;j++){
      if(i % j == 0){
        c++;
      }
    }
    if(c == 8 && i % 2 == 1 ){
      cnt++;
      //cout << i << endl;
    }
  }
  cout << cnt << endl;
    
    
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng (chrono::steady_clock::now().time_since_epoch().count() );

const int MOD = 998244353;
const ll INF = 1e18;
const int N = 1e6 + 12; //check the limits, dummy


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

    ll n;
    cin >> n;
    ll ans = 0;
    FOR (i, 1, n) {
        if (i != n - i && (i && (n - i) ) ) ans++;
    }
    cout << ans / 2 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int N,K;
    char S[10],temp;

    scanf("%d",&N);
    scanf("%s",&S);
    scanf("%d",&K);
    temp = S[K-1];

    for(int i = 0; i < N; i++){
        if(S[i] != temp){
            S[i] = '*';
        }
    }

    printf("%s",S);

    return 0;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())
a = list(map(int, input().split()))

cost_to_l = 0
cost_to_r = 0

for x in a:
    if(x < X):
        cost_to_l += 1
    else:
        cost_to_r += 1

print(min(cost_to_l, cost_to_r))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ALL(a) a.begin(),a.end()


int main(){
    int n;
    cin>>n;
    vector<long long int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(ALL(a));
    vector<long long int> pos(n);
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            pos.push_back(a[i]);
            i++;
        }
    }

    if(pos.size()>=2){
        cout<<pos[pos.size()-1]*pos[pos.size()-2]<<endl;
    }
    else{
        cout<<0<<endl;
    }

    
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    
	int N;
	int m = scanf("%d",&N);
	if (m == EOF) {
		printf("scan error!\n");
		return 0;
	}

	int* H;
	H = calloc(N, sizeof(int));

	for (int i = 0; i < N; i++) {
		int input;
		int m2 = scanf("%d", &input);
		if (m2 == EOF) {
			printf("scan error!\n");
			return 0;
		}
		H[i] = input;
	}


	int max = 0;
	int next = 1;
	int hantei = 0;
	for (int i = 0; i < N; i++) {
		if (max < H[i]) {
			max = H[i];
		}
		else if (H[i] < max - 1) {
			hantei = 1;
			printf("No\n");
			return 0;
		}

	}
	printf("Yes\n");

	
	
	free(H);
	return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    llint n, c, k;
    cin >> n >> c >> k;
    string s;
    cin >> s;

    list<int> l;
    list<int> r;
    for(int in=1;in<=n;in++) {
        if(s[in-1]=='o') {
            l.push_back(in);
            in += k;
        }
    }
    int cnt=0;
    for(int in=n;in>=1;in--) {
        if(s[in-1]=='o') {
            r.push_front(in);
            in -= k;
            cnt++;
        }
        if(cnt==c) break;
    }
    int cmax = min(l.size(), r.size());
    auto itrl = l.begin();
    auto itrr = r.begin();
    for(int ic=0;ic<cmax;ic++) {
        if(*itrl==*itrr) cout << *itrl << endl;
        itrl++;
        itrr++;
    }
    return 0;
}


Measured memory_bytes: 16032
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
	
	int n,m,x; cin>>n>>m>>x;
	int cnt = 1e9;
	vector c(n,0);
	vector a(n,vector(m,0));
	for(int i=0; i<n; i++){
		cin >> c.at(i);
		for(int j=0; j<m; j++){
			cin >> a.at(i).at(j);
		}
	}
	for(int i=0; i<(1<<n); i++){
		int sum{};
		vector ri(m,0);
		for(int j=0; j<n; j++){
			if(i&(1<<j)){
				sum += c.at(j);
				for(int k=0; k<m; k++){
					ri.at(k) += a.at(j).at(k);
				}
				
			}
		}
		bool flg = 1;
		for(int k=0; k<m; k++){
			if(ri.at(k)<x) flg = 0;
		}
		if(flg){
			cnt = min(cnt, sum);
		}
	}
	if(cnt>1e8) cnt = -1; 
	cout << cnt << endl;
}


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

int main() {
  int n;cin>>n;
  vector<int> a(n+1); for(int i=1;i<=n;i++) cin>>a[i];
  int count=0;
  for(int i=1;i<=n;i++){
  	if(i==a[a[i]]) count++;
  }
  cout<<count/2<<endl;
}

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


int bipartiteMatching(const vector<vector<int> > &g) {  //g: left side
	int nleft = g.size(), nright = 0;
	for (auto es = g.begin(); es != g.end();es++) if (!es->empty()) nright = max(nright, *max_element(es->begin(), es->end()) + 1);
	vector<int> matchL(nleft, -1), matchR(nright, -1), prev(nleft), seen(nleft, -1);
	for (int i = 0; i < nleft; i++) {
		vector<int> stk; stk.push_back(i);
		seen[i] = i; prev[i] = -1;
		while (!stk.empty()) {
			int v = stk.back(); stk.pop_back();
			for (auto ui = g[v].begin(); ui != g[v].end();ui++) {
				int u = *ui;
				int j = matchR[u];
				if (j == -1) {
					while (v != -1) {
						matchR[u] = v;
						swap(u, matchL[v]);
						v = prev[v];
					}
					goto break_;
				}
				else if (seen[j] < i) {
					seen[j] = i; prev[j] = v;
					stk.push_back(j);
				}
			}
		}
	break_:;
	}
	return (int)matchL.size() - count(matchL.begin(), matchL.end(), -1);
}

#define MAX 10000002

int n;

bool use[MAX];

vector<int> v[2];


set<int> s;

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		s.insert(x);
	}
	for (auto it = s.begin(); it != s.end();it++){
		int ich = (*it);
		if (s.count(ich - 1)==0){
			v[(ich - 1) & 1].push_back(ich - 1);
		}
		if (s.count(ich + 1)==0){
			v[ich & 1].push_back(ich);
		}
	}
	for (int i = 2; i < MAX; i++){
		if (use[i] == false){
			for (int j = i * 2; j < MAX; j+=i){
				use[j] = true;
			}
		}
	}
	use[0] = use[1] = use[2] = true;
	vector<vector<int> > g(v[0].size());
	for (int j = 0; j < v[0].size(); j++){
		for (int k = 0; k < v[1].size(); k++){
			if (!use[abs(v[1][k] - v[0][j])]){
				g[j].push_back(k);
			}
		}
	}
	int num = bipartiteMatching(g);
	int f = ((v[0].size() - num) / 2)*2;
	f += num;
	f += ((v[1].size() - num) / 2) * 2;
	if ((v[0].size()-num) & 1){
		if ((v[1].size() - num) % 2 == 0){
			return 1;
		}
		f += 3;
	}
	else{
		if ((v[1].size() - num) & 1){
			return 1;
		}
	}
	cout << f << endl;
	return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> P(N),Q(N),R(N);
  for(int i=0;i<N;i++){
    cin >> P[i];
  }
  for(int i=0;i<N;i++){
    cin >> Q[i];
  }
  for(int i=0;i<N;i++){
    R[i] = i+1;
  }
  int p,q,i=0;
  do{
    if(R==P){
      p =i;
    }
    if(R==Q){
      q=i;
    }
    i++;
  }while(next_permutation(R.begin(),R.end()));
  cout << abs(p-q) << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
 
int n,m,ans;
int main(){
    scanf("%d%d",&n,&m);
    while(n){
        n/=m;
        ans++;
    }
    printf("%d",ans);
}

Measured memory_bytes: 128
#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 N = 100005;

int n, m, v, p, a[N];

ll cum[N];

int main() {
  cin >> n >> m >> v >> p;
  rep(i, n) cin >> a[i];
  sort(a, a + n, greater<int>());
  cum[0] = 0;
  rep(i, n) cum[i+1] = cum[i] + a[i];
  int ans = 0;
  rep(ai, n) {
    if (ai < p) {
      ans++;
      continue;
    }
    int na = a[ai] + m;
    if (a[p-1] > na) continue;
    if (v < p) {
      ans++;
      continue;
    }
    if ((ll)na * (ai-p+1) - cum[ai] + cum[p-1] < (ll)m * max(0, v-p-n+ai+1)) continue;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4808
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int x = scanner.nextInt();
			int[] l = new int[n];
			IntStream.range(0, n).forEach(i -> l[i] = scanner.nextInt());
			int sum = 0;
			int i = 0;
			for (i = 0; i < n; i++) {
				sum += l[i];
				if (sum > x) {
					break;
				}
			}
			System.out.println(i + 1);
		}
	}
}


Measured memory_bytes: 26964
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
# A = sorted(list(map(int, input().split())), reverse=True)
# B = sorted(list(map(int, input().split())), reverse=True)
# C = sorted(list(map(int, input().split())), reverse=True)

AB = []
ABC = []
for b in B:
    for a in A:
        AB.append(a+b)
AB.sort(reverse=True)
AB = AB[:K+1]
# AB = AB[:min(3001, X*Y*Z+1)]

for c in C:
    for ab in AB:
        ABC.append(ab+c)
ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])

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

using namespace std;

int main()
{

	int n;
	cin >> n;
	vector<int> v(n);
	int ans = 0;
	for (auto& x : v)
	{
		cin >> x;
		if (x == ans+1) ans++;
	}
	ans = n - ans;
	if (ans == n) ans = -1;
	cout << ans << endl;

	return 0;
}

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


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


int main() {
	ll a;
	string s;
	cin >> a >> s;
	if (a >= 3200)cout << s << endl;
	else cout << "red" << endl;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl


int main() {
    IN(int, n);
    IN(int, y);
    REP(i, n+1){
        REP(j, n-i+1){
            int k = n-j-i;
            if (i*10000+j*5000+k*1000 == y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    COUT("-1 -1 -1");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [[[0 for i in range(10)]for i in range (3)]for i in range(4)]
for i in range(n):
    b,f,r,v = map(int,input().split())
    a[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {a[i][j][k]}",end = "")
        print()
    if i < 3:
        print("####################")
    else:
        pass


Measured memory_bytes: 5636
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

vector<bool> ERATOSTEHES(int N) {
    vector<bool> ret(N + 1, true);
    ret[0] = ret[1] = false;
    for (int i = 2; i * i <= N; i++) {
        if (ret[i]) {
            for (int j = i + i; j < N; j += i) {
                ret[j] = false;
            }
        }
    }
    return ret;
}

int main() {

    int N;
    cin >> N;

    auto primes = ERATOSTEHES(600000);

    vector<int> a;
    for (int i = 0; i < primes.size(); i++) {
        if (primes[i]) {
            int d = i;
            if (d % 10 == 1) a.push_back(i);
        }
    }

    for (int i = 0; i < N; i++) cout << a[i] << " ";

    return 0;
}








































Measured memory_bytes: 384
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		int[][][] room = new int[4][3][10];
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n_input = Integer.parseInt(br.readLine());
		
		for (int i = 0; i < n_input; i++) {
			String[] sz_line = (br.readLine()).split(" ");
			int block = Integer.parseInt(sz_line[0]) -1;
			int floor = Integer.parseInt(sz_line[1]) -1;
			int room_number = Integer.parseInt(sz_line[2]) -1;
			
			room[block][floor][room_number] += Integer.parseInt(sz_line[3]);
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + room[i][j][k]);
				}
				System.out.println();
			}
			if (i < 3) {
				System.out.println("####################");
			}
		}
	}
}

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

int main() {
	int d;
	cin >> d;
	if (d == 25) cout << "Christmas" << endl;
	else if (d == 24) cout << "Christmas Eve" << endl;
	else if (d == 23) cout << "Christmas Eve Eve" << endl;
	else cout << "Christmas Eve Eve Eve" << endl;

}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

C = [0] * N 
C[0] = A[0] + sum(B)
for i in range(1,N):
    C[i] = C[i-1]+A[i]-B[i-1]
print(max(C))


Measured memory_bytes: 9064
import java.io.BufferedReader;
		import java.io.IOException;
		import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int num = Integer.parseInt(br.readLine());
		
		System.out.println(num*num*3);
	}
}


Measured memory_bytes: 21332
#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>;

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1), b(n);
    ll sum = 0;
    rep(i,n+1){
        cin >> a[i];
        sum += a[i];
    }
    rep(i,n) cin >> b[i];

    rep(i,n){
        if(b[i] >= a[i]){
            b[i] -= a[i];
            a[i] = 0;
            a[i+1] = max(a[i+1]-b[i], 0);
        }
        else{
            a[i] -= b[i];
        }
    }
    
    ll cnt = 0;
    rep(i,n+1) cnt += a[i];
    cout << sum - cnt << endl;  
}

Measured memory_bytes: 4016
use std::io::*;
use std::str::FromStr;

fn gcd(a: usize, b: usize) -> usize {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    println!("{}", a * b / gcd(a, b));
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  
  if(a == b) printf("%d\n",a);
  else if((a+b)%2 == 0) printf("%d\n",(a+b)/2);
  else printf("%d\n",(a+b)/2+1);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int n;
vector<int> v;
queue<int> q;
bool visit[100010];
void build()
{
	int t=6;
	while (t<=n)
	{
		v.push_back(t);
		t*=6;
	}
	t=9;
	while (t<=n)
	{
		v.push_back(t);
		t*=9;
	}
}
int main()
{
	cin >>n;
	v.push_back(1);
	build();
	q.push(0);
	q.push(0);
	q.push(0);
	while (!q.empty())
	{
		int x=q.front(); q.pop();
		int y=q.front(); q.pop();
		int z=q.front(); q.pop();
		if (x==n)
		{
			cout <<y;
			return 0;
		}
		for (int i=z;i<v.size();i++)
		{
			int xi=v[i];
			if (x+xi>n) continue;
			q.push(x+xi);
			q.push(y+1);
			q.push(i);
		}
	}
	return 0;
} 

Measured memory_bytes: 37448
import bisect
n = int(input())
l = list(map(int, input().split()))

def meguru_nibutan(ar,m,key):
    a = m
    b = len(ar)
    while(abs(a-b) > 1):
        c = (a+b)//2
        if (ar[c] > key):
            a = c
        else:
            b = c
    return a

def main():
    cnt = 0
    l.sort()
    for a in range(0,n-2):
        for b in range(a+1,n-1):
            #cnt += meguru_nibutan(l,b,l[a]-l[b]) - b
            cnt += bisect.bisect_left(l,l[a]+l[b]) - 1 - b
    print(cnt)

if (__name__ == "__main__"):
    main()

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

int main(){
    int x,y,buf;
    
    for(int i=0; ;i++){
        scanf("%d %d",&x,&y);
        if(x==0 && y==0)break;
        if(x>y){
            buf=x;
            x=y;
            y=buf;
        }
        cout<<x<<" "<<y<<endl;
    }
    
    return 0;
}


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

using namespace std;
int main(){
    long long A,B,C,D,E,K;
    vector<long long > X(5);

for(auto &x:X){
    cin>>x;

}
    cin>>K;

    for(int i=0;i<4;++i){
        for(int k=i+1;k<5;++k){ 
            if(abs(X[i]-X[k])>K){
                cout<<":("<<endl;
                return 0;
            }
    }
    }

    cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MOD = 1e9+7;
const int MAX = 2002;
int N, pd[MAX];

int solve(int m) {
	if(!m) return 1;
	if(pd[m] != -1) return pd[m];
	pd[m] = 0;
	REP(i, 3, m) pd[m] = (pd[m]+solve(m-i))%MOD;
	return pd[m];
}

int main(int argc, char** argv) {
	scanf("%d", &N);
	memset(pd, -1, sizeof pd);
	printf("%d\n", solve(N));
	return 0;
}


Measured memory_bytes: 3816
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int llui_t;
typedef long long int lli_t;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

/* inputs */
llui_t N, Y;
vector<llui_t> X;

int main() {
    cin >> N;
    cin >> Y;

    for(llui_t i=0; i<=N; i++) {
        for(llui_t j=0; j<=N-i; j++) {
            llui_t k = N - i - j;
            llui_t s = i * 10000 + j * 5000 + k * 1000;
            if(s == Y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

ll sum_all[128000];
ll sum_pos[128000];

void solve(ll N, ll K, const vector<ll> &a) {
  REP(i,N) sum_all[i+1] = sum_all[i] + a[i];
  REP(i,N) sum_pos[i+1] = sum_pos[i] + max(0LL, a[i]);
  ll res = 0;
  REP(i,N-K+1) {
    const int l = i, r = i + K;
    ll sum = 0;
    sum += max(0LL, sum_all[r] - sum_all[l]);
    sum += sum_pos[l] - sum_pos[0];
    sum += sum_pos[N] - sum_pos[r];
    chmax(res, sum);
  }
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll K;
	ll N;
	scanf("%lld", &N);
	vector<ll> a(N-1+1);
	scanf("%lld", &K);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &a[i]);
	}
	solve(N, K, a);
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(void){
  int d;
  cin>>d;
  if(d==25)cout<<"Christmas"<<endl;
  if(d==24)cout<<"Christmas Eve"<<endl;
  if(d==23)cout<<"Christmas Eve Eve"<<endl;
  if(d==22)cout<<"Christmas Eve Eve Eve"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main()
{
	ll N;
	cin >> N;

	vector<ll> h(N);

	for (ll i = 0; i < N; ++i)
	{
		cin >> h[i];
	}
	ll cnt = 0;

	cnt += *min_element(h.begin(), h.end());

	for (ll i = 0; i < N; ++i)
	{
		h[i] -= cnt;
	}

	while (true)
	{
		ll l_idx = -1;
		ll r_idx = N - 1;

		for (ll i = 0; i < N; ++i)
		{
			if (h[i] > 0)
			{
				l_idx = i;
				break;
			}
		}

		if (l_idx == -1)
		{
			break;
		}

		for (ll i = l_idx; i < N; ++i)
		{
			if (h[i] < 1)
			{
				r_idx = i - 1;
				break;
			}
		}

		for (ll i = l_idx; i < r_idx + 1; ++i)
		{
			--h[i];
		}

		++cnt;
	}

	cout << cnt << endl;
}

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

int main(){
int w,a,b;
  cin>>w>>a>>b;
  
  if(b>a+w){cout<<b-a-w<<endl;}
  else if(a+w>=b && b+w>=a){cout<<0<<endl;}
  else{cout<<a-b-w<<endl;}                          
}

Measured memory_bytes: 256
// susheel_7
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f 
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long int
#define pi 3.14159265358979
int main() 
{
    ll n,m,b,c,p,q,x,y,z,i,j,k,ans=0,count=0,flag=0;
   ll count1=0,count2=0,count3=0,count4=0;
    ll a[n+5];
    cin>>n;
    for(i=0;i<n;i++)
    {
    	string v;
    	cin>>v;
    	if(v[0]=='A')
    	count1++;
    	else if(v[0]=='W')
    	count2++;
    	else if(v[0]=='T')
    	count3++;
    	else 
    	count4++;
    }
    for(i=0;i<n;i++)
    {
    	
    }
    cout<<"AC"<<" "<<"x"<<" "<<count1<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<count2<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<count3<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<count4<<endl;
    
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define ar array
#define endl '\n'

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 4*1e18;

void pre(){

}

void solve(){    
    
    char ch;
    cin >> ch;
    if(ch >= 'a' and ch <= 'z'){
        cout << 'a';
    }else{
        cout << 'A';
    }
    
}


int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin >> T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;    
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
#define PI 3.1415926535897932384626433832795
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define trav(x,v) for (auto &x : v)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pv(v) trav(x, v) cout << x << " "; cout << endl; // print vector/array
#define pvv(vv) trav(xx, vv){pv(xx);} // print 2-d vector/2-d array
#define pm(m) trav(x, m) cout << x.F << ":" << x.S << " "; cout << endl; //print map/lookup table

const int MOD = 1000000007;

string solve(string s1, string s2){
    int n = s1.length();
    int m = s2.length();

    int dp[n+1][m+1];
    F0R(i,n) dp[i][0] = 0;
    F0R(i,m) dp[0][i] = 0;
    FOR(i, 1, n+1){
        FOR(j, 1, m+1){
            if(s1[i-1] == s2[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    string ans = "";
    int i = n, j = m;
    while(i>0 && j>0){
        if(s1[i-1] == s2[j-1]){
            ans += s1[i-1];
            i--;
            j--;
        }
        else{
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }
    }
    reverse(ans.begin(), ans.end()); 
    return ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s1,s2;
    cin >> s1 >> s2;
    cout << solve(s1, s2);
    return 0;
}

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

using namespace std;
const int N = 3e5 + 3;
int n, a[N];
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	scanf("%d", &n);
	multiset<int> st;
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
		st.insert(a[i]);
	}
	for (int i = 0; i < n; ++i) {
		st.erase(st.find(a[i]));
		printf("%d\n", *--st.end());
		st.insert(a[i]);
	}
	return 0;
}

Measured memory_bytes: 11776
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
#define rep(i,N) for(int i=0;i<(int)N;++i)
//cout << fixed << setprecision(20) << *** << endl;
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
	ll t;
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	if(a%b==0)return b;
	return gcd(b,a%b);
}
int main()
{
	ll N,F=0,ANS=1;
	vector<ll>vec;
	cin>>N;
	rep(i,N){
		ll t;
		cin>>t;
		vec.push_back(t);
	}
	sort(vec.begin(),vec.end());
	if(vec[0]==0){
		cout<<"0"<<endl;
	}
	else{
		rep(i,N){
			if(ANS<=1000000000000000000/vec[i]){
				ANS=ANS*vec[i];
			}
			else{
				F=1;
				break;
			}
		}
		if(F==0){
			cout<<ANS<<endl;
		}
		else{
			cout<<"-1"<<endl;
		}
	}
}

Measured memory_bytes: 3876
#include<stdio.h>

int isPrime(int a){int i;for(i=2; i*i<=a; i++) if(a%i==0) return 0; return (a>1?1:0);}

int main(){
  int n, i, ans=0;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    int num;
    scanf("%d",&num);
    ans += isPrime(num);
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  int n, y, a=-1, b=-1, c=-1;
  cin >> n >> y;
  for(int i = 0; i <= n; i++){
    for(int j = 0; i+j <= n; j++){
      if(10000*i + 5000*j + 1000*(n-j-i) == y){
        a=i;b=j;c=(n-i-j);
      }
    }
  }
  cout << a << " " << b << " " << c;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  int ans = 0;
  rep(i, N) {
    if(i%2 == 0 && a[i]%2 == 1) ans++;
  }
  cout << ans << endl;

}

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

using namespace std;

#define rep(i,x) for(int i=0;i<x;++i)
#define fst first
#define scd second
#define PB push_back

using data=tuple<int,int,int>;
using P=pair<int,data>;

const int inf = 1e9;

struct edge{int to,cost;};
vector<edge> G[10010];

int d[10010][2][205];

int n,m,x;
int t[10010];

signed main()
{
    cin>>n>>m>>x;

    rep(i,n){
        cin>>t[i];
        if (t[i]==1)t[i]=2;
        else if (t[i]==2)t[i]=1;
    }

    rep(i,m) {
        int a,b,d;cin>>a>>b>>d;
        --a,--b;
        G[a].PB(edge{b,d});
        G[b].PB(edge{a,d});
    }

    priority_queue<P,vector<P>,greater<P>> q;

    rep(i, n) rep(j, 2) rep(k, 205) d[i][j][k] = inf;
    d[0][0][0] = 0;

    q.push(P(0, data(0, 0, 0)));

    while (q.size()) {
        P p = q.top(); q.pop();

        int dist = p.fst;
        int v, type, tim;
        tie(v,type,tim) = p.scd;

        if (d[v][type][tim] < dist) continue;

        if (v == n-1) {
            cout << dist << endl;
            return 0;
        }

        for (edge &e : G[v]) {
            if (t[e.to] == 2) {
                int ntim = min(x, tim+e.cost);
                if (d[e.to][type][ntim] > d[v][type][tim] + e.cost) {
                    d[e.to][type][ntim] = d[v][type][tim] + e.cost;
                    q.push(P(d[e.to][type][ntim], data(e.to, type, ntim)));
                }
            } else {
                if (type != t[e.to] && tim + e.cost < x) continue;
                if (d[e.to][t[e.to]][0] > d[v][type][tim] + e.cost) {
                    d[e.to][t[e.to]][0] = d[v][type][tim] + e.cost;
                    q.push(P(d[e.to][t[e.to]][0], data(e.to,t[e.to],0)));
                }
            }
        }
    }
}

Measured memory_bytes: 20112
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <deque>
 
using namespace std;
 
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MOD 1000000007
 
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;
 
deque<pi>vec, a, b, c;
int N, M, P, Q, R;
 
int cnt(int p, int q, int r){
  if(p > r) return 0;
  if(r >= q) return q-p+1;
  return r-p+1;
}
 
int countR(int p, int q, int r){
  int n = 1, vp, res = 0;
  for(vp=0;vp<vec.size();vp++){
    int f = vec[vp].F, l = vec[vp].S;
    int c = l-f+1;
    if(n <= p){
      if(n+c < p){
      }
      else if(n + c > q){
    res += cnt(f+p-n, f+q-n, r);
      }else{
    res += cnt(f+p-n, l, r);
      }
      n += c;
    }else if(n <= q){
      if(n+c<=q){
    res += cnt(f, l, r);
      }else{
    res += cnt(f, f+q-n, r);
      }
      n += c;
    }
  }
  return res;
}
 
 
int main(){
  while(1){
    cin >> N;
    if(!N) break;
    cin >> M >> P >> Q >> R;
    vec.clear();
    vec.push_back(MP(1,N));
    int x, y;
    rep(i, M){
      cin >> x >> y;
      a.clear(); b.clear();
      int p=1;
      while(p<=x){
    int f = vec[0].F, s = vec[0].S;
    if(p+s-f<=x){
      a.push_back(MP(f,s));
      p += s-f+1;
      vec.pop_front();
    }else if(p+s-f>x){
      a.push_back(MP(f, f+x-p));
      vec[0].F = f+x-p+1;
      p = x+1;
    }
      }
      while(p<=y){
    int f = vec[0].F, s = vec[0].S;
    if(p+s-f<=y){
      b.push_back(MP(f, s));
      p += s-f+1;
      vec.pop_front();
    }else if(p+s-f>y){
      b.push_back(MP(f, f+y-p));
      vec[0].F = f+y-p+1;
      p = y+1;
    }
      }
 
      vec.insert(vec.end(), b.begin(), b.end());
      vec.insert(vec.end(), a.begin(), a.end());
 
    }
 
 
    /*    rep(i, vec.size()){
      for(int j=vec[i].F;j<=vec[i].S;j++) cout << j << endl;;
      }*/
    cout << countR(P, Q, R) << endl;
  }
}


Measured memory_bytes: 3272
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<climits>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<set>
#include<stack>
#include<functional>
#include<queue>
using namespace std;
#define int long long

signed main(){
    int N,T[10000];
    while(cin>>N,N){
        for(int i=0;i<N;i++) cin>>T[i];
        sort(T,T+N);
        int ans=0,sum=0;
        for(int i=0;i<N;i++){
            ans += sum; sum += T[i];
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1240
import java.awt.geom.Point2D;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		Point2D.Double p1, p2, q, r;
		String st[];
		
		while (sc.hasNext()) {
			st = sc.next().split(",");
			p1 = new Point2D.Double(Double.valueOf(st[0]), Double.valueOf(st[1]));
			p2 = new Point2D.Double(Double.valueOf(st[2]), Double.valueOf(st[3]));
			q  = new Point2D.Double(Double.valueOf(st[4]), Double.valueOf(st[5]));
			r  = new Point2D.Double();
			
			if (p1.x == p2.x) {
				r.x = p1.x + p1.x - q.x;
				r.y = q.y;
			} else if (p1.y == p2.y) {
				r.x = q.x;
				r.y = p1.y + p1.y - q.y;
			} else {
				double a1, b1, a2, b2;
				double x, y;
				a1 = (p2.y - p1.y) / (p2.x - p1.x);
				b1 = p1.y - a1 * p1.x;
				a2 = -1.0 / a1;
				b2 = q.y - a2 * q.x;
				x = (b2 - b1) / (a1 - a2);
				y = a1 * x + b1;
				r.x = x + x - q.x;
				r.y = y + y - q.y;
			}
			System.out.println(r.x + " " + r.y);
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define mod LLONG_MAX
#define ll long long
#define pi 3.141592653589
using namespace std;

struct ca
{
  char a;
   int si,ei;
};



int binarySearch(vector<int> arr, int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        if (arr[mid] == x) 
            return mid; 
  
         
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
       
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    
    return -1; 
} 

int prime[1000001]={};

void pr()
{
  prime[1]=0;

 for(int i=2;i*i<1000001;i++)
  if(prime[i]==0)
  for(int j=i*i;j<1000001;j+=i)
  prime[j]=1;

}


ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
  
    x = x % p;  
  
    while (y > 0) 
    { 
         
        if (y & 1) 
            res = (res*x) % p; 
  
        
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 


ll fac[1000001]={};

void facto(ll p)
{
   fac[0] = 1; 
    for (ll i=1 ; i<=1000000; i++) 
        fac[i] = fac[i-1]*i%p; 
}
  
 
ll nCrModPFermat(ll n, ll r, ll p) 
{ 
  
   if (r==0) 
      return 1;  
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 



/*
struct cmp
 {

     bool operator() (const ca &a , const ca &b) const
  {
      if(a.val>b.val)
       return true;

      return false;
  }
 };*/


int main()
{

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

   //pr();
   //facto(mod);
  int t;
  //cin>>t;
  t=1;
  int id=1;

  

  while(t--)
{
    int n;
     cin>>n;

     n= n%10;

      if(n==3)
      cout<<"bon"; 

      else if(n==0 || n==1 || n==6 || n==8)
     cout<<"pon";

     else
     cout<<"hon";
}
     



    
      
  


return 0;
}






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

const ll INF = 1e12;
ll dp[100010];

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

    int n,K;
    cin >> n >> K;

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    rep(i,100010) dp[i] = INF;

    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= K; j++){
            if(i - j < 0) break;

            dp[i] = min(dp[i],dp[i - j] + abs(a[i] - a[i-j]));
        }
    }
    cout << dp[n - 1] << endl;
}



Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, L;
    cin >> N >> L;
    
    vector<int> A(N);
    rep(i, N) A[i] = L + i;
    int sum = 0;
    rep(i, N) sum += A[i];
    vector<pair<int, int>> B(N);
    rep(i, N) B[i] = make_pair(abs(A[i]), i);
    sort(B.begin(), B.end());
    
    cout << sum - A[B[0].second] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

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

    N = N%10;
    if(N == 3) cout << "bon" << endl;
    else if(N == 0
         || N == 1
         || N == 6
         || N == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001LL;
constexpr double EPS = 1e-10;
using number = long long;

int main() {
    int a, b; cin >> a >> b;
    cout << max(0, a - 2 * b) << endl;
}


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

//=============belman_ford============================
struct edge{ll from, to, cost;};
vector<ll> belman_ford(ll s, ll E, ll V, vector<edge> es)
{
  // for (ll i = 0; i < E; ++i)
  // {
  //   cout << "from" << es.at(i).from << endl;
  // }
  vector<ll> d(V, INF);
  ll cnt = 0;
  d.at(s) = 0;
  while (true)
  {
    bool update = false;
    for (ll i = 0; i < E; ++i)
    {
      edge e = es.at(i);
      // cout << e.from << e.to << e.cost << endl;
      if (d.at(e.from) != INF && d.at(e.to) > d.at(e.from) + e.cost)
      {
        d.at(e.to) = d.at(e.from) + e.cost;
        update = true;
      }
    }
    if (!update)
    {
      break;
    }
    cnt += 1;
    if (cnt == V)
    {
      return {};
    }
  }
  return d;
}
//=================================================

int main()
{
  ll V, E, r;
  cin >> V >> E >> r;
  vector<edge> es(E);
  for (ll i = 0; i < E; ++i)
  {
    ll s, t, d;
    cin >> s >> t >> d;
    es.at(i) = {s, t, d};
    // cout << s << endl;
  }
  // for (ll i = 0; i < E; ++i)
  // {
  //   cout << es.at(i).from << "from" << endl;
  // }
  vector<ll> dis = belman_ford(r, E, V, es);
  if (dis.size() == 0)
  {
    cout << "NEGATIVE CYCLE" << endl;
  }
  else
  {
    for (ll i = 0; i < dis.size(); ++i)
    {
      if (dis.at(i) == INF)
      {
        cout << "INF" << endl;
      }
      else
      {
        cout << dis.at(i) << endl;
      }
    }
  }
}



Measured memory_bytes: 3276
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

int main() {
  ll N;
  cin >> N;
  vector<ll> L(N, 0);
  for (ll i = 0; i < N; i++) {
    cin >> L[i];
  }

  // 昇順にソートする
  sort(L.begin(), L.end());

  ll ans = 0;
  // a <= b <= c
  // a, bを固定する
  for (ll i = 0 ; i < N; i++) {
    for (ll j = i + 1; j < N; j++) {
      ll a = L[i];
      ll b = L[j];

      // a + b 以下となる最初の値
      auto iter = lower_bound(L.begin(), L.end(), a + b);
      ll index = iter - L.begin();

      ans += index - j - 1;
    }
  }

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


Measured memory_bytes: 256
S = list(input())
for num,letter in enumerate(S):
    num += 1
    if num % 2 == 1:
        if letter != "R" and letter != "U" and letter != "D":
            print("No")
            exit()
    else:
        if letter != "L" and letter != "U" and letter != "D":
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);

    if(a[0] == 5 && a[1] == 5 && a[2] == 7)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int h, w, i, j;
    cin >> h >> w;
    char a[h][w];
    long dp[h+1][w+1];
    memset(dp, 0, sizeof(dp));
    dp[1][0] = 1;
    for(i = 0; i < h; ++i) 
        for(j = 0; j < w; ++j) 
            cin >> a[i][j];
    for(i = 1; i <= h; ++i)
        for(j = 1; j <= w; ++j)
            if(a[i-1][j-1] == '.') 
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % 1000000007;
            else dp[i][j] = 0;
    cout << dp[h][w] % 1000000007;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;

int main()
{
    int c[10000];
    int count = 0;
    rep(i, 10000)
    {
        cin >> c[i];
        if (c[i] == 0)
            break;
        count++;
    }

    rep(i, count)
    {
        cout << "Case " << i+1 << ": " << c[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3120