akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	vector<ll> A(N), B(N), sumA(N + 1), sumB(N + 1), tari, fusoku;
	sumA[0] = 0;
	sumB[0] = 0;
	REP(i, N) {
		cin >> A[i];
		sumA[i + 1] = sumA[i] + A[i];
	}
	REP(i, N) {
		cin >> B[i];
		if (A[i] < B[i]) fusoku.push_back(B[i] - A[i]);
		else if (A[i] > B[i]) tari.push_back(A[i] - B[i]);
		sumB[i + 1] = sumB[i] + B[i];
	}
	if (sumA[N] < sumB[N]) {
		cout << -1 << "\n";
		return 0;
	}
	sort(tari.begin(), tari.end(), greater<ll>());
	int i = 0;
	vector<ll> copy = tari;
	REP(j, fusoku.size()) {
		while (fusoku[j] > tari[i]) {
			fusoku[j] -= tari[i];
			tari[i] = 0;
			i++;
		}
		tari[i] -= fusoku[j];
		fusoku[j] = 0;
	}
	if (tari[i] != copy[i]) i++;
	cout << fusoku.size() + i << "\n";

	return 0;
}

Measured memory_bytes: 4852
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

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

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    let road = a + b - 1;
    let garden = a * b;
    println!("{}", garden - road);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<n-2;i++)
	{
		if(s[i]=='A'||s[i]=='a')
		{
			if(s[i+1]=='B'||s[i+1]=='b')
			{
				if(s[i+2]=='C'||s[i+2]=='c')
				{
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,v,b,w;cin >> a >> v >> b >> w;
  ll t;cin >> t;
  if(w>=v){
    cout << "NO" << endl;
  }else{
    if(abs(a-b) <= (v-w)*t){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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

stack<int> s;

void solve(long long int n){
	while(n > 26)
	{
		if(n%26 == 0)
		{
			s.push(26);
			n = n/26 - 1;
		}
		else
		{
			s.push(n%26);
			n /= 26;
		}
	}
	if(n > 0)
	{
		s.push(n);
	}
}

int main(void){
  long long int n;
  cin>>n;
  solve(n);
  string Doggo = "";
  while(!s.empty()){
    Doggo += char(s.top() + 'a' - 1);
    s.pop();
  }
  cout<<Doggo<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	/*int a, b, c;

	cin >> a >> b >> c;
	if (b % 2 == 1 || c % 2 == a % 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}*/

	long long a, b, c;
	cin >> a >> b >> c;
	for (long long i = 0; i < 1000000; ++i) {
		if ((c + b * i) % a == 0) {
			cout << "YES\n";
			return 0;
		}
	}

	cout << "NO\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[2];
	for(int i=0;i<=2;i++)
		cin>>a[i];
	sort(a,a+3);
	int s=a[2]*10+a[1]+a[0];
	cout<<s<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int tike[4];
	int i;
	int n;
	
	for (i = 0; i < 4; i++){
		scanf("%d %d", &tike[i], &n);
		switch (tike[i]){
			case 1:
			tike[i] = 6000 * n;
			break;
			
			case 2:
			tike[i] = 4000 * n;
			break;
			
			case 3:
			tike[i] = 3000 * n;
			break;
			
			case 4:
			tike[i] = 2000 * n;
			break;
		}
	}
	
	for (i = 0; i < 4; i++){
		printf("%d\n", tike[i]);
	}
	
	return (0);
}

Measured memory_bytes: 600
function Main(input) {
    input = input.split("\n");
    var a = parseInt(input[0]);
    var nums = input[1].split(' ').map(Number).sort((a,b) => a-b);
    var b = (nums[0] + nums[1])/2;
    for(var i=2; i<a; i++){
        b = (b + nums[i])/2;
    }
    console.log(b);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
    int n;
    cin>>n;
    vector<pii> robots;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        robots.emplace_back(a+b,a-b);
    }
    sort(robots.begin(),robots.end());

    int ans=0;
    ll x=-1e9-1;
    rep(i,n){
        if(robots[i].second>=x){
            x=robots[i].first;
            ans+=1;
        }
    }
    cout<< ans <<endl;
}

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

int main(){

  int n,m;
  int i;
  int l,r;
  int ans = 0;
  int min = 9999999;
  int max = -9999999;

  scanf("%d %d", &n, &m);
  
  for(i = 1;i <= m;i++){
    scanf("%d %d", &l, &r);
    if(l > max) max = l;
    if(r < min) min = r;
  }

  if(min >= max) printf("%d\n", min - max + 1);

  else printf("0\n");
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) c.begin(),c.end()


int N,M;
int r[1010],w[1010];
bool dp[2][1010*1010];
int sum;

bool check(){
	sum=0;
	for(int i=0;i<N;i++){
		sum+=r[i];
	}
	for(int i=0;i<N;i++){
		if(sum<r[i]*2) return false;
	}
	return true;
}

int ub;

int solve2(){
	for(int i=0;i<2;i++) for(int j=0;j<1010*1010;j++){
		dp[i][j]=false;
	}
	int t=0;
	dp[0][0]=true;
	ub=-1;
	for(int i=0;i<N;i++){
		if(sum<r[i]*2){
			ub=r[i]*2-sum;
			continue;
		}
		for(int j=0;j<1010*1010;j++){
			if(dp[t][j]==false) continue;
			int nj=j+w[i];
			if(nj>=1010*1010) continue;
			dp[1^t][nj]=true;
			dp[1^t][j]=true;
		}
		t^=1;
	}
	for(int i=ub;i>=0;i--){
		if(dp[t][i]) return ub-i;
	}
	return -1;
}

int solve(){
	bool flg=check();
	if(flg){
		int res=0;
		for(int i=0;i<N;i++){
			res+=w[i];
			res+=r[i];
		}
		return res;
	}
	int tmp=solve2();
	int res=0;
	for(int i=0;i<N;i++){
		res+=w[i];
		res+=r[i];
	}
	res+=tmp;
	return res;
}

void input(){
	scanf("%d",&N);
	if(N==0) exit(0);
	for(int i=0;i<N;i++){
		scanf("%d%d",r+i,w+i);
	}
}

int main(){
	while(true){
		input();
		int ans=solve();
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 3172
#include<iostream>

using namespace std;
int main(){
  int a;
  // int b;
 // int c;
 // int d;
 // int e;
 // int f;
  cin>>a ;
  cout<<a/3600<<":"<<a%3600/60<<":"<<a%3600%60<<endl;
 return 0;
}
 



Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <deque>
#include <set>
#include <map>
using namespace std;
typedef long long int lli;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF 1000000000
#define IOS ios_base::sync_with_stdio(0); cin.tie(0) //making cin faster
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FOR_R(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define REP_R(i,n)   FOR_R(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SIZ(x) ((int)(x).size())
//int IsPrime(int Nvrbl){int i;if(Nvrbl<2){return 0;}else if(Nvrbl==2){return 1;}else if(Nvrbl%2==0){return 0;}for(i=3;i<=sqrt(Nvrbl);i+=2){if(Nvrbl%i==0){return 0;}}return 1;} // 1 for prime, 0 for not prime

int sort_bubble(vector<int>&,int);

int main(void)
{
  
  int N;
  cin >> N;
  
  vector<int> A(N);

  int cnt;
  
  REP(i,N)
    {
      cin >> A[i];
      
    }

  cnt = sort_bubble(A,N);

  REP(i,N)
    {
      if( i != N-1 )
	{
	  cout << A[i] << " " ;
	}
      else
	{
	  cout << A[i] << "\n" ;
	}
    }

  cout << cnt << "\n" ;
  
  
}

int sort_bubble(vector<int>& A, int N)
{
  int flag;
  int cnt = 0;
  
  
  REP(j,N-1)
    {
      flag = 1;
      

      REP(i,N-1-j)
	{

	  if( A[i] > A[i+1] )
	    {
	      swap(A[i],A[i+1]);
	      flag = 0;
	      ++ cnt;
	      
	    }
	  
	}

      if(flag)
	{
	  break;
	  
	}

      
    }

  return cnt;
  
  
}



Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
ld a,b,c;
cin >> a;
cout << setprecision(15);
cout << pow((a/3.0),3) << endl;
}


Measured memory_bytes: 512
import java.io.*; 
import java.util.*; 


public class Main{ 
	
	static class FastReader{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

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

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

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

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

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}

	static int n, arr[][];
	static long mod = (long)1e9+7, dp[][];

	static long func(int i, int mask){
		if(i==n)
			return 1;

		if(dp[i][mask]!=-1)
			return dp[i][mask];

		long res = 0;
		for(int j=0;j<n;j++)
			if( arr[i][j]==1 && (mask&(1<<j))==0 )
				res = ( res + func(i+1, mask^(1<<j)) )%mod;

		return dp[i][mask] = res;
	}

	public static void main(String[] args) 
	{ 
        FastReader sc = new FastReader(); 
        //PrintWriter out = new PrintWriter(System.out); 

        n = sc.nextInt();
        arr = new int[n][n];
    	dp = new long[n][(1<<n)];
    	
    	for(int i=0;i<n;i++)
    		for(int j=0;j<(1<<n);j++)
    			dp[i][j] = -1;

        for(int i=0;i<n;i++)
        	for(int j=0;j<n;j++)
        		arr[i][j] = sc.nextInt();

        System.out.println( func(0, 0) );
	}
}


Measured memory_bytes: 369492
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	ll n, p, q;
	cin >> n >> p >> q;
	vector<ll> v;
	ll sum = 0;
	REP(i, n)
	{
		ll c; cin >> c;
		v.push_back(c + p*i);
		sum += c;
	}
	sort(ALL(v));
	ll ans = LLONG_MIN;
	ll tmp = 0;
	REP(i, n + 1)
	{
		ll t = sum + p*i*(q + i - 1) - tmp;
		if(i!=n) tmp += v[i];
		chmax(ans, t);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7016
N, K = map(int, input().split())
P = list(map(int, input().split()))
Es = [n * (n + 1) / 2 / n for n in P]

res = sum(Es[0:K])
now = res
for i in range(0, N-K):
    now = now - Es[i] + Es[i+K]
    res = max(res, now)

print(res)


Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
#define PB push_back

#define N 105
#define W 100'005
#define V 1'005
int n, w;
int u[N], v[N];
ll p[N][V*N];

int main(){
	scanf("%d%d", &n, &w);
	REP(i, n) scanf("%d%d", u+i, v+i);
	REP(i, N) REP(j, N*V) p[i][j]=LLONG_MAX/100;
	p[0][0]=0;
	REP(i, n){
		REP(j, V*N){
			SML(p[i+1][j], p[i][j]);
			int x = j + v[i];
			if(x < V*N){
				SML(p[i+1][x], p[i][j]+u[i]);
			}
		}
	}
	int ans=0;
	REP(j, V*N) if(p[n][j]<=w) LAR(ans, j);
	printf("%d\n", ans);
}


Measured memory_bytes: 86912
from itertools import accumulate
 
N,M,Q=map(int, input().split())
a=[[0]*N for i in range(N)]

for i in range(M):
  l,r=map(int, input().split())
  a[l-1][r-1]+=1

for i in range(N):
  a[i]=list(accumulate(a[i]))

for i in range(N):
  for j in range(N-1):
    a[j+1][i]+=a[j][i]

for i in range(Q):
  p,q=map(int, input().split())
  if p==1:
    ans=a[q-1][q-1]
  else:
    ans=a[q-1][q-1]-a[p-2][q-1]
  print(ans)

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

const int mod=(int)1e9+7;
const int maxk=(int)1e5+10;
int dp[maxk];
int prze[maxk];

int main()
{
	int n,k;
	scanf("%d %d",&n, &k);
	for(int i=0;i<=k;i++)
		dp[i]=1;
	prze[0]=1;
	while(n--)
	{
		int a;
		scanf("%d",&a);
		for(int i=1;i<=k;i++)
			prze[i]=(dp[i]-((i-a-1<0) ? 0 : dp[i-a-1]))%mod;
		for(int i=1;i<=k;i++)
			dp[i]=(prze[i]+dp[i-1])%mod;
	}
	printf("%d",(dp[k]-dp[k-1]+mod)%mod);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
long long combination(long n, long r, long long mod) {
  // nCrを返す　O(r)
  if (n < r) swap(n, r);
  long long bunbo = 1;
  long cnt = r;
  while (0 < cnt) {
    bunbo *= cnt;
    bunbo % mod;
    cnt--;
  }
  if (bunbo == 0) return 1;
  long long bunsi = 1;
  cnt = 0;
  while (cnt < r) {
    bunsi *= (n - cnt);
    bunbo %= mod;
    cnt++;
  }
  return bunsi / bunbo % mod;
}
int main() {
  int n;
  cin >> n;
  vector<long> a(n);
  REP(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  ll _n = a[n - 1];
  ll _r = a[0];
  for (int i = 0; i < n - 1; i++) {
    if (abs(a[i] - _n / 2) <= abs(_r - _n / 2)) _r = a[i];
  }
  cout << _n << " " << _r << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
void _main() {
	int N;
	cin >> N;
	int W[100];
	rep(i, 0, N) {
		cin >> W[i];
	}
	int S1, S2;
	int ans = 100000000;
	rep(j, 0, N) {
		S1 = 0; S2 = 0;
		//jから0までの和　=>　S1
		rrep(k, j, 0) {
			S1 += W[k];
		}
		//j+1からNまでの和　=> S2
		rep(l, j + 1, N) {
			S2 += W[l];
		}
		int num = abs(S1 - S2);
		ans = min(ans, num);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
int main(){while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d %d",&a,&b); if(a==1){
num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1 && c[i][j]==1){num[j]++;}}}
for(i=2;i<=n;i++){if(num[i]!=0) sum++;}
printf("%d\n",sum);}return 0;}

Measured memory_bytes: 1588
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int N=3010;
ll n,a[N],L;
const ld pi=acos(-1);
struct dot{ld x,y;}O,ans;
dot operator +(dot a,dot b){return (dot){a.x+b.x,a.y+b.y};}
dot operator -(dot a,dot b){return (dot){a.x-b.x,a.y-b.y};}
dot operator *(dot a,ld b){return (dot){a.x*b,a.y*b};}
dot ang(ld arc){
	return (dot){cos(arc),sin(arc)};
}
dot operator *(dot a,dot b){return (dot){a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x};}
int main(){
	cin>>n>>L;
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++){
		dot sum=O,B=ang(2*pi*a[i]/L);
		for (int j=i+1;j<=n;j++){
			dot M=O-ang(pi*(a[j]+a[i])/L);
			ans=ans+M*(j-i-1)+(B-M)*sum;
			sum=sum+ang(pi*(a[j]-a[i])/L);
		}
	}
	ans=ans*(6.0/n/(n-1)/(n-2));
	printf("%.15Lf %.15Lf\n",ans.x,ans.y);
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <queue>
#include <string>

using namespace std;

int main() {
    
    priority_queue<int> PQ;
    
    string comm;
    int num;
    
    while (1) {
        cin >> comm;
        if (comm == "insert") {
            cin >> num;
            PQ.push(num);
        }
        else if (comm == "extract") {
            cout << PQ.top() << endl;
            PQ.pop();
        }
        else if (comm == "end") {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 7028
nmax, abmax, inf = 40, 10, 1000000

dp = [[[inf] * (nmax * abmax + 1) for _ in range(nmax * abmax + 1)] for _ in range(nmax + 1)]

n, ma, mb = map(int, input().split())

dp[0][0][0] = 0

for i in range(n):
  a, b, c = map(int, input().split())
  dpi = dp[i]
  dpi1 = dp[i + 1]
  for ca in range(0, 401):
    for cb in range(0, 401):
      if dpi[ca][cb] == inf:
        continue
      dpi1[ca][cb] = min(dpi1[ca][cb], dpi[ca][cb])
      dpi1[ca + a][cb + b] = min(dpi1[ca + a][cb + b], dpi[ca][cb] + c)

ans = inf
dpn = dp[n]
for ca in range(1, 401):
  for cb in range(1, 401):
    if ca * mb == cb * ma:
      ans = min(ans, dpn[ca][cb])

if ans == inf:
  ans = -1

print(ans)


Measured memory_bytes: 59472
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

  vector<int> to_r(N);
  to_r[0] = 0;
  repp(i, 1, N - 1) { to_r[i] = to_r[i - 1] + (S[i - 1] == 'W'); }

  vector<int> to_l(N);
  to_l[N - 1] = 0;
  repr(i, N - 2, 0) { to_l[i] = to_l[i + 1] + (S[i + 1] == 'E'); }

  vector<int> turn(N);
  rep(i, N) { turn[i] = to_r[i] + to_l[i]; }
  sort(all(turn));
  cout << turn[0] << endl;
}

Measured memory_bytes: 4228
#include <stdio.h>
int main(void){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    for(int i=1; i<=a*b; i++){
        if((a*i)%b==c){
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}


Measured memory_bytes: 1664
from heapq import heappop, heappush,heapify
X,Y,Z,K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
H = []
heappush(H,[-1*(A[0]+B[0]+C[0]),0,0,0])
count = 1
memo = []
while H and count <= K:
  tmp,i,j,k = heappop(H)
  print(-1*tmp)
  count += 1
  if i+1 < X and ((i+1,j,k) not in memo):
    heappush(H,[-1*(A[i+1]+B[j]+C[k]),i+1,j,k])
    memo.append((i+1,j,k))
  if j+1 < Y and ((i,j+1,k) not in memo):
    heappush(H,[-1*(A[i]+B[j+1]+C[k]),i,j+1,k])
    memo.append((i,j+1,k))
  if k+1 < Z and ((i,j,k+1) not in memo):
    heappush(H,[-1*(A[i]+B[j]+C[k+1]),i,j,k+1])
    memo.append((i,j,k+1))

Measured memory_bytes: 4592
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int A, B;
  cin >> A >> B;
  if(A >= 2*B)cout << A - 2*B << endl;
  else cout << "0" << endl;

}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(c-a) <= d || (abs(b-a) <= d && abs(c-b) <= d)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

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

int main()
{
    int N, X, Y;
    cin >> N >> X >> Y;
    X--, Y--;

    vector<int> dis(N, 0);

    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int tmp = min(abs(i - j), min(abs(i - X) + abs(j - Y) + 1, abs(i - Y) + abs(j - X) + 1));
            dis[tmp]++;
        }
    }
    for (int i = 1; i < N; i++)
        cout << dis[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n;
int ans=0;
cin >> n;
for(int i = 1; i<=n;i++) {
  if(to_string(i).length()%2==1) ans++;
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N + 1];
    int[] c = new int[N + 1];
    int cnt = 0;
    while (++cnt <= N) {
      a[cnt] = sc.nextInt();
      b[cnt] = sc.nextInt();
      c[cnt] = sc.nextInt();
    }
    int[] dpA = new int[N + 1];
    int[] dpB = new int[N + 1];
    int[] dpC = new int[N + 1];
    for (int i = 1; i <= N; i++) {
      dpA[i] = Math.max(dpB[i - 1], dpC[i - 1]) + a[i];
      dpB[i] = Math.max(dpC[i - 1], dpA[i - 1]) + b[i];
      dpC[i] = Math.max(dpA[i - 1], dpB[i - 1]) + c[i];
    }

    System.out.println(Math.max(Math.max(dpA[N], dpB[N]), dpC[N]));
  }
}

Measured memory_bytes: 93492
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

val MOD = 1000000007L

fun main(omkar: Array<String>) {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val n = jin.readLine().toInt()
    val adj = Array(n + 1) { mutableSetOf<Int>() }
    for (j in 2..n) {
        val tokenizer = StringTokenizer(jin.readLine())
        val a = tokenizer.nextToken().toInt()
        val b = tokenizer.nextToken().toInt()
        adj[a].add(b)
        adj[b].add(a)
    }
    val inv = LongArray(n + 1) { it.toLong() pow -1 }
    val subTree = IntArray(n + 1) { 1 }
    val dp = LongArray(n + 1) { 1L }
    fun recur1(a: Int) {
        for (b in adj[a]) {
            adj[b].remove(a)
            recur1(b)
            subTree[a] += subTree[b]
            dp[a] *= (dp[b] * inv[subTree[b]]) % MOD
            dp[a] %= MOD
        }
    }
    recur1(1)
    dp[1] = dp[1]
    for (j in 1 until n) {
        dp[1] *= j.toLong()
        dp[1] %= MOD
    }
    fun recur2(a: Int, parentDP: Long) {
        if (a != 1) {
            dp[a] = parentDP
            dp[a] *= subTree[a].toLong()
            dp[a] %= MOD
            dp[a] *= inv[n - subTree[a]]
            dp[a] %= MOD
        }
        for (b in adj[a]) {
            recur2(b, dp[a])
        }
    }
    recur2(1, 0)
    println(dp.joinToString("\n").substring(2))
}

val MOD_TOTIENT = (MOD - 1).toInt()

infix fun Long.pow(power: Int): Long {
    var e = power
    e %= MOD_TOTIENT
    if (e < 0) {
        e += MOD_TOTIENT
    }
    if (e == 0 && this == 0L) {
        return this
    }
    var b = this % MOD
    var res = 1L
    while (e > 0) {
        if (e and 1 != 0) {
            res *= b
            res %= MOD
        }
        b *= b
        b %= MOD
        e = e shr 1
    }
    return res
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)*2+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  c_fac();
  int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
  int ra = r2-r1+1, ca = c2-c1+1;
  ll result = 0;
  result += nck(r1+c1,c1);
  repr(i,1,ra) { result += nck(i+r1+c1,c1) * nck(ra+ca-(i+1),ca-1); result %= MOD; }
  repr(i,1,ca) { result += nck(i+r1+c1,r1) * nck(ra+ca-(i+1),ra-1); result %= MOD; }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 15872
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        int[][] nums = new int[n][2];
        for (int i = 0; i < n; i++) {
            nums[i][0] = sc.nextInt();
            nums[i][1] = sc.nextInt();
        }
        
        Arrays.sort(nums, (a, b) -> Integer.compare(a[1], b[1]));
        Arrays.sort(nums, (a, b) -> Integer.compare(a[0], b[0]));
        
        long count = 0;
        for (int i = 0; i < n; i++) {
            count += nums[i][1];
            
            if (count >= k) {
                System.out.println(nums[i][0]);
                return;
            }
            
        }
    }
}


Measured memory_bytes: 94412
/*input
4
abcd
cdef

*/
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 

using namespace std;
long long mod=1e9+7;
typedef long long int lld;
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scd(a) scanf("%d",&a)
#define scd2(a,b) scanf("%d%d",&a,&b)
#define scd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scf(a) scanf("%lf",&a)
#define scf2(a,b) scanf("%lf%lf",&a,&b)
#define scf3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define Error(x) cerr << #x << " = " << (x) <<endl;
#define Error2(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c) cerr<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d) cerr<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define popcount __builtin_popcountll
typedef pair<lld,lld> PA;
#define lim 1000010
#define lim2 3003
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

lld B[lim],A[lim],C[lim];
PA P[lim],Q[lim];
lld n,m,p,q;
// string S[lim],R[lim];
// vector<lld> V[lim];
// unordered_map<lld,lld> Ind;


lld powP(lld a,lld b){
    if(b==0) return 1%mod;
    lld k;
    k=powP(a,b/2);
    k=k*k%mod;
    if(b%2==0) return k;
    else return a*k%mod;
}
bool bitSet(lld n,lld i){
    if((n&(1LL<<i))!=0) return true;
    else return false;
}


int main(){
    lld T,i,j,h,l,r,b,k,c,a,d,w,x,y,v,z,t,curr,prev,sum,ans,pos,val,countA,secondMin,indicator;
    sc(n);
    string A,B;
    cin>>A>>B;
    ans=2*n;
    rep(i,0,n-1){
        j=0;
        t=1;
        for(lld j=i;j<n;j++){
            if(A[j]!=B[j-i]) t=0;
        }
        if(t==1) ans=min(ans,n-(i)+2*(i));
    }
    prL(ans);
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#define MAX 251

int parent(int );
int left(int );
int right(int );

int main(){
  int i;
  int n;
  int A[MAX];
  
  scanf("%d", &n);

  for(i=1;i<n+1;i++){ 
    scanf("%d", &A[i]);
   
  }
   
  for(i=1;i<n+1;i++){  
    printf("node %d: key = %d, ", i, A[i]);   
    if(parent(i)>=1)printf("parent key = %d, ", A[parent(i)]);
    if(left(i)<=n)printf("left key = %d, ", A[left(i)]);
    if(right(i)<=n)printf("right key = %d, ", A[right(i)]);

    printf("\n");
  }
  
  return 0;
}


int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return (2*i)+1;
}



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

typedef long long ll;
static const int MOD = 1e9+7;
static const int INF = 1<<30;

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> p(N);
    for(int i=0; i<N; i++) cin>>p[i];

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

    int ans = 0;

    for(int i=0; i<K; i++){
        ans += p[i];
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
const int MAX_N = 100;

int N, D, X, A[MAX_N];

int main() {
  scanf("%d%d%d", &N, &D, &X);
  for ( int i = 0; i < N; ++i ) {
    scanf("%d", A + i);
  }
  int ans = X;
  for ( int i = 0; i < N; ++i ) {
    ans += (D - 1) / A[i] + 1;
  }
  printf("%d\n", ans);
  return 0;
}

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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second
 
Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

int main() {
    Int m1, d1;
    Int m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    dump(m1 != m2 ? 1 : 0);
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC_077_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word1 = Console.ReadLine();
            var word2 = Console.ReadLine();
            char C11 = (word1[0]); char C21 = (word2[0]);
            char C12 = (word1[1]); char C22 = (word2[1]);
            char C13 = (word1[2]); char C23 = (word2[2]);
            if (C11 == C23 && C12 == C22 && C13 == C21)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include <numeric>
#define int long long
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}

void panda() {
   int n;
   cin>>n;
   int t;
   double sum=100;
   double xx=100;
   double x=1.01;
   for(int i=1;;++i)
   {
       sum=floor((sum*x));
       //xx+=floor(sum);
       if(sum>=n)
       {
           cout<<i<<"\n";
           return;
       }

   }
}

int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
//    int t;
//    cin>>t;
//    while(t--)
    panda();
}

Measured memory_bytes: 3612
N, A, B, C = map(int, input().split())

ABC = [A, B, C]

l = [int(input()) for i in range(N)]

abc = [0 for i in range(N)]

ans = 1 << 30

def cost():
    take = [0 for i in range(3)]

    tmp = 0

    for i in range(N):
        if abc[i] == 0:
            continue
        take[abc[i]-1] += l[i]
        tmp += 1

    tmp = (tmp - 3) * 10


    for i in range(3):
        if take[i] == 0:
            return 1 << 30
        tmp += abs(ABC[i] - take[i])

    return tmp


def dfs(i):
    global ans
    if i == N:
        ans = min(ans, cost())
        return
    for j in range(4):
        abc[i] = j
        dfs(i+1)

dfs(0)
print(ans)

Measured memory_bytes: 48604
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
const int N = 1e9 ;
const int P = 1e9 + 7;

ll quickPower(ll a, ll b) {
    ll res = 1;
    a %= P;
    while (b) {
        if (b & 1)res = (res % P) * (a % P) % P;
        a = (a % P) * (a % P) % P;
        b >>= 1;
    }
    return res;
}
ll inv(ll x) {//x关于p的逆元，p为素数
    return quickPower(x, P - 2);
}
ll C(ll n, ll m) {
    if (m > n)return 0;
    ll up = 1, down = 1;//分子分母;
    for (int i = n - m + 1; i <= n; i++)
        up = up * i % P;
    for (int i = 1; i <= m; i++)
        down = down * i % P;
    return up * inv(down) % P;
}
ll Lucas(ll n, ll m) {
    if (m == 0)return 1;
    return C(n % P, m % P) * Lucas(n / P, m / P) % P;
}
int main()
{
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll ans=(quickPower(2,n)-1+mod)%mod;
	ans=(ans-C(n,a)-C(n,b)+mod*2)%mod;
	printf("%lld\n",ans);
}

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

int n;
vector<int> h;

void input() {
    cin >> n;
    h = vector<int>(n);
    for(int i = 0; i < n; i++) {
        cin >> h.at(i);
    }
}

void solve() {
    vector<int> cost(n, 0);
    cost.at(1) = abs(h.at(1) - h.at(0));
    for(int i = 2; i < n; i++) {
        cost.at(i) = min(cost.at(i-2) + abs(h.at(i) - h.at(i-2)), cost.at(i-1) + abs(h.at(i) - h.at(i-1)));
        //cout << "i: " << i << ", cost[i]: " << cost.at(i) << endl;
    }
    cout << cost.at(n-1) << endl;
}



int main() {
    input();
    solve();
}


Measured memory_bytes: 1024
N=int(input())
T=list(input().split(" "))
for i in range(N):
    T[i]=int(T[i])
M=int(input())
P=[]
X=[]
for i in range(M):
    P0,X0=map(int,list(input().split(" ")))
    P+=[P0]
    X+=[X0]
for i in range(M):
    TT=T.copy()
    TT[P[i]-1]=X[i]
    print(sum(TT))


Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)


int main() {
	int n;
	cin >> n;
	if (n == 3) {
		cout << "2 5 63" << endl;
		return 0;
	}
	for (int i = 3; i + 6 < 30000 && n >= 4; i += 12, n -= 2) {
		cout << i << " " << i + 6<<" ";
	}
	int x = 2;
	for (; n >= 3; x += 6, n -= 3) {
		cout << x << " " << x + 2 << " " << x + 4 << endl;;
	}
	if (n == 1) {
		cout << x + 4 << endl;
	}
	else if (n == 2) {
		cout << x  << " " << x + 2 << endl;
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
  cin>>a[i];
  }int c=0;
   for(int i=0;i<n;i++)
   {
   if(a[i]!=i+1)
     c++;
   }
  if(c>2)
    cout<<"NO";
  else cout<<"YES";}

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

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define debug(x) cerr << "x is "<<x <<" "

using ll = long long;
using pll = pair<ll,ll>;
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9+7, N = 1e5 + 10;

bool comp(pair<pair<string,int>,int> a,pair<pair<string,int>,int> b){
	if(a.F.F!=b.F.F) return a.F.F<b.F.F;
	else return a.F.S>b.F.S;
}

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	//#endif
	int n;
	cin >> n ;
	vector<pair<pair<string,int>,int> > a(n);
	f(i,0,n){
		cin >> a[i].F.F >> a[i].F.S;
		a[i].S=i+1;
	}
	sort(all(a),comp);
	f(i,0,n) cout << a[i].S << "\n";
	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<climits>

using namespace std;

const int N = 2e5 + 7;
int fp[N], fs[N], n, arr[N];

void updatePref(int v, int val, int *fenv) {
  for (; v >= 0; v = (v & (v + 1)) - 1) {
    fenv[v] = min(fenv[v], val);
  }
}

void updateSuf(int v, int val, int *fenv) {
  for (; v < N; v |= v + 1) {
    fenv[v] = min(fenv[v], val);
  }
}

int getPref(int v, int* fenv) {
  int res = INT_MAX;
  for (; v >= 0; v = (v & (v + 1)) - 1) {
    res = min(res, fenv[v]);
  }
  return res;
}

int getSuf(int v, int* fenv) {
  int res = INT_MAX;
  for (; v < N; v |= v + 1) {
    res = min(res, fenv[v]);
  }
  return res;
}

map<int, int> inds;
set<int> y;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  vector<pair<long long, long long>> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i].first >> arr[i].second;
    y.insert(arr[i].second);
  }
  int qq = 0;
  for (auto i : y) {
    inds[i] = qq++;
  }
  fill(fp, fp + N, 2e9);
  fill(fs, fs + N, 2e9);
  sort(arr.begin(), arr.end());
  long long res = 0;
  for (auto i : arr) {
    int q = getPref(inds[i.second], fp);
    res = max(res, 0ll + i.first + i.second - q);
    q = getSuf(inds[i.second], fs);
    res = max(res, 0ll + i.first - i.second - q);//-q=(i.first - i.second)
    
    updateSuf(inds[i.second], i.first + i.second, fp);
    updatePref(inds[i.second], i.first - i.second, fs);
  }
  cout << res << "\n";
}



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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<i64> v(n);
  for (auto& x : v) cin >> x;
  multiset<i64> lb;
  i64 lbsum = 0;
  i64 ans = 0;
  for (int i = 0; i <= min(k, n); ++i) {
    if (i > 0) {
      lb.insert(v[i - 1]);
      lbsum += v[i - 1];
    }
    multiset<i64> rb(lb.begin(), lb.end());
    i64 rbsum = 0;
    for (int j = 0; j <= min(k, n) - i; ++j) {
      if (j > 0) {
        rb.insert(v[n - j]);
        rbsum += v[n - j];
      }
      int p = k - i - j;
      auto it = rb.begin();
      i64 value = lbsum + rbsum;
      for (int r = 0; r < p && it != rb.end(); ++r, ++it) {
        if (*it >= 0) break;
        value -= *it;
      }
      ans = max(ans, value);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  while(true){
    int n;
    cin >> n;
    if(!n)break;
    vector<int> line(n);
    REP(i,n){
      int tmp;
      cin >> tmp;
      line[i] = tmp;
    }
    string s;
    cin >> s;
    int line_i;
    REP(i,s.size()){
      
      if(i >= n)line_i = i % n;
      else line_i = i;
      if(s[i] - line[line_i] - 'a' < -26 && s[i] >= 'a')
	s[i] = 'z' + 1 + (s[i] - line[line_i] + 26 - 'a');
      else if(s[i] - line[line_i] - 'A' < -26 && s[i] >= 'A'){
	s[i] = 'Z' + 1 +  (s[i] - line[line_i] + 26 - 'A');
      }else if(s[i] - line[line_i]  < 'a' && s[i] >= 'a'){
	s[i] = 'Z' + 1 + (s[i] -line[line_i] - 'a');
      }else if(s[i] - line[line_i] < 'A' && s[i] >='A'){
	s[i] = 'z' + 1  + (s[i] - line[line_i] - 'A');
      }else{
	s[i] = s[i] - line[line_i];
      }
    }
    
    cout << s <<endl;
  }

  return 0;
}

Measured memory_bytes: 3160
require "matrix"

def vectorLength(vector)
   Math.sqrt(vector[0] ** 2 + vector[1] ** 2)
end

def unitVector(vector)
   vector / vectorLength(vector)
end

#main
n = gets.to_i
arr = Array.new
n.times{arr << gets}
arr.each do |i|
   k = i.split(" ")
   k.map!{|j| j.to_f}
   a = Vector[k[0], k[1]]
   b = Vector[k[2], k[3]]
   ab = b - a
   c = Vector[k[4], k[5]]
   d = Vector[k[6], k[7]]
   cd = d - c
   ab_u = unitVector(ab)
   cd_u = unitVector(cd)
   puts (ab_u == cd_u or ab_u == -1 * cd_u) ? "YES" : "NO"
end

Measured memory_bytes: 6416
#include <stdio.h>

int main() {
  int N, verdict[4] = {0}; // AC, WA, TLE, RE
  scanf("%d", &N);

  for(int i = 0; i < N; i++) {
    char str[5];
    scanf("%s", str);
    
    switch(str[0]) {
      case 'A':
        verdict[0]++;
        break;
      case 'W':
        verdict[1]++;
        break;
      case 'T':
        verdict[2]++;
        break;
      case 'R':
        verdict[3]++;
        break;
    }
  }

  printf("AC x %d\n", verdict[0]);
  printf("WA x %d\n", verdict[1]);
  printf("TLE x %d\n", verdict[2]);
  printf("RE x %d\n", verdict[3]);

  return 0;
}

// Reading Material
// https://stackoverflow.com/questions/427760/when-to-use-if-else-if-else-over-switch-statements-and-vice-versa

Measured memory_bytes: 1732
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(){
	
	string str;
	
	cin >> str;
	
	int ans = 10000;
	int N = str.size();
	
	for(int loop = 0; loop < 26; loop++){
		char c = 'a' + loop;
		int intv_max = 0;
		int pre = 0;
		for(int i = 0; i < N; i++){
			if(str[i] == c){
				intv_max = max(intv_max, i - pre);
				pre = i + 1;
			}
		}
		intv_max = max(intv_max, N - pre);
		ans = min(intv_max, ans);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<cmath>
#include<cstdio>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >=0; i--)
#define lint long long
#define all(x) (x).begin(), (x).end()


int main(){
    int a,b,c,d; cin>>a>>b>>c>>d;
    if(a!=c) cout<<1<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 888
if __name__ == '__main__':
    N = int(input())
    s = []
    for i in range(N):
        s.append(int(input()))

    not_10_multi = list(filter(lambda x: (x % 10) != 0, s))

    if sum(s) % 10 != 0:
        print(sum(s))
    elif len(not_10_multi) == 0:
        print(0)
    else:
        print(sum(s) - min(not_10_multi))


Measured memory_bytes: 3060
#include<cstdio>
int n,k,ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		ans+=(x>=k);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = 0;
            var N = Console.ReadLine();
            foreach (var n in N)
            {
                sum += int.Parse(n.ToString());
            }

            if (int.Parse(N) % sum == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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; }

int N,M,visited[100000],X,Y,Z,ans;
vector<vector<int> > G(100000);

void dfs(int v){
    visited[v]=1;
    for(auto next : G[v]){
        if(!visited[next])dfs(next);
    }
}

int main(){
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        G[X].push_back(Y);
        G[Y].push_back(X);
    }
        rep(i,N){
            // out(*itr);
            if(!visited[i]){
                dfs(i);
                ans++;
            }
        }
    out(ans);
    
}


Measured memory_bytes: 13952