akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int sos(int);

int main(){
  int i,j,p,q,n;
  while(1){
  scanf("%d",&n);
  if(n==0){break;}
  for(i=n-2;i>=2;i--){
    p=sos(i);
    q=sos(i+2); 
    if(p!=0&&q!=0){
      break;
    }
  }
  printf("%d %d\n",p,q);
  }
  return 0;
}

int sos(int x){
  int i;
  for(i=2;i<=sqrt(x);i++){
    if(x%i==0){
      return 0;
    }
  } 
  return x;
}

Measured memory_bytes: 404
#include <iostream>
using namespace std;
 
int main() {
    int n;
    long long a;
    long long maxValue = -1000000;
    long long minValue = 1000000;
    long long sum = 0;
 
    cin>>n;
 
    for(int i=0;i<n;i++){
        cin>>a;
        if(a < minValue) minValue = a;
        if(a > maxValue) maxValue = a;
        sum += a;
    }
 
    cout<< minValue <<" "<< maxValue <<" "<< sum << endl;
 
    return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
int main()
{
 long int n,s=1000,t=0,q=0,r=1000,g=0,d=0;
	cin>>n;
   long long int arr[n+1];
	for(int i=0;i<n;i++)
	cin>>arr[i];
	arr[n]=0;
	for(int i=0;i<n;i++)
	{
	    if(arr[i+1]>arr[i] &&q==0)
	    {
	     t=s/arr[i];
	    	s=s%arr[i];
	    	q++;
		}
	    else if(arr[i]==arr[i+1])
	    continue;
	    else{
	    	if(arr[i+1]<arr[i])
	    	{
	    s=s+t*arr[i];
	    t=0;
	    q=0;}
       	}
	}
	for(int i=0;i<n;i++)
	{
		if(arr[i+1]>arr[i] &&d==0)
		{
			g=r/arr[i];r=r%arr[i];
			d++;
		}
		else if(arr[i]==arr[i+1])
	    continue;
	    else{
	    	r=r+g*arr[i];
	    	g=0;
	    	d=0;}
	    }
	cout<<max(r,s)<<endl;

	
}


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

int main(){
     int A,B;
     while(cin>>A>>B,A||B){
	  int mon=B-A;
	  mon/=100;
	  int x,y,z;
	  x=mon/10;
	  mon-=10*x;
	  y=mon/5;
	  mon-=5*y;
	  z=mon;
	  cout<<z<<" "<<y<<" "<<x<<endl;
     }
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int A,B;
        Scanner in=new Scanner(System.in);
        A=in.nextInt();
        B=in.nextInt();
        if (A>2*B)
        {
            System.out.println(A-2*B);
        }
        else
        {
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 21844
N,M = map(int,input().split())
sw = []
for i in range(M):
    tmp = list(map(int,input().split()))
    sw.append(tmp[1:])
p = list(map(int,input().split()))
bit = []
for i in range(2**N):
    tmp = list(map(int,bin(i)[2:].zfill(N)))
    bit.append(tmp)
ans = 0
for i in range(2**N):
    all = True
    for j in range(M):
        num = 0
        for k in range(len(sw[j])):
            if bit[i][sw[j][k]-1] == 1:
                num += 1
        if num%2 != p[j]:
            all = False
            break
    ans += all
print(ans)

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

int main() {
  long long N, ans;
  cin >> N;
  for (long long a = 1; a*a <= N; a++) {
    if (N%a == 0) {
      ans = a + N/a -2;
    }
  }
  cout << ans << endl;
}

    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1000000000
#define  pow(x) pow(10,(x)) 
typedef long long int LL;
//sort(all(x))とするとソートできるよ

int mysqrt(unsigned int x){
  int a = 0, c = 0, y = 0, i = 0, t = x;
  while(t >>= 1){
    ++i;
  }
  for(i += i & 1; i >= 0; i -= 2){
    c = (y << 1 | 1) <= x >> i;
    a = a << 1 | c;
    y = y << 1 | c;
    x -= c * y << i;
    /* if(c){
      x -= y << i;
    } */
    y += c;
  }
  return a;
}

int main(){
    int N,D; cin >> N >> D;
    vector<vector<int>> X(N,vector<int>(D,0));
    rep(i,N){
        rep(j,D){
            cin >> X[i][j];
        }
    }
    int tmp;
    int sum;
    int res;
    int ev;
    rep(k,N-1){
        for(int l = k+1;l <= N-1;l++){
            sum = 0;
            rep(m,D){
                tmp = X[k][m] - X[l][m];
                sum += tmp * tmp;
            }

    ev = mysqrt(sum);
    if(ev*ev == sum)res++;

    }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
  		int rabs[] = new int[s]; 
      	long stack_num;
      	long like = 0;
      	
      	for(int i = 0;i < s; i++){
        	rabs[i] = sc.nextInt();
        }
      
      	for(int i = 0; i < s;i++){ 
          if(rabs[rabs[i]-1] == (i + 1)) like++;
        }
 		
      	System.out.println(like/2);
        
	}
}


Measured memory_bytes: 59724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[7];
		while (n-- > 0) {
			double a = scanner.nextDouble();
			if (a < 165)
				num[1]++;
			else if (a < 170)
				num[2]++;
			else if (a < 175)
				num[3]++;
			else if (a < 180)
				num[4]++;
			else if (a < 185)
				num[5]++;
			else
				num[6]++;
		}
		for (int i = 1; i < 7; i++) {
			System.out.print(i + ":");
			for (int j = 0; j < num[i]; j++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 20188
#include <bits/stdc++.h>
using namespace std;
#define rep(k,nu)    for(int i=k; i<nu;  i++)
#define rep2(k,n)   for(int j=k; j<n;  j++)
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define ll long long
#define pb pop_back
template<typename T> inline void chMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}
const double PI = acos(-1);

int main(){
    string s; cin >> s;
    cout << ((s[2]==s[3]&&s[4]==s[5])? "Yes" : "No") << endl;
    return 0;
}
/*

*/


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






string a, b;
//-----------------------------------------------------------------------------------
int main() {
	cin >> a >> b;
	if (a == "H" && b == "H")
		printf("H\n");
	else if(a == "D" && b == "D")
		printf("H\n");
	else
		printf("D\n");
}

Measured memory_bytes: 256
package main

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

func main() {
	N := nextInt()
	D := nextInt()
	d := N / (D*2 + 1)
	r := N % (D*2 + 1)
	if r > 0 {
		fmt.Printf("%d", d+1)
	} else {
		fmt.Printf("%d", d)
	}
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 640
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
static const lint MOD = (lint)1e9+7;

lint Sum(vector<lint> nums)
{
    lint sum = 0;
    rep (i, SZ(nums))
    {
        sum += nums[i];
    }
    return sum;
}

int main()
{
    int N;
    cin >> N;
    vector<lint> B(N-1);
    rep (i, N-1)
    {
        cin >> B[i];
    }

    vector<lint> A(N);
    A[0] = B[0];
    for (int i = N - 1; i > 0; --i)
    {
        A[i] = min(B[i-1], B[i]);
    }
    A[N-1] = B[N-2];

    rep (i, N)
    {
        cerr << A[i] << " ";
    }
    cerr << endl;

    lint sum = Sum(A);
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[int(input()) for i in range(N)]

if A[0]>0:
  print(-1)
  exit(0)
for i in range(1,N):
  if A[i-1]+1<A[i]:
    print(-1)
    exit(0)
    

ans=0
for i in reversed(range(1,N)):
  if A[i]==A[i-1]+1:
    ans+=1
  else:
    ans+=A[i]
print(ans)
    

Measured memory_bytes: 11048
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

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

    int ans = 0;
    rep(i, N) {
        if (h[i] >= K) ++ans;
    }
	cout << ans << endl;
	return 0;
}


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

template<class T>
vector<pair<T,T>> divisor(T n){
	vector<pair<ll,ll>> res;
	for(T i = 1; i * i <= n; i++){
		if(n % i == 0){
			T j = n / i;
			res.emplace_back(i, j);
			res.emplace_back(j, i);
		}
	}
	return res;
}


ll f(ll a, ll b) {
	if(a == 1 || b == 1) return (ll)1e18;
	pair<ll, ll> v = atcoder::crt({-1, 0},{a, b});
	return v.first;
}



int main()
{
	ll n; cin >> n;
	if(n <= 2) {
		cout << n << endl;
		return 0;
	}
	auto v = divisor(n);
	int m = v.size();
	ll nin = n - 1;
	

	for(int i = 0; i < m; i++) {
		ll a = v[i].first, b = v[i].second;
		if(gcd(2 * a, b) == 1)nin = min(nin, f(2 * a, b));
		if(gcd(a, b * 2) == 1)nin = min(nin, f(a, b * 2));
	}

	cout << nin << endl;

}

Measured memory_bytes: 3908
#include <cstdio>

int N, Ans;

int SG(int a, int k) {
	if (a < k) return 0;
	if (a % k == 0) return a / k;
	int val = a / k + 1;
	return SG(a - (a - a / k * (k - 1)) / val * val, k);
}

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) {
		int a, k;
		scanf("%d%d", &a, &k);
		Ans ^= SG(a, k);
	}
	puts(Ans ? "Takahashi" : "Aoki");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int N, A[100002], S = 0;
    cin >> N;
    A[0] = A[N+1] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        S += abs(A[i] - A[i-1]);
    }
    S += abs(A[N+1] - A[N]);
    for (int i = 1; i <= N; i++)
        cout << S + abs(A[i+1] - A[i-1]) - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) << endl;
}

Measured memory_bytes: 1664
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int>a(n);
    vector<int>b;
    vector<int>c;
    if(n%2==0){
        for(int i=0;i<n;i++){
            cin >> a[i];
            if(i%2==1){
                b.push_back(a[i]);
            }else{
                c.push_back(a[i]);
            }
        }
        reverse(b.begin(),b.end());
        for(int i=0;i<b.size();i++){
            cout << b[i] << " ";
        }
        for(int i=0;i<c.size();i++){
            cout << c[i] << " ";
        }
    }else{
        for(int i=0;i<n;i++){
            cin >> a[i];
            if(i%2==0){
                b.push_back(a[i]);
            }else{
                c.push_back(a[i]);
            }
        }
        reverse(b.begin(),b.end());
        for(int i=0;i<b.size();i++){
            cout << b[i] << " ";
        }
        for(int i=0;i<c.size();i++){
            cout << c[i] << " ";
        }
    }
}

