akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, nn, total = 0;
  cin >> n;
  nn = n;

  while (true) {
    total += n % 10;
    n /= 10;
    if (n == 0) {
      break;
    }
  }
  if (nn % total == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 384
import java.util.*;
  
public class Main{
  
    int n;
    String[] a,b;
    String from,to;
  
    class E{
        String s;
        int cost;
        E(String s, int cost){
            this.s = s;
            this.cost = cost;
        }
    }
  
    void solve(){
        Scanner sc = new Scanner(System.in);
  
        while(true){
            n = sc.nextInt();
            if(n==0) break;
  
            a = new String[n];
            b = new String[n];
            for(int i=0; i<n; i++){
                a[i] = sc.next();
                b[i] = sc.next();
            }
            from = sc.next();
            to = sc.next();
  
            System.out.println(getMin());
        }
    }
  
    int getMin(){
        PriorityQueue<E> 
            q = new PriorityQueue<E>(n, new Comparator<E>(){
                    public int compare(E e1, E e2){
                        return e1.cost - e2.cost;
                    }
                });
        q.add(new E(from,0));
        HashSet<String> set = new HashSet<String>();
  
        while(q.size()>0){
            E e = q.poll();
            String ss = e.s;
            int cost = e.cost;
  
            if(ss.equals(to)) return cost;
            if(set.contains(ss)) continue;
            set.add(ss);
  
            for(int i=0; i<a.length; i++){
                String s = ss;
                for(int j=0; j<=s.length()-a[i].length(); j++){
                    if(a[i].equals(s.substring(j,j+a[i].length()))){
                        s = s.substring(0,j) + b[i] + 
                            s.substring(j+a[i].length(),s.length());
                        j += b[i].length()-1;
                    }
                }
                if(ss.equals(s)) continue;
                if(s.length()>to.length()) continue;
                q.add(new E(s,cost+1));
            }
        }
  
        return -1;
    }
  
    public static void main(String[] args){
        new Main().solve();
    }
}

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

#define debug(x) cout<<#x<<": "<<x<<endl

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

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

class Union_Find{
  public:
  Union_Find(){};
  static const ll MAX_N = 100000*2+1;
  int par[MAX_N];
  int ranks[MAX_N];
  void init(int n){
    rep(i,MAX_N){
      par[i] = i;
      ranks[i] = 0;
    }
  }
  int find(int x){
    if(par[x] == x){
      return x;
    }
    else{
      return par[x] = find(par[x]);
    }
  }

  void Unite(int a, int b){
    a = find(a);
    b = find(b);
    if(a == b) return ;
    if(ranks[a] < ranks[b]){
      par[a] = b;
    }
    else{
      par[b] = a;
      if(ranks[a] == ranks[b]) ranks[a]++;
    }
  }
  bool same(int a,int b){
    return find(a) == find(b);
  }
};

struct edge{ll u, v, cost,i;};

bool comp(const edge& e1,const edge& e2){
  return e1.cost < e2.cost;
}

vector<edge> p(100000*2+1);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll w,h,a,b,k;
  cin >> w >> h;
  rep(i,w+h){
    cin >> k;
    if(i < w){
      p[i] = edge{i,i+1,k,0};
    }
    else
      p[i] = edge{i - w,i+1 - w,k,1};
  }
  sort(all(p),comp);
  a = w+1,b = h+1;
  k = 0;
  Union_Find W,H;
  W.init(a),H.init(b);
  rep(i,p.size()){
      if(p[i].i && !W.same(p[i].u,p[i].v)){
      k += p[i].cost * a;
      W.Unite(p[i].u,p[i].v);
      --b;
    }
    else if(!p[i].i && !H.same(p[i].u,p[i].v)){
      k += p[i].cost * b;
      H.Unite(p[i].u,p[i].v);
      --a;
    }
  }
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 9728
N = int(input())
SP = [ [i for i in input().split() ] for _ in range(N)]




SP2 = [ [0, 0, 0] for _ in range(N) ]
for _ in range(N):
	SP2[_][0] = SP[_][0]
	SP2[_][1] = -( int(SP[_][1]) )
	SP2[_][2] = _+1

SP2.sort()

for i in range(N):
	print(SP2[i][2])

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

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 replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

class SCCD {
public:
	stack<int> post;
	vb used;

	void dfs(int pos, int par, const Graph &G) {
		used[pos] = true;
		rep(i, G[pos].size()) {
			int to = G[pos][i].to;
			if (used[to])continue;
			dfs(to, pos, G);
		}
		post.push(pos);
	}

	void dfsrev(int pos, int par, const Graph &rev, vi &group) {
		used[pos] = true;
		group.push_back(pos);
		rep(i, rev[pos].size()) {
			int to = rev[pos][i].to;
			if (used[to])continue;
			dfsrev(to, pos, rev, group);
		}
	}

	void SCC(Graph G, vvi &scc, vi &n2g) {
		int N = G.size();
		Graph rev(N);
		rep(i, N) {
			rep(j, G[i].size()) {
				Edge e = G[i][j];
				rev[e.to].push_back(Edge{ e.to,e.from,1 });
			}
		}

		used = vb(N, false);
		rep(i, N) {
			if (!used[i])dfs(i, -1, G);
		}

		fill(all(used), false);
		while (!post.empty()) {
			int pos = post.top();
			post.pop();
			if (used[pos])continue;
			vi group;
			dfsrev(pos, -1, rev, group);
			scc.push_back(group);
		}

		rep(i, scc.size()) {
			rep(j, scc[i].size()) {
				n2g[scc[i][j]] = i;
			}
		}
	}
};

int main() {
	int V, E;
	cin >> V >> E;
	Graph G(V);
	
	rep(i, E) {
		int s, t;
		cin >> s >> t;
		G[s].push_back(Edge{ s,t,1 });
	}

	vvi scc;
	vi n2g(V);

	SCCD sccd;
	sccd.SCC(G, scc, n2g);

	rep(i, V) {
		cout << scc[i][0] << endl;
	}
}

Measured memory_bytes: 6596
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define N 200010

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

vector<ll> graph[N];
int val[N],ans[N];
bool vist[N];
int n,q,a,b,x;

void dfs(int t,ll carry)
{
	vist[t] = true;
	for(int i=0;i<graph[t].size();++i)
	{
		int j = graph[t][i];
		if(!vist[j])
			dfs(j,carry+val[j]),val[j]=carry+val[j];
	}
}

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

	cin>>n>>q;
	for(int i=1;i<=n;++i) vist[i] = false,val[i] = 0;

	for(int i=1;i<n;++i)
	{
		cin>>a>>b;
		graph[a].pb(b);
		graph[b].pb(a);
	}

	int j;

	for(int i=1;i<=q;++i)
	{
		cin>>j>>x;
		val[j]+=x;
	}
	
	dfs(1,val[1]);
	for(int i=1;i<=n;++i)
		cout<<val[i]<<" ";
	cout<<"\n";
}

