akhauriyash/Code-Regression huggingface dataset:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    r = 0
    for i1 in range(1, n + 1):
        y = n // i1
        r += y * (y + 1) // 2 * i1
    print(r)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9148
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(new BufferedInputStream(System.in));
		int n;
		while (scanner.hasNext()) {
			n = scanner.nextInt();
			System.out.println(getResult(n));
		}
	}

	public static int getResult(int n) {
		int count = 0;
		for (int i = 0; i <= 9; i++)
			for (int j = 0; j <= 9; j++)
				for (int k = 0; k <= 9; k++)
					for (int l = 0; l <= 9; l++) {
						if (i + j + k + l == n)
							count++;
					}

		return count;
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <map>
#define _USE_MATH_DEFINES
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 30;
const double EPS = 1e-9;

int nums[10000];

int main(){
	int n, m, p;
	while(cin >> n >> m >> p && (n || m || p)){
		m--;
		int sum = 0;
		for(int i = 0; i < n; i++){
			cin >> nums[i];
			sum += 100 * nums[i];
		}
		if(nums[m] == 0) cout << 0 << endl;
		else cout << (int)((double)sum / (double)100 * (100 - p) / nums[m]) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#define rep(i,n) REP(i,0,n)
#define REP(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

ll A[(ll)2e5 + 10];
ll ans[(ll)2e5 + 10];

ll GetAbove(ll i) {
   ll sum = 0;
   ll j = i;
   while (1) {
      j+= (i+1);
      if (j >= 2e5+10) break;
      sum += ans[j];
   }
   return sum;
}

int main(void) {
   ll N;
   cin>>N;
   rep(i,2e5+10) A[i] = 0;
   rep(i,2e5+10) ans[i] = 0;
   rep(i,N) {
      cin>>A[i];
   }
   int m = N;
   int prev;
   while (1) {
      prev = m;
      m = (int)(m/2);
      for (int i = m; i < prev;i++) {
         // cout<<i<<" "<<GetAbove(i)<<endl;
         ans[i] = (A[i] + GetAbove(i))%2;
      }
      if (m==0) break;
   }

   // rep(i,N) cout<<ans[i]<<" ";
   // cout<<endl;
   set<int> vHave;
   rep(i,N) {
      if (ans[i]  == 1) vHave.insert(i+1);
   }
   cout<<vHave.size()<<endl;
   for (auto itr = vHave.begin(); itr != vHave.end();itr++) {
      cout<<*itr<<" ";
   }
   cout<<endl;

   return 0;
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#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 true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int a, b; cin >> a >> b;
  if (a%2==1 && b%2==1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
typedef complex<ld> point;
#define endl '\n'
#define matrix vector<vector<ll>>
#define EPS 1e-9
#define X real()
#define Y imag()
#define vec(a, b) ((b) - (a))
#define dot(a, b) ((conj(a) * (b)).real())
#define cross(a, b) ((conj(a) *(b)).imag())
#define lengthsqr(v) (dot(v, v))
#define length(v) ((ld)hypot((v).Y, (v).X))
#define same(a, b) (lengthsqr(vec(a, b)) < EPS)

const int N = 1e5 + 5, inf = 1e9 + 5;
const ll mod = 1e9 + 7;

int dp[N][3], a[N][3];

int main()
{
    VIC
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < 3; j++)
            cin >> a[i][j];
    for (int i = 0; i < 3; i++)
        dp[0][i] = a[0][i];
    for (int i = 1; i < n; i++)
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 3; k++)
            {
                if (j == k)
                    continue;
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
            }
    int ans = 0;
    for (int i = 0; i < 3; i++)
        ans = max(ans, dp[n - 1][i]);
    cout << ans;
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#define ll long long
using namespace std;
int main(){
	ll a[15001],n,b,c,m,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	cin>>m;
	for(int i=1;i<=m;i++){
		cin>>b>>c;
		cout<<sum-a[b]+c<<endl;
	}
	return 0;
}
	

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	m := map[byte]int{}
	for i := 0; i < len(s); i++ {
		m[s[i]] = 1
	}

	if len(m) == 1 {
		fmt.Fprintln(writer, "No")
		return
	}
	fmt.Fprintln(writer, "Yes")
}


Measured memory_bytes: 640
def resolve():
    N = int(input())
    V = list(map(int, input().split(" ")))
    
    evens = V[::2]
    odds = V[1::2]

    import collections
    evenMosts = collections.Counter(evens).most_common()
    oddMosts = collections.Counter(odds).most_common()
    evenM = evenMosts[0]
    oddM = oddMosts[0]

    if len(evenMosts) == 1:
        if len(oddMosts) == 1:
            if evenM[0] != oddM[0]:
                print(0)
            else:
                print(evenM[1])
            return
        else:
            print(len(odds)-oddM[1])
            return
    else:
        if len(oddMosts) == 1:
            print(len(evens)-evenM[1])
            return
        else:
            if evenM[0] == oddM[0]: 
                if (len(evens)-evenMosts[1][1]+len(odds)-oddM[1]) <= (len(evens)-evenM[1] + len(odds)-oddMosts[1][1]):
                    evenM = evenMosts[1]
                else:
                    oddM = oddMosts[1]
            print((len(evens)-evenM[1])+(len(odds)-oddM[1]))
            return
    


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 20956
#include <stdio.h>

int main(void){
  int N,K,i,Ans=1;
  scanf("%d",&N);
  scanf("%d",&K);
  for (i=1;i<=N;i++){
    if (Ans*2<Ans+K){
      Ans = Ans*2;
    }else{
      Ans = Ans + K;
    }
  }
  printf("%d",Ans);
  return 0;
}


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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int p, q, r;
  cin >> p >> q >> r;
  cout << (p + q + r) - max({p, q, r}) << '\n';
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 111111;
int a[N];
int n, k;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    rep(i, 1, n) {
        cin >> a[i];
    }
    int ans = 0;
    rep(i, 1, n) {
        ans += a[i] >= k;
    }
    cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int A, B;
  cin >> A >> B;
  cout << max(0, A - B * 2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
 int n,x,i,j,k,s;


 for(;;){
       s=0;
       scanf("%d%d",&n,&x);
       if(n==0&&x==0)break;

       for(i=1;i<=n-2;i++){

                        for(j=i+1;j<=n-1;j++){
                         
                                             for(k=j+1;k<=n;k++){
                                                                   if(i+j+k==x)s++;
                                                                   }
                                             }
                          }

           printf("%d\n",s);
           }


 return 0;
}



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

int main(){
  int N;
  cin >> N;
  vector<vector<pii>> l(N);
  rep(i,N-1){
    int u,v,w;
    cin >> u >> v >> w;
    u--;v--;w&=1;
    l[u].push_back(make_pair(v,w));
    l[v].push_back(make_pair(u,w));
  }
  queue<int> q;
  q.push(0);
  int c[N];
  rep(i,N) c[i]=(i==0?0:-1);
  while(!q.empty()){
    int n=q.front();
    q.pop();
    for(auto x:l[n]){
      if(c[x.first]==-1){
        c[x.first]=c[n]^x.second;
        q.push(x.first);
      }
    }
  }
  rep(i,N) cout << c[i] << endl;
  return 0;
}

Measured memory_bytes: 6784
N=int(input())
A=[0]
A+=map(int,input().split())
A.append(0)
S=0

for i in range(N+1):
    S+=abs(A[i+1]-A[i])

for i in range(1,N+1):
    Si=S+abs(A[i+1]-A[i-1])-(abs(A[i]-A[i-1])+abs(A[i+1]-A[i]))
    print(Si)

Measured memory_bytes: 64364
#include<iostream>
using namespace std;
class dice
{
  private:
  int status[6];
  public:
  dice();
  int showright(void);
  bool is(int,int);
  bool isfront(int);
  void rotate(char);
};

dice::dice()
{
  for(int i=0;i<6;i++)
    cin>>status[i];
}

bool dice::isfront(int a)
{
  if(status[1]==a) return true;
  else return false;
}

bool dice::is(int a,int b)
{
  if((status[0]==a)&&(status[1]==b)) return true;
  else return false;
}

int dice::showright()
{
  cout<<status[2]<<endl;
}

void dice::rotate(char s)
{
  switch(s)
  {
    int tmp;
    case 'N':
      tmp=status[0];
      status[0]=status[1];
      status[1]=status[5];
      status[5]=status[4];
      status[4]=tmp;
      break;
    case 'E':
      tmp=status[0];
      status[0]=status[3];
      status[3]=status[5];
      status[5]=status[2];
      status[2]=tmp;
      break;
    case 'W':
      tmp=status[0];
      status[0]=status[2];
      status[2]=status[5];
      status[5]=status[3];
      status[3]=tmp;
      break;
    case 'S':
      tmp=status[0];
      status[0]=status[4];
      status[4]=status[5];
      status[5]=status[1];
      status[1]=tmp;
      break;
  }
}

int main()
{
  dice di1;
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    int a,b;
    cin>>a>>b;
    int j;
    for(j=0;j<=3;j++)
    {
      if(di1.isfront(b)||di1.is(a,b)) break;
      di1.rotate('N');
    }
    if(j==4)
    {
      di1.rotate('E');
      di1.rotate('S');
    }
    if(!di1.isfront(b))
    {
      di1.rotate('N');
      di1.rotate('N');
    }
    for(j=0;j<3;j++)
    {
      if(di1.is(a,b)) break;
      di1.rotate('E');
    }
    di1.showright();
  }
}

Measured memory_bytes: 3092
#include<cmath>
#include<iostream>
int main(){int n;double E=1e-10,a,b,c,d,e,f,g,h;std::cin>>n;while(n--){std::cin>>a>>b>>c>>d>>e>>f>>g>>h;std::cout<<((fabs((d-b)*(g-e)-(h-f)*(c-a))<E)?"YES\n":"NO\n");}}

Measured memory_bytes: 0
import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		try {
			int n = 1;
			for (int i = 0; i < 10000; i++) {
				int data = Integer.parseInt(br.readLine());
				if (data == 0) {
					break;
				}
				sb.append("Case ").append(Integer.toString(n++)).append(": ").append(Integer.toString(data)).append("\n");
			}
			System.out.print(sb);
		} catch (Exception e) {
			System.out.println("??¨??????");
		}
	}
}

