akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<set>
#include<string>
#include<stdlib.h>
typedef long long ll;
using namespace std;

int main() {
	int N, d;
	set<int>moti;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> d;
		moti.insert(d);
	}
	cout << moti.size() << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Prime Number II
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int N = 50000;
		int overN;
		boolean[] prims;

		// prim number of over 50000
		for (int i = N + 1; ; i++) {
			if (i % 2 != 0) {
				int count = 0;
				for (int j = 2; j < i; j++) {
					if (i % j == 0) {
						count++;
						break;
					}
				}
				if (count == 0) {
					overN = i;
					break;
				} else {
					continue;
				}
			}
		}

		prims = new boolean[overN + 1];
		for (int i = 2; i < overN / 2 + 1; i++) {
			if (!prims[i]) {
				for (int j = 2; j < overN / i + 1; j++) {
					prims[i * j] = true;
				}
			}
		}

		int primU = 0, primL = 0;
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = Integer.parseInt(line);
			//U
			for (int i = n + 1; ; i++) {
				if (!prims[i]) {
					primU = i;
					break;
				}
			}
			//L
			for (int i = n - 1; ; i--) {
				if (!prims[i]) {
					primL = i;
					break;
				}
			}
			System.out.println(primL + " " + primU);
		}
	}
}

Measured memory_bytes: 19548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))

#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n,m;
	string s;
	cin>>n>>m>>s;
	s[m-1] += 32;
	cout << s << endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    
    string ans = "No";

    for(int i=1;i<10;i++){
        if(n%i==0 and n/i<10){
            ans = "Yes";
            break;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define fe(x)                   *(x.begin())
#define le(x)                   *(x.rbegin())
#define pb                      push_back
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x)                  find_by_order(x)
#define ook(x)                  order_of_key(x)
#define all(x)                  (x).begin(),(x).end()
#define FOR(i,n)                for(int i = 1; i<=n; i++)
#define REP(i,n)                for(int i = 0; i<n;  i++)
#define TT                      int TC;  scanf("%d",&TC);  while(TC--)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define dbg(...)                debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
using                           namespace __gnu_pbds;
using                           namespace std;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;

vector<string> vec_splitter(string s){
    s += ','; vector<string> res;
    while(!s.empty()) res.push_back(s.substr(0,s.find(','))), s = s.substr(s.find(',') + 1);
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused))int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T){
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...);
}


const ll P = 1e9 + 7;
string s;
#define mx 100002

ll dp[mx][15];

ll fn(ll pos,ll rem){
    if(pos==s.size())   return rem==5;
    ll &ans = dp[pos][rem];
    if(ans!=-1) return ans;
    ll p = s[pos] - '0';
    ans = 0;
    if(p>=0 && p<=9)    return ans = (ans + fn(pos+1,(rem*10 + p)%13 ) ) %P;
    for(ll i = 0; i<=9; i++)
        ans = (ans + fn(pos + 1, (rem*10 + i) %13) ) %P;
    return ans;
}


main(){
//read;


memset(dp,-1,sizeof dp);
cin>>s;


ll ans = fn(0,0);
cout<<ans;



return 0;
}


Measured memory_bytes: 19968
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=n1;i<(int)(n2);i++)
using namespace std;
typedef long long ll;

