akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str) { return str.split.to!(T[]); }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

void main()
{
	auto A = RD!long;
	auto B = RD!long;

	writeln(B % A == 0 ? A + B : B - A);
	stdout.flush();
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a, b;
    int i;
    char k;
    for(i=0;i<10000; i++){
        scanf("%d %c %d", &a, &k, &b);
        if(k == '?'){
            break;
        }else if(k == '+'){
            printf("%d\n", a+b);
        }else if(k == '-'){
            printf("%d\n", a-b);
        }else if(k == '*'){
            printf("%d\n", a*b);
        }else{
            printf("%d\n", a/b);
        }
    }
    return 0;
}



Measured memory_bytes: 2036
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
  string O, E;
  cin >> O >> E;
  for(int i=0;i<E.size();i++){
    cout << O.at(i) <<E.at(i);
  }
  if(O.size()!=E.size()){
    cout << O.at(O.size()-1);
  }
  cout << endl;
}

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

typedef long long ll;

int main() {
    ll x;
    cin >> x;
    ll ans = x / 11 * 2;
    if (x % 11 > 0) ans++;
    if (x % 11 > 6) ans++;
    cout << ans << "\n";
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        long l1 = ReadLongArray()[0];

        long hp = l1;
        long attack = 1;
        long attacks = 0;
        while (hp > 0)
        {
            attacks += attack;
            attack *= 2;
            hp /= 2;
        }

        Console.WriteLine(attacks);
    }

    static string[] ReadStringArray()
    {
        return Console.ReadLine().Trim().Split(' ');
    }

    static long[] ReadLongArray()
    {
        return ReadStringArray().Select(_ => long.Parse(_)).ToArray();
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
struct Info{
  int b, c;
};

int main()
{
  int n, m; 
  cin >> n >> m;
  vector<int> a(n);
  vector<Info> info(m);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < m; ++i) cin >> info[i].b >> info[i].c;
  sort(info.begin(), info.end(), [](const Info&x, const Info&y){
    return x.c > y.c;
  });
  
  int p1, p2;
  p1 = 0; p2 = 0;
  while ( (a[p1] < info[p2].c) && (p1 < n) && (p2 < m) ) {
    a[p1] = info[p2].c;
    ++p1;
    if (--info[p2].b == 0) ++p2;
  }
  
  long long sum = 0;
  for (int i = 0; i < n; ++i) sum += a[i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll u(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll d(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll z(ll a){
  if(a<0)return -a;
  return a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
ll nCr(int n,int k){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(void){
  int h,w,k;
  scanf("%d %d %d",&h,&w,&k);
  int a[h][w];
  int f[h];
  char s[h][w+1];
  FOR(h)scanf("%s",s[i]);
  FOR(h){
    int flg=1;
    int FLG=1;
    FORJ(w){
      if(s[i][j]=='#'){
        FLG=0;
        if(flg){
          for(int t=0;t<j;t++)a[i][t]=k;
          flg--;
        }else{
          k--;
        }
      }
      a[i][j]=k;
    }
    f[i]=FLG;
    if(!f[i])k--;
  }
  int x=-1;
  for(int i=0;f[i];i++)x=i;
  for(int i=x;i>=0;i--){
    f[i]=0;
    FORJ(w)a[i][j]=a[i+1][j];
  }
  FOR(h)if(f[i])FORJ(w)a[i][j]=a[i-1][j];
  FOR(h){
    FORJ(w)printf("%d ",a[i][j]);
    PRS("");
  }
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <iomanip>
#define PI 3.14159265359
using namespace std;
int main(void){
    double r;
    cin>>r;
    double m=r*r*PI;
    double e=(r+r)*PI;
    
    cout<<fixed<<setprecision(6)<<m<<' '<<e<<endl;
}



Measured memory_bytes: 3264
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const int inf=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;


int main(){
  ll n,d;cin>>n>>d;
  ll cnt=0;
  rep(i,0,n){
    ll x,y;cin>>x>>y;
    double dd=pow((x*x)+(y*y),0.5);
    if(dd<=d){cnt++;}
  }
  cout<<cnt<<endl;
}



Measured memory_bytes: 4256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] a = new int[4];
		for(int i = 0 ; i < 4 ; i++) {
			a[i] = s.charAt(i) - '0';
		}
		for(int i = 0 ; i < (1<<3) ; i++) {
			String ans = "";
			int tot = 0;
			ans += (char)(a[0] + '0');
			tot += a[0];
			for(int j = 0 ; j < 3 ; j++) {
				if(((i>>j)&1) == 1) {
					ans += '+';
					ans += (char)(a[j + 1] + '0');
					tot += a[j + 1];
				} else {
					ans += '-';
					ans += (char)(a[j + 1] + '0');
					tot -= a[j + 1];
				}
			}
			if(tot == 7) {
				ans += '=';
				ans += '7';
				System.out.println(ans);
				return;
			}
		}
	}
}

Measured memory_bytes: 23764
N,K = map(int,input().split())
A = list(map(int,input().split()))

numbers = [0] * max(N,max(A))
for i in range(N):
    numbers[A[i]-1] += 1

numbers.sort(reverse=True)

ans = 0
for i in range(N):
    if numbers[i] == 0:
        break
    if i > K-1:
        ans += numbers[i]
print(ans)

Measured memory_bytes: 24996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define p2d(v,n,m) rep(i,n){rep(j,m){pk(v[i][j]);}p("");}
#define fi first
#define se second
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll a[100001],b[100001],c[100001],d,n,m,x,y,z,h,w,k,sum,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;
P pa;

ll f[11][11];

int main(){
    cin>>n;
    rep(i,1,n+1){
        st=to_string(i);
        f[st[0]-'0'][st[st.size()-1]-'0']++;
    }
    rep(i,1,10)rep(j,1,10){
        sum+=f[i][j]*f[j][i];
    }
    p(sum);
    return 0;
}


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

using namespace std;

const int MAX = 3000000;

int day[MAX+1];
int isPrime[MAX+1];

int main(void){
    int i, j;
    for(i=0; i<MAX; ++i){
        day[i] = (i%7 == 1 || i%7 == 6);
        isPrime[i] = day[i];
    }

    for(i=6; i<=MAX; ++i){
        if(isPrime[i] == 0) continue;
        for(j=2; i*j <= MAX; ++j){
            if(day[j]) isPrime[i*j] = 0;
        }
    }

    int n;
    while(cin >> n){
        if(n == 1) break;
        cout << n << ":";
        for(i=2; i<=n; ++i){
            if(isPrime[i] && n%i == 0){
                cout << " " << i;
            }
        }
        cout << "\n";
    }
}

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

long long digits(long long n){
  int ans = 1;
  while(9<n){
      n /= 10;
      ans++;
  }
  return ans;
}

int main (){
    long long A,N,ans = 1000;
    cin >> N;
    
    for(A=1;A<=sqrt(N);A++){
        if(N%A == 0){
            ans = min(ans,digits(N/A));
        }
        else{continue;}
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
s=[int(input()) for i in range(N)]
S=0
for i in range(N):
  S+=s[i]
if S%10!=0:
  print(S)
else:
  s.sort()
  flag=0
  for i in range(N):
    if s[i]%10!=0:
      flag=1
      break
  if flag==1:
    print(S-s[i])
  else:
    print(0)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ll a;
  cin >> a;
  set<ll> s;
  ll t = a,ans=0;
  REP(i, 1000001) {
    ans++;
    s.insert(t);
    if (t % 2 == 0)
      t /= 2;
    else
      t = t * 3 + 1;
    if (s.count(t)) break;
  }
  cout << ans+1 << endl;
  return 0;
}


Measured memory_bytes: 3636
#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__ "Yes"
#define FALSE__ "No"
#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
#define MOD 1000000007

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

bool f[1 << 10];
char c;

void init()
{
	cin >> c;
	f['a'] = true;
	f['i'] = true;
	f['u'] = true;
	f['e'] = true;
	f['o'] = true;
}

void solve()
{
	if (f[c]) cout << "vowel";
	else cout << "consonant";
	cout << endl;
}



Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n;
int d[55];
signed main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",d+i);
    long long ans=0;
    for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)ans+=d[i]*d[j];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__",", __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

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

  if(c%__gcd(a,b)==0) cout << "YES"<<endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

bool check(int i)
{
    set<int> s;
    s.insert(i % 10);
    s.insert((i / 10) % 10);
    s.insert(i / 100);
    return s.size() == 1;
}

int main()
{
    int n;
    cin >> n;
    for (int i = n; i <= 999; i++)
    {
        if (check(i))
        {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct EdgeMF
{
	int to;
	ll capacity;
	int reverse;
};

void addEdgeForFlow(vector<vector<EdgeMF>>& G, int from, int to, ll capacity, ll reverseCapacity)
{
	G[from].push_back({ to, capacity, (int)G[to].size() });
	G[to].push_back({ from, reverseCapacity, (int)G[from].size() - 1 });
}

ll dfsForFlow(vector<vector<EdgeMF>>& G, vector<bool>& used, int u, int t, ll f)
{
	if (u == t)
	{
		return f;
	}

	used[u] = true;
	for (auto& e : G[u])
	{
		if (used[e.to] || e.capacity <= 0)
		{
			continue;
		}

		auto d = dfsForFlow(G, used, e.to, t, min(f, e.capacity));
		if (d > 0)
		{
			e.capacity -= d;
			G[e.to][e.reverse].capacity += d;
			return d;
		}
	}

	return 0;
}

ll calcMaxFlow(vector<vector<EdgeMF>>& G, int s, int t)
{
	auto f = 0ll;
	while (true)
	{
		vector<bool> used((int)G.size());
		auto d = dfsForFlow(G, used, s, t, LLONG_MAX);
		if (d <= 0)
		{
			break;
		}
		f += d;
	}

	return f;
}


int main()
{
	int N;
	cin >> N;
	vector<int> x(2 * N);
	vector<int> y(2 * N);
	for (auto i = 0; i < 2 * N; ++i)
	{
		cin >> x[i] >> y[i];
	}

	vector<vector<EdgeMF>> G(2 * N + 2);
	for (auto i = 0; i < N; ++i)
	{
		for (auto j = N; j < 2 * N; ++j)
		{
			if (x[i] < x[j] && y[i] < y[j])
			{
				addEdgeForFlow(G, i, j, 1, 0);
			}
		}
	}
	int s = 2 * N;
	int t = s + 1;
	for (auto i = 0; i < N; ++i)
	{
		addEdgeForFlow(G, s, i, 1, 0);
		addEdgeForFlow(G, i + N, t, 1, 0);
	}

	cout << calcMaxFlow(G, s, t) << endl;

	return 0;
}

Measured memory_bytes: 3816
#include <cstdio>

int main(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int ans;
    if(a + b < c){
        ans = a + b + b + 1;
    }else if(a + b == c){
        ans = a + b + b;
    }else{
        ans = b + c;
    }
    printf("%d\n", ans);

    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int sum = 0;
    rep(i, 4) {
        int a; cin >> a;
        sum += a;
    }
    int resm = sum/60;
    sum -= resm*60;
    cout << resm << '\n';
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>
int main(){
  long long int r,temp,x,y;
  while(scanf("%lld",&x)!=EOF){
    scanf("%lld",&y);
    if(x<y){
      temp=x;
      x=y;
      y=temp;
    }
    long long int a=x;
    long long int b=y;
    while(y!=0){
      r=x%y;
      x=y;
      y=r;
    }
    long long int lcm=a*b/x;
    printf("%lld %lld\n",x,lcm);
  }
  return(0);
}

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

void solve()
{
    string s;
    cin >> s;
    if (s[0] == '9' || s[1] == '9')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3636
#入力
H, W = [int(i) for i in input().split()]
map = []
for i in range(H):
    line = input()
    map.append(line)

tmp = [[0 for i in range(W+2)] for j in range(H+2)]
for i in range(H):
    for j in range(W):
        if map[i][j]=='#':
            tmp[i][j]+=1
            tmp[i][j+1]+=1
            tmp[i][j+2]+=1
            tmp[i+1][j+2]+=1
            tmp[i+2][j+2]+=1
            tmp[i+2][j+1]+=1
            tmp[i+2][j]+=1
            tmp[i+1][j]+=1
            
for i in range(H):
    for j in range(W):
        if map[i][j]=='#':
            tmp[i+1][j+1]='#'
        print(str(tmp[i+1][j+1]), end='')
    print('\n')

Measured memory_bytes: 3444
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

double a,b;

int main(){
	cout<<syosu(8);
	cin>>a>>b;
	cout<<1/(1/a+1/b)<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	char A[N+1],B[N+1],C[N+1];
	scanf("%s",A);
	scanf("%s",B);
	scanf("%s",C);
	
	int ans=0;
	for(int i=0;i<N;i++){
		int f1=0,f2=0,f3=0;
		if(A[i]==B[i])f1=1;
		if(B[i]==C[i])f2=1;
		if(C[i]==A[i])f3=1;
		if(f1+f2+f3==0)ans+=2;
		else if(f1*f2*f3==1)ans+=0;
		else ans+=1;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
	
	int a, b, c, d;	
	cin >> a >> b >> c >> d;
	if (a + b < c + d) {
	cout << "Right" << endl;
	}
	else if (a+b>c+d) {
	cout << "Left" << endl;
	}
	else {
	cout << "Balanced" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#https://atcoder.jp/contests/abc176/submissions/16118386
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
H,W,M=map(int,input().split())
A=list()
B=list()
for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
c = collections.Counter(A)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if A[i]!=k:
    L.append(B[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  ans=s[0][1]+t
else:
  ans=t
c = collections.Counter(B)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if B[i]!=k:
    L.append(A[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  q=s[0][1]+t
else:
  q=t
ans=max(ans,q)
print(ans)

Measured memory_bytes: 106700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int a, b, c, d, N, ans;

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

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define double long double
#define INF LLONG_MAX/10000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n;
char c[2][52];
int grid[2][52];
vector<int> vec[52];
int ans[52];
signed main() {
	cin >> n;
	rep(i, 2) {
		rep(j, n)cin >> c[i][j];
	}
	int ans = 1;
	rep(i, n) {
		if (c[0][i] == c[1][i]) {
			if (!i)ans *= 3;
			else if (c[0][i - 1] == c[1][i - 1])ans *= 2;
		}
		else {
			if (!i)ans *= 6;
			else if (c[0][i - 1] == c[1][i - 1])ans *= 2;
			else ans *= 3;
			i++;
		}
		ans %= moder;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())+1
A=[0]+list(map(int,input().split()))
Heap=[]
for i in range(1,n):
    parent,right,left=i//2,i*2,i*2+1
    right=A[right] if right<n else 0
    left=A[left] if left<n else 0
    Heap.append([i,A[i],A[parent],right,left])

for i in range(n-1):
    node,key,parent,left,right=Heap[i]
    print("node {}: key = {}, ".format(node,key), end="")
    if parent!=0:print("parent key = {}, ".format(parent), end="")
    if left!=0:print("left key = {}, ".format(left), end="")
    if right!=0:print("right key = {}, ".format(right), end="")
    print()


Measured memory_bytes: 5728
from itertools import accumulate
from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
S=list(accumulate(A))
C=Counter(S)

def num(m):
    return m*(m-1)//2

ans=0
for k,v in C.items():
    if k==0:
        ans+=v
    if v>1:
        ans+=num(v)
print(ans)

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    int n, k;
    cin >> n >> k;
    vector<ll>a(n);
    vector<pii>cnt(n);
    rep(i, 0, n)cin >> a[i];
    sort(a.begin(),a.end());
    rep(i, 0, n){
        cnt[i].first = i;
        cnt[i].second = n-(i+1); 
    }
    COMinit();
    ll ans = 0;
    rep(i, 0, n){
        if(cnt[i].first>=k-1){
            ans = (ans + a[i]*(COM(cnt[i].first,k-1)))%mod;
        }
        if(cnt[i].second>=k-1){
            ans = (ans - a[i]*(COM(cnt[i].second,k-1)))%mod;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 28284
#include <iostream>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))

using namespace std;

int main()
{
    int n;
    int a;
    int sum = 0;
    int l = -1;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sum = sum + a;
        l = max(l, a);
    }

    if (l < sum - l) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            List<int> info = Cin();
            int x = info[0];
            int n = info[1];
            if (n == 0)
            {
                Cout(x);
                return;
            }
            
            List<int> nums = Cin().Distinct().OrderBy(t=>t).ToList();
            int idx = nums.IndexOf(x);
            if (idx == -1)
            {
                Cout(x);
                return;
            }
            
            int li = 0;
            int ri = nums.Count-1;
            // Left.
            for (int i = idx-1;i>=0; i--)
            {
                if (nums[i] + 1 != nums[i+1])
                {
                    li = i + 1;
                    break;
                }
            }
            // Right.
            for (int i = idx + 1; i < nums.Count; i++)
            {
                if (nums[i-1] + 1 != nums[i])
                {
                    ri = i - 1;
                    break;
                }
            }

            int left  = nums[li]-1;
            int right = nums[ri]+1;
            if(x - left <= right - x)
                Cout(left);
            else
               Cout(right); 
                     
        }
        
        public static List<int> Cin()
        {
            return Console.ReadLine().Split().Select(t => int.Parse(t)).ToList();
        }
        
        public static void Cout(int s)
        {
            Console.WriteLine(s);
        }
            
    }
}

Measured memory_bytes: 28524
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int MAX = 1000001; 
  
// array to store prime factors 
int factor[MAX] = { 0 }; 
  
// function to generate all prime factors 
// of numbers from 1 to 10^6 
void generatePrimeFactors() 
{ 
    factor[1] = 1; 
  
    // Initializes all the positions with their value. 
    for (int i = 2; i < MAX; i++) 
        factor[i] = i; 
  
    // Initializes all multiples of 2 with 2 
    for (int i = 4; i < MAX; i += 2) 
        factor[i] = 2; 
  
    // A modified version of Sieve of Eratosthenes to 
    // store the smallest prime factor that divides 
    // every number. 
    for (int i = 3; i * i < MAX; i++) { 
        // check if it has no prime factor. 
        if (factor[i] == i) { 
            // Initializes of j starting from i*i 
            for (int j = i * i; j < MAX; j += i) { 
                // if it has no prime factor before, then 
                // stores the smallest prime divisor 
                if (factor[j] == j) 
                    factor[j] = i; 
            } 
        } 
    } 
}
int calculateNoOFactors(int n) 
{ 
    if (n == 1) 
        return 1; 
  
    int ans = 1; 
  
    // stores the smallest prime number 
    // that divides n 
    int dup = factor[n]; 
  
    // stores the count of number of times 
    // a prime number divides n. 
    int c = 1; 
  
    // reduces to the next number after prime 
    // factorization of n 
    int j = n / factor[n]; 
  
    // false when prime factorization is done 
    while (j != 1) { 
        // if the same prime number is dividing n, 
        // then we increase the count 
        if (factor[j] == dup) 
            c += 1; 
  
        /* if its a new prime factor that is factorizing n,  
           then we again set c=1 and change dup to the new  
           prime factor, and apply the formula explained  
           above. */
        else { 
            dup = factor[j]; 
            ans = ans * (c + 1); 
            c = 1; 
        } 
  
        // prime factorizes a number 
        j = j / factor[j]; 
    } 
  
    // for the last prime factor 
    ans = ans * (c + 1); 
  
    return ans; 
} 
int main(){
	ll n;
	cin>>n;
	generatePrimeFactors(); 
	int ans=0;
	for(int i=1;i<n;i++){
		ans+=calculateNoOFactors(n-i);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 7536
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
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); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  IN(n);
  vi d(n);
  VIN(d);

  if (n%2==1) {
    OUT(0);
    return 0;
  }

  SORT(d);
  ll abc = d[n/2-1];
  ll arc = d[n/2];
  if (abc == arc) {
    OUT(0);
  } else {
    OUT(arc - abc);
  }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  int ans = 0;
  int sum = 0;
  int cur = -1;
  rep(i, n) {
    if (cur == -1) {
      cur = h[i];
    } else if (cur >= h[i]) {
      cur = h[i];
      sum++;
    } else {
      ans = max(ans, sum);
      sum = 0;
      cur = h[i];
    }
  }
  ans = max(ans, sum);
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#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(){
    int x;
    cin >> x;
    int answer = 8;
     
    for(int i=600;i <= 2000;i+=200){
        if(x < i){
            cout << answer << endl;
            break;
        }
        answer--;
    }
    return 0;
}

Measured memory_bytes: 3580
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long a[n];
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        auto it = find(s.begin(), s.end(), '.');
        if (it == s.end())
            a[i] = atoll(s.c_str()) * 1000000000LL;
        else {
            const int j = it - s.begin();
            string s1 = s.substr(0, j), s2 = s.substr(j+1);
            long long m = atoll(s2.c_str());
            for (int k = 9 - s2.size(); k > 0; k--) m *= 10;
            a[i] = atoll(s1.c_str()) * 1000000000LL + m;
            // cerr << s1 << " " << s2 << " " << m <<" " << a[i] << endl;
        }
    }
    long long ans = 0;
    int cnt[19][19] = {};
    for (int i = 0; i < n; i++) {
        int e = 0, f = 0;
        while (a[i] % 2 == 0) { e++; a[i] /= 2; }
        while (a[i] % 5 == 0) { f++; a[i] /= 5; }
        e = min(e, 18);
        f = min(f, 18);
        for (int p = 18 - e; p < 19; p++)
            for (int q = 18 - f; q < 19; q++)
                ans += cnt[p][q];
        cnt[e][f]++;
        // cerr << ans << endl;
    }
    cout << ans << endl;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

bool isHonest(int bit, int n)
{
    return bit & 1 << n;
}

void solve()
{
    int N; cin >> N;
    vector<vector<pii>> t(N);
    REP(i, N)
    {
        int A; cin >> A;
        t[i].resize(A);
        REP(j, A)
        {
            cin >> t[i][j].first >> t[i][j].second;
            t[i][j].first--;
        }
    }

    int ans = 0;
    REP(b, 1 << N)
    {
        bool ok = true;
        REP(i, N)
        {
            if(!isHonest(b, i)) continue;
            REP(j, t[i].size())
            {
                int x = t[i][j].first, y = t[i][j].second;
                if(isHonest(b, x) != y) ok = false;
            }
        }
        if(ok) ans = max(ans, __builtin_popcount(b));
    }
    cout << ans << endl;
}
    
signed main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cmath>
#include <iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int A, B, H, M;
double res;

int main()
{
    cin >> A >> B >> H >> M;

    res = sqrt(A * A + B * B - 2 * A * B * cos(abs((H * 30 + M * 0.5) - (M * 6)) * PI / 180));
    cout << fixed << setprecision(20) << res << endl;

    return 0;
}

Measured memory_bytes: 4160
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
  string a;
  cin >> a;
  for(int i=0;i<3; i++){
    if(a[i]=='9') cout << 1;
    else if(a[i]=='1') cout << 9;
  }
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        vector<int> l(n, 0), r(n, 0), h(n, numeric_limits<int>::max()), d(n);
        vector<int> pos, neg;
        rep (i, n) {
                string s;
                cin >> s;
                rep (j, s.size()) {
                        if (s[j] == '(') {
                                l[i]++;
                        } else {
                                r[i]++;
                        }
                        h[i] = min(h[i], l[i] - r[i]);
                }

                d[i] = l[i] - r[i];

                if (l[i] - r[i] >= 0) {
                        pos.push_back(i);
                } else {
                        neg.push_back(i);
                }
        }

        sort(pos.begin(), pos.end(), [&](int i, int j){
                return h[i] > h[j];
        });
        sort(neg.begin(), neg.end(), [&](int i, int j){
                return h[i] + (r[i] - l[i]) < h[j] + (r[j] - l[j]);
        });

        int t = 0;
        for (int i : pos) {
                if (t + h[i] < 0) {
                        cout << "No" << endl;
                        return 0;
                } else {
                        t += d[i];
                }
        }

        for (int i : neg) {
                if (t + h[i] < 0) {
                        cout << "No" << endl;
                        return 0;
                } else {
                        t += d[i];
                }
        }

        if (t == 0) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }

        return 0;
}


Measured memory_bytes: 23072
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long x,y;
	scanf("%lld%lld",&x,&y);
	x=x%y;
	if(abs(x-y)<x)
	printf("%lld\n",abs(x-y));
	else
	printf("%lld\n",x);
}

Measured memory_bytes: 256
n, x = map(int, input().split())

def dp(a, b):
    if a == 1:
        if 1 <= b <= 4:
            return b-1
        else:
            return 3
    elif b == 1:
        return 0
    elif 1 < b < 2**(a+1)-1:
        return dp(a-1, b-1)
    elif b == 2**(a+1)-1:
        return dp(a-1, 2**(a+1)-3) + 1
    elif 2**(a+1)-1 < b < 2**(a+2)-3:
        return dp(a-1, 2**(a+1)-3) + 1 + dp(a-1, b+1-2**(a+1))
    elif b == 2**(a+2)-3:
        return dp(a-1, 2**(a+1)-3) * 2 + 1
    
print(dp(n, x))

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

int main(){
    string S; cin >> S;
    long long int N; N = S.length();
    vector<int> U(N,0);

    for (int i = 0;i < N;i++){
        int j = N-i-1;
        char c; c = S.at(j);
        int u; u = c - '0';
        U.at(i) = u;
    }

    vector<int> DP(N+1,0);
    DP.at(0) = 0;
    long long int now; now = 0;
    long long pnow = 1;
    for (int i = 0;i < N;i++){
        int u; u = U.at(i);
        pnow*=10;
        pnow%=2019;
        now+=u * pnow;
        now%=2019;
        DP.at(i+1) = now;
    }

    vector<int> tyo(2019,0);
    for (int dp : DP){
        tyo.at(dp)++;
    }

    int ans = 0;
    for (int t : tyo){
        ans+=(t*(t-1))/2;
    }

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

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

int main() {
    int n;
    cin >> n;
    int count = 0;
    char x;
    int i = 0;

    while (i < n) {
        cin >> x;
        if (x == 'Y') {
            count++;
        }
        i++;
    }
    if (count) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }
}

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

constexpr int si = 1001 * 1002, si_log = 7 + 10, mod = static_cast<int>(1e9) + 7;
constexpr long double eps = 1.0e-9;
int n, ar[si];
//string s1;
//vector<int> gr[si];

int64_t sol() {
   int ret = 0, cnt = 0;
   for (int i = 1; i <= 100*1000+2; i++) {
      int c2 = ar[i - 1] + ar[i] + ar[i + 1];
      if (cnt < c2)
      {
         cnt = c2;
         ret = i;
      }
   }

   return cnt;
}

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

   while ((cin >> n)) {
      memset(ar, 0, sizeof ar);
      for (int i = 1; i <= n; i++) { int x; cin >> x; ar[x]++; }
      //for (int i = 1; i <= n; i++) { gr[i].clear(); }
      //for (int i = 1; i < n; i++) {
      //   int a, b; cin >> a >> b; gr[a].push_back(b); gr[b].push_back(a);
      //}

      auto s =
      sol();
      //cout << (s ? "Yes": "No") << '\n';
      cout << s << '\n';
   }
   return 0;
}

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

int main(){
	int num[3];
	cin >> num[0] >> num[1] >> num[2];
    
	sort(num, num + 3);
	
	cout << num[0] << " " << num[1] << " " << num[2] << endl;

	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)


using Graph = vector<string>;
vector<int> dx = { 1,0,-1,0 };
vector<int> dy = { 0,1,0,-1 };

int main() {
	int h, w; //頂点数,辺数
	cin >> h >> w;

	Graph G;
	FOR(i, 0,h-1) {
		string s;
		cin >> s;
		G.push_back(s);
	}

	int res = 0;
	FOR(i, 0, h - 1) {
		FOR(j, 0, w - 1) {
			if (G[i][j] == '#')continue;
			vector<vector<int>> dist(h, vector<int>(w, -1));
			queue<pair<int,int>> que;

			// 初期条件 (頂点 1 を初期ノードとする)
			dist[i][j] = 0;
			que.push(MP(i,j));

			while (!que.empty()) {
				pair<int,int> v = que.front(); // キューから先頭頂点を取り出す
				que.pop();
				FOR(dir, 0, 3) {
					int xtmp = v.F + dx[dir];
					int ytmp = v.S + dy[dir];
					pair<int, int> gv = MP(xtmp,ytmp);
					if (gv.first >= 0 && gv.first < h && gv.second < w && gv.second >= 0 && G[gv.first][gv.second]=='.') {
						if (dist[gv.first][gv.second] == -1) {
							dist[gv.first][gv.second] = dist[v.first][v.second] + 1;
							//dump(dist[gv.first][gv.second])
							res = max(res, dist[gv.first][gv.second]);
							que.push(gv);
						}
					}
				}
			}
		}
	}
	pv(res)
}

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

int main() {
  int r, g, b, n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  for (int i = 0; r * i <= n; i++) {
    for (int j = 0; r * i + j * b <= n; j++) {
      int x = n - r * i - b * j;
      if (x >= 0 && (x % g) == 0) ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

const long long INF = 1LL << 60;

struct Node {
    explicit Node(int idx, int pos, long long cost) : idx(idx), pos(pos), cost(cost) {}
    int idx, pos;
    long long cost;
    bool operator > (const Node& nd) const { return cost > nd.cost; }
};

int main(){
    int N; cin >> N;
    vector<string> S(2*N);
    vector<long long> C(2*N);
    for(int i=0;i<N;i++){
        cin >> S[2*i];
        S[2*i+1] = S[2*i];
        reverse(S[2*i+1].begin(), S[2*i+1].end());
        cin >> C[2*i];
        C[2*i+1] = C[2*i];
    }
    vector dist(2*N, vector(21, INF));
    priority_queue<Node, vector<Node>, greater<Node>> qu;
    for(int i=0;i<2*N;i++){
        qu.emplace(i, 0, C[i]);
        dist[i][0] = C[i];
    }
    long long res = INF;
    while(!qu.empty()){
        Node nd = qu.top(); qu.pop();
        const string& s = S[nd.idx];
        bool end = true;
        for(int i=0;i+nd.pos<s.size()-i-1;i++){
            if(s[i+nd.pos] != s[s.size()-i-1]) end = false;
        }
        if(end){
            res = min(res, nd.cost);
        }
        for(int i=1-nd.idx%2;i<2*N;i+=2){
            int l = min<int>(s.size() - nd.pos, S[i].size());
            bool ok = true;
            for(int j=0;j<l;j++){
                if(s[nd.pos+j] != S[i][j]) ok = false;
            }
            if(!ok) continue;
            int nidx = (nd.pos + l == s.size() ? i : nd.idx);
            int npos = (nd.pos + l == s.size() ? l : nd.pos + l);
            long long ncost = dist[nd.idx][nd.pos] + C[i];
            if(ncost < dist[nidx][npos]){
                dist[nidx][npos] = ncost;
                qu.emplace(nidx, npos, ncost);
            }
        }
    }
    cout << (res < INF ? res : -1) << endl;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int c=0;
  for(int i=1;i<=n;i++){
    int d=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        if(j==2)
          break;
        else
          d++;
      }
    }
    if(d==8)
      c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 3640
n, m = gets.split.map(&:to_i)

edge = Array.new(n+1) {Array.new(n+1)}
dp = Array.new(n+1) {Array.new(n+1, 1000 * 100)}
m.times do
    a, b, c = gets.split.map(&:to_i)
    edge[a][b] = edge[b][a] = dp[a][b] = dp[b][a] = c
end
n.times {|i| dp[i][i] = 0}

1.upto(n) do |k|
    1.upto(n) do |s|
        next if s == k
        (s+1).upto(n) do |f|
            dp[s][f] = dp[f][s] = [dp[s][f], dp[s][k] + dp[k][f]].min
        end
    end
end

ans = 0
1.upto(n) do |i|
    (i+1).upto(n) do |j|
        ans += 1 if edge[i][j] && edge[i][j] > dp[i][j]
    end
end

p ans

Measured memory_bytes: 14428
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i<=r; i++) {
        if(i%d == 0) ans++;
    }
    cout << ans << '\n';
}

int main() {_
    int t = 1;
    //cin >> t;
    //Plese remember to uncomment for taking test cases.
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
import numpy as np
from collections import defaultdict
from math import gcd
import time
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
 
start = time.time()
# N, K = map(int, input().split(' '))
N = int(input())
rad=N*2*3.14
print(rad)


Measured memory_bytes: 27136
n,m=map(int,input().split())
s=[[0]*10 for _ in range(m)]
for i in range(m):
    k=list(map(int,input().split()))
    for j in range(1,k[0]+1):
        s[i][10-k[j]]=1
import numpy as np
s=np.asarray(s)
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    binst=format(i,'010b')
    l=list(map(int,list(binst)))
    l=np.asarray(l)
    on=s&l
    onsum=np.sum(on,axis=1)%2
    err=0
    for j in range(m):
        if onsum[j]!=p[j]:
            err=1
            break
    if err==0:
        ans+=1
print(ans)
    

Measured memory_bytes: 26852