Measured memory_bytes: 3956
/**
 * Computing Geometry Library
 * @author Sshwy
 */
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)

namespace cg{
    typedef long double vtyp;
    const vtyp eps = 1e-9;
    bool isZero(vtyp x){
        return -eps < x && x < eps;
    }
    struct vec {
        vtyp x,y;
        vec(){ x = y = 0; }
        vec(vtyp _x, vtyp _y){ x = _x, y = _y; }
        vec operator+(const vec V) const { return vec(x+V.x, y+V.y); }
        vec operator-() const { return vec(-x, -y); }
        vec operator-(const vec V) const { return *this + (-V); }
        vec operator*(const vtyp a) const { return vec(x*a, y*a); }
        friend vec operator*(const vtyp a, const vec v){ return v*a; }
        operator bool() const { return !(isZero(x) && isZero(y)); }
        bool operator==(const vec V) const { return bool(*this-V) == 0; }
        vtyp length(){ return sqrt(x*x + y*y); }
        /**
         * 方向角，单位 rad
         */
        vtyp ang() const { return atan2(y,x); }
        /**
         * 方向向量
         * @return 0向量或者一个单位向量
         */
        vec dir() const {
            if(*this){
                vtyp ang = atan2(y,x);
                return vec(cos(ang), sin(ang));
            } else return vec(0,0);
        }
        void read(){ scanf("%Lf%Lf",&x,&y); }
    };
    istream & operator>>(istream & in, vec & v){ 
        return in >> v.x >> v.y, in; 
    }
    ostream & operator<<(ostream & out, const vec & v){ 
        return out << v.x << " " << v.y, out;
    }
    ifstream & operator>>(ifstream & in, vec & v){ 
        return in >> v.x >> v.y, in; 
    }
    ofstream & operator<<(ofstream & out, const vec & v){ 
        return out << v.x << " " << v.y, out;
    }
    /**
     * 点积
     * a dot b == |a||b|cos theta
     */
    vtyp dot(const vec a, const vec b){ return a.x*b.x + a.y*b.y; }
    /**
     * 叉积
     * 两个向量围成的有向面积
     */
    vtyp det(const vec a, const vec b){ return a.x*b.y - a.y*b.x; }
    typedef vec point;
    struct line {
        point p1, p2;
        line(point _p1, point _p2){ p1 = _p1, p2 = _p2; }
    };

