akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
int binary_search_index(Int Y, vi &q){
    int left = 0, right = q.size() - 1;
    while (right >= left) {
        int mid = left + (right - left) / 2;
        if (q[mid] == Y) return mid;
        else if (q[mid] > Y) right = mid - 1;
        else if (q[mid] < Y) left = mid + 1;
    }
    return -1;
}

int main() {
    Int N;
    cin >>N;
    vi x = vi(N);
    vi y = vi(N);
    vi h = vi(N);

    int xx;
    int yy;
    int hh;

    rep(i,N){
        cin >> x[i];
        cin >> y[i];
        cin >> h[i];
        if (h[i]>=1){
            xx = x[i];
            yy = y[i];
            hh = h[i];
        }
    }

    if (N==1){
        cout << x[0] << " " << y[0] << " " << h[0] << endl;
        return 0;
    }

    vvi cands = vvi(101,vi(101,0));
    rep(i,101){
        rep(j,101){
            cands[i][j] = max(abs(i-xx)+abs(j-yy)+hh,0LL);
        }
    }

    Int H = -1;
    int X = -1000;
    int Y = -1000;
    bool flag;
    rep(i,101){
        rep(j,101){
            flag = true;
            Int tmp_h = cands[i][j];
            rep(k,N){
                Int ans_tmp = max(tmp_h - abs(i-x[k])-abs(j-y[k]),0LL);
                if(h[k] != ans_tmp){
                    flag = false;
                }
            }
            if(flag){
                X=i;
                Y=j;
                H=max(cands[i][j],0LL);
            }
        }
    }

    cout << X << " " << Y << " " << H << endl;


    return 0;
}