Measured memory_bytes: 30528
#include<cstdio>
#include<set>
#include<algorithm>
int N;
std::multiset<int>A;
int main(){
	scanf("%d",&N);
	for(int i=0,a;i<N;i++)scanf("%d",&a),A.insert(a);
	int ans=0;
	while(A.size()){
		int x=*A.rbegin(),y=1;
		A.erase(A.find(x));
		while(y<=x)y*=2;
		std::multiset<int>::iterator it=A.find(y-x);
		if(it!=A.end()){
			A.erase(it);
			ans++;
		}
	}
	printf("%d\n",ans);
}

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

#define ll long long

int main() {
    std::ios::sync_with_stdio(false);
    using namespace std;
    ll mod = 1'000'000'000 + 7;
    int h, w;
    cin >> h >> w;
    
    vector< string > B(h);
    for(int i = 0; i < h; i++)
        cin >> B[i];

    vector< vector<int> > A(h + 1);
    for(int i = 0; i < h + 1; i++)
        A[i].resize(w + 1, 0);
    A[0][1] = 1;
    for(int i = 1; i <= h; i++)
        for(int j = 1; j <= w; j++)
            if(B[i - 1][j - 1] == '#')
                A[i][j] = 0;
            else
                A[i][j] = (A[i - 1][j] + A[i][j - 1]) % mod;
    cout << A[h][w] << "\n";

    return 0;
}


