akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
 
int compareInt(const void* a, const void* b)
{
    int aNum = *(int*)a;
    int bNum = *(int*)b;
 
    return bNum - aNum;
}
 
int main(void){
    int i,j;
    int x =0;
    int k[100]={0};
    scanf("%d %d", &i,&j);
    for(int l = 0;l<i;l++){
    scanf("%d ",&k[l]);
    x+=k[l];
    }
    
    qsort(k,i,sizeof(int),compareInt);
    
    if(k[j-1]>=(double)x/(4*j)){
    printf("Yes");}
    else{
    printf("No");}
    
    return 0;
    
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int LIMIT = 1e9 + 7;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

int main(){
	string S;cin>>S;
  int r=0, b=0;

  for(char c: S){
    if(c=='0')r++;
    else b++;
  }

  cout<<min({r,b})*2<<endl;
}

Measured memory_bytes: 3752
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        int ans=a+b;
        if(ans%2==0){
            System.out.println(ans/2);
        }else{
            System.out.println("IMPOSSIBLE");
        }
    }
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const int B = 9000;
const int B2 = B*2;
using BI = bitset<B2>;

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

  string S;
  cin >> S;
  int X, Y;
  cin >> X >> Y;

  VI ds;
  bool f = true;
  for(char c: S){
	if(c == 'F'){
	  if(f) --X;
	  else ds.back()++;
	}
	else{
	  f = false;
	  ds.PB(0);
	}
  }

  BI dx, dy;
  dx.set(B);
  dy.set(B);
  for(int i=0;i<SZ(ds);++i){
	if(i%2==0){
	  dy = (dy>>ds[i]) | (dy<<ds[i]);
	}
	else{
	  dx = (dx>>ds[i]) | (dx<<ds[i]);
	}
  }

  bool ok = (B+X>=0 && B+X<B2) && dx[B+X] && dy[B+Y];
  
  cout << (ok? "Yes": "No") << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>

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

	int r = 0;
	std::string S;
	std::cin >> S;

	bool b = (S[0] == '0') ^ true;
	for (auto c : S) {
		if ((c == '0') == b) {
			r++;
			b ^= true;
		}
		else {
			b = c == '0';
		}
	}

	std::cout << r;
	return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {

    public static void main(String args[]) {


        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();

        String u = t.substring(0, t.length()-1);

        if (s.equals(u)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

}

Measured memory_bytes: 35620
N, = (int(x) for x in input().split())

n_prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]

n_prime_sum = [0]*len(n_prime)
for n in range(1, N+1):
    for i, p in enumerate(n_prime):
        np = 0
        n_c = n
        while(n_c % p == 0):
            n_c = n_c // p
            np += 1
        n_prime_sum[i] += np

p_2 = len([0 for x in n_prime_sum if x >= 2])
p_4 = len([0 for x in n_prime_sum if x >= 4])
p_14 = len([0 for x in n_prime_sum if x >= 14])
p_24 = len([0 for x in n_prime_sum if x >= 24])
p_74 = len([0 for x in n_prime_sum if x >= 74])

n_75 = (p_2-p_4)*p_4*(p_4-1)//2 + p_4*(p_4-1)*(p_4-2)//2 + p_14*(p_4-1) + p_24*(p_2-1) + p_74
print(n_75)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; ++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int, int> P;
struct edge {
    int to, cost;
};
// other libs
int gcd(int a, int b) {
    if (a % b == 0)
        return b;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}

class dijkstra {
  private:
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<>> que;

  public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first)
                continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

    int find(int e) {
        return d[e];
    }
};
template<typename T>
class Union_Find {
  private:
    vector<T> t, s;