Measured memory_bytes: 384
N,A,B = map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    if (A-1)<=(N-B):
        print(A+(B-A-1)//2)
    else:
        print(N-B+1+(B-A-1)//2)

Measured memory_bytes: 61604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  int a=0;
  rep(i,0,n){
    if(i%2==0){
      if(s[i]=='0') a++;
    }
    else{
      if(s[i]=='1') a++;
    }
  }
  int b=0;
  rep(i,0,n){
    if(i%2==0){
      if(s[i]=='1') b++;
    }
    else{
      if(s[i]=='0') b++;
    }
  }
  
  cout<<min(a,b)<<endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  int N = s.size();

  for(int i = 0; i < N - 1; i++){
    if(s[i] == s[i + 1]){
      cout << "Bad" << endl;
      return 0;
    }
  }

  cout << "Good" << endl;
  return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int a,b,c,k;
	cin >> a >> b >> c >> k;

	int ans = min(a, k);
	k -= (a + b);
	if(k > 0) ans -= min(k, c);

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

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

using namespace std;

int main()
{
 	int N;
  	string s;
  	cin>>N;
  	cin>>s;
  	if(s.size()<=N)cout<<s<<endl;
  	else
    {
      s=s.substr(0,N);
      cout<<s<<"..."<<endl;
    }
  	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string s;
	cin >> s;

	int ans = 0, num = 0;
	for(int i=0;i<s.size();i++){
		if(s.at(i)=='A') num++;
		else if(s.at(i)=='C') num++;
		else if(s.at(i)=='G') num++;
		else if(s.at(i)=='T') num++;
		else{
			if(num>ans){
				ans = num;
				num = 0;
			}
		}
	}
	if(num>ans) ans = num;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL K,N;
LL t[100001];
LL d[100001];
vector<LL>v[100001];
vector<LL>w;
vector<LL>x;
LL S[100011];
LL SS[100011];
int main(){
	cin>>N>>K;
	REP(i,N){
		cin>>t[i]>>d[i];
		v[t[i]-1].push_back(d[i]);
	}
	REP(i,N){
		sort(v[i].begin(),v[i].end());
		reverse(v[i].begin(),v[i].end());
	}
	REP(i,N){
		REP(j,v[i].size()){
			if(j==0){
				w.push_back(v[i][j]);
			}else{
				x.push_back(v[i][j]);
			}
		}
	}
	sort(w.begin(),w.end());
	reverse(w.begin(),w.end());
	sort(x.begin(),x.end());
	reverse(x.begin(),x.end());
	REP(i,N+1){
		S[i]=0;
		SS[i]=0;
	}
	REP(i,w.size()){
		if(i==0){
			S[i+1]=w[i];
		}else{
			S[i+1]=S[i]+w[i];
		}
	}
	REP(i,x.size()){
		if(i==0){
			SS[i+1]=x[i];
		}else{
			SS[i+1]=SS[i]+x[i];
		}
	}
	LL ans=0;
	REP(i,K+1){
		if(S[i]!=0){
			//cout<<S[i]<<" "<<SS[K-i]<<endl;
			ans=max(ans,S[i]+SS[K-i]+(LL)i*i);
		}
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 9716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vector<int>>;  // int <=> ll
using P = pair<int, int>;  // int <=> ll
const int INFTY = 1e9+7;

int main() {
  int N, H;
  cin >> N >> H;
  int max_a = 0;
  vi Katana(N);
  rep(i,N) {
    int a;
    cin >> a >> Katana[i];
    if (max_a < a) max_a = a;
  }

  priority_queue<int> pq;
  rep(i,N) {
    if (max_a < Katana[i]) pq.push(Katana[i]);
  }

  int ans = 0;
  while (!pq.empty()) {
    H -= pq.top(); pq.pop();
    ++ans;
    if (H <= 0) break;
  }
  if (H > 0) ans += (H-1)/max_a + 1;

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


Measured memory_bytes: 1404
#!/usr/bin/env python3
import sys

X,Y = list(map(int, input().split()))

YES = "Yes"  
NO = "No" 

for i in range(X+1):
    two = i
    four = X-i
    
    if 2 * two + 4 * four == Y:
        print(YES)
        sys.exit()

print(NO)

Measured memory_bytes: 61856
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var array2 = array.Distinct().ToArray();

            if (array.Length != array2.Length && (array2.Length == 2))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13268
#!/usr/bin/env python3
#三井住友信託銀行プログラミングコンテスト2019 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def C(n,r):
    return math.factorial(n)//math.factorial(n-r)//math.factorial(r)

n = I()
s = input()
t = list(map(int,list(s)))
ans = 0
for i in range(10):
    for j in range(n):
        if i == t[j]:
            tmp = j
            break
    else:
        continue
    for j in range(100):
        if len(str(j)) == 2:
            x,y = list(str(j))
        else:
            x,y = '0',str(j)
        flg = False
        for k in range(tmp+1,n):
            if flg and y == str(t[k]):
                ans += 1
                break
            if x == str(t[k]):
                flg = True
print(ans)

Measured memory_bytes: 46044
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> g[n];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> ans(n, -1);
    vector<bool> seen(n, false);
    queue<int> que;
    que.emplace(0);
    while (not que.empty()) {
        int v = que.front();
        que.pop();
        if (seen[v]) continue;
        seen[v] = true;
        for (int u : g[v]) if (not seen[u]) {
            if (ans[u] == -1) ans[u] = v;
            que.emplace(u);
        }
    }

    bool ok = true;
    for (int i = 0; i < n; i++) {
        ok &= (seen[i]);
    }
    if (ok) {
        cout << "Yes" << '\n';
        for (int i = 1; i < n; i++) {
            cout << ans[i] + 1 << '\n';
        }
    } else {
        cout << "No" << '\n';
    }

    return 0;
}

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

using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int> pii32;
typedef pair<int64,int64> pii64;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int maxn = 1e5+10;
const int64 MO = 1e9+7;
const int64 IN = 1e9;

vector <int> v[2];
int n;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	bool z = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x == 0)
			z = 1;
		if (x >= 0)
			v[1].PB(x);
		else
			v[0].PB(x);
	}
	sort(all(v[0])); reverse(all(v[0]));
	sort(all(v[1]));
	if (z) {
		int sum = 0;
		for (auto x : v[0])
			sum += abs(x);
		for (auto x : v[1])
			sum += abs(x);
		cout << sum << "\n";
		sum = v[1][0];
		for (int i = 1; i < sz(v[1]); i++) {
			if (i == sz(v[1]) - 1) {
				cout << v[1][i] << " " << sum << "\n";
				sum = v[1][i] - sum;
			} else {
				cout << sum << " " << v[1][i] << "\n";
				sum = sum - v[1][i];
			}
		}
		for (auto x : v[0]) {
			cout << sum << " " << x << "\n";
			sum = sum - x;
		}
		return 0;
	}
	if (sz(v[0]) && sz(v[1])) {
		int sum = 0;
		for (auto x : v[0])
			sum += abs(x);
		for (auto x : v[1])
			sum += abs(x);
		cout << sum << "\n";
		sum = v[0][0];
		for (int i = 0; i < sz(v[1]); i++) {
			if (i == sz(v[1]) - 1) {
				cout << v[1][i] << " " << sum << "\n";
				sum = v[1][i] - sum;
			} else {
				cout << sum << " " << v[1][i] << "\n";
				sum = sum - v[1][i];
			}
		}
		for (int i = 1; i < sz(v[0]); i++) {
			cout << sum << " " << v[0][i] << "\n";
			sum = sum - v[0][i];
		}
		return 0;
	}
	if (sz(v[0])) {
		int sum = -2 * abs(v[0][0]);
		for (auto x : v[0])
			sum += abs(x);
		cout << sum << "\n";
		sum = v[0][0];
		for (int i = 1; i < sz(v[0]); i++) {
			cout << sum << " " << v[0][i] << "\n";
			sum = sum - v[0][i];
		}
		return 0;
	} else {
		int sum = -2 * abs(v[1][0]);
		for (auto x : v[1])
			sum += abs(x);
		cout << sum << "\n";
		sum = v[1][0];
		for (int i = 1; i < sz(v[1]); i++) {
			if (i == sz(v[1]) - 1) {
				cout << v[1][i] << " " << sum << "\n";
				sum = v[1][i] - sum;
			}
			else {
				cout << sum << " " << v[1][i] << "\n";
				sum = sum - v[1][i];
			}
		}
	}
}


Measured memory_bytes: 2424
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 200020
using namespace std;
int read(){
	int nm=0,fh=1; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
int n,m,fs[M],nt[M],to[M],fa[M],tmp,cnt,Mx,Mn,v[M];
bool vis[M],lp[M],hv[M];
void link(int x,int y){nt[tmp]=fs[x],fs[x]=tmp,to[tmp++]=y;}
void dfs(int x){
	for(int i=fs[x];i!=-1;i=nt[i]) if(!lp[to[i]]) dfs(to[i]);
	for(int i=fs[x];i!=-1;i=nt[i]) if(!lp[to[i]]) hv[v[to[i]]]=true;
	while(hv[v[x]]) v[x]++;
	for(int i=fs[x];i!=-1;i=nt[i]) if(!lp[to[i]]) hv[v[to[i]]]=false;
}
int main(){
	n=read(),memset(fs,-1,sizeof(fs)),Mn=n+1;
	for(int i=1;i<=n;i++) fa[i]=read(),link(fa[i],i);
	for(m=1;!vis[m];m=fa[m]) vis[m]=true;
	for(;!lp[m];m=fa[m]) cnt++,lp[m]=true;
	for(m=1;m<=n;m++) if(lp[m]) dfs(m),Mx=max(Mx,v[m]),Mn=min(Mn,v[m]);
	puts((cnt&1)&&Mx==Mn?"IMPOSSIBLE":"POSSIBLE"); return 0;
}

Measured memory_bytes: 4480
#include<iostream>
#include<unordered_map>
using namespace std;
int main(){
  int n,i;
  cin>>n;
  int ar[n];
  unordered_map<int,int> mp;
  for(i=1;i<=n;i++){
      mp[i]=0;
  }
  for(i=0;i<(n-1);i++){
    cin>>ar[i];
    mp[ar[i]]+=1;
  
  }
  for(i=1;i<=n;i++)
    cout<<mp[i]<<"\n";
 }

Measured memory_bytes: 12200
n, m = map(int, input().split())
city = []
for i in range(m):
    p, y = map(int, input().split())
    city.append([p,y,i])
city.sort(key = lambda x: x[1])
city.sort()
num = 1
for i in range(m):
    if i == 0:
        city[i][1] = num
        num += 1
    else:
        if city[i][0] == city[i-1][0]:
            city[i][1] = num
            num += 1
        else:
            city[i][1] = 1
            num = 2
city.sort(key = lambda x: x[2])
for i in range(m):
    p = format(city[i][0], '0>6')
    num = format(city[i][1], '0>6')
    print(p, end='')
    print(num)


Measured memory_bytes: 24520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double d;cin>>d;
    double ans=sqrt(d*d/2.0)*2.0;
    for(double i=0.0;i<=d;i+=1.0){
        double j=sqrt(d*d-i*i);
        ans=max(ans,i+max(j,1.0));
    }
    
    cout<<setprecision(25)<<ans<<endl;
}




Measured memory_bytes: 3312
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    cin >> n >> a >> b;
    ll ans = 0;
    for(int i=1;i<=n;++i){
        int t = i;
        int sum = 0;
        while(t>0){
            sum += t%10;
            t /= 10;
        }
        if(sum>=a&&sum<=b){
            ans += i;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int a[2*n];
  for(int i = 0; i < 2*n; ++i){
    cin >> a[i];
  }
  sort(a,a+2*n);
  int res = 0;
  for(int i = 0; i < 2*n; i += 2){
    res += a[i];
  }
  cout << res << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
int a,b;
char op;
while(1){
scanf("%d %c %d",&a,&op,&b);
if(op=='+'){
printf("%d\n",a+b);
}else if(op=='-'){
printf("%d\n",a-b);
}else if(op=='*'){
printf("%d\n",a*b);
}else if(op=='/'){
printf("%d\n",a/b);
}else{
break;
}
}
return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#define mx 300007
#define mod 1000000007
using namespace std;
typedef long long int LL;
int vt[20][20];
int main() {
	ios_base::sync_with_stdio(false);
	int n, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		for(int j = 1; j <= x; j++) {
			int u, v;
			cin >> u >> v;
			u--;
			vt[i][u] = ++v;
		}
	}
	// for(int i = 0; i < n; i++) {
	// 	for(int j = 0; j < n; j++) {
	// 		cout << vt[i][j] << " ...";
	// 	}
	// 	cout << endl;

	// }
	for(int i = 0; i < (1 << n); i++) {
		int flag = 1, arr[20];
		memset(arr, 0, sizeof arr);
		for(int j = 0; j < n; j++) {
			if(i & (1 << j)) arr[j] = 1;
		}
		for(int j = 0; j < n; j++) {
			int foo = 1, boo = 0;
			for(int k = 0; k < n; k++) {
				if(arr[j]) {
					if(arr[k] && vt[j][k] == 1) foo = 0;
					if(!arr[k] && vt[j][k] == 2) foo = 0;
				} else {
					if(arr[k] && vt[j][k] == 1) boo = 1;
					if(!arr[k] && vt[j][k] == 2) boo = 1;
				}
			}
			if(arr[j]) flag = flag & foo;
			if(!arr[j]) flag = flag & boo;
		}
		if(flag) ans = max(ans, __builtin_popcount(i));
	}
	cout << ans << endl;
	return 0;
}


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

#define rep(I,N) for(int I=0;I<N;I++)
using ll=long long int;
using namespace std;
int ans=0;
const int N = 200000;
int main(){
	ll n,m,k;
	cin>>n>>m>>k;
	ll a[1000000],b[1000000];
	a[0]=0;
	b[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
		b[i]+=b[i-1];
	}
  int j=m;
	for(int i=0;i<=n;i++){
     
		if(k<a[i])break;

      for( ;k<(a[i]+b[j]);j--);
     
          ans=max(ans,i+j);
      
            
	}
cout<<ans<<endl;
}

Measured memory_bytes: 6692
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


 
 
int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<pair<double, pair<int,int> > > z;
    int i,j;
    for(i=0; i<n; i++) {
        int x,y;
        scanf("%d%d", &x, &y);
        double t=0;
        if(x!=0 || y!=0) {
            t = atan2((double)y, (double)x);
        }
        z.push_back(make_pair(t, make_pair(x,y)));
    }
    sort(z.begin(), z.end());

    int k;
    double sx0=0, sy0=0;
    for(k=0; k<n; k++) {
        sx0+=z[k].second.first;
        sy0+=z[k].second.second;
    }

    double maxval=0;
    for(i=0; i<n; i++) {
        for(j=i; j<n; j++) {
            double sx=0, sy=0;
            for(k=0; k<n; k++) {
                if(k>=i && k<=j) {
                    sx+=z[k].second.first;
                    sy+=z[k].second.second;
                }
            }
            double val=(sx*sx+sy*sy);
            maxval=MAX(maxval,val);

            sx=sx0-sx; sy=sy0-sy;
            val=(sx*sx+sy*sy);
            maxval=MAX(maxval,val);
        }
    }
    maxval=sqrt(maxval);
    printf("%.10lf\n", maxval);

    return 0;
}



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

int main() {
	int N, X;
	cin >> N >> X;
	vector<int> m(N);
	int sum = 0;
	int min = 10000;
	for(int i = 0; i < N; i++) {
		cin >> m[i];
		sum += m[i];
		if(min > m[i]) min = m[i];
	}

	X -= sum;
	cout << (N + X / min) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#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 all(c) c.begin(),c.end()
#define psb push_back
#define ppb pop_back

const int INF = 1001001001;

int main() {
    ll A;
    long double B;

    cin >> A >> B;

    ll ans = A*(ll)(B*100+0.001)/100;

    cout << ans << endl;
}


Measured memory_bytes: 3704
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int n;
    vector<double> x, y;
    double input;
    double a, b, c, d;

    cin>>n;
    for (int i=0; i<n; ++i) {
        cin>>input;
        x.push_back(input);
    }
    for (int i=0; i<n; ++i) {
        cin>>input;
        y.push_back(input);
    }

    a = 0;
    d = 0;
    for (int i=0; i<n; ++i) {
        double tmp = abs(x[i] - y[i]);
        a += tmp;
        d = max(d, tmp);
    }

    b = 0;
    for (int i=0; i<n; ++i) {
        b += pow((x[i] - y[i]), 2);
    }
    b = sqrt(b);

    c = 0;
    for (int i=0; i<n; ++i) {
        c += pow(abs(x[i] - y[i]), 3);
    }
    c = cbrt(c);


    cout<<setprecision(10)<<a<<endl;
    cout<<setprecision(10)<<b<<endl;
    cout<<setprecision(10)<<c<<endl;
    cout<<setprecision(10)<<d<<endl;

    return 0;
}



Measured memory_bytes: 3428
#include <cstdio>

int main(){
  int a[4],b[4];
  while(~scanf("%d %d %d %d\n%d %d %d %d\n",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])){
    int c=0,d=0;
    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++)
	if(a[i]==b[j])
	  i==j?c++:d++;
    printf("%d %d\n",c,d);
  }
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
set<int>st;
int main() {
	int q;
	cin >> q;
	while (q--) {
		int Q, k;
		cin >> Q >> k;
		if (Q == 0) {
			st.insert(k);
			cout << st.size() << endl;
		}
		else if (Q == 1) {
			cout << st.count(k) << endl;
		}
		else {
			st.erase(k);
		}
	}
	return 0;
}


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

typedef long long ll;

void print(int n,vector<int> a){
  cout << a[0];
  for(int i=1;i<n;i++) cout << " " << a[i];
  cout << endl;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=1;i<n;i++){
    print(n,a);
    int v = a[i];
    int j = i-1;
    while(j>=0&&a[j] > v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
  }
  print(n,a);
  return 0;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()

/*** Define Values ***/
#define mx 200005
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 100005

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))