signed main()
{
	int A, B;
	cin >> A;
	cin >> B;

	cout << max(0, A-B*2);
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============



int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N)cin >> A[i];

    ll minv = 0, maxv = 1e9 + 7;
    while (abs(minv - maxv) > 1) {
        ll mid = (minv + maxv) / 2;
        ll cnt = 0;
        for (auto a : A) {
            cnt += a / mid - (a == mid ? 1 : 0);
        }
        (cnt <= K ? maxv : minv) = mid;
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 4828
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, k;
string s;

int main(){
	cin >> n >> k >> s;
	vector<ll> v;
	
	bool start = (s[0] == 0);
    bool isst = false;
	bool noww = start;
	ll block = 0;
	for(ll i = 0; i < n; i++){
		if(!isst){isst = true;}
		else{
			if(s[i] == '0'){
				if(!noww){
					v.push_back(block);
					noww = true;
					block = 0;
				}
			}
			else{
				if(noww){
					v.push_back(block);
					noww = false;
					block = 0;
				}
			}
		}
		block++;
		if(i == n-1){v.push_back(block);}
	}
	if(s[n-1] == '0'){v.push_back(0);}
	
	ll m = v.size();
	for(ll j = 1; j < m; j++){v[j] += v[j-1];}
	
	ll ans = 0;
	if(start){
		if(m <= 2*k){ans = v[m-1];}
		else{
			ans = v[2*k-1];
			for(ll ki = 0; 2*ki+2*k+1 < m; ki++){
				ans = max(v[2*ki+2*k+1]-v[2*ki], ans);
			}
		}
	}
	else{
		if(m <= 2*k+1){ans = v[m-1];}
		else{
			ans = v[2*k];
			for(ll ki = 0; 2*ki+1+2*k+1 < m; ki++){
				ans = max(v[2*ki+1+2*k+1]-v[2*ki+1], ans);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1528
import java.util.*;

public class Main {

    static int n;
    static int[] a;
    static int[][] g;
    static int[] b;
    static int[] lis;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        g = buildGraph(sc, n, n-1);
        b = new int[n];
        Arrays.fill(b, -1);
        b[0] = 1;
        lis = new int[n+1];
        Arrays.fill(lis, Integer.MAX_VALUE);
        lis[0] = 0;
        dfs(0, 0);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(b[i] + "\n");
        }
        System.out.print(sb.toString());
        sc.close();

    }

    private static void dfs(int i, int max) {
        int x = a[i];
        int l = 0, r = n;
        while(1 < r - l){
            int m = (l + r) / 2;
            if(lis[m] < x) l = m;
            else r = m;
        }
        b[i] = Math.max(r, max);
        int tmp = lis[r];
        lis[r] = x;
        for(int nv : g[i]){
            if(b[nv] < 0) dfs(nv, b[i]);
        }
        lis[r] = tmp;
    }

    public static int[][] buildGraph(Scanner sc, int n, int m) {
        int[][] graph = new int[n][];
        int[][] edges = new int[m][2];
        int[] deg = new int[n];
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            edges[i][0] = a;
            edges[i][1] = b;
            deg[a]++;
            deg[b]++;
        }
        for (int i = 0; i < n; i++) {
            graph[i] = new int[deg[i]];
        }
        for (int i = 0; i < m; i++) {
            int a = edges[i][0];
            int b = edges[i][1];
            graph[a][--deg[a]] = b;
            graph[b][--deg[b]] = a;
        }

        return graph;
    }

}


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

Measured memory_bytes: 5100
#include <bits/stdc++.h>
using namespace std;
int main () {
    set<int> a;
    for (int i = 0; i < 3; i++) {
        int x;
        cin >> x;
        a.insert(x);
    }
    if (a.size() == 2) {
        puts("Yes");
    }
    else {
        puts("No");
    }
}

Measured memory_bytes: 256
H,N=map(int,input().split())
A,B=[],[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)


INF=10**9
dp=[INF for i in range(H+max(A))]
dp[0]=0

for i in range(H):
    for j in range(N):
        p1=dp[i+A[j]]
        p2=dp[i]+B[j]
        dp[i+A[j]]=min(p1,p2)

print(min(dp[H:]))


Measured memory_bytes: 43324
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main()
{long long n,b,r,s=0;
cin>>n>>b>>r;
s=n/(b+r);
n=n%(b+r);
if(n<=b)
cout<<s*b+n;
else
cout<<s*b+b;
}

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

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

Measured memory_bytes: 256
# def cumulative_sum(array)
#   array.inject([]) { |a, num| a << (a.last || 0) + num; a }
# end

def cumulative_sum(array)
  array.each_with_object([]) { |num, obj| obj << (obj.last || 0) + num }
end

n = gets.to_i
creatures = gets.split.map(&:to_i).sort
cumulative_sum = cumulative_sum(creatures)
ans = 1
(n - 2).downto(0) do |i|
  break if creatures[i + 1] > 2 * cumulative_sum[i]
  ans += 1
end
puts ans


Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,s=0,x;
	cin>>a>>b>>c;
	for(int i=1;i<=a;i++)
	{
		cin>>x;
		if(x<b||x>=c)s++;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		HashSet<Integer> set = new HashSet<>();
		int n = sc.nextInt();
		int m = sc.nextInt();
		for (int i = 0; i < m; i++) {
		    int a = sc.nextInt();
		    int b = sc.nextInt();
		    if (a == 1) {
		        if (set.contains(b)) {
		            System.out.println("POSSIBLE");
		            return;
		        }
		        set.add(b);
		    }
		    if (b == n) {
		        if (set.contains(a)) {
		            System.out.println("POSSIBLE");
		            return;
		        }
		        set.add(a);
		    }
		}
		System.out.println("IMPOSSIBLE");
	}
}


Measured memory_bytes: 106656
package main

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

func solve() {
	n, k := getInt(), getInt()
	n -= k
	k--

	ans := 1 + (n+k-1)/k
	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, -1)
#define RREP(i, n, k) for(auto i = n; i != k; i--)

#define debug(x) cerr << #x << " " << x << endl
#define print(x) cout << x;
#define println(x) cout << x << endl;
#define spc << " " <<

#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define eb emplace_back
#define np next_permutation

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<class T>using V = vector<T>;
template<class T>using VV = vector<vector<T>>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

long long pow_mod(long long a, long long b, long long mod) {
   if (a < 0 || b < 0) throw invalid_argument("pow_mod of minus values");
   if (b == 0) return 1;

   long long p = pow_mod(a, b/2, mod);
   if (b % 2 == 0) {
      return p * p % mod;
   } else {
      return (p * p) % mod * a % mod;
   }
}

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

   ll m, n; cin >> m >> n;
   cout << pow_mod(m, n, 1000000007) << endl;

   return 0;
}