    /**
     * 投影
     * @param L 直线
     * @param p 要求投影的点
     * @return p 在 L 上的投影坐标（即垂足）
     */
    point projection(line L, point p){
        vec d = L.p2 - L.p1;
        return L.p1 + (dot(d, p-L.p1)/d.length()) * d.dir();
    }
}


int main(){
    cg::point p1,p2,p;
    int q;
    cin>>p1>>p2>>q;
    cg::line l(p1,p2);
    FOR(i,1,q){
        cin>>p;
        cout<<setiosflags(ios::fixed)
            <<setprecision(10)
            <<cg::projection(l,p)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
int total[8]={},totallain=0;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int input;
		cin>>input;
		bool ada=false;
		for(int i=1;i<=8;i++)
		{
			if(input<i*400)
			{
				total[i-1]=1;
				ada=true;
				break;
			}
		}
		if(!ada)
			totallain++;
	}
	int totalsemua=0;
	for(int i=0;i<8;i++)
		totalsemua+=total[i];
	cout<<max(1,totalsemua)<<" "<<totalsemua+totallain<<endl;
}

Measured memory_bytes: 256
def add_prime_factor(x, list_N):
    for i in range(2, x+1):
        count = 0
        while True:
            if x % i != 0:
                break
            count += 1
            x //= i
        list_N[i-1] += count
        if x == 1:
            break
    return list_N