Measured memory_bytes: 23680
n = int(input())
P = [int(x) for x in input().split()]
Q = [int(x) for x in input().split()]

count = 0
p = -1
q = -1

A = [0 for _ in range(n)]
def calc(i):
    global p, q, count
    if p != -1 and q != -1:
        return
    if i == n:
        count += 1
        if A == P:
            p = count
        if A == Q:
            q = count
        return
    for j in range(1, n+1):
        A[i] = j
        flag = 0
        for k in range(i):
            if A[k] == j:
                flag = 1
        if flag == 0:
            calc(i + 1)

calc(0)
print(abs(p - q))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


      


            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double a = (double)num[0];
            double b = (double)num[1];

            double ans = (1.0/a) + (1.0/b);

            Console.WriteLine(1.0/ans);



        }

        

    }


   

    
}


Measured memory_bytes: 2776
from math import gcd

n = int(input())
a = list(map(int, input().split()))

g = a[0]
for i in range(1, n):
    g = gcd(g, a[i])
    if g == 1:
        break
else:
    print('not coprime')
    exit()

ind = [-1] * (10**6)

prime = [2, 3, 5, 7]
for i in range(11, 10 ** 6, 2):
    j = 0
    flag = True
    while prime[j] * prime[j] <= i:
        if i % prime[j] == 0:
            flag = False
            break
        else:
            j += 1
    if flag:
        prime.append(i)

for i in range(len(prime)):
    ind[prime[i]] = i

# len(prime) = 78498

tf = [False] * len(prime)

for i in a:
    for j in range(len(prime)):
        if i == 1:
            break
        if prime[j] * prime[j] > i:
            if tf[ind[i]]:
                print('setwise coprime')
                exit()
            tf[ind[i]] = True
            break

        if i % prime[j] == 0:
            if tf[j]:
                print('setwise coprime')
                exit()
            tf[j] = True
            while i % prime[j] == 0:
                i //= prime[j]