Measured memory_bytes: 3164
require 'set'

N = gets.to_i
edges = Hash.new { |h, k| h[k] = [] }.tap do |h|
  (N-1).times do 
    a, b = gets.split.map(&:to_i)
    h[a] << b
    h[b] << a
  end
end

nodes = Array.new(N+1, :none)
nodes[0] = :dummy
nodes[1] = :fennec
nodes[N] = :snuke

queue = [[1, :fennec], [N, :snuke]]
until queue.empty?
  node, player = queue.shift
  edges[node].each do |a|
    next unless nodes[a] == :none
    
    nodes[a] = player
    queue << [a, player]
  end
end

fennec = 0
snuke = 0
nodes.each do |node|
  case node
  when :fennec
    fennec += 1
  when :snuke
    snuke += 1
  end
end
puts fennec > snuke ? "Fennec" : "Snuke"

Measured memory_bytes: 19196
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()

ans = 0
check = [0] * N

for i in range(N):
  j = T[i]
  if i >= K:
    if j == check[i-K]: continue
  if j == "r": ans += P
  elif j == "s": ans += R
  else: ans += S
  check[i] = j

print(ans)

Measured memory_bytes: 9932
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        if (S.equals("ABC")) {
            System.out.println("ARC");
        } else {
            System.out.println("ABC");
        }
        sc.close();
    }
}

Measured memory_bytes: 35548
#include <bits/stdc++.h>
#define int long long
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define pp pair<int,int>
#define N 100005 // check
using namespace std;

int n;

bool dis[N];
set<array<int,3>> enddds, begins;
pp segments[N];

pp dist(int x, int index) {
    int a = segments[index].ff; int b = segments[index].dd;
    if(a <= x and b >= x) return {0,x};
    if(abs(a-x) >= abs(b-x)) {
        return {abs(b-x), b};
    }
    return {abs(a-x), a};
}

main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; ++i) {
        int a,b; cin >> a >> b;
        dis[i] = false;
        enddds.insert({b,a,i});
        begins.insert({a,b,i});
        segments[i] = {a,b};
    }

    int ans = 0;
    int current = 0;

    int side = 0;
    int temp = 0;

    for(int i = 0; i < n; ++i) {
        while(1) {
            if(dis[(*begins.rbegin())[2]]) begins.erase(*begins.rbegin()); else break;
        }
        while(1) {
            if(dis[(*enddds.begin())[2]]) enddds.erase((enddds.begin())); else break;
        }

        int index = -1;
        if(side) {
            index = (*begins.rbegin())[2];
        } else {
            index = (*enddds.begin())[2];
        }
        dis[index] = true;
        pp k = dist(current, index);
        temp += k.ff;
        current = k.dd;
        side = 1-side;
    }
    temp += abs(current); current = 0;
    ans = max(ans, temp);

    begins.clear(); enddds.clear();
    for(int i = 0; i < n; ++i) {
        int a = segments[i].ff; int b = segments[i].dd;
        dis[i] = false;
        enddds.insert({b,a,i});
        begins.insert({a,b,i});
    }

    side = 1;
    temp = 0;

    for(int i = 0; i < n; ++i) {
        while(1) {
            if(dis[(*begins.rbegin())[2]]) begins.erase(*begins.rbegin()); else break;
        }
        while(1) {
            if(dis[(*enddds.begin())[2]]) enddds.erase((enddds.begin())); else break;
        }

        int index = -1;
        if(side) {
            index = (*begins.rbegin())[2];
        } else {
            index = (*enddds.begin())[2];
        }
        dis[index] = true;
        pp k = dist(current, index);
        temp += k.ff;
        current = k.dd;
        side = 1-side;
    }
    temp += abs(current); current = 0;
    ans = max(ans, temp);

    cout << ans << endl;
}