if __name__ == '__main__':
    N = int(input())
    list_N = [0] * N
    for i in range(2, N+1):
        list_N = add_prime_factor(i, list_N)
    ans = 1
    for x in list_N:
        ans *= (x + 1)
    print(ans % (10**9 + 7))

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

int main(){
    ll n;
    cin >> n;
    vector <ll> a(n);
    rep(i,n){
        cin >> a[i];
    }

    sort(a.begin(),a.end());

    ll k=0;

    rep(i,n){
        if(i!=0){
            if(a[i]==a[i-1]){
                ++k;
            }
        }
    }

    ll ans;
    if(k%2==0){
        cout << n-k << endl;
    }
    else{
        cout << n-k-1 << endl;
    }
    

    return 0;
}

Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool isPerfectSquare(ll x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss < b.ss;
    return (a.ff > b.ff); 
}
//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////
int gcd(int p, int q){
if(p % q == 0)return q;
return gcd(q, p % q);
}

void solve()
{

    ld d,t,s;

    cin>>d>>t>>s;

    ld T = d/s;

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


    return;
}
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 



Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
int v[100010];
int dp[100010];
int f(int i){
    if(i == 1) return 0;
    if(i == 2) return abs(v[1]-v[2]);
    if(dp[i]!=-1) return dp[i];
    dp[i] = min(abs(v[i]-v[i-1])+f(i-1),abs(v[i]-v[i-2])+f(i-2));
    return dp[i];
}
int main(){
    memset(dp,-1,sizeof dp);
    memset(v,0,sizeof v);
    int n;
    cin>>n;
    for(int i = 1 ; i <= n ; i++) cin>>v[i];
    cout<<f(n)<<"\n";
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    set<int> s;
    while(k--){
        int d;
        cin>>d;
        while(d--){
            int temp;
            cin>>temp;
            s.insert(temp);

        }
    }

    // cout<<"F: "<<s.size();

    cout<<( max(0, n -(int)s.size()) )<<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,M,Q;
vector<int> g[100100];
int v[100100],d[100100],c[100100];
int dp[100100][12];
void rec(int v,int d,int q){
	if(dp[v][d]!=-1)return;
	if(d<0)return;
	dp[v][d]=q;
	for(int i=0;i<g[v].size();i++){
		int u = g[v][i];
		rec(u,d-1,q);
	}
	rec(v,d-1,q);
}
int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int a,b;
		cin >> a >> b;
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	cin >> Q;
	for(int i=0;i<Q;i++){
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}
	memset(dp,-1,sizeof(dp));
	for(int i=Q-1;i>=0;i--){
		rec(v[i],d[i],i);
	}
	for(int i=0;i<N;i++){
		if(dp[i][0]==-1)cout << 0 << endl;
		else cout << c[dp[i][0]] << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll R, C, K;
    cin >> R >> C >> K;
    map<pair<ll,ll>,ll> S;
    REP(i,0,K) {
        ll r, c, v;
        cin >> r >> c >> v;
        S[{r, c}] = v;
    }

    vector<vector<vector<ll>>> dp(R+1, vector<vector<ll>>(C+1, vector<ll>(4, 0)));
    REP(i,1,R+1) {
        REP(j,1,C+1) {
            ll x = 0;
            if(S.count({i, j}) > 0) x = S[{i, j}];
            dp[i][j][0] = MAX(dp[i][j][0],dp[i][j-1][0]);
            REP(k,0,4) dp[i][j][0] = MAX(dp[i][j][0],dp[i-1][j][k]);
            REP(k,1,4) dp[i][j][k] = MAX(dp[i][j][0],dp[i][j-1][k]);
            dp[i][j][1] = MAX(dp[i][j][1],dp[i][j-1][0]+x);
            REP(k,0,4) dp[i][j][1] = MAX(dp[i][j][1],dp[i-1][j][k]+x);
            REP(k,2,4) dp[i][j][k] = MAX(dp[i][j][k],dp[i][j-1][k-1]+x);
        }
    }
    
    ll ans = MAX(dp[R][C][0],dp[R][C][1]);
    ans = MAX(ans,dp[R][C][2]);
    ans = MAX(ans,dp[R][C][3]);
    PR(ans);

    return 0;
}

/*



*/

Measured memory_bytes: 649040
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, M);
    A2IN(ll, a, ll, b, M);
    vi d(N + 1);
    REP(i, M)
    {
        ++d[a[i]];
        ++d[b[i]];
    }
    bool ok = true;
    REP1(i, N)
    {
        ok &= (d[i] % 2 == 0);
    }
    YES(ok, "YES", "NO");
}