Measured memory_bytes: 5248
#include<stdio.h>
#include<stdlib.h>
double res=100000000.0,t;
int T,D,t1,t2,d1,d2,p1,p2;
int main()
{
	scanf("%d%d%d%d%d%d",&T,&D,&t1,&t2,&d1,&d2);
	for(p1=0;p1<=D;p1+=d1)
		for(p2=0;p2<=D-p1;p2+=d2)
		{
			if(p1+p2==0)continue;
			t=(1.0*(t1*p1)+(t2*p2))/(p1+p2);
			t-=T;
			if(t<0)t*=-1;
			res=(res-t>0)?t:res;
		}
	printf("%.10f\n",res);
	return 0;
}

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

#define llong long long 
#define ii pair<int, int>
#define xx first
#define yy second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )

#define rem 998244353
#define maxn 301010
llong fac[maxn];

llong mpow(llong u, llong m) {
  llong ans = 1;
  for (; m > 0; m >>= 1) {
    if (m & 1) (ans *= u) %= rem;
    (u *= u) %= rem;
  }
  return ans;
}

llong comp(llong n, llong k) {
  return fac[n] * (mpow(fac[k] * fac[n - k] % rem, rem - 2)) % rem;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  llong n, a, b, k;
  fac[0] = 1;
  rep1(i, maxn - 1) (fac[i] = fac[i - 1] * i) %= rem;
  cin >> n >> a >> b >> k;
  llong ans = 0;
  rep(i, n + 1) {
    if (i * a > k) break;
    if ((k - i * a) % b) continue;
    llong f = (k - i * a) / b;
    if (f > n) continue;
    //clog << i << ' ' << f << endl;
    (ans += comp(n, i) * comp(n, f) % rem) %= rem;
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

vector<int> par;

void Initpar(int n){
  par = vector<int>(n); 
  for(int i=0; i<n; i++) par.at(i) = i;
}

int root(int x){
  if(x == par.at(x)) return x;
  else par.at(x) = root(par.at(x));
}

void unite(int x, int y){
  int rx = root(x);
  int ry = root(y);
  if(rx == ry) return ;
  if(rx < ry) par.at(ry) = rx;
  else par.at(rx) = ry;
}

bool same(int x, int y){
  return root(x) == root(y);
}

void update_par(){
  for(int i=0;i<par.size();i++){
    root(i);
  }
}

int main(){
  long n,k,l;
  cin >> n >> k >> l;
  vi par1,par2;
  Initpar(n);
  rep(i,k){
    int p,q;
    cin >> p >> q;
    p--;q--;
    unite(p,q);
  }
  update_par();
  par1 = par;
  Initpar(n);
  rep(i,l){
    int r,s;
    cin >> r >> s;
    r--;s--;
    unite(r,s);
  }
  update_par();
  par2 = par;
  map<pii,int> mp;
  rep(i,n){
    pii P = {par1.at(i), par2.at(i)};
    if(mp.count(P)) mp.at(P)++;
    else mp[P] = 1;
  }
  rep(i,n){
    pii P = {par1.at(i), par2.at(i)};
    cout << mp.at(P) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 14352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a;
  while(cin>>n>>m>>a,n){
    int d[1001][101]={};
    while(m--){
      int h,p,q; cin>>h>>p>>q;
      d[h][p]=q,d[h][q]=p;
    }
    for(int i=1000;i>=0;--i)
      if(d[i][a]) a=d[i][a];
    cout<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 3456
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B, C, D = map(int, input().split())
    A_dead = (A + D - 1) // D
    C_dead = (C + B - 1) // B
    if A_dead >= C_dead:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9176
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define all(a)  (a).begin(),(a).end()


signed main(){
  int n;
  cin >> n;
  vector<int>a(100010);
  fo(i,n){
    int A;
    cin >> A;
    a[A]++;
  }
  int ans=0;
  fo(i,100010){
    if(i==0)
      ans=max(a[0]+a[1],ans);
    else if(i==100009)
      ans=max(ans,a[i]+a[i-1]);
    else 
      ans=max(ans,a[i]+a[i-1]+a[i+1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<complex>
#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

typedef complex<double> Point;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

typedef vector<Point> Polygon;

double cross(const Point &a, const Point &b) {
  return imag(conj(a)*b);
}

double area(const Polygon &p) {
  double A = 0;
  for(int i=0; i<p.size(); i++) {
    A += cross( p[i], p[(i+1)%p.size()] );
  }
  return A;
}

int main() {
  int n,count = 1;
  double x,y;

  Polygon p = Polygon();
  while(~scanf("%lf,%lf", &x,&y)) {
    p.push_back( Point(x,y) );
  }

  double a = area(p)/2;
  printf("%f\n", (a < 0) ? -a : a);
  count++;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    vi a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(all(a));
    cout << 10*a[2] + a[1] + a[0] <<endl;
    return 0;
}
    

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

  using namespace std;

  int main(){
    double N;
    int K;
    cin >> N;
    cin >> K;
    double ans=0;
    double syoki=1/N;
    for(int i=1;i<=N;i++){
      double an=1;
      int p=i;
      while(p<K){
        an=an*0.5;
        p=p*2;
      }
      an=an*syoki;
      ans=ans+an;
    }
    cout << setprecision(10) <<ans << endl;
    return 0;
  }

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int int_sort(const void * a, const void * b)
{
    if(*(int*)a<*(int*)b)
    {
        return -1;
    }
    else if(*(int*)a==*(int*)b)
    {
        return 0;
    }
    return 1;
}

int main(void)
{
    int n,m;
    scanf("%d",&n);
    long long int d[n];
    for(int p=0;p<n;p++)scanf("%lld",&d[p]);
    scanf("%d",&m);
    long long int t[m];
    for(int q=0;q<m;q++)scanf("%lld",&t[q]);
    qsort(d,n,sizeof(d[1]),int_sort);
    qsort(t,m,sizeof(t[1]),int_sort);
    //for(int r=0;r<n;r++)printf("%lld",d[r]);
    //for(int s=0;s<m;s++)printf("%lld",t[s]);
    int ans=0;
    int a=m-1;
    int b=n-1;
    while(ans==0 && a>=0)
    {
        if(t[a]==d[b])
        {
            a--;
            b--;
        }
        else if(t[a]<d[b])
        {
            b--;
            if(b<0)ans=-1;
        }
        else if(t[a]>d[b])
        {
            ans=-1;
        }
    }
    if(ans==-1)
      printf("NO");
    else if(a==-1)
      printf("YES");
}


Measured memory_bytes: 4908
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def main():

    n = str(input().strip())

    s = 0
    for i in range(len(n)):
        s = (s + int(n[i])) % 9

    if s == 0:
        print('Yes')
    else:
        print('No')

main()








Measured memory_bytes: 9240
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1

using namespace std;

const double g=10.0,eps=1e-7;
const int N=10000+10,maxn=60000+10,inf=0x3f3f3f;

int num[30];
int v[N],p[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m,vsz=0,psz=0;
    cin>>n>>m;
    if(n%2==1&&m%2==1)
    {
        v[1]++;
        for(int i=0;i<(n-1)/2*(m-1)/2;i++)v[4]++;
        for(int i=0;i<(n-1)/2+(m-1)/2;i++)v[2]++;
    }
    else if(n%2==1&&m%2==0)
    {
        for(int i=0;i<m/2;i++)v[2]++;
        for(int i=0;i<(n-1)/2*m/2;i++)v[4]++;
    }
    else if(n%2==0&&m%2==1)
    {
        for(int i=0;i<n/2;i++)v[2]++;
        for(int i=0;i<n/2*(m-1)/2;i++)v[4]++;
    }
    else
    {
        for(int i=0;i<n/2*m/2;i++)v[4]++;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            char a;
            cin>>a;
            num[a-'a']++;
        }
    }
    memset(p,0,sizeof p);
    for(int i=0;i<26;i++)
        if(num[i])
            p[num[i]]++;
    for(int i=4;i>=1;i--)
    {
        while(v[i])
        {
            bool f=0;
            for(int j=i;j<=10000;j++)
            {
              //  cout<<p[j]<<endl;
                if(p[j]>0&&j>=i)
                {
                    f=1;
                    p[j]--;
                    p[j-i]++;
                    v[i]--;
                    break;
                }
            }
            if(!f)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
/********************
3 4
aaab
aabb
aacc
********************/


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

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

using namespace std;

int main(){
  map<int, int> m;
  int a,b,c;
  cin>>a>>b>>c;
  m[a]=1;
  m[b]=1;
  m[c]=1;

  cout<<m.size();

  return 0;
}


Measured memory_bytes: 256
def isEven(n):
    return n%2==0
moves = []
h, w = map(int, input().split())
cells = [[-2 for i in range(w+2)]]
evens = 0
totalSum = 0
for i in range(h):
    r = list(map(int, input().split()))
    row = [-2]
    for c in r:
        row.append(c)
        totalSum += c
        if isEven(c):
            evens += 1
    row.append(-2)
    cells.append(row)
cells.append([-2 for i in range(w+2)])

for hc in range(1, h+1):
    for wc in range(1, w+1):
        if not isEven(cells[hc][wc]):
            if not isEven(cells[hc][wc+1]):
                cells[hc][wc] -= 1
                cells[hc][wc+1] += 1
                moves.append([hc, wc, hc, wc+1])
            elif not isEven(cells[hc+1][wc]):
                cells[hc][wc] -= 1
                cells[hc+1][wc] += 1
                moves.append([hc, wc, hc+1, wc])
            else:
                if cells[hc][wc+1] >= 0:
                    cells[hc][wc] -= 1
                    cells[hc][wc+1] += 1
                    moves.append([hc, wc, hc, wc+1])
                elif cells[hc+1][wc] >= 0:
                    cells[hc][wc] -= 1
                    cells[hc+1][wc] += 1
                    moves.append([hc, wc, hc+1, wc])

print(len(moves))
for m in moves:
    print(" ".join(map(str, m)))


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

int main() {
  
  char x;
  cin >> x;
  
  int num = x - 65;
  
  if ( num < 26 ){
    cout << 'A' << endl;
  }else{
    cout << 'a' << endl;
  }  
  
}



Measured memory_bytes: 3636
#include <iostream>

int main() {
  int m;
  int f;
  int r;

  int sum;
  while(std::cin >> m >> f >> r) {
    if(m == -1 && f == -1 && r == -1) break;
    if(m == -1 || f == -1) {
      std::cout << "F" << std::endl;
      continue;
    }
    sum = m + f;
    if(sum >= 80) {
      std::cout << "A" << std::endl;
    }
    else if(65 <= sum && sum < 80) {
      std::cout << "B" << std::endl;
    }
    else if(50 <= sum && sum < 65) {
      std::cout << "C" << std::endl;
    }
    else if(30 <= sum && sum < 50) {
      if(r >= 50) {
        std::cout << "C" << std::endl;
      }
      else {
        std::cout << "D" << std::endl;
      }
    }
    else if(sum < 30) {
      std::cout << "F" << std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3072
#![allow(unused_mut, non_snake_case,unused_imports)]
use std::iter;
use std::cmp::{max, min, Ordering};
use std::mem::{swap};
use std::collections::{HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap,VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//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")};}
// 低速 EOF不要
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */



static MOD : i64 = 1_000_000_007;
fn main(){
    input!(n:usize,k:usize);
    let mut dp = vec![vec![0_i64;1005] as Vec<i64>; 1005];
    dp[0][0] = 1;
    for i in 1..n+1{
        for j in 1..k+1{
            dp[i][j] += dp[i-1][j]*j as i64;
            dp[i][j] += dp[i-1][j-1];
            dp[i][j] %= MOD;
        }
    }
    let mut ans = 0;
    for i in 1..k+1 {
        ans += dp[n][i];
        ans %= MOD;
    }
    println!("{}",ans);
}


Measured memory_bytes: 13196
#include<iostream>
#include<vector>
#include<map>

using namespace std;

map<string,vector<string> > M;
map<string,bool> counted;

int N,ans;
string wanted;

void init(){
  M.clear();
  counted.clear();
  ans = 0;
}

void input(){
  
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    
    vector<string> V;
    string tmp = "";
    string gname;

    for(int j = 0; j < s.length(); j++){
      if(s[j] == ':'){
	gname = tmp;
	tmp = "";
	if(i == 0) wanted = gname;
      }else if(s[j] == ',' || s[j] == '.'){
	V.push_back(tmp);
	tmp = "";
      }else tmp += s[j];
    }
    
    M[gname] = V;
  }
}

void solve(string s){

  vector<string> V = M[s];
  
  counted[s] = true;

  for(int i = 0; i < V.size(); i++){
    if(M[V[i]].size() > 0 && !counted[V[i]]) solve(V[i]);
    else if(counted[V[i]] == false){
      counted[V[i]] = true;
      ans++;
    }
  }
}


int main(){

  while(cin >> N  && N){
    init();
    input();
    solve(wanted);
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
#include <vector>
#include <string>

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

bool array_equal(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return false;
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return false;
    }
  }
  return true;
}

int gcd(int a, int b) {
  if (a == b) {
    return a;
  }
  else if (a > b) {
    return gcd(a - b, b);
  }
  else {
    return gcd(a, b - a);
  }
}

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int main() {
  std::cout << std::setprecision(9);
  int n;
  cin >> n;

  vector<pair<int, int>> a(n);
  for(int i=0; i<n; i++) {
    cin >> a.at(i).first;
    a.at(i).second = i + 1;
  }
  sort(a.begin(), a.end());
  for(int i=0; i<n; i++) {
    if(i != 0) {
      cout << ' ';
    }
    cout << a.at(i).second;
  }
  cout << endl;
}

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

int main(){
    string s;
    cin >> s;
    char pre = s[0];
    ll n = s.size();
    ll ans = 0;
    rep(i, 1, n){
        if(pre != s[i]){
            pre = s[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    std::cin.tie(nullptr);                  // 標準入出力高速化
    std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
    int h,w;
    cin >> h >> w;
    char s[h+2][w+2];
    //fill(s[0],s[w+2],'#');
    bool flag;
    
    REP(i,h)REP(j,w)cin >> s[i+1][j+1];
    
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            if(s[i][j]=='#' && s[i-1][j] != '#' && s[i][j+1] != '#' && s[i+1][j] != '#' && s[i][j-1] != '#'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
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<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

const int N = 1010;

vi ps;
vb isp( N , true );

int cnt[1010];

int main(){

  isp[0] = isp[1] = false;
  FOR( i , 2 , N ){
    if( isp[i] ){
      ps.pb( i );
      for( int j = i*2; j < N; j += i ){
        isp[j] = false;
      }
    }
  }

  int n = in();
  FOR( i , 1 , n+1 ){
    int cur = i;
    YYS( w , ps ){
      while( cur % w == 0 ){
        cur /= w;
        cnt[w]++;
      }
    }
  }

  ll ans = 1;
  REP( i , N ){
    ans = ( ans * ( cnt[i] + 1 ) ) % MOD;
  }

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


Measured memory_bytes: 256
S = [(ord("z") + 1 - ord(s)) % 26 for s in input()]
K = int(input())

for i in range(len(S)):
  if S[i] > K: continue
  K -= S[i]
  S[i] = 0

S[-1] = (S[-1] - K) % 26
print(*[chr(ord("z") - (s-1) % 26) for s in S], sep="")

Measured memory_bytes: 6864
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int h,w;cin>>h>>w;
  vs c(h);
  rep(i,h)cin>>c[i];
  rep(i,h){
    cout(c[i]);
    cout(c[i]);
  }
  return 0;
}

Measured memory_bytes: 256
S = input()

ans = 0
if len(S)==1:
    ans = S
else:
    ans += int(S[0]) - 1
    for i in range(len(S)-1):
        ans += 9
    sum_S = 0
    for i in range(len(S)):
        sum_S += int(S[i])
    if ans < int(sum_S):
        ans = sum_S
print(ans)


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

using namespace std;

int a[4];
int t;
char op[3];

int main()
{
    string s;
    cin >> s;

    for (int i = 0; i < 4; i++) {
        a[i] = s[i] - '0';
        // cout << a[i] << " ";
    }
    // cout << endl;

    int t = a[0], ti, tj, tk;
    for (int i = 0; i < 2; i++) {
        if (i) {
            ti = t + a[1];
            op[0] = '+';
        } else {
            ti = t - a[1];
            op[0] = '-';
        }
        for (int j = 0; j < 2; j++) {
            if (j) {
                tj = ti + a[2];
                op[1] = '+';
            } else {
                tj = ti - a[2]; 
                op[1] = '-';
            }
            for (int k = 0; k < 2; k++) {
                if (k) {
                    tk = tj + a[3];
                    op[2] = '+';
                } else {
                    tk = tj - a[3]; 
                    op[2] = '-';
                }
                if (tk == 7) {
                    cout << a[0] << op[0] << a[1] << op[1] << a[2] << op[2] << a[3] << "=" << tk << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}


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

int main()
{
    ll n, k;
    cin >> n >> k;

    double ans = 0;

    rep(i, n){
        ll point = i+1;
        ll cnt = 0;
        double h = 1.0;
        while(true){
            if (point >= k){
                break;
            }
            cnt++;
            h /= 2.0;
            point *= 2;
        }
        ans += 1.0 / double(n) * h;
    }

    cout << std::fixed << std::setprecision(20) << ans << endl;

    return 0;
}


Measured memory_bytes: 3764
s, t = [input() for _ in range(2)]
t_len = len(t)

def is_fit(a, b):
	for i in range(t_len):
		if a[i] not in [b[i], "?"]:
			return False
	return True

for i in range(len(s)-t_len, -1, -1):
	if not is_fit(s[i:i+t_len], t):
		continue
	s = list(s)
	s[i:i+t_len] = list(t)
	s = "".join(s).replace("?", "a")
	print(s)
	exit()
print("UNRESTORABLE")

		

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, A, B; cin >> N >> A >> B;
    vector<double> v(N); REP(i, N) cin >> v[i];
    sort(ALL(v));

    double m = v[N-A];
    ll n = upper_bound(ALL(v), m) - lower_bound(ALL(v), m);
    if(v[N-1] == m)
    {
        ll ans = 0;
        for(ll i = A; i <= min(n, B); i++)
        {
            // nCi 
            ll p = 1;
            for(ll j = 1; j <= i; j++)
            {
                p *= n-j+1;
                p /= j; 
            }
            ans += p;
        }
        cout << m << '\n' << ans << endl;
        return 0;
    }

    ll r = A - (v.end() - upper_bound(ALL(v), m));

    ll ans = 1;
    for(ll i = 1; i <= r; i++)
    {
        ans *= n-i+1;
        ans /= i;
    }

    double ave = 0;
    REP(i, A) ave += v[N-i-1];
    ave /= A;

    cout << ave << endl;
    cout << ans << endl;
}

Measured memory_bytes: 3808
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////
LL c2(LL a) {
	LL ans = a * (a - 1) / 2;
	return ans;
}
void solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	IN(A);
	vector<int> his(200001, 0);
	for (int i = 0; i < N; ++i) {
		his[A[i]]++;
	}
	LL ans = 0;
	for (int i = 0; i < 200001; ++i) {
		ans += c2(his[i]);
	}
	for (int i = 0; i < N; ++i) {
		LL ter = his[A[i]];
		cout << ans - c2(ter) + c2(ter-1) << endl;
	}
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 4224
s=[]
while True:
    l1=input()
    if l1==".":
        break
    l2=input()
 
    sp1=l1.split('"')
    sp2=l2.split('"')
     
    m=0
    if len(sp1)==len(sp2):
        for i in range(len(sp1)):
            if i%2==1 and sp1[i]!=sp2[i]:
                m+=1
            elif i%2!=1 and sp1[i]!=sp2[i]:
                m+=2
 
 
    if sp1==sp2:
        s+=["IDENTICAL"]
    elif m==1:
        s+=["CLOSE"]
    else:
        s+=["DIFFERENT"]
 
for x in s:
    print(x)



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k,x,y,s=0;
    cin>>n>>k>>x>>y;
    if(n>=k)
    cout<<(k*x)+(n-k)*y<<endl;
    else
        cout<<n*x<<endl;
    return 0;
}


Measured memory_bytes: 3604
inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
A = l[0] * 1
B = l[1] * 1
C = l[2] * 1
s = [A, B, C].sort((a, b) => b - a)
console.log((s[0] + '' + s[1]) * 1 + s[2]) 


Measured memory_bytes: 9420
n = int(input())
d = {}
for i in range(n):
  [b, f, r, v] = list(map(int,input().split()))
  key = f'{b} {f} {r}'
  if key in d:
    d[key] += v
  else:
    d[key] = v
    
for b in range(1,5):
  for f in range(1,4):
    for r in range(1,11):
      key = f'{b} {f} {r}'
      if key in d:
        print(" "+str(d[key]),end="")
      else:
        print(" "+str(0),end="")
      if r == 10:
        print()
      if r == 10 and f == 3 and b != 4:
        print('####################')
        


Measured memory_bytes: 5636
#include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    int i = 0;
      int N;
      cin >> N;
      int D;
      int sum = 0;
      int Di = 0;
    while(i < N){
     cin >> D;
      sum += D;
     i++;
      if(Di < D) {
        Di = D;
      }
    }
      cout << sum - Di / 2 << endl;
    }

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "H"
#define FALSE__ "D"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif

bool a, b;

signed main()
{
	init();
	solve();
}

void init()
{
	CIN(char, t);
	CIN(char, tt);
	a = t == 'H';
	b = tt == 'H';
}

void solve()
{
	PRINT(!(a^b));
}


Measured memory_bytes: 256