/*** STLs ***/
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a,pll b){ if(a.ff == b.ff)return a.ss < b.ss; return a.ff > b.ff; }

#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": "

/*** Functions
ll BigMod(ll base, ll pow, ll modvalue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modvalue);ll total = ((ans % modvalue) * (ans % modvalue)) % modvalue;  if(pow % 2 == 0) return total; else{ return (total * (base % modvalue) ) % modvalue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool checkprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
ll sumofdigit(long ll n){ll sum=0;while(n){sum=sum+n%10;n=n/10;}return sum;}
ll countDigit(ll n) { if (n == 0) return 0; return 1 + countDigit(n / 10); }
ll countDigit(ll n) { return floor(log10(n) + 1); } //only positive  
 ***/

template <class T> inline T gcd(T a,T b){if(b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a,T b){return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll ans = 1;while(p--) ans *= b; return ans;}

int main()
{

	#ifndef ONLINE_JUDGE
	freopen("C:/Users/91731/Documents/input.txt","r",stdin);
	freopen("C:/Users/91731/Documents/output.txt","w",stdout);
	freopen("C:/Users/91731/Documents/error.txt","w",stderr);
    #endif
	
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	string s;
	cin>>s;
	char z=s[s.length()-1];
	// cout<<z;
	if(z=='2' ||z=='4' || z=='5' || z=='7' || z=='9')
		cout<<"hon";
	else if(z=='0' ||z=='1'||z=='6'||z=='8')cout<<"pon";
	else if(z=='3')cout<<"bon";
}

Measured memory_bytes: 3656
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	char[] ch=sc.next().toCharArray();
    int e=0;
    for(int i=0;i<ch.length-1;i++){
      for(int j=i+1;j<ch.length;j++){
        if(ch[i]==ch[j]){
          System.out.println("no");
          e++;
          break;
        }
      }
      if(e>0){
        break;
      }
    }
    if(e==0){
      System.out.println("yes");
    }
  }
}


Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int M = ni();
        int K = ni();
        int[] a = new int[N*M+1];
        for (int i = 0; i <= M; i++) {
            int s = i * N;
            for (int j = 0; j <= N; j++) {
                // System.out.println(s);
                a[s] = 1;
                s = s + (M-i) - i;
            }
        }
        // for (int i = 0; i < a.length; i++) {
        //     System.out.println(a[i]);
        // }
        if(a[K]==1){
            out.println("Yes");
        }else{
            out.println("No");
        }
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 37188
import math
def sieve():
    prime = [1 for i in range(10010)]
    prime[0] = 0
    prime[1] = 0
    for i in range(2, int(math.sqrt(i))):
        if (prime[i] == 1):
            for j in range(i * i, 10010, i):
                prime[j] = 0
    return prime