Measured memory_bytes: 5612
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*///map < string, ll> s;

/*i++ずつずらす
a[0] a[1] a[2]//a[1] a[2] a[3]
a[0] a[2] a[4]//a[1] a[3] a[5]
/*if (N % 2 != 0)a = N / 2;
else a = N / 2 - 1;
for (int i = 1;i <= a;i++) {
	for (int j = 0;j < N - (i * 2);j++) {
		if (S[j] != S[j + i] && S[j + i * 2] != S[j] && S[j + i] != S[j + i * 2]) sum--;
		if (sum == 0)break;
	}
}*/

//mapの使い方
/*map<int, int> mp;
for (int i = 0; i < N; i++)
	mp[a[i]]++;

int ans = 0;
for (auto p : mp) {
	int x = p.first;
	int n = p.second;
	if (n < x) ans += n;
	else ans += n - x;
}*/

int main() {
	ll N;cin >> N;
	vector<ll>A(N);
	for (int i = 0;i < N;i++) cin >> A[i];
	bool ok = false;
	ll a = 0, b = 0;
	for (int i = 0;i << N;i++) cin >> A[i];
	sort(all(A));
	for (int i = N-2;i >= 0;i--) {
		if(ok==false){
			if (A[i] == A[i + 1]) {
				ok = true;
				a = A[i];
				i--;
			}
		}else if (A[i] == A[i + 1]) {
			b = A[i];
			break;
		}
	}
	cout << a * b<< endl;
}

Measured memory_bytes: 1024
class UnionFind:
  def __init__(self, n):
    self.parent = [i for i in range(n)]
    self.height = [0 for i in range(n)]
    
  def get_root(self, i):
    if self.parent[i] == i:
      return i
    else:
      self.parent[i] = self.get_root(self.parent[i])
      return self.parent[i]
    
  def unite(self, i, j):
    root_i = self.get_root(i)
    root_j = self.get_root(j)
    if root_i != root_j:
      if self.height[root_i] < self.height[root_j]:
        self.parent[root_i] = root_j
      else:
        self.parent[root_j] = root_i
        if self.height[root_i] == self.height[root_j]:
          self.height[root_i] += 1
          
  def is_in_group(self, i, j):
    if self.get_root(i) == self.get_root(j):
      return True
    else:
      return False
    
def kruskal(V, e_list):
  #V := ノードの数
  #e_list := [[始点ノード, 終点ノード, コスト], ...]
  e_cost_sorted = []
  for e in e_list:
    e_cost_sorted.append([e[2], e[0], e[1]])
  e_cost_sorted.sort()
  uf_tree = UnionFind(V)
  cost = 0
  for k in range(len(e_cost_sorted)):
    c = e_cost_sorted[k][0]
    i = e_cost_sorted[k][1]
    j = e_cost_sorted[k][2]
    if not uf_tree.is_in_group(i, j):
      uf_tree.unite(i, j)
      cost += c
  print(cost)
  
V, E = map(int, input().split())
e_list = []
for i in range(E):
  e_list.append(list(map(int, input().split())))
kruskal(V, e_list)


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

typedef uint32_t u32;
typedef uint64_t u64;
typedef std::pair<int, int> pii;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int w, h;
char a[64][64];
int used[64][64];
int count;
bool black_flag;
bool white_flag;


void dfs(int y, int x) {
  if( not ( 0 <= y and y < h and 0 <= x and x < w ) ) return;
  if( used[y][x] ) return;
  if( a[y][x] != '.' ) {
    if( a[y][x] == 'B' ) black_flag = true;
    if( a[y][x] == 'W' ) white_flag = true;
    return;
  }
  used[y][x] = true;
  count += 1;
  for(int i = 0; i < 4; ++i) {
    dfs(y + dy[i], x + dx[i]);
  }
  return;
}    