Measured memory_bytes: 16512
n, m = list(map(int, input().split(' ')))
kk = []
ss = []
for i in range(m):
    l = list(map(int, input().split(' ')))
    k = l[0]
    s = l[1:]
    kk.append(k)
    ss.append(s)
    
pp = list(map(int, input().split(' ')))
def ok(switches):
    valid = True
    for i in range(len(ss)):
        s = ss[i]
        temp = 0
        for j in range(len(s)):
            temp += switches[s[j]-1]
        if temp % 2 != pp[i]:
            valid = False
            break
    return valid
# 2^10 = 1024
def f(current, switches):
    if current == n:
        return ok(switches)
    ans = f(current + 1, switches + [1])
    ans += f(current + 1, switches + [0])
    return ans
print(f(0, []))

Measured memory_bytes: 3064
import java.util.*;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] a = new int[n];
      for(int i = 0;i < n;i++)a[i]=sc.nextInt();
      int[] l = new int[n+1];
      int[] r = new int[n+1];
      int[] m = new int[n+1];
      int max = 0;
      l[0]=0;
      r[n]=0;
      for(int i = 0;i < n;i++)l[i+1]=gcd(l[i],a[i]);
      for(int i = n-1;i >= 0;i--)r[i]=gcd(r[i+1],a[i]);
      for(int i = 1;i <= n;i++){
        m[i]=gcd(l[i-1],r[i]);
        max = Math.max(m[i],max);
      }
      System.out.println(max);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 50848
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
map<char,char>mp;
void init(){
	cin>>s1;
	s2=s1;
	mp['b']='d'; mp['d']='b'; mp['q']='p'; mp['p']='q';
}
int main(){
	init();
	reverse(s2.begin(),s2.end());
	for(int i=0;i<s2.size();i++)
	    s2[i]=mp[s2[i]];
	if(s1==s2)
	    cout<<"Yes\n";
	else
	    cout<<"No\n";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll N;
    cin >> N;
    double p[3333];
    double dp[N+5][N+5];
    ll i, j;
    memset(dp, 0, sizeof(dp));
    dp[0][0]=1;
    for(i=0; i<N; i++) {
        cin >> p[i];
    }
    
    for(i=1; i<=N; i++) {
        for(j=0; j<=i; j++) {
            dp[i][j]=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1];
        }
    }
    
    double ans=0;
    for(j=N/2+1; j<=N; j++) {
        ans+=dp[N][j];
    }
    
    printf("%.10f\n", ans);
    
}















Measured memory_bytes: 70784
#include <algorithm>
#include <iostream>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <fstream>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <map>
#include <set>
#if __cplusplus > 199711L
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//	tree<key, mapped = null_type, cmp = less<key>, rb_tree_tag, tree_order_statistics_node_update> name;
//	order_of_key
//	find_by_order
#endif

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fs first
#define sc second
#define abs(a) ((a) < 0 ? -(a) : (a))
#define sqr(a) ((a) * (a))

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

const double eps = 1e-9;
const int mod = (int) 1e+9 + 7;
const double pi = acos(-1.);
const int maxn = 100100;



int main() {

	#ifdef SOL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	#else
	srand(time(0));
	const string file = "";
	if (!file.empty()) {
		freopen((file + ".in").c_str(), "r", stdin);
		freopen((file + ".out").c_str(), "w", stdout);
	}
	#endif

	string s;
	int k;
	cin >> s >> k;
	for(int i = 0; i < (int)s.length(); i++) {
		s[i] -= 'a';
	}
	for(int i = 0; i < (int)s.length(); i++) {
		if(s[i] == 0) {
			continue;
		}
		if(k >= 26 - s[i]) {
			k -= 26 - s[i];
			s[i] = 0;
		}
	}
	if(k) {
		s[s.length() - 1] += k % 26;
		s[s.length() - 1] %= 26;
	}
	for(int i = 0; i < (int)s.length(); i++) {
		s[i] += 'a';
	}
	cout << s << endl;

	#ifdef SOL
	fflush(stdout);
	fprintf(stderr, "%.3lf ms\n", 1000. * clock() / CLOCKS_PER_SEC);
	fflush(stderr);
	#endif
	return (0);
}