if __name__ == "__main__":
    prime = sieve()
    while True:
        try:
            n = input()
            d1 = [i for i in range(1, n + 1)]
            d2 = list(d1)
            d2.reverse()
            tmp = 0
            for i in range(n):
                if (prime[d1[i]] == 1 and prime[d2[i]] == 1):
                    tmp += 1
            print tmp
        except:
            break
        

Measured memory_bytes: 5556
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_A(){
    int n, m;
    cin >> n >> m;

    int ans = n * (n-1) / 2 + m * (m-1) / 2;

    cout << ans;
}

void solve_B(){
    string s;
    cin >> s;

    int n = s.size();

    string s_1 = s.substr(0,(n-1)/2);
    string s_2 = s.substr((n+3)/2-1, n-1);

    bool ok_1 = true, ok_2 = true, ok = true;

    for(int i = 0; i < n; i++){
        if(s[i] != s[n-i-1]) ok = false;
    }

    if(!ok) cout << "No";
    else{
        for(int i = 0; i < s_1.size(); i++){
        if(s_1[i] != s_1[s_1.size() - i - 1]){
            ok_1 = false;
            }
        }
    
        for(int j = 0; j < s_2.size(); j++){
            if(s_2[j] != s_2[s_2.size()-j-1]) ok_2 = false;
        }

        if(ok_1 && ok_2) cout << "Yes";
        else cout << "No";   
    }
}