  public:
    Union_Find(T max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(T x, T y) {
        if (same(x, y))
            return;
        T tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        }
        else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        }
        else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        }
        else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }
    T Find(T n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

    bool same(T x, T y) {
        return Find(x) == Find(y);
    }

    T get_Size(size_t a) {
        return s[a];
    }
};
bool ifPrime(int n){
    if(n==1)
        return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0)
            return false;
    }
    return true;
}
vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}
signed main(signed argc, char* argv[]) {
    string s;
    cin>>s;
    rep(i,s.size()){
        if((i%2==0&&s[i]=='L')||(i%2==1&&s[i]=='R')){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>

using namespace std;

struct S{
  double d;
  int l,r;
  bool operator<(S s)const{
    return d>s.d;
  }
};

int main(){
  for(int n;cin>>n,n;){
    int xx[100],yy[100];
    for(int i=0;i<n;i++){
      cin>>xx[i]>>yy[i];
    }
    vector<int> h(yy,yy+n);
    sort(begin(h),end(h));
    h.erase(unique(begin(h),end(h)),end(h));
    vector<int> rh(h.rbegin(),h.rend());
    vector<double> x;
    vector<int> y;
    for(int i=0;i<n-1;i++){
      x.push_back(xx[i]);
      y.push_back(yy[i]);
      vector<int> &v=(yy[i]<yy[i+1])?h:rh;
      for(auto it=find(begin(v),end(v),yy[i]);*it!=yy[i+1];it++){
	double yd=yy[i+1]-yy[i];
	double xd=xx[i+1]-xx[i];
	x.push_back((*it-yy[i]+yd/xd*xx[i])*xd/yd);
	y.push_back(*it);
      }
    }
    x.push_back(xx[n-1]);
    y.push_back(yy[n-1]);
    priority_queue<S> que;
    que.push({0,0,(int)x.size()-1});
    set<int> s;
    for(;;){
      S cs=que.top();
      if(cs.l==cs.r)break;
      que.pop();
      if(!s.insert((cs.l<<16)+cs.r).second)continue;
      for(int i=-1;i<=1;i++){
	for(int j=-1;j<=1;j++){
	  int nl=cs.l+i;
	  int nr=cs.r+j;
	  if(nl<0||nr>=x.size()||y[nl]!=y[nr])continue;
	  que.push({cs.d+hypot(y[nl]-y[cs.l],x[nl]-x[cs.l])+hypot(y[nr]-y[cs.r],x[nr]-x[cs.r]),nl,nr});
	}
      }
    }
    cout.precision(9);
    cout<<fixed<<que.top().d<<endl;
  }
}

      

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

int main () {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<int>> x(N, vector<int>(N, 0));

  rep(i,M) {
    int L, R;
    cin >> L >> R;
    L--; R--;
    x[L][R]++;
  }
  vector<vector<int>> c(N+1, vector<int>(N+1, 0));
  rep(i,N) {
    rep(j,N) c[i+1][j+1] = c[i][j+1] + c[i+1][j] - c[i][j] + x[i][j];
  }

  rep(k,Q) {
    int p, q;
    cin >> p >> q;
    cout << c[q][q] - c[q][p-1] - c[p-1][q] + c[p-1][p-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 2944
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int f(li n,li k){
  while(n>=k){
    if(n%k==0)n/=k;
    else n%=k;
  }
  if(df)print("->",n);
  return n==1;
}

int main(){
  li n; cin >>n;
  li cnt=0;
  if(n==2){
    print(1);
    return 0;
  }
  for(li i=2;i*i<=n;i++){
    if(n%i==0){
      if(df)print(n,i,n/i);
      cnt+=f(n/i,i);
      if(df)print(cnt);
    }
    if((n-1)%i==0){
      if(df)print(n-1,i,n/i);
      cnt+=2-(i*i==n-1);
      if(df)print(cnt);
    }
  }
  print(cnt+2);                 // k=n-1,n
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0

        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv


def main():
    N, K = map(int, input().split())
    red = N - K
    comb = Combination(2 * 1000 + 1)

    for i in range(1, K + 1):
        ans = comb(red + 1, i) * comb(K - 1, i - 1)
        ans %= MOD
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3572
#include <iostream>
#include <string>

using namespace std;

struct node {
	node* right, * left;
	int key, priority;
};

node* root;

node* rightRotate(node* t) {
	node* s = t->left;
	t->left = s->right;
	s->right = t;
	return s;
}

node* leftRotate(node* t) {
	node* s = t->right;
	t->right = s->left;
	s->left = t;
	return s;
}

node* insert(node* t, int key, int priority) {
	if (t == NULL) {
		node* add;
		add = (node*)malloc(sizeof(node));
		add->key = key;
		add->priority = priority;
		add->left = NULL; add->right = NULL;
		return add;
	}
	if (key == t->key) return t;

	if (key < t->key) {
		t->left = insert(t->left, key, priority);
		if (t->priority < t->left->priority) t = rightRotate(t);
	} else {
		t->right = insert(t->right, key, priority);
		if (t->priority < t->right->priority) t = leftRotate(t);
	}
	return t;
}

node* find(int k) {
	node* x = root;
	while (x != NULL) {
		if (x->key == k) return x;
		else if (x->key > k) x = x->left;
		else x = x->right;
	}
	return NULL;
}

node* _delete(node*, int);
node* treeDelete(node* t, int key) {
	if (t == NULL) return NULL;
	if (key < t->key) t->left = treeDelete(t->left, key);
	else if (key > t->key) t->right = treeDelete(t->right, key);
	else return _delete(t, key);
	return t;
}

node* _delete(node* t, int key) {
	if (t->left == NULL && t->right == NULL) return NULL;
	if (t->left == NULL) t = leftRotate(t);
	else if (t->right == NULL) t = rightRotate(t);
	else {
		if (t->left->priority > t->right->priority) t = rightRotate(t);
		else t = leftRotate(t);
	}
	return treeDelete(t, key);
}

void preorder(node* u) {
	if (u == NULL) return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

void inorder(node* u) {
	if (u == NULL) return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}

int main() {
	int n; cin >> n;
	while (n--) {
		string s;
		cin >> s;
		if (s == "insert") {
			int k, p; cin >> k >> p;;
			root = insert(root, k, p);
		} else if (s == "find") {
			int k; cin >> k;
			cout << (find(k) != NULL ? "yes" : "no") << endl;
		} else if (s == "delete") {
			int k; cin >> k;
			root = treeDelete(root, k);
		} else {
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 9436
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int main() {
	int w, h, n;
	cin >> w >> h >> n;

	int x, y;
	cin >> x >> y;

	int ans = 0;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;

		if(x <= a) {
			if(y <= b) {
				int c = a - x, d = b - y;
				ans += max(c, d);
			} else {
				int c = a - x, d = y - b;
				ans += c + d;
			}
		} else {
			if(y <= b) {
				int c = x - a, d = b - y;
				ans += c + d;
			} else {
				int c = x - a, d = y - b;
				ans += max(c, d);
			}
		}

		x = a;
		y = b;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
int INF=1e+9+1;
int main(){
	int N;
	ll toori=1;
	string S1,S2;
	scan(N);scan(S1);scan(S2);
	ll MOD=1000000007;
	if(N==1) prin(3);
	else if(N==2) prin(6);
	else{
		int nowi;
		int okikata;
		if(S1[0]==S2[0]){
			toori=3;
			nowi=1;
			okikata=0;
		}
		else{
			toori=6;
			nowi=2;
			okikata=1;
		}
		while(nowi<N){
			if(S1[nowi]==S2[nowi]&&okikata==0){
				toori*=2;
				toori%=MOD;
				nowi+=1;
				okikata=0;
			}
			else if(S1[nowi]==S2[nowi]&&okikata==1){
				toori*=1;
				nowi+=1;
				okikata=0;
			}
			else if(S1[nowi]!=S2[nowi]&&okikata==0){
				toori*=2;
				toori%=MOD;
				nowi+=2;
				okikata=1;
			}
			else{
				toori*=3;
				toori%=MOD;
				nowi+=2;
				okikata=1;
			}
		}
		prin(toori);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
const ll INF=1e9+7;
const ll N = 200002;
char c;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>c;
	if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')pri("vowel");
	else pri("consonant");
	return 0;
}

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

int N;
int h[110];

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

    int cnt = 0;

    while (true)
    {
        int i = 0;

        while (h[i] == 0)
        {
            i++;
        }

        bool done = false;
        while (i < N && h[i] > 0)
        {
            h[i]--;
            i++;
            done = true;
        }

        bool allzero = true;
        for (int i = 0; i < N; i++)
        {
            if (h[i] > 0)
                allzero = false;
        }
        if (done)
            cnt++;

        if (allzero)
            break;
    }

    cout << cnt << endl;

    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 REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
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() {

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

    int l = s.length();
    int a[26] = {};
    int b[26] = {};
    rep(i, l){
        a[s[i]-'a']++;
        b[t[i]-'a']++;
    }
    sort(a, a+26);
    sort(b, b+26);

    bool ok = true;
    rep(i, 26){
        if(a[i] != b[i]){
            ok = false;
            break;
        }
    }

    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 776
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let s=read::<String>().chars().collect::<Vec<char>>();
    let mut flag=false;
    for c in "abcdefghijklmnopqrstuvwxyz".chars(){
        let mut f=false;
        for t in &s{
            f=f||*t==c
        }
        if !f&&!flag{
            println!("{}",c);
            flag=true;
        }
    }
    if !flag{println!("None")}
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
#include <algorithm>

#define BUF 200002
#define LIM_N 100001

char str[BUF];

int N;
char S[LIM_N][101];
int P[LIM_N];

typedef struct {
	char s[101];
	int p;
} Rest;
Rest rest[LIM_N];

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d", &N);

	for (size_t i = 1; i <= N; i++) {
		fgets(str, sizeof(str), stdin);
		sscanf(str, "%s %d", &S[i], &P[i]);
	}

	for (size_t i = 1; i <= N; i++) {
		for (size_t c = 0; S[i][c]; c++) {
			rest[i].s[c] = S[i][c];
		}
		rest[i].p = P[i];
	}
}

bool comp(int a, int b) {
	int cmp_result = strcmp(rest[a].s, rest[b].s);

	if (cmp_result < 0) {
		return 1;
	} else if (cmp_result > 0){
		return 0;
	} else {
		return rest[a].p > rest[b].p;
	}
}

void solve() {
	int index[LIM_N];
	for (size_t i = 0; i <= N; i++) {
		index[i] = i;
	}

	std::sort(index+1, index+1+N, comp);

	for (size_t i = 1; i <= N; i++) {
		// printf("%d %s %d\n", index[i], rest[index[i]].s, rest[index[i]].p);
		printf("%d\n", index[i]);
	}
}

int main(void) {
	receive_input();

	solve();
	// printf("%d\n", solve());

	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
    using namespace std;
     
     
     
    int main(){
      int x;
      cin>>x;
      for(int i=9; i>=1; i--){
        if(x%i==0){
          if(x/i<10){
            cout<<"Yes\n";
            break;
          }
          else{ cout<<"No\n"; break;}
        }
      }
    }

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

bool test = true;
#define log(x) cout << "#x" << " : " << x << "\n";

int main()
{
    FIO;
    long long n;
    cin >> n;
    string s = "";
    while(n > 0) {
        n--;
        //cout << "rem :  " << n % 26 << "\n";
        s.push_back('a' + (n%26));
        n/=26;
    }
    reverse(s.begin(), s.end());
    cout << s << "\n";
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;
// 四方向への移動ベクトル  //dx[i] dy[i] がそれぞれ4方向を示している
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};   


int calulate_distance(vector<string> field,int H,int W,int sh,int sw,int gh,int gw) {
    queue<pair<int,int>> que;
    vector<vector<int>> dist(30, vector<int>(30));
    for (int i = 0;i<30;i++) {
        for (int j = 0;j<30;j++) {
            dist[i][j] = -1;
        }
    }
    pair<int,int> p = make_pair(sh,sw);
    que.push(p);
    dist[sh][sw] = 0;
    int ans = 0;

    while(!que.empty()) {
        pair <int,int> p = que.front();
        que.pop();

        for (int dir = 0;dir < 4;dir++) {
            int nh = p.first + dx[dir];
            int nw = p.second + dy[dir];

            if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if (field[nh][nw] == '#') continue;
            if (dist[nh][nw] != -1) continue;
            pair <int,int> np = make_pair(nh,nw);
            dist[nh][nw] = dist[p.first][p.second] + 1;
            que.push(np);
            ans = max(ans,dist[nh][nw]);
        }
    }
    return ans;
}

int main() {
    int H,W;
    cin >> H >> W;
    vector<string> field;
    field.resize(H);
    for (int h = 0; h < H; ++h) cin >> field[h];
    int ans = 0;
    for (int sh = 0;sh<H;sh++) {
        for (int sw = 0;sw<W;sw++) {
            if (field[sh][sw] == '#') continue;
            for (int gh = 0;gh < H;gh++) {
                for (int gw = 0;gw<W;gw++) {
                    if (field[gh][gw] == '#') continue;
                    ans = max(ans,calulate_distance(field,H,W,sh,sw,gh,gw));
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
sq_dict = {}
for i in range(40001):
    sq_dict[i * i] = i

def func(n):
    cnt = 0
    for y in range(1, 13500):
        for z in range(1, 13500):
            D = (y + z) ** 2 - 4 * (y * y + z * z + y * z  - n)
            if D < 0:
                break
            if D in sq_dict:
                x = -(y + z) + sq_dict[D]
                if x % 2 == 0 and x > 0:
                    cnt += 1
                x = -(y + z) - sq_dict[D]
                if x % 2 == 0 and x > 0:
                    cnt += 1
    return cnt

def main():
    N = int(input())
    for n in range(1, N + 1):
        print(func(n))

if __name__ == '__main__':
    main()
    

Measured memory_bytes: 72452
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <ll , ll>;
void in(ll &x);
const ll M = 1e9 + 7;
const ll N = 2e6 + 10;
ll dp[N][2][2];
ll n;

int main() {
  in(n);
  dp[0][1][1] = 1;
  for (int cur = 1 ; cur <= n ; cur++) {
    for (int zero = 1 ; zero >= 0 ; zero--) {
      for (int nine = 1 ; nine >= 0 ; nine--) {
        ll &sol = dp[cur][zero][nine];
        sol = (8 * dp[cur - 1][zero][nine]) % M;
        (sol += dp[cur - 1][1][nine]) %= M;
        (sol += dp[cur - 1][zero][1]) %= M;
      }
    }
  }
  printf("%lld\n" , dp[n][0][0]);
  return 0;
}

void in(ll &x){
	bool neg = false;
	register ll c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 34804
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
#define what(x) cerr << #x << " is " << x << endl;
const int INF = 1 << 28;

int main() {
    int n;
    cin >> n;
    deque<ll> b;
    bool back = true;
    for (int i = 0; i < n; ++i) {
        ll a;
        cin >> a;
        if (back)
            b.push_back(a);
        else
            b.push_front(a);
        back = !back;
    }
    if (n % 2 == 0) {
        for (int i = 0; i < n; ++i) {
            cout << b[i];
            if (i != n - 1)
                cout << " ";
            else
                cout << endl;
        }
    } else {
        for (int i = n - 1; i >= 0; --i) {
            cout << b[i];
            if (i != 0)
                cout << " ";
            else
                cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3840
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
#include <chrono>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
template<class T, class U>

using umap = unordered_map<T, U>;
template<class T>
using uset = unordered_set<T>;

typedef long long ll;

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

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

class Random {
  public:
  std::uniform_int_distribution<> uniform_int;
  std::mt19937 rnd;
  std::bernoulli_distribution bern_dist;
  int uniform(int l, int r) {
    return uniform_int(rnd, std::uniform_int_distribution<>::param_type(l, r));
  }
  int next(int N) {
    return uniform(0, N - 1);
  }
  int bern(double p) {
    return bern_dist(rnd, std::bernoulli_distribution::param_type(p));
  }
};
// }}}

// main {{{
void solve();
int main() {
  cout << setprecision(20);
  solve();
}
// }}}

void solve() {
  int N;
  cin >> N;
  int a = N / 2 + N % 2;
  double ans = (double)a / N;
  cout << ans << endl;
}


Measured memory_bytes: 888
n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    diff_1 = dp[i-1] + abs(h[i]-h[i-1])
    diff_2 = dp[i-2] + abs(h[i]-h[i-2])
    dp[i] = min(diff_1, diff_2)

print(dp[n-1])

Measured memory_bytes: 13928
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;
using System.Numerics;

public class Program
{
    static readonly int Mod = (int)1e9 + 7;

    public void Solve()
    {
        int N = Reader.Int();
        var A = Reader.IntArray(N);
        var B = Reader.IntArray(N);
        int firstMax = Array.IndexOf(A, A[N - 1]);
        int lastMax = Array.LastIndexOf(B, B[0]);
        if (firstMax > lastMax || A[firstMax] != B[lastMax]) { Console.WriteLine(0); return; }
        long ans = 1;

        for (int i = 1; i < N - 1; i++)
            if (i < firstMax && A[i] == A[i - 1]) ans = ans * A[i] % Mod;
            else if (i > firstMax && B[i] == B[i + 1]) ans = ans * B[i] % Mod;

        Console.WriteLine(ans);
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 24656
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>
#include <string>
#include <map>
#include <numeric>
#include <queue>
#include <stack>

using namespace std;
using ll = long long;

int main(){

	int N, maxa, ans = 0;
	int a[100010] = { 0 };
	int arr[100010] = { 0 };

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		maxa = (maxa, a[i]);
	}

	for (int i = 0; i < N; i++) {
		if (a[i] == 0) {
			arr[a[i]]++;
			arr[a[i] + 1]++;
		}
		else {
			arr[a[i] - 1]++;
			arr[a[i]]++;
			arr[a[i] + 1]++;
		}
	}

	for (int i = 0; i <= maxa + 1; i++) {
		ans = max(arr[i], ans);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;

void printvP(vector<P> ans){
  int n = ans.size();
  for(int i=0; i<n; ++i){
    printf("%d %d\n",ans[i].first,ans[i].second);
  }
}

int main(){
  int n;
  cin >> n;
  vector<int> an(n);
  for(int i=0; i<n; ++i) cin >> an[i];
  sort(an.begin(),an.end());
  if(an[n-1] <= 0){
    vector<P> ans;
    for(int i=1; i<n-1; ++i){
      ans.push_back(P(an[n-1],an[i]));
      an[n-1] -= an[i];
    }
    ans.push_back(P(an[n-1],an[0]));
    an[n-1] -= an[0];
    printf("%d\n", an[n-1]);
    printvP(ans);
    return 0;
  }
  if(an[0] >= 0){
    vector<P> ans;
    for(int i=1; i<n-1; ++i){
      ans.push_back(P(an[0],an[i]));
      an[0] -= an[i];
    }
    ans.push_back(P(an[n-1],an[0]));
    an[n-1] -= an[0];
    printf("%d\n", an[n-1]);
    printvP(ans);
    return 0;
  }
  int num;
  int ans1 = 0;
  for(int i=0; i<n; ++i){
    ans1 += abs(an[i]);
    if(i<n-1 && an[i]<0 && an[i+1] >=0){
      num = i;
    }
  }
  printf("%d\n", ans1);
  for(int i=1; i<=num; ++i){
    printf("%d %d\n", an[n-1], an[i]);
    an[n-1] -= an[i];
  }
  for(int i=num+1; i<n-1; ++i){
    printf("%d %d\n", an[0], an[i]);
    an[0] -= an[i];
  }
  printf("%d %d\n", an[n-1], an[0]);
}

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

int main(){
  int N ;
  cin >> N ; 
  bool ok = false ; 
  vector<char> S(N) ;  
  for(int i = 0 ; i < N ; i ++){
    cin >> S.at(i) ; 
    if(S.at(i) == 'Y') ok = true ; 
  }
  
  if(ok) cout << "Four" << endl;
  else cout << "Three" << endl;
  
}

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

#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 INF 1e9

int N, Q;
vector<int> a, b, p, x;
vector<int> cnt;
vector<vector<int>> g;
vector<bool> homon;

void dfs(int node, int sum){
  homon[node] = true;
  cnt[node] += sum;
  REP(i, g[node].size()){
    int nx = g[node][i];
    if(homon[nx]) continue;
    dfs(nx, cnt[node]);
  }
}

int main(){
  cin >> N >> Q;
  a.resize(N-1), b.resize(N-1), p.resize(Q), x.resize(Q);
  cnt.resize(N, 0),  g.resize(N), homon.resize(N, false);
  REP(i, N-1){
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  REP(i, Q){
    cin >> p[i] >> x[i];
    cnt[p[i]-1] += x[i];
  }
  dfs(0, 0);
  REP(i, N){
    cout << cnt[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 26624
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

long double p[2][6];

long double calc(long double x){
	long double sum=0;
	for(int i=0;i<6;i++){
		sum+=max(x*p[0][i],(1-x)*p[1][i]);
	}
	return sum;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	for(int i=0;i<2;i++){
		for(int j=0;j<6;j++){
			cin >> p[i][j];
			p[i][j]/=100.0;
		}
	}
	long double left=0,right=1.0;
	for(int i=0;i<1000;i++){
		long double l=(left*2+right)/3.0,r=(left+right*2)/3.0;
		if(calc(l)<calc(r)){
			right=r;
		}
		else{
			left=l;
		}
	}
	long double ans=calc(left);
	printf("%.10Lf\n",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 100005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   int ans=0;
   for(int i=1;i<=n;i++)
   {
       ans+=(i*(n-i+1));
   }
   for(int i=0;i<(n-1);i++)
   {
       int u,v;
       cin>>u>>v;
       if(u>v)swap(u,v);
       ans-=(u*(n-v+1));
   }
   cout<<ans<<endl;

}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
main(){
  string S,T;
  cin >> S >> T;
  
  int ans=T.size();
  
  for(int start=0;start<=S.size()-T.size();start++){
    int diff=0;
    for(int i=0;i<T.size();i++){
      if(T[i]!=S[start+i]){
        diff++;
      }
    }
    ans=min(diff,ans);
  }
  
  cout << ans <<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);


    string S; cin >> S;
    string t = "CODEFESTIVAL2016";
    int ans = 0;
    REP(i,16){
        if(S[i] != t[i]) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
 
typedef struct{
  int num,id;
  char mark;
} card;
 
void swap(card *a,card* b){
  card t=*a;*a=*b,*b=t;
}
 
int partition(card *A,int p,int r){
  int x=A[r].num,i=p-1,j;
  for(j=p;j<r;j++){
    if(A[j].num<=x){
      i=i+1;
      swap(&A[i],&A[j]);
    }
  }
  swap(&A[i+1],&A[r]);
  return i+1;
}
 
void quickSort(card *A,int p,int r){
  if(p<r){
    int q=partition(A,p,r);
    quickSort(A,p,q-1);
    quickSort(A,q+1,r);
  }
}
 
int isStable(card *a,int n){
  int i;
  for(i=0;i<n-1;i++){
    if(a[i].num==a[i+1].num && a[i].id>a[i+1].id)return 0;
  }
  return 1;
}
 
int main(void){
 
  int n,i;
  card A[100000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c %d",&A[i].mark,&A[i].num);
    A[i].id=i;
  }
  quickSort(A,0,n-1);
 
  printf("%s\n",isStable(A,n)?"Stable":"Not stable");
  for(i=0;i<n;i++)
    printf("%c %d\n",A[i].mark,A[i].num);
   
  return 0;
}


Measured memory_bytes: 2972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        while(true){
            try{
            StringTokenizer st=new StringTokenizer(br.readLine()," ");
            double array[] =new double[6];
            for(int j=0;j<array.length;j++) array[j]=Integer.parseInt(st.nextToken());
            double y=(array[0]*array[5]-array[2]*array[3])/(array[0]*array[4]-array[1]*array[3]);
            double x=(array[2]*array[4]-array[1]*array[5])/(array[0]*array[4]-array[1]*array[3]);
            if(x==-0.0) x=0.0;
            if(y==-0.0) y=0.0;
            System.out.printf("%.3f %.3f\n",x,y);
            }catch(Exception e){
                System.exit(0);
            };
        }
    }
    
}

Measured memory_bytes: 24436
#include<bits/stdc++.h>
using namespace std;
int main()

{
    int n,l;
    cin>>n>>l;
    if(l>=0)
    {
        cout<< l*(n-1)+n*(n-1)/2<<endl;
    }
    else
    {
        cout<< (l-1)*(n-1)+n*(n+1)/2-min(n,1-l)<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

const int MAX_A = 300005;
 
int op(int a, int b) { return max(a,b);}
int e() { return 0;}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  segtree<int,op,e> dp(MAX_A);
  rep(i,n) {
    int x = a[i];
    int l = x-k, r = x+k+1;
    l = max(l,0);
    r = min(r,MAX_A);
    int now = dp.prod(l,r)+1;
    dp.set(x, now);
  }
  int ans = dp.prod(0,MAX_A);
  cout << ans << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n, m;
    cin >> n;
    map<string, int> mp, mp2;
    rep(i, n)
    {
        string s;
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    rep(i, m)
    {
        string s;
        cin >> s;
        mp2[s]++;
    }

    int ans = 0;

    for (auto itr = mp.begin(); itr != mp.end(); itr++)
    {
        int cnt = 0;
        cnt += itr->second;
        cnt -= mp2[itr->first];
        ans = max(ans, cnt);
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    cout << n << ':';
    for(int i = 2; (ll)i * i <= n; ++i){
        while(n % i == 0){
            cout << ' ' << i;
            n /= i;
        }
    }
    if(n != 1)  cout << ' ' << n;
    cout << endl;
}


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

using namespace std;

int main(){
    int R, G, B, N; cin >> R >> G >> B >> N;

    vector<int> rgb(3, 0);
    rgb[0] = R;
    rgb[1] = G;
    rgb[2] = B;

    int rmax = N/R;
    int gmax = N/G;
    int bmax = N/B;

    int count = 0;
    for(int i=0; i<=rmax; i++){
        for(int j=0; j<=gmax; j++){
            int left = N - i*R - j*G;
            if(left >= 0 && left % B == 0){
                count += 1;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
i = 0
while i < 10000:
    c, o, d = map(str, input().split())
    a = int(c)
    b = int(d)
    if o == '+':
        print(a+b)
    elif o == '-':
        print(a-b)
    elif o == '*':
        print(a*b)
    elif o == '/':
        print(int(a/b))
    elif o == '?':
        break


Measured memory_bytes: 5592
t[3000];w,c;f(x,i){if(!--t[x])for(;i;f(x+="33h6h25"[--i]-52,8));}main(h){for(;scanf("%d%d",&w,&h)*w;printf("%d\n",c)){for(;h;--h)for(c=w;c;)scanf("%d",h*52+c--+t);for(h=3e3;--h;f(h,8))c+=t[h]>0;}}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	int a,b;
	cin >> a >> b;
	if(a>0)
	cout << "Positive" << endl;
	if(b<0){
		if((b-a+1)%2==0)
		cout << "Positive" << endl;
		else
		cout << "Negative" << endl;
	}if(a<=0 && b>0)
		cout << "Zero" << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val Array(n, lim) = io.StdIn.readLine().split(' ').map(_.toInt)
  val items = Array.fill(n)(io.StdIn.readLine().split(' ').map(_.toInt))
  val sumOfValue = items.map(_(1)).sum
  val dp: Array[Array[Int]] = Array.fill(n+1)(Array.fill(sumOfValue+1)(Int.MaxValue))
  dp(0)(0) = 0

  for (i <- 0 until n)
    for (v <- (0 to sumOfValue).filter(dp(i)(_) != Int.MaxValue)) {
      val nWeight = dp(i)(v) + items(i)(0)
      if (nWeight <= lim && nWeight < dp(i+1)(v+items(i)(1))) dp(i+1)(v+items(i)(1)) = nWeight
      if (dp(i)(v) < dp(i+1)(v)) dp(i+1)(v) = dp(i)(v)
    }

  println(dp(n).indices.reverse.dropWhile(dp(n)(_) == Int.MaxValue).head)
}

Measured memory_bytes: 118700
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define sz(x) x.size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) begin(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}
template <class T> T gcd(T a, T b) {if (b) return gcd(b, a % b); else return a;}
template <class T> T lcm(T a, T b) {return (a * b) / gcd(a,b);}

#define int long long

signed main() {
    int n, k; cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<ll> v;

    for (int i = 0; i < n; i++) {
        ll s = 0;
        for (int j = i; j < n; j++) {
            s += a[j];
            v.eb(s);
        }
    }

    bool check[v.size() + 1];
    int num = 0;
    for (int i = 0; i < v.size(); i++) check[i] = true;

    for (int i = 50; i > 0; i--) {
        num = 0;
        for (int j = 0; j < v.size(); j++) {
            if (check[j]) {
                if ((v[j] >> i) & 1) num++;
            }
        }
        if (num >= k) {
            for (int j = 0; j < v.size(); j++) {
                if (check[j]) {
                    if (!((v[j] >> i) & 1)) check[j] = false;
                }
            }
        }
    }
    ll ans = LLONG_MAX;
    for (int i = 0; i < v.size(); i++) {
        if (check[i]) ans &= v[i];
    }
    cout << ans;
}


Measured memory_bytes: 6256