int main() {

  for(;;) {
    int B = 0, W = 0;
    std::cin >> w >> h;
    if( w == 0 and h == 0 ) break;
    for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) std::cin >> a[i][j];
    for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) used[i][j] = false;
    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        count = 0;
        black_flag = white_flag = false;
        dfs(i, j);
        if( black_flag != white_flag ) {
          if( black_flag ) {
            B += count;
          }
          else {
            W += count;
          }
        }
      }
    }
    std::cout << B << ' ' << W << std::endl;
  }                                                           
  
  return 0;
}

Measured memory_bytes: 3216
import heapq

def insert(a,key):
    key2=-key
    heapq.heappush(a,key2)

def extract(a):
    key=heapq.heappop(a)
    return -key

a=[]
cmds=input().split()
while(cmds[0] != 'end'):
    if(cmds[0]=='insert'):
        op=int(cmds[1])
        insert(a,op)
    elif(cmds[0]=='extract'):
        print(extract(a))
    cmds=input().split()



Measured memory_bytes: 45312
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
   int a,b,c,k,ans(0);

   cin >> a >> b >> c >> k;
   for(int i = 0;i < k ;i++){
       if(a != 0){
           ans++;
           a--;
       }
        else if(b != 0){
           b--;
       }
        else if(c != 0){
           ans--;
           c--;
       }


   } 
   cout << ans;
}
   



Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  string s;
  cin >> s;
  cin >> n;

  vector<string> subst;
  for(int i=0; i<s.length(); i++){
    for(int j=1; ((i+j-1)<s.length()) && (j<=5); j++){
      subst.push_back(s.substr(i,j));
    }
  }

  sort(subst.begin(), subst.end());
  decltype(subst)::iterator result = unique(subst.begin(),subst.end());
  subst.erase(result, subst.end());
  /*
  for( auto sss : subst ){
    cout << sss <<endl;
  }
  */
  cout << subst[n-1] << endl;
  return 0;
  
}


Measured memory_bytes: 1660
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int k;
    string s;
	cin >> k >> s;
    if (s.length() > k) {
        for (int i=0; i < k; i++) {
            cout << s[i];
        }
        cout << "...";
    } else {
        cout << s;
    }
	return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final int n = s.nextInt();
			final int l = s.nextInt();

			int min = Integer.MAX_VALUE;
			int pie = 0;
			for (int i = 1; i <= n; i++) {
				int aji = l + i - 1;
				if (Math.abs(aji) < Math.abs(min)) {
					min = aji;
				}
				pie += aji;
			}
			System.out.println(pie - min);
		}
	}

}


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

int main() {
	int N, M;
	cin >> N >> M;
	int A = 0;
	for (int i = 0; i < M; i++) {
		int Ai;
		cin >> Ai;
		A += Ai;
	}
	cout << (N - A < 0 ? -1 : N - A) << endl;
	return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll bb=b-b/c-b/d+b/lcm(c,d);
    ll aa=(a-1)-(a-1)/c-(a-1)/d+(a-1)/lcm(c,d);
    cout << bb-aa << endl;
    return 0;
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int x[N];

  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }

  int sum = 0;
  for (int i = 0; i < N; i++) {
    if ((K - x[i]) > x[i]) {
      sum += x[i] * 2;
    } else {
      sum += (K - x[i]) * 2;
    }
  }
  cout << sum << endl;
  return 0;
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

const int INF = 0x3f3f3f3f;
const ll  LINF = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 2e5+10;
const int mod = 1e9+7;

using namespace std;

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

    ll n,d,a,ans=0;

    cin >> n >> d >> a;

    vector<pair<ll,ll>> vs(n);
    queue<pair<ll,ll>> pq;

    for(auto &x:vs){ 
    	cin >> x.ff >> x.ss;
    }

   	sort(all(vs));

   	ll s=0;

   	for(int i=0;i<n;++i){
   		while(!pq.empty() && pq.front().ff < vs[i].ff){
   			s-=pq.front().ss;
   			pq.pop();
   		}
   		vs[i].ss=max(0LL,vs[i].ss-s);
   		ll k = (vs[i].ss+a-1)/a;
   		ans+=k;
   		s+=a*k;
   		pq.push({vs[i].ff+2*d,a*k});
   	}

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 9524
def main():
    examD()