print('pairwise coprime')

Measured memory_bytes: 197284
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){
	
	int n,i;
	double p1=0, p2=0, p3=0, pm=0;
	cin >> n ;
	
	int x[n], y[n], dif[n];
	for (i=0; i<n; i++){
		cin >> x[i] ;		
	}
	for (i=0; i<n; i++){
		cin >> y[i] ;		
	}	
	for (i=0; i<n; i++){
		dif[i]=fabs(x[i]-y[i]);
		p1+=dif[i];
		p2+=pow(dif[i], 2);
		p3+=pow(dif[i], 3);
		if (pm<dif[i]) pm=dif[i];
	}
	p2=sqrt(p2);
	p3=pow(p3, 1.0/3.0);
	
	printf("%.6f\n""%.6f\n""%.6f\n""%.6f\n", p1, p2, p3, pm);
	
	return 0;
}

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

int main() {
  string S;cin>>S;
  int m=99999,x;
  for(int i=0; i<S.size()-2; i++){
    x=(S.at(i)-'0')*100+(S.at(i+1)-'0')*10+(S.at(i+2)-'0');
    m=min(abs(x-753),m);
  }
  cout<<m<<endl;
}

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  
  long long ans = 0;
  for(int i=1;i<N;i++){
    ans += A[i/2];
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4836
#include<iostream>
#include<string>
using namespace std;
int main(void){
  string s;
  cin >> s;
  int alpha[s.length()]={0};
/*  for(int i=0;i<s.length();++i){
  	alpha[i] = 0;
  }
*/
  for(int i=0;i<s.length();++i){
  	alpha[s.at(i)-'a'] += 1;
  }
  for(int i=0;i<26;++i){
    if(alpha[i]==0){
      cout << (char)('a'+i);
      return 0;;
   }
  }
  	cout << "None";

  
return 0;}

Measured memory_bytes: 896
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
ll n, s, b, x;
bool exist=false;
vector<ll> candid;

ll sum(ll u, ll base)
{
	if(u<base)
	{
		return u;
	}
	else
	{
		return sum(u/base,base)+u%base;
	}
}

bool work(ll base)
{
	if(sum(n,base)==s)
	{
		return true;
	}
	return false;
}
void check(void)
{
	ll i;
	for(i=2 ; i<=x ; i++)
	{
		if(work(i))
		{
			cout<<i;
			exit(0);
		}
	}
}

void getcandid(void)
{
	for(ll i=1 ; i*i<=(n-s) ; i++)
	{
		if((n-s)%i==0)
		{
			candid.push_back(i+1);
			if(i*i!=(n-s))
			{
				candid.push_back((n-s)/i+1);
			}
		}
	}
	sort(candid.begin(),candid.end());
}

void perf(void)
{
	int i;
	for(i=0 ; i<candid.size() ; i++)
	{
		if(sum(n,candid[i])==s)
		{
			cout<<candid[i];
			exit(0);
		}
	}
}
int main(void)
{
	cin>>n>>s;
	if(n==s)
	{
		cout<<n+1;
		return 0;
	}
	if(n<s)
	{
		cout<<-1;
		return 0;
	}
	x=(ll)sqrt(n);
	check();
	getcandid();
	perf();
	cout<<-1;
}


Measured memory_bytes: 512
n, w = map(int,input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]
dp = [[0] * (w+1) for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(1, w+1):
        if wv[i-1][0] <= j:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]] + wv[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[n][w])

Measured memory_bytes: 120172
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	[ a, b ] <- readInts
	ps <- readInts
	let
		easy = length $ filter ( <= a ) ps
		hard = length $ filter ( b < ) ps
		medium = n - easy - hard
	print $ minimum [ easy, medium, hard ]

Measured memory_bytes: 508
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

const int inf = 1e9 + 5;