// by Andrey Kim


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < a.length; ++i) {
            a[i] = sc.nextInt();
        }

        System.out.println(solve(a, K));

        sc.close();
    }

    static int solve(int[] a, int K) {
        Arrays.sort(a);

        int lastIndex = -1;
        int lower = 0;
        int upper = a.length - 1;
        while (lower <= upper) {
            int middle = (lower + upper) / 2;

            if (isUnnecessary(a, K, middle)) {
                lastIndex = middle;
                lower = middle + 1;
            } else {
                upper = middle - 1;
            }
        }

        return lastIndex + 1;
    }

    static boolean isUnnecessary(int[] a, int K, int index) {
        if (a[index] >= K) {
            return false;
        }

        boolean[] sums = new boolean[K];
        sums[0] = true;

        for (int i = 0; i < a.length; ++i) {
            if (i != index) {
                boolean[] nextSums = new boolean[K];
                for (int j = 0; j < nextSums.length; ++j) {
                    nextSums[j] = sums[j] || (j >= a[i] && sums[j - a[i]]);

                    if (nextSums[j] && j + a[index] >= K) {
                        return false;
                    }
                }

                sums = nextSums;
            }
        }

        return true;
    }
}

Measured memory_bytes: 106352
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var a = int.Parse(ss[0]);
            var b = int.Parse(ss[1]);

            Console.WriteLine(a * b % 2 == 0 ? "Even" : "Odd");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
using namespace std;
int main(){
    int n;
    bool flag=false;
    cin >> n;
    for(int i=1;i<=9;i++){
        int tmp = n/i;
        if((1 <= tmp && tmp <= 9)&& n%i==0){
            flag = true;
        }
    }
    if(flag){
        cout << "Yes"<<endl;
    }else{
        cout <<"No" <<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;

typedef long long ll;
 ll  p=1e9+7; 
double pi=3.141592653589793238;
double calcAngle(double h, double m)  
{  
      
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
  
    // Calculate the angles moved  
    // by hour and minute hands  
    // with reference to 12:00  
    double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
  
    // Find the difference between two angles  
    double angle = abs(hour_angle - minute_angle);  
  
    // Return the smaller angle of two possible angles  
    angle = min(360 - angle, angle);  
  
    return angle;  
} 

 int main() {
        ff;
        double a,b,h,m;
        cin>>a>>b>>h>>m;
        
        double z=calcAngle(h,m);
        double c=z/180;
        
        double ans=(a*a)+(b*b)-(2*a*b*cos(c*pi));
        
        cout<<fixed<<setprecision(12)<<pow(ans,0.5)<<endl;
            
            
            
        
           
       
    return 0;
}


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

int main(){
    int A,B; cin >> A >> B;
    for(int i = 1;i <= 3; ++i){
        if(i != A && i != B) cout << i << endl;
    }
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll a, b;
  cin >> a >> b;
  a = (a==1)?14:a;
  b = (b==1)?14:b;
  if(a>b)cout << "Alice";
  else if(a==b)cout << "Draw";
  else cout << "Bob";
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long lli;
typedef lli elm;
typedef vector<vector<elm> > mat;

const int H = 20;
const int W = 20;
const int di[6] = {0,1,1,0,-1,-1};
const int dj[6] = {1,1,0,-1,-1,0};

lli N, M, L;
vector<lli> V;
int G[H][W];

mat getE(int n) {
  mat e(n, vector<elm>(n, 0));
  for(int i = 0; i < n; ++i) {
    e[i][i] = 1;
  }
  return e;
}

mat multiply(const mat &a, const mat &b) {
  if(a.size() == 0 || b.size() == 0 ||
     a[0].size() != b.size()) return mat();
  int s = a.size();
  int t = b.size();
  int u = b[0].size();
  mat c(s, vector<elm>(u, 0));
  for(int i = 0; i < s; ++i) {
    for(int j = 0; j < u; ++j) {
      for(int k = 0; k < t; ++k) {
        c[i][j] += (a[i][k] * b[k][j])%M;
        c[i][j] %= M;
      }
    }
  }
  return c;
}

mat pow(const mat &a, const lli &n) {
  if(n == 0) return getE(a.size());
  mat b = pow(multiply(a, a), n/2);
  if(n & 1) return multiply(b, a);
  else return b;
}

int main() {
  while(cin >> N >> M >> L && (N|M|L)) {
    fill(G[0], G[H], -1);
    V.clear();
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < i+N; ++j) {
        int a;
        cin >> a;
        G[i][j] = V.size();
        V.push_back(a);
      }
    }
    for(int i = 0; i < N-1; ++i) {
      for(int j = 0; j < 2*N-2-i; ++j) {
        int a;
        cin >> a;
        G[N+i][j+i+1] = V.size();
        V.push_back(a);
      }
    }
    mat X(1, V);
    mat A(V.size(), vector<lli>(V.size(), 0LL));
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        if(G[i][j] == -1) continue;
        int a = G[i][j];
        A[a][a] = 1;
        for(int k = 0; k < 6; ++k) {
          int ni = i + di[k];
          int nj = j + dj[k];
          if(ni < 0 || ni >= H) continue;
          if(nj < 0 || nj >= W) continue;
          if(G[ni][nj] == -1) continue;
          int b = G[ni][nj];
          A[a][b] = 1;
        }
      }
    }

    X = multiply(X, pow(A,L));
    lli res = 0;
    for(int i = 0; i < X[0].size(); ++i) {
      res += X[0][i];
    }
    static int tc = 0;
    cout << "Case " << ++tc << ": " << res << endl;
  }
  return 0;
}

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