void solve_C(){
    int L;
    scanf("%d", &L);

    double vertex = (double) L/3;
    printf("%.7f", vertex * vertex * vertex);
}

int main(void){
    solve_B();
    
    return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
a = list(map(int, input().split()))
sum_a = sum(a)

for i in range(1,N):
    if a[i-1] + a[i] > x:
        if a[i] > (a[i] + a[i-1]) - x:
            # cnt += (a[i] + a[i-1]) - x
            a[i] -= (a[i] + a[i-1]) - x
            continue
        else:
            # cnt += a[i-1] - x
            a[i] = 0
            a[i-1] = x
            continue

print(sum_a - sum(a))

Measured memory_bytes: 14252
#include<cstdio>
using namespace std;
int main(){
char str;

int flag=0;
while(1){
    int sum=0;
 while((str=getchar())!='\n'){
     sum+=str-'0';
 }
 if(sum==0){
     break;
 }else{
     printf("%d\n",sum);
 }
 
}
return 0;
}


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


	int a,b,c; cin >> a>>b>>c;
	int sum = a+b+c;
	int pre = 5+5+7;
	if(sum<=pre) cout << "YES" << endl;
	else cout << "NO" <<  endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int aa[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;string s;cin>>s;
  char l='A';int cnt=0;
  for(int i=0;i<n;i++)
  {
    if(s[i]!=l)cnt++;
    l=s[i];
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int h,w,i,j;
	char odd,even;
	while(scanf("%d %d", &h, &w)!=EOF && (h!=0 || w!=0)){
		for(i=1;i<=h;i++){
			(i%2)?(odd='#',even='.'):(odd='.',even='#');
			for(j=1;j<=w;j++){
				printf("%c",(j%2)?odd:even);
			}
			printf("\n");
		}
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 572
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vs s(n);
    vi t(n);
    rep(i,n)cin >> s[i] >> t[i];
    string x;
    cin >> x;
    int ans = 0;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == x)break;
        ans += t[i];

    }
    cout << ans << endl;
}


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

int main() {
  string S;
  cin >> S;
  
if (S.at(2) == S.at(3) && S.at(4) == S.at(5)){
  cout << "Yes" << endl;
}

 else{
  cout << "No" << endl;
 }
}


Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int cnt = 0;
int N;
bool dfs(string S, int now, int digit){
    // debug(now)
    if(now==digit){
        cnt++;
        if(cnt==N){
            cout << S << bn;
            return true;
        }
        return false;
    }
    int upper;
    int lower;
    // int idx = digit-now-1; //どこを変更するか
    if(now==0){
        lower = 1;
        upper = 9;
    }else{
        lower = max(0,S[now-1]-'0'-1);
        upper = min(9,S[now-1]-'0'+1);
    }
    for(int x=lower; x<=upper;x++){
        auto tmp = S;
        tmp[now] = x+'0';
        auto res = dfs(tmp,now+1,digit);
        if(res) return true;
    }
    return false;
}

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

    int ans=0;
    REP(i,12){
        auto res = dfs(string(i+1,'.'), 0, i+1);
        if(res){
            return 0;
        }
    }

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in);
String str=sc.nextLine();
boolean flag = true;
for(int i=0;i<str.length();i++)
{

if(str.charAt(i) != str.charAt(str.length() - i - 1)) {
  flag = false;
  break;
}
}
if(flag){
System.out.println("Yes");
}
else {
  System.out.println("No");
}
}
}