int main() {
	int n, x;
	scanf("%d%d", &n, &x);
	vector<int> dp(n + 1, inf);
	dp[0] = 0;
	long long sum = 0;
	for(int rep = 0; rep < n; ++rep) {
		int want;
		scanf("%d", &want);
		sum += want;
		for(int i = n - 1; i >= 0; --i) {
			if(dp[i] == inf) {
				continue;
			}
			dp[i+1] = min(dp[i+1], dp[i] + want);
		}
		debug() << imie(dp);
	}
	int answer = 0;
	while(answer + 1 <= n && dp[answer + 1] <= x) {
		++answer;
	}
	if(answer == n && sum != x) {
		answer--;
	}
	printf("%d\n", answer);
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

const int INF = 2147483647;
//const ll LINF = ll();今度書く

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	
	int w, h, n, x, y, a, x0, y0, x1, y1;
	scanf("%d%d%d", &w, &h, &n);
	x0 = y0 = 0;
	x1 = w;
	y1 = h;
	rep(i, n) {
		scanf("%d%d%d", &x, &y, &a);
		if (a == 1) {
			x0 = max(x0, x);
		}
		else if (a == 2) {
			x1 = min(x1, x);
		}
		else if (a == 3) {
			y0 = max(y0, y);
		}
		else {
			y1 = min(y1, y);
		}
	}
	printf("%d\n", y1 > y0 && x1 > x0 ? (x1 - x0) * (y1 - y0) : 0);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if (b-a<=k && c-a<=k && d-a<=k && e-a<=k && c-b<=k && d-b<=k && e-b<=k && d-c<=k && e-c<=k && e-d<=k)
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
  // 整数の入力
  ll X,Y;
  cin >> X >> Y;
  if ( 2 * X <= Y &&  Y <= 4* X && Y % 2 == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  ll x = 0;
  bool hari = true;                // 数字が張り付いてるか？
  for (int i = 60; i >= 0; i--) {  // 上の桁から順に見ていく
    int count = 0;

    // その桁の1の数を数える
    for (auto a : v) count += a >> i & 1;

    // 0にできたら嬉しいときと、1にできたら嬉しいときがある
    if (count * 2 > n) {
      if (k >> i & 1 == 1) hari = false;  // 張り付きが取れる
    } else {
      // 張り付きが取れてるかkのそのbitが1とかでそこを1にできる
      if (!hari || k >> i & 1 == 1) x |= 1ll << i;
    }
  }

  ll ans = 0;
  for (auto a : v) ans += a ^ x;
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>

int main(void){
	int i,a;
	char str[20];
	gets(str);
	for (i = 0; i < strlen(str); i++){
		putchar(str[strlen(str) - (i+1)]);
	}
	printf("\n");
	return 0;
}

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

int main() {

    ll n, m; cin >> n >> m;
    vector<ll> h(n);
    for (ll i = 0; i < n; i++) {
        cin >> h[i];
    }
    vector<ll> max_h(n, 0);
    for (ll i = 0; i < m; i++) {
        ll a, b; cin >> a >> b;
        a--;
        b--;
        max_h[a] = max(max_h[a], h[b]);
        max_h[b] = max(max_h[b], h[a]);
    }
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        if (max_h[i] < h[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}
 
ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

void solve(){

}

int main(){
	load;
    ll ans , medA, medB;
    int n;
    cin>>n;
    vector<int> v1(n);
    vector<int> v2(n);
    fori(i,n){
		cin >> v1[i] >> v2[i];
	}
	srt(v1);
	srt(v2);
	if (n%2 == 1){
		medA = v1[n/2];
		medB = v2[n/2];
		ans = medB - medA + 1; // every integer within both median, inclusive
	}else{
		medA = v1[n/2] + v1[n/2-1];
		medB = v2[n/2] + v2[n/2-1];
		ans = medB - medA + 1; // every multiply of 0.5 within both median, inclusive , eg: 4, 4.5, 5
	}
	cout << ans << "\n";
	
	
}



Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
const int INF_INT = 2147483647;
const long long INF_LONG = 9223372036854775807;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


void bfs(vector<vector<int>> &v, vector<int> &w) {
  queue<int> que;

  for (int x : v[0]) {
    que.push(x);
    w[x] = 0;
  }
  while (!que.empty()) {
    int x = que.front();  que.pop();
    for (int y : v[x]) {
      if (w[y] == -1) {
        que.push(y);
        w[y] = x;
      }
    }
  }
}

     
int main() {
  int n, m;  cin >> n >> m;
  vector<vector<int>> v(n ,vector<int>(0));
  vector<int> w(n, -1);
  rep (i, m) {
    int x, y;  cin >> x >> y;
    v[x-1].push_back(y-1);
    v[y-1].push_back(x-1);
  }

  bfs(v, w);

  int flag=0;
  rep (i, n) {
    if (w[i] == -1) {
      flag = 1;
      break;
    }
  }

  if (flag) cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    for (int i=1; i<n; ++i) cout << w[i] + 1 << endl;
  }
}

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

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

Measured memory_bytes: 256
#include<stdio.h>
int main(){

	int data[2][3000];

	int i = 1,n;

	while(1){

		scanf("%d",&data[0][i-1]);
		scanf("%d",&data[1][i-1]);

		if(data[0][i-1] == 0 && data[1][i-1] == 0 ){
			break;
		}

		i++;
	}

	for (n = 1;n < i; n++)
	{
		if(data[0][n-1] < data[1][n-1] ){
			printf("%d %d\n",data[0][n-1],data[1][n-1] );
		}
		else{
			printf("%d %d\n",data[1][n-1],data[0][n-1] );
		}
	}



return 0;
}

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

int main(void){
    char s[120] ;
    bool ans=true;
    cin >> s ;
    for (int i=0; i<strlen(s); i++){
        if (i%2==0 && s[i]=='L'){
            ans=false;
        }
        if (i%2!=0 && s[i]=='R'){
            ans=false;
        }
    }
    if (ans==true){
        cout << "Yes" << endl ;
    } else {
        cout << "No" << endl ;
    }
}

Measured memory_bytes: 256
using System;

namespace ABC135A_Harmony
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int sum = int.Parse(input[0]) + int.Parse(input[1]);

            string result = "IMPOSSIBLE";

            if (sum % 2 == 0)
            {
                result = (sum / 2).ToString();
            }

            Console.WriteLine(result);


        }
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }

    static long GCD(long x,long y)
    {
        if (y == 0) return x;
        return GCD(y, x % y);
    }

    static long LCM(long x,long y)
    {
        return x * y / GCD(x, y);
    }

    static int keta(int x)
    {
        string s = x.ToString();
        return s[s.Length - 1]-'0';
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();


        long ans = INF;
        var x = sc.intarr;
        int D = x[0];
        int G = x[1];
        long[] p = new long[D];
        long[] c = new long[D];
        for(int i = 0; i < D; ++i)
        {
            var y = sc.intarr;
            p[i] = y[0];
            c[i] = y[1];
        }

        for (int bit = 0; bit < (1 << D); ++ bit)
        {
            long sum = 0;
            long num = 0;

            for (int i = 0; i < D; ++i)
            {
                if (((bit>>i)&1) == 1)
                {
                    sum += c[i] + p[i] * 100 * (i + 1);
                    num += p[i];
                }
                
            }
            if (sum >= G) ans = Math.Min(ans, num);
            else
            {
                for(int i = D - 1; i >= 0; --i)
                {
                    if (((bit>>i)&1) == 1) continue;
                    for(int k = 0; k < p[i]; ++k)
                    {
                        if (sum >= G) break;
                        sum += 100 * (i + 1);
                        ++num;
                    }
                }
                ans = Math.Min(ans, num);
            }
        }
        wr.wri(ans);
        
    }


}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<string> v(n);
    vector<ll> a(n);
    ll ans = 0;
    FOR(i,0,n){
        cin>>v[i];
        cin>>a[i];
        ans += a[i];
    }

    string x; cin>>x;

    FOR(i,0,n){
        ans -= a[i];
        if(v[i] == x) break;
    }
    cout<<ans<<endl;
}

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

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& (a) : (x))
#define all(x) (x).begin (), (x).end ()
#define sz(x) (int) (x).size ()
#define FASTIO cin.sync_with_stdio (0); cin.tie (0); cin.exceptions (cin.failbit);