void update(int next, int prev, string num, vector<string>& dp) {
  if (dp[next].length() > dp[prev].length() + 1) return;
  string next_num = dp[prev] + num;
  sort(next_num.rbegin(), next_num.rend());
  if (dp[next].length() < next_num.length()) {
    dp[next] = next_num;
  } else if (dp[next].length() == next_num.length() && next_num > dp[next]) {
    dp[next] = next_num;
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n, m;
  cin >> n >> m;
  vector<int> nums(m);
  rep(i, m) cin >> nums[i]; 

  const int num_matchs[10] = {0,2,5,5,4,5,6,3,7,6};
  vector<string> dp(n+100);
  for (int i = 0; i < n; ++i) {
    if (i != 0 && dp[i] == "") continue;
    for (auto& num : nums) {
      update(i + num_matchs[num], i, to_string(num), dp);
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 27008
#include <stack>
#include <iostream>
#include <algorithm>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;

const int N=1e6+5,mod=1000000007;
string S;
int main() {
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>S;
	if (S[1]=='B') S[1]='R';
	else S[1]='B';
	cout<<S;
	return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int w[1000];
int s[1000];
int v[1000];
long long dp[10001];

int main() {
    int n, i, j;
    long long ans = 0;
    vector <pair<int, int>> z;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d %d %d", &w[i], &s[i], &v[i]);
    
    for (i = 0; i < n; i++) z.push_back(make_pair(w[i] + s[i], i));
    sort(z.begin(), z.end());
    
    for (i = 0; i < n; i++) {
        int x = z[i].second;
        
        for (j = s[x]; j >= 0; j--) {
            ans = max(ans, dp[j] + v[x]);
            if (j + w[x] <= 10000) dp[j + w[x]] = max(dp[j + w[x]], dp[j] + v[x]);
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 384
from collections import defaultdict
n, m = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
adj = defaultdict(list)
for i in range(m):
    a, b = [int(i) for i in input().split()]
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)
ans = 0
for i in range(n):
    if adj[i] == 0:
        ans += 1
    else:
        for j in adj[i]:
            if H[j] >= H[i]:
                break
        else:
            ans +=1
print(ans)

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

int main() {
    int N;
    cin >> N;
    set<string> S;

    for(int i=0; i<N; i++) {
        string s;
        cin >> s;
        S.insert(s);
    }

    cout << S.size() << endl;
}

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

int main() {
  for(int W, H, N; cin >> W >> H >> N && (W|H|N); ) {
    N *= 2;
    vector<double> x(N), y(N);
    for(int i = 0; i < N; ++i) {
      cin >> x[i] >> y[i];
    }
    x.push_back(W);
    y.push_back(0);
    x.push_back(W);
    y.push_back(H);

    vector<double> ys = y;
    ys.push_back(0);
    ys.push_back(H);
    for(int i = 0; i < x.size(); ++i) {
      for(int j = i+1; j < x.size(); ++j) {
        if(x[i] == x[j]) continue;
        double a = (y[i] - y[j]) / (x[i] - x[j]);
        double b = y[i] - a * x[i];
        if(0 < b && b < H) ys.push_back(b);
      }
    }
    sort(ys.begin(), ys.end());
    double res = 0;
    for(int i = 0; i+1 < ys.size(); ++i) {
      double m = (ys[i] + ys[i+1]) / 2.0;
      vector<pair<double, int> > v;
      for(int j = 0; j < N; ++j) {
        double rad;
        rad = atan2(y[j] - m, x[j]);
        v.push_back(make_pair(rad, j));
      }
      sort(v.begin(), v.end());
      int s = v[N/2-1].second;
      int t = v[N/2].second;
      double y1 = (y[s] - m) / x[s] * W + m;
      double y2 = (y[t] - m) / x[t] * W + m;
      double w = min((double)H, y2) - max(0.0, y1);
      if(w <= 0.0) continue;
      res += (ys[i+1] - ys[i]) * w / pow((double)H, 2.0);
    }
    printf("%.10f\n", res);
  }
  return 0;
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
#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)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int h,w;
  cin>>h>>w;
  rep(i,w+2)cout<<"#";
  cout<<endl;
  rep(i,h){
    cout<<"#";
    rep(j,w){
      char a;
      cin>>a;
      cout<<a;
    }
    cout<<"#"<<endl;
  }
  rep(i,w+2)cout<<"#";
  cout<<endl;
  return(0);
}
      


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
#define ll long long
const int mod = 1e9+7; 
 
int n,m,k,flag;
int a[maxn];
ll sum[maxn];
 
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&a[i]);
		if(i>1&&a[i]==a[i-1]+1)flag=1;
	}
	a[m+1]=n+1;
	if(flag==1){
		printf("0");
		return 0;
	}
	if(a[1]==1)sum[2]=1;
	else{
		sum[1]=1;
		if(a[1]!=2)sum[2]=1;
	}
	while(k<m){
		k++;
		for(int i=a[k-1]+1;i<a[k];i++){
			for(int j=1;j<=2&&i-j>=0;j++)
				sum[i]+=sum[i-j];
			sum[i]%=mod;
		}
	}
	for(int i=a[m]+1;i<=n;i++){
		for(int j=1;j<=2&&i-j>=0;j++)
			sum[i]+=sum[i-j];
		sum[i]%=mod;
	}
	printf("%lld",sum[n]);
	return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
long long A[200010],B[200010],K[200010],H[200010];
int main(){
  long long n,a,b,q=1,p=0,u,d,s,t,i,M=1e9+7;
  scanf("%lld %lld %lld %*d",&n,&a,&b);
  A[0]=B[0]=H[0]=K[0]=1;
  for(i=1;i<2*n+5;i++){
    A[i]=(A[i-1]*a)%M;
    B[i]=(B[i-1]*b)%M;
    K[i]=(K[i-1]*i)%M;
    H[i]=(H[i-1]*(a+b))%M;
  }
  for(i=n;i<2*n;i++){
    u =((A[n]*B[i-n])%M*K[i-1])%M;
    d =((H[i]*K[n-1])%M*K[i-n])%M;
    u+=((A[i-n]*B[n])%M*K[i-1])%M;
    u=u*i%M;
    s=((p*d)%M+(u*q)%M)%M;
    t=(d*q)%M;
    p=s;
    q=t;
  }
  //printf("%lld %lld\n",p,q);
  p=(p*100)%M;
  q=(q*(a+b))%M;
  u=gcd(p,q);  //printf("%lld %lld\n",p,q);
  p/=u;
  q/=u;//printf("%lld %lld\n",p,q);
  q=inv(q,M);
  printf("%lld\n",p*q%M);
  return 0;
}


Measured memory_bytes: 6400
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    [n,m] <- r'
    as <- sortBy (flip compare) <$> r'
    putStrLn $ if as!!(m-1) < ceiling (fromIntegral (sum as)/(fromIntegral $4*m)) then "No" else "Yes"



Measured memory_bytes: 508
var  a,b,s,i,j,k,l:longint;
begin
  readln(a,b);
  l:=1;
  k:=b;
  repeat
    l:=l*10;
    k:=k div 10;
  until  k=0;
  a:=a*l;
  s:=a+b;
  k:=trunc(sqrt(s));
  for  i:=1  to  k  do
    if  i*i=s  then
      begin
        writeln('Yes');
        exit;
      end;
  writeln('No');
end.


Measured memory_bytes: 128
#include <cstdio>
using namespace std;
int n;
int arr[100005];
int c[100005];

const long long mod=1000000007;
int main(){
    scanf("%d",&n);
    for (int x=0;x<n;x++) scanf("%d",&arr[x]);
    
    for (int x=0;x<n;x++) {
        if (arr[x]!=x) goto _notsped;
    }
    
    printf("3\n");
    return 0;
    
    _notsped:;
    
    c[0]=3;
    for (int x=0;x<n;x++) arr[x]++;
    
    long long ans=1;
    
    for (int x=0;x<n;x++){
        c[arr[x]]++;
        if (arr[x]){
            ans=(ans*c[arr[x]-1])%mod;
            c[arr[x]-1]--;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 896
A=int(input())
n_l=[0]*(A+1)
for i in range(1,A+1):
   B=i
   for j in range(2,i+1):
      while B % j ==0:
         B=B//j
         n_l[j]+=1
      if B==1:
         break
ans=1
n_l=list(map(lambda x:x+1,n_l))
for i in n_l:
   ans*=i
print(ans%(10**9+7))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
      		sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
		
			System.out.println((10*b+c) % 4 == 0 ? "YES" : "NO");
	}
}

Measured memory_bytes: 35584
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;


typedef unsigned long long int ulint;

int main(){
  ulint A, B, K;
  cin >> A;
  cin >> B;
  cin >> K;

  ulint a, b;

  if (A > K) {
    a = A - K;
    b = B;
  } else {
    a = (ulint) 0;

    if (B > (K - A)) {
      b = B - (K - A);
    } else {
      b = (ulint) 0;
    }
  }
  cout << a << " " << b << endl;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n;
	
	while (scanf("%d", &n) * n != 0){
		int prime[10001] = {0};
		int i, j;
		
		for (i = 2; i <= sqrt(n); i++){
			if (prime[i] == 1) continue;
			for (j = i * 2; j <= n; j += i){
				prime[j] = 1;
			}
		}
		for (i = n; i >= 2; i--){
			if (prime[i] + prime[i - 2] == 0){
				printf("%d %d\n", i - 2, i);
				break;
			}
		}
	}
	
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  ll N, T;
  cin >> N >> T;
  cout << N + T / 2 << endl;
  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

const double PI = acos(-1);
#define MOD 1000000007  ///1e9+7

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '

#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///******************************** C o d e ********************************///



main()
{
    int a,b,c,d,k;
    while(cin>>a>>b>>c>>d>>k){
        int x,y;
        x=c-a;
        y=d-b;
        if(y<0){
            y+=60;
            x--;
        }
        if(x<0) x=0;
        int z=y+x*60;
        if(z<k) cout<<0 el;
        else cout<<abs(z-k) el;
    }

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3620
#include <iostream>
#include <queue>

int main()
{
	int N, M, a;
	std::cin >> N >> M;

	std::priority_queue<int> q;
	for (int i = 0; i < N; ++i)
	{
		std::cin >> a;
		q.push(a);
	}

	for (int i = 0; i < M; ++i)
	{
		int c = q.top() / 2;
		q.pop();
		q.push(c);
	}

	long long ans = 0;
	while (!q.empty())
	{
		ans += q.top();
		q.pop();
	}

	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 892
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
int main(){
ll h,w;
cin >>h>>w;
char c[h][w];
for(ll i=0;i<h;i++){
for(ll j=0;j<w;j++){
cin >>c[i][j];
}
}
for(ll i=0;i<2*h;i++){
for(ll j=0;j<w;j++){
cout <<c[i/2][j];
}
cout<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long int a,b;
  cin>>a>>b;
 
  long int x = abs(a+b)/2;
  if(abs(a+b)&1) cout<<"IMPOSSIBLE";
  else cout<<x;
  /*long int y = (a+b)/2;
  
  if(a<b &&  a+x == b-x) cout<<x;
  else if(a>b && a-x == b+x) cout<<x;
  else if(a<b && a+y == b-y) cout<<y;
  else if(a>b && a-y && b+y) cout<<y;
  else cout<<"IMPOSSIBLE";*/
      

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	
	int Q;
	cin >> Q;
	vector<int> B(Q), C(Q);
	REP(i, Q) scanf("%d %d", &B[i], &C[i]);
	
	ll ans = accumulate(ALL(A), 0ll);
	map<int, int> mm;
	REP(i, N) mm[A[i]]++;
	
	REP(i, Q) {
		int c = mm[B[i]];
		ans += (ll)(C[i] - B[i]) * c;
		mm[B[i]] = 0;
		mm[C[i]] += c;
		printf("%lld\n", ans);
	}
	
	return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;

int main(){
    
    int N;cin>>N;
    string S;cin>>S;
    int cnt=0,left=0;
    for(int i=0;i<N;i++){
        if(S[i]==')') cnt++;
        else cnt--;
        left=max(left,cnt);
    }
    for(int i=0;i<left;i++){
        cout<<'(';
    }
    cout<<S;
    for(int i=0;i<left-cnt;i++){
        cout<<')';
    }
    cout<<endl;
}


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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

signed main(){
    int n,m; cin >> n >> m;
    UnionFind tree(n);
    vector<int> a(m),b(m),ans(m);
    rep(i,m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    ans[m-1]=n*(n-1)/2;

    for(int i=m-1; i>0; i--){
        if(!tree.same(a[i],b[i])){
            ans[i-1]=ans[i]-tree.size(a[i])*tree.size(b[i]);
            tree.unite(a[i],b[i]);
        }else{
            ans[i-1]=ans[i];
        }
    }
    rep(i,m) cout<<ans[i]<<endl;
}

Measured memory_bytes: 5248
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x = sc.nextDouble();
		double a;
		double b;

		a = 2 * 3.14159265359 * x;
		b = 3.14159265359 * x * x;

		System.out.printf("%.6f %.6f", b, a);
	}
}

Measured memory_bytes: 28296