Measured memory_bytes: 23764
w,h,n = map(int,input().split())
x_min = 0
x_max = w
y_min = 0
y_max = h
for _ in [0]*n:
  x,y,a = map(int,input().split())
  if a == 1:
    x_min = max(x_min,x)
  elif a == 2:
    x_max = min(x_max,x)
  elif a == 3:
    y_min = max(y_min,y)
  else:
    y_max = min(y_max,y)
print(max(x_max-x_min,0)*max(y_max-y_min,0))

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[205],ans;
int main()
{
  scanf("%d",&n);
  for(int i=1;i<=n*2;i++)  scanf("%d",&a[i]);
  sort(a+1,a+n*2+1);
  for(int i=1;i<=n*2;i+=2)  ans+=a[i];
  printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int n, q;
int N[30], Q[205];

bool C[40005];

int main()
{
	cin >> n;
	REP(i, n)
	{
		cin >> N[i];
	}
	cin >> q;
	REP(i, q)
	{
		cin >> Q[i];
	}

	REP(i, pow(2, n))
	{
		int sum = 0;
		for (int j = 0; i>>j > 0; ++j)
		{
			if ((i >> j) & 1 != 0)
			{
				sum += N[j];
			}
		}
		C[sum] = true;
	}

	REP(i, q)
	{
		string s = "no";
		if (C[Q[i]])s = "yes";
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 3352
H,W=list(map(int, input().split()))
A=[list(input()) for _ in range(H)]
for i in range(2**(H+W)):
  L=[['.']*W for _ in range(H)]
  L[0][0]='#'
  c,d=0,0
  for j in range(H+W):
    if (i>>j)&1:
      c+=1
    else:
      d+=1
    if 0<=c<H and 0<=d<W:
      L[c][d]='#'
    else:
      break
  for k in range(H):
    if A[k]!=L[k]:
      break
  else:
    print('Possible')
    exit()
else:
  print('Impossible')

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

using namespace std;

using ll = long long;

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

    string a, b, c;
    cin >> a >> b >> c;
    if (a.back() == b.front() && b.back() == c.front())
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int n;
using vb = vector<bool>;
using vl = vector<ll>;
#define eb(x) emplace_back(x);
pair<vl,vb> eratosthenes_sieve(ll n){
  vb is_prime(n+1,true);
  vl prime;
  is_prime[0] = false;
  is_prime[1] = false;
  FOR(i,2,sqrt(n)+1){
    if(!is_prime[i]) continue;
    for(ll j=2*i;j<=n;j+=i) is_prime[j] = false;
    prime.eb(i);
  }
  FOR(i,sqrt(n)+1,n+1){
    if(is_prime[i])prime.eb(i);
  }
  return {prime,is_prime};
}

int main(){
  while(cin>>n,n){
    auto sieve = eratosthenes_sieve(2*n);
    int ans = 0;
    FOR(i,n+1,2*n+1)if(sieve.second[i]) ans++;
    cout << ans << endl;
  }
}



Measured memory_bytes: 3340
#include <iostream>

int main()
{
    int a, b; std::cin >> a >> b ;
    int n; std::cin >> n ;

    int s, f;
    bool flag = true ;
    for ( int i = 0 ; i < n ; i++ )
    {
        std::cin >> s >> f ;
        if ( !( b <= s || f <= a ) )
            flag = false ;
    }

    if ( flag )
        std::cout << "0" << std::endl ;
    else
        std::cout << "1" << std::endl ;
}


Measured memory_bytes: 3116
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  s=list(S())

  l1=[]
  l2=[]

  a=s[0]
  if a=='W':
    l1.append([1,0])
  else:
    l1.append([0,1])

  for i in range(1,len(s[1:])+1):
    if s[i]=='W':
      l1.append([l1[i-1][0]+1,l1[i-1][1]])
    else:
      l1.append([l1[i-1][0],l1[i-1][1]+1])

  _s=s[:]
  _s.reverse()

  a=_s[0]
  if a=='W':
    l2.append([1,0])
  else:
    l2.append([0,1])

  for i in range(1,len(_s[1:])+1):
    if _s[i]=='W':
      l2.append([l2[i-1][0]+1,l2[i-1][1]])
    else:
      l2.append([l2[i-1][0],l2[i-1][1]+1])

  l2.reverse()

  # print(l1)
  # print(l2)

  mn=inf
  for i in range(n):
    a=s[i]
    if a=='W':
      l1[i][0]-=1
      l2[i][0]-=1
    else:
      l1[i][1]-=1
      l2[i][1]-=1
    mn=min(mn,l1[i][0]+l2[i][1])

  return mn

print(main())


Measured memory_bytes: 104264
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
        xy_vec: [(isize, isize); n]
    }

    let mut ans = 0.0;
    let mut cnt = 0.0;

    for idx in (0..n).permutations(n) {
        cnt += 1.0;
        for i in 0..idx.len()-1 {
            let x_dist = (xy_vec[idx[i]].0 - xy_vec[idx[i+1]].0).pow(2);
            let y_dist = (xy_vec[idx[i]].1 - xy_vec[idx[i+1]].1).pow(2);
            // dbg!(&idx, ((x_dist + y_dist) as f64).sqrt());
            ans += ((x_dist + y_dist) as f64).sqrt();
        }
    }

    println!("{}", ans/cnt);
}


Measured memory_bytes: 2160
#include<iostream>
#include<vector>
using namespace std;
int main(){

  int N;
  int max=0;
  int second=0;
  int maxcount=0;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<=N-1;i++){
  
    cin>>A[i];
    if(A[i]>max){
    
      maxcount=1;
      if(max>second)second=max;
      max=A[i];
    }
    else if(A[i]==max){
    
      maxcount++;
    }
    else if(A[i]>second){
    
      second=A[i];
    }
  }
  for(int i=0;i<=N-1;i++){
  
    if(A[i]==max){
    
      if(maxcount!=1){
      
        cout<<max<<endl;
      }
      else{
      
        cout<<second<<endl;
      }
    }
    else{
    
      cout<<max<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3968
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 524288
#define P 200003

constexpr ulli PRIME = 0xffffffffff000001;
constexpr ulli ntt_add(ulli a, ulli b)
{
    ulli res = 0;
    if(__builtin_uaddll_overflow(a,b,&res))
        res -= PRIME;
    return res;
}
constexpr ulli ntt_sub(ulli a, ulli b)
{
    ulli res = 0;
    if(__builtin_usubll_overflow(a,b,&res))
        res += PRIME;
    return res;
}
constexpr ulli ntt_mul(ulli a, ulli b)
{
    constexpr ulli magic = -PRIME;
    unsigned __int128 k = (unsigned __int128)a*b;
    k = (k>>64<<24) + (ulli)k - (k>>64);
    ulli res = 0;
    if(__builtin_uaddll_overflow((k>>64)*magic,(ulli)k,&res))
        res += magic;
    return res;
}
constexpr ulli ntt_pow(ulli a, ulli b)
{
    ulli r = 1;
    while(b)
    {
        if(b&1) r = ntt_mul(r,a);
        a = ntt_mul(a,a);
        b >>= 1;
    }
    return r;
}
constexpr ulli ntt_find()
{
    ulli res = 2;
    while(ntt_pow(res,PRIME/2) != PRIME-1) ++res;
    return res;
}
constexpr ulli OMEGA = (ntt_pow(ntt_find(),PRIME/N));
static_assert(__builtin_popcount(N) == 1);
static_assert(PRIME%N == 1);
static_assert(ntt_pow(OMEGA,N/2) == PRIME-1);
uint ricr(uint k)
{
    k ^= (N-1);
    k ^= -1u >> 1 >> __builtin_clz(k);
    return k;
}
void ntt(ulli *a, ulli ow=OMEGA)
{
    for(int i=0,ii=0;i<N;++i,ii=ricr(ii))
        if(i<ii) std::swap(a[i],a[ii]);
    for(int n2=1,n=2;n2<N;n2=n,n*=2)
    {
        ulli w = ntt_pow(ow,N/n);
        for(ulli *p=a; p!=a+N; p+=n)
        {
            ulli k = 1;
            for(int i=0,j=n2;i<n2;++i,++j)
            {
                ulli e = p[i], o = p[j];
                ulli ok = ntt_mul(o,k);
                p[i] = ntt_add(e,ok);
                p[j] = ntt_sub(e,ok);
                k = ntt_mul(k,w);
            }
        }
    }
}
void ntt_inv(ulli *a)
{
    ntt(a,ntt_pow(OMEGA,PRIME-2));
    for(int i=0;i<N;++i) a[i] = ntt_mul(a[i],ntt_pow(N,PRIME-2));
}

int po[N], lo[N];
ulli a[N];

int main()
{
    for(int i=0, k=1; i<P-1; ++i, k=k*2%P)
        po[i] = k, lo[k] = i;
    int n;
    lli ans = 0;
    scanf("%d", &n);
    for(int i=0;i<n;++i)
    {
        int k;
        scanf("%d", &k);
        if(!k) continue;
        ++a[lo[k]];
        ans -= (lli)k*k % P;
    }
    ntt(a);
    for(int i=0;i<N;++i) a[i] = ntt_mul(a[i],a[i]);
    ntt_inv(a);
    for(int i=0;i<N;++i)if(a[i])
    {
        if(a[i] >= PRIME) a[i] -= PRIME;
        ans += po[i%(P-1)] * a[i];
    }
    assert(ans%2==0);
    ans /= 2;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 7396
#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
(__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    string s;
    cin >> s;

    REP(i, 3) {
        cout << s[i];
    }
}

#pragma region main
main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3652