typedef long long ll;

typedef pair<int, int> pii;
#define fi first
#define se second
#define mkp(x) make_pair ((x))

typedef vector<int> vi;
#define pb(x) push_back ((x))

#define DEBUG 1
#define ddcout if (DEBUG) cout
#define ddprintf(fmt, ...) if (DEBUG) printf (fmt, ##__VA_ARGS__)

int main ()
{
    int i, j;
    int N;
    string S, a, b;
    scanf ("%d\n", &N);
    getline (cin, S);
    for (i = 0; i < N/2; i++)
        a += S[i];
    for (; i < N; i++)
        b += S[i];
    if (a == b)
        printf ("Yes\n");
    else
        printf ("No\n");

    return 0;
}

Measured memory_bytes: 256
//Problem *
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=3005;
int n;ll a[N],dp[N][N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)for(int l=1;l<=n-i+1;l++){
		int r=l+i-1;
		dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
	}
	printf("%lld",dp[1][n]);
	return 0;
}

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


int main() {
  int a, b;
  cin >> a >> b;
  string ans = "Impossible";
  if(a%3==0 || b%3==0 || (a+b)%3==0) ans = "Possible";
  cout << ans << endl;
  return 0;
  
}

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

using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, c;
    cin >> a >> b >> c;
    if (c < a + b) {
        cout << "No" << endl;
    } else {
        if (4 * a * b < (c - a - b) * (c - a - b)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

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

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

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	int N, D; cin >> N >> D;
	int ans = 0;

	rep(i, N) {
		long long x, y; cin >> x >> y;
		double d = sqrt(x * x + y * y);
		if (d <= D)++ans;
	}
	cout << ans;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;


int main(){

int n; cin>>n;
ll a[n+1];
FOR(i,1,n+1)cin>>a[i];
 
//n個の連立方程式を解く,x[1]のみn回ループ他は順に代入する
//formula[i]=x[i]+x[i+1];
ll x[n+1];
x[1]=0;
for(int i=1;i<=n;i++){
    if(i%2==1)x[1]+=a[i];
    else x[1]-=a[i];
}
cout<<x[1]<<" ";
FOR(i,2,n+1){
    x[i]=a[i-1]-(x[i-1]/2);
    x[i]*=2;
    cout<<x[i]<<" ";
}
cout<<endl;
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0);
int k;
string s;
string ans;
int ns;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> k >> s;
    ns = s.size();
    rep1(i,0,ns){
        if(i == k){
            ans += "...";
            break;
        }
        ans += s[i];
    }
    cout << ans;
	return 0;
}

Measured memory_bytes: 3664
#include <stdio.h>
#define M 102
typedef struct GG{
    int name;
    int dis;
    int fin;
    int next[M];
    char color;
}G;

G u[M];
int n,time;

void search(int x){
    int y=1;
    u[x].dis = time;
    time++;
    u[x].color = 'r';
    for(y=1;y<=n;y++){
        if(u[u[x].next[y]].color == 'w'){
            search(u[x].next[y]);
        }
    }
    u[x].fin = time;
    time++;
    u[x].color = 'b';
}

int main(void){
    int i,j,k;
    time =1;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        u[i].dis = 0;
        u[i].fin = 0;
        u[i].color = 'w';
    }
    u[n+1].color='b';
    for(i=1;i<=n;i++){
        scanf("%d%d",&u[i].name,&k);
        for(j=1;j<=k;j++){
            scanf("%d",&u[i].next[j]);
        }
        u[i].next[j]= -1;
    }
//    for(i=1;i<=n;i++){
//        printf("%d ",u[i].name);
//        k=1;
//        while(u[i].next[k] != -1){
//            printf("%d ",u[i].next[k]);
//            k++;
//        }
//        printf("\n");
//    }
    for(int v=1;v<=n;v++){
        if(u[v].color == 'w'){
            search(v);
        }
    }

    for(i=1;i<=n;i++){
        printf("%d %d %d\n",u[i].name,u[i].dis,u[i].fin);
    }
    
    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}