def examA():
    N = I()
    ans = 1^N
    print(ans)
    return

def examB():
    a, b, c, d = LI()
    ans = max(a*c,a*d,b*c,b*d)
    print(ans)
    return

def examC():
    N = I()
    if N==1:
        ans = 0
    else:
        ans = pow(10,N,mod) - pow(9,N,mod)*2 + pow(8,N,mod)
        ans += mod*2
        ans %= mod
    print(ans)
    return

def examD():
    class combination():
        # 素数のmod取るときのみ　速い
        def __init__(self, n, mod):
            self.n = n
            self.mod = mod
            self.fac = [1] * (n + 1)
            self.inv = [1] * (n + 1)
            for j in range(1, n + 1):
                self.fac[j] = self.fac[j - 1] * j % mod

            self.inv[n] = pow(self.fac[n], mod - 2, mod)
            for j in range(n - 1, -1, -1):
                self.inv[j] = self.inv[j + 1] * (j + 1) % mod

        def comb(self, n, r):
            if r > n or n < 0 or r < 0:
                return 0
            return self.fac[n] * self.inv[n - r] * self.inv[r] % self.mod
    S = I()
    C = combination(S,mod)
    cnt = 0
    for i in range(S//3):
        cur = S - (i+1)*3 + i
        cnt += C.comb(cur,i)
        cnt %= mod
    ans = cnt
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 78248
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int n;
string s;
cin>>n>>s;
int l=s.length();
rep(i,0,l-1)
{
	ol(char((s[i]-'A'+n)%26+'A'));
}
return 0;
}



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

int main(void){
  int A, B;
  bool pos = true;
  cin >> A >> B;
  if(A > 9 || B > 9)
    pos = false;
  if(pos) cout << A * B << "\n";
  else cout << -1 << "\n";
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, n;
    cin >> n >> a >> b;
    ll ans = 0;
    if(a > b) ans = 0;
    else if(n == 1 && a != b) ans = 0;
    else if(n == 1 && a == b) ans = 1;
    else ans = (n-2) * (b-a) + 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int a,b,t,i,count;
  count=0;
  
  
  scanf("%d %d %d",&a,&b,&t);
  for(i=1;i<t+0.5;i++){
    if(i%a==0){
      count+=b;
    }
  }
  
  printf("%d",count);
  
  return 0;
}

Measured memory_bytes: 128
H, W = map(int, input().split())

grid = []
for _ in range(H):
    row = input()
    if row[0] == "." and len(set(row)) == 1:
        H -= 1
        continue
    grid.append(row)

for i in range(W-1, -1, -1):
    if grid[0][i] == "#" or len(set([row[i] for row in grid ])) != 1:
        continue
    for h in range(H):
        new_row = ""
        if i > 0:
            new_row += grid[h][:i]
        if i < W-1:
            new_row += grid[h][i+1:]
        grid[h] = new_row

for row in grid:
    print(row)


Measured memory_bytes: 3064
#include<stdio.h>
int n,A[50];

int solve(int i,int m)
{
    if(m==0) return 1;
    if(i>=n) return 0;
    int res=solve(i+1,m)||solve(i+1,m-A[i]);
    return res;
}
int main()
{
    int q,i,m;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++)
    {
        scanf("%d",&m);
        if(solve(0,m)) printf("yes\n");
        else printf("no\n");
        
    }
}


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

ll ans = 0;

const int N = pow(10,5) + 20;
bool x[N] = {};

int main(){
    ll f;
    cin >> f;
    for(int i = 2; i < N; ++i){//cout << " a" ;
        if(x[i] == false){
            for(int j = i + i; j < N; j += i){
                x[j] = true;
            }
        }
    }



    for(ll i = f; i < N; ++i){
        if(x[i] == false){
            cout << i << endl;
            return 0;
        }
    }

}


Measured memory_bytes: 384
import qualified Data.ByteString.Char8 as BS

readString = map BS.unpack . BS.words

getString = readString <$> BS.getLine

simulate :: String -> Int -> String
simulate [] b = ""
simulate (s : ss) b
  | s /= 'B' && b == 0 = s : simulate ss b
  | s /= 'B' && b > 0 = simulate ss (b -1)
  | s == 'B' = simulate ss (b + 1)

main = do
  [s] <- getString
  putStrLn $ reverse (simulate (reverse s) 0)


Measured memory_bytes: 3776
N = int(input())
H = list(map(int, input().split()))