long long a,b;
string str;
int ans=0;
priority_queue<P ,vector<P>,greater<P> > que;
set<P> st;
long long reg(long long l,long long r){
	if(l<r){
		ll d=r;
		r=l;
		l=d;
	}
	while(r){
		l%=r;
		ll d=r;
		r=l;
		l=d;
	}
	return l;

}
int main() {
	cin>>a>>b;
	long long n=reg(a,b);
	for(int i=2;i<=n;++i){
		if(i>1000000){
			ans++;
			break;
		}
		if(n%i==0){
			ans++;
			while(n%i==0){
				n/=i;
			}
		}
	}
	cout<<ans+1<<endl;
	return 0;
}


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

int main(){
  int N, K, x, temp, ans = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    cin >> x;
    temp = min(x * 2, abs((x - K) * 2));
    ans += temp;
  }
  cout << ans;
}

Measured memory_bytes: 3612
#include<iostream>
using namespace std;
main(){
	double in;
	while(cin>>in){
		double t,y;
		int n;
		t=in/9.8;
		y=4.9*t*t;
		for(int i=1;;++i){
			if(5*i-5>y){
				n=i;
				break;
			}
		}
		cout<<n<<endl;
	}	
}

Measured memory_bytes: 1224
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 998244353;
const ll INF = 1LL << 60;

struct mint {
  ll x;
  mint(ll x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  //
  ll n;
  cin >> n;
  vl d(n);
  map<ll, ll> cnt;
  ll maxd = 0;
  rep(i, n) {
    cin >> d[i];
    if (cnt.find(d[i]) != cnt.end()) {
      cnt[d[i]]++;
    } else {
      cnt[d[i]] = 1;
    }
    maxd = max(maxd, d[i]);
  }
  if (d[0] > 0 || cnt[0] > 1) {
    cout << 0 << endl;
    return 0;
  }
  mint ans(1);
  mint prevcnt(1);
  for (int x = 1; x <= maxd; x++) {
    // cerr << x << ":" << cnt[x] << endl;
    mint curcnt(cnt[x]);
    ans *= (prevcnt.pow(cnt[x]));
    prevcnt = curcnt;
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 7416
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#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 wFor(i,a,b) for(ll i=a;i<b;i+=2)
#define wrFor(i,a,b) for(ll i=a;i>b;i-=2)
#define sort(a,b) sort(a.begin(),b.end())
#define reverse(a,b) reverse(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//vector<vector<int>> data(a,vector<int>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数
//ceil(log10(a)) aの10進法での桁数

int main() {
  vec a(3),b(3),c(3);
  For(i,0,3)
    ci(a[i]);
  For(i,0,3)
    ci(b[i]);
  For(i,0,3)
    ci(c[i]);
  string an="Yes";
  For(i,1,3){
    ll k=a[0]-b[0];
    if(a[i]!=b[i]+k)
      an="No";
  }
  For(i,1,3){
    ll k=a[0]-c[0];
    if(a[i]!=c[i]+k)
      an="No";
  }
  co(an);
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    ifdef __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

int nanko(string s,Int n,Int i){
    Int length = min(n - i - 1,i);
    Int ans = 0;
    for (int k = i-length;k < i;k++){
        if (s.at(k) == 'R' && s.at(i +  (i - k) == 'B')) ans++;
    }
    return ans;
}

struct datas{
    Int x;

};

int main(){
    double a, b , n;
    cin >> a >> b >> n;
    Int maxer = 0;
    for (double x = n; x >= max((double)1,n-10e7);x--){
        upd_max(maxer,floor(a*x/b) - a * floor(x /b));
    }
    for (double x = max(b-10e4,(double)1); x <= min((double)b+10e4,n);x++){
        upd_max(maxer,floor(a*x/b) - a * floor(x /b));
    }
    cout << maxer << endl;
}

Measured memory_bytes: 3700
import java.util.*;

public class Main {
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int N = Integer.parseInt(sc.next());
	  
	  int[] A = new int[N];
	  int max = 0;
	  int maxIndex = -1;
	  
	  int semimax = 0;
	  for(int i = 0; i < N; i++) {
		  int value = Integer.parseInt(sc.next());
		  A[i] = value;
		  
		  if(value > max) {
			  max = value;
			  maxIndex = i;
		  }
		  else if(value >= semimax) {
			  semimax = value;
		  }
	  }
	  
	  for(int i = 0; i < N; i++) {
		  if(i == maxIndex) {
			  System.out.println(semimax);
		  }
		  else {
			  System.out.println(max);
		  }
		  
	  }
	  
	  sc.close();
	  
  }
}


Measured memory_bytes: 82468
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    string s; cin >> s;
    long long k; cin >> k;
    int i = 0;
    while(k > 0) {
        if(i == s.size() - 1) {
            k %= 26;
            if(s[i] + k > 'z') { 
                k -= 25 - (s[i] - 'a') + 1;
                s[i] = 'a';
                s[i] += k;
            }
            else s[i] += k;
            break;
        } else {
            if(25 - (s[i] - 'a') + 1 > k || s[i] == 'a') {
                i++;
            } else {
                k -= 25 - (s[i] - 'a') + 1;
                s[i] = 'a';
            }
        }
    }
    cout << s << endl;
}


Measured memory_bytes: 640
import math

def isPrimeNumber(_val):
	if _val < 2:return False
	if _val == 2:return True
	if _val % 2 == 0:return False

	for i in range(3, int(math.sqrt(_val)+1),2):
		if _val % i == 0:return False;

	return True

X = int(input())
while(1):
	if isPrimeNumber(X):break
	X+=1
print(X)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int h, w;
    cin >> h >> w;
    int c[10][10];
    int a[h][w];
    REP(i,10) REP(j,10) cin >> c[i][j];
    REP(i,h) REP(j,w) cin >> a[i][j];
    REP(k,10) REP(i,10) REP(j,10) c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
    ll magic[10];
    REP(i,10) magic[i] = c[i][1];
    ll ans = 0ll;
    REP(i,h) REP(j,w) {
        if (a[i][j] == -1) continue;
        ans += magic[a[i][j]];
    }
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
using namespace std;

int n,k;
long long a[200015];

int c(long long p){
    int i=0;

    for(int j=0;j<k;j++){
        long long s=0;
        while(s+a[i]<=p){
            s+=a[i];
            i++;
            if(i==n)
                return n;
        }
    }
    return i;
}

int s(){
    long long left=0;
    long long right=1000000000;
    long long mid;
    while(right-left>1){
        mid=(right+left)/2;
        int v=c(mid);
        if(v>=n) right=mid;
        else left=mid;
    }
    return right;
}

int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    printf("%d\n",s());
    return 0;
}

Measured memory_bytes: 3460
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <vector>
#include <queue>
#include <math.h>
#include <string> 
#include <bits/stdc++.h>
using namespace std;

int main(){
    long long N,K;
    cin >> N >> K;
    double P[N],Q[N+1];
    double max;
    max=0;
    for(int i=0;i<N;i++){
        double K;
        cin >> K;
        P[i]=(K+1.0)/2.0;
    }
    Q[0]=0.0;
    for(int i=1;i<N+1;i++){
        Q[i]=Q[i-1]+P[i-1];
    }
    for(int i=0;i<N-K+1;i++){
        if(max<Q[i+K]-Q[i]){
            max=Q[i+K]-Q[i];
        }

    }
    cout << fixed << setprecision(12) << max << endl;
}

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

int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    if(a<=k){
        b-=k-a;
        a=0;
    }else{
        a-=k;
    }
    if(a<0||b<0){
        a=0;
        b=0;
    }
    cout<<a<<" "<<b<<endl;
}

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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<ll>>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, s, n, d) for (int i = (s); i < (int)(n); i += (d))
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()

const int mod = 1e9 + 7;

const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

bool check(int y, int x, int h, int w)
{
    return 0 <= y && y < h && 0 <= x && x < w;
}

VI cumsum(VI &v)
{
    int s = 0;
    VI ret = {0};

    rep(i, v.size())
    {
        s += v[i];
        ret.push_back(s);
    }
    return ret;
}

void shuffle(VI &v, int t)
{
    int temp = v[t - 1];
    rep(i, t - 1) v[t - 1 - i] = v[t - 2 - i];
    v[0] = temp;
}



int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    string s;
    cin >> s;
    string ans = "No";
    if (s[2] == s[3] && s[4] == s[5]) ans = "Yes";
    cout << ans << rt;


    return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(3*n);
    for(int i=0;i<3*n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    LL ans = 0;
    for(int i=0;i<n;i++){
        ans += a[i*2+1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		
		int[] A = new int[n];
		for(int i=0; i<n; i++) {
			A[i] = sc.nextInt();
		}
		
		int cnt = 0;
		int d = 2;
		ArrayList<Integer> G = new ArrayList<Integer>();
		while(n/d != 0) {
			G.add(n/d);
			d *= 3;
		}
		if(!G.contains(1)){
			G.add(1);
		}
		int m = G.size();
		for(int i=0; i<m; i++) {
			cnt += insertionSort(A, n, G.get(i));
		}
		
		System.out.println(m);
		
		for(int i=0; i<m; i++) {
			System.out.print(G.get(i));
			if(i != m-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
		
		System.out.println(cnt);
		
		for(int i=0; i<n; i++) {
			System.out.println(A[i]);
		}
	}
	
	static int insertionSort(int[] A, int n, int g){
		int cnt = 0;
		for(int i=g; i<n; i++) {
			int v = A[i];
			int j = i - g;
			while(j >= 0 && A[j] > v) {
				A[j+g] = A[j];
				j = j - g;
				cnt++;
			}
			A[j+g] = v;
		}
		return cnt;
	}

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

Measured memory_bytes: 114832