bind = False
for n in range(N - 1):
	if H[n] < H[n + 1]:
		bind = False
		continue
	else:
		if H[n] == H[n + 1]:
			continue
		if bind:
			print("No")
			break
		else:
			if H[n] - 1 <= H[n + 1]:
				bind = True
				continue
			else:
				print("No")
				break
else:
	print("Yes")


Measured memory_bytes: 15020
#include<cstdio>
#define int long long
#define min(a,b)((a)<(b)?(a):(b))
const int N=403,INF=1e18;
int n,a[N],dp[N][N];
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",a+i),dp[i][0]=0,a[i]+=a[i-1];
	for(int k=1;k<n;k++)
	  for(int i=1;i+k<=n;i++){
		dp[i][k]=INF;
		for(int j=0;j<k;j++)
		  dp[i][k]=min(dp[i][k],dp[i][j]+dp[i+j+1][k-j-1]+a[i+k]-a[i-1]);
	  }printf("%lld",dp[1][n-1]);
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
double sum1,sum2;
int n;
int a[15];
int b[20];
int c[15][15];
void sum(int a1,int b1)
{
	sum1+=sqrt((c[a1][1]-c[b1][1])*(c[a1][1]-c[b1][1])*1.0+(c[a1][2]-c[b1][2])*(c[a1][2]-c[b1][2])*1.0);
}
void dfs(int t)
{
	if(t==n+1)
	{
		for(int i=2;i<=n;i++)
		{
			sum(a[i-1],a[i]);
		}
		return;
	}
	for(int i=1;i<=n;i++)
	{
		if(b[i]==0)
		{
			a[t]=i;
			b[i]=1;
			dfs(t+1);
			b[i]=0;
		}
	}
}
long long h=1;
void jie()
{
	for(int i=1;i<=n;i++)
	h*=i;
}
int main()
{
	cin>>n;
	jie();
	for(int i=1;i<=n;i++)
	cin>>c[i][1]>>c[i][2];
	dfs(1);
	sum2=sum1/h;
	printf("%0.10f",sum2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=20010, inf=2e9;

int n;
int P[MX];
int A[MX], B[MX];
bool done[MX];

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for(int i=1; i<=n; i++) A[i]=i, B[i]=n-i+1;
    for(int i=1; i<=n; i++) cin>>P[i];

    for(int i=1; i<=n; i++){
        int x=P[i];
        done[x]=true;
        for(int i=x+1, add=1; i<=n; i++){
            A[i]+=add;
            B[i]-=(add-1);
            if(done[i]) B[i]--, add++;
        }
        for(int i=x-1, add=1; i>=1; i--){
            A[i]-=(add-1);
            B[i]+=add;
            if(done[i]) add++, A[i]--;
        }
    }
    int a=1, b=1;
    for(int i=1; i<=n; i++){
        a=min(a,A[i]);
        b=min(b,B[i]);
    }
    for(int i=1; i<=n; i++)
        A[i]-=a-1, B[i]-=b-1;

    for(int i=1; i<=n; i++)
        cout<<A[i]<<' ';
    cout<<'\n';
    for(int i=1; i<=n; i++)
        cout<<B[i]<<' ';
    cout<<'\n';
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void b_uneven_number(void) {
	
	int n;
	cin >> n;

	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		string n_str = to_string(i);
		if ((n_str.size() & 0x1) == 0x0) continue;
		cnt++;
	}

	cout << cnt << endl;
}

int main()
{
    b_uneven_number();

    return 0;
}

Measured memory_bytes: 3764
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;

void main()
{
  long[] n_and_k;
  long n;
  long k;
  
  n_and_k = readln.split.to!(long[]);
  n = n_and_k[0];
  k = n_and_k[1];
  
  writeln(min(n % k, k - n % k));
}


Measured memory_bytes: 256
#import numpy
[n,k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [0]
i_ls = []
now = 0
#dpのi番目の要素がi+1番目の足場までの最小コスト
for i in range(1,n):
    #i番目の足場
    if i < k:
        for j in range(i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i<k")
    else:
        for j in range(i-k,i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i>=k")
    dp.append(min(i_ls))
    #print(i_ls)
    i_ls = []

print(dp[n-1])


Measured memory_bytes: 58208
#include<stdio.h>
int main(void) {
	double n;
	double a[1000];
	scanf("%lf", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lf", &a[i]);
	}
	double ans;
	double hako = 0;

	for (int i = 0; i < n; i++) {
		hako += (1 / a[i]);
	}

	ans = 1 / hako;

	printf("%lf\n", ans);
	return 0; 
}

Measured memory_